Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
TAB.C
Package: sharewareluncher.zip [view]
Upload User: sales84
Upload Date: 2007-01-11
Package Size: 864k
Code Size: 20k
Category:
SourceCode/Document
Development Platform:
Visual C++
- #include <userdlg.h> // 基本Windows编程接口的头文件
- #include <commctrl.h> // 公共控件头文件
- #include <prsht.h> // 包含属性表控件的函数和常量说明的头文件
- //#include <stdio.h>
- //#include <string.h>
- #include "sharewareluncher.h"
- #include "Tab.h"
- #include "resource.h"
- #define EVERYDAY 1
- #define SUPER 2
- #define E_SUPER 3
- int nTimerNum;
- void TimeToString(void);
- void SortList1(void);
- void TtoS(int a,int b,int c);
- void RegAlarm(void);
- void DoTimerChange(HWND);
- extern HINSTANCE hInst;
- extern HWND hMainWnd;
- extern BOOL bDlgRuned;
- PROPSHEETPAGE * ps;
- BOOL bSheet=FALSE;
- int nBarPos[]={212,270,-1};
- extern TIMERINFO ti[10];
- TIMERINFO titemp;
- LPSTR szflag[4]={"临时","每日提示","高级","高级"};
- //TIMEFLAG tiflag;
- HWND hListWnd,hBarWnd,hHUDWnd,hMUDWnd;
- char szerr[1100];
- int nOldSel=-2;
- BOOL bInScroll=FALSE,bInSel=FALSE;
- BOOL bTextChanged=FALSE,bHourChanged=FALSE,bMinChanged=FALSE;
- extern int nAlarmEveryHour;
- BOOL btRuning=FALSE,bNoShowDel=FALSE;
- HWND hSheetWnd,hTimelistWnd;
- TAB psp[2];
- TABFLAG psh;
- int CreatePropertySheet(HWND hwndOwner)
- {
- //PROPSHEETPAGE psp[2];
- //PROPSHEETHEADER psh;
- bSheet=TRUE;
- psp[0].dwSize = sizeof (PROPSHEETPAGE);
- psp[0].dwFlags = PSP_USETITLE;
- psp[0].hInstance = hInst;
- psp[0].pszTemplate = MAKEINTRESOURCE(IDD_TIME);
- psp[0].pszIcon = NULL;
- psp[0].pfnDlgProc = (DLGPROC)MakeTime;
- psp[0].pszTitle = "闹钟设置";
- psp[0].lParam = 0;
- psp[1].dwSize = sizeof (PROPSHEETPAGE);
- psp[1].dwFlags = PSP_USETITLE | PSP_USEHICON;
- psp[1].hInstance = hInst;
- psp[1].pszTemplate = MAKEINTRESOURCE(IDD_LIST);
- psp[1].hIcon = NULL;
- psp[1].pfnDlgProc = (DLGPROC)ListWndProc;
- psp[1].pszTitle = "程序设置";
- psp[1].lParam = 0;
- psh.dwSize = sizeof (PROPSHEETHEADER);
- psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_HASHELP;
- psh.hwndParent = hwndOwner;
- psh.hInstance = hInst;
- psh.pszIcon = MAKEINTRESOURCE(IDI_APPICON);
- psh.pszCaption = (LPSTR) "设置";
- psh.nPages = sizeof (psp) / sizeof (PROPSHEETPAGE);
- psh.ppsp = (LPCPROPSHEETPAGE) &psp;
- //PropertySheet(&psh);
- return (PropertySheet((LPCPROPSHEETHEADER)&psh));//hSheetWnd;
- }
- #pragma argsused
- LONG APIENTRY MakeTime(HWND hWnd,UINT message, WPARAM wParam,LPARAM lParam)
- {
- int i,j;
- hTimelistWnd=hWnd;
- switch (message)
- {
- case WM_INITDIALOG:
- hSheetWnd=GetParent(hWnd);
- bSheet=TRUE;
- btRuning=TRUE;
- GetTimerInfo(nTimerNum);
- TimeToString();
- hListWnd=GetDlgItem(hWnd,IDC_LISTTIME);
- for (i=0; i < nTimerNum; i++)
- {
- SendMessage(hListWnd,LB_ADDSTRING,0,(LPARAM)(ti[i].szTimerString));
- SendMessage(hListWnd, LB_SETITEMDATA, SendMessage(hListWnd,LB_FINDSTRING,-1,(LPARAM)(ti[i].szTimerString)), (LPARAM) i);
- }
- if(nTimerNum>0)
- {
- SendMessage(hListWnd,LB_SETCURSEL,0,0);
- SendMessage(hWnd,WM_COMMAND,MAKELONG(IDC_LISTTIME,LBN_SELCHANGE),(LPARAM)hListWnd);
- }
- if (hListWnd == NULL)
- MessageBox (NULL, "加载定时器信息时出错!", "出错", MB_OK );
- SetFocus(hListWnd);
- hBarWnd=GetDlgItem(hWnd,IDC_TIMEBAR);
- SendMessage(hBarWnd,SB_SETPARTS,3,(LPARAM)nBarPos);
- SendMessage(hBarWnd,SB_SETTEXT,(1 | 0),(LPARAM)"状态");
- //SendMessage(hBarWnd,SB_SETTEXT,(2 | 0),(LPARAM)"01/23/1998");
- hHUDWnd=GetDlgItem(hWnd,IDC_HOURUPDOWN);
- SendMessage(hHUDWnd,UDM_SETRANGE,0,MAKELONG(23,0));
- hMUDWnd=GetDlgItem(hWnd,IDC_MINUPDOWN);
- SendMessage(hMUDWnd,UDM_SETRANGE,0,MAKELONG(59,0));
- if(nAlarmEveryHour==1)
- CheckDlgButton(hWnd,IDC_ONEHOUR,BST_CHECKED);
- ps = (PROPSHEETPAGE *)lParam;
- return (TRUE);
- case WM_VSCROLL:
- bInScroll=TRUE;
- i=SendMessage(hListWnd,LB_GETCURSEL,0,0);
- if(i==LB_ERR)
- {
- nOldSel=-2;
- bInScroll=FALSE;
- break;
- }
- j=SendMessage(hListWnd, LB_GETITEMDATA, i, (LPARAM) 0);
- TtoS(GetDlgItemInt(hWnd,IDC_SETHOUR,NULL,FALSE),GetDlgItemInt(hWnd,IDC_SETMIN,NULL,FALSE),j);
- {
- int x;
- BOOL bf=FALSE;
- for(x=0;x<nTimerNum;x++)
- {
- if(x!=j)
- if(strcmp(ti[j].szTimerString,ti[x].szTimerString)==0)
- {
- bf=TRUE;
- break;
- }
- }
- if(bf)
- {
- bInScroll=FALSE;
- ti[j]=titemp;
- break;
- }
- SendMessage(hListWnd,LB_DELETESTRING,i,0L);
- SendMessage(hListWnd,LB_ADDSTRING,0,(LPARAM)(ti[j].szTimerString));
- x=SendMessage(hListWnd,LB_FINDSTRING,-1,(LPARAM)(ti[j].szTimerString));
- SendMessage(hListWnd,LB_SETITEMDATA, x, (LPARAM) j);
- SendMessage(hListWnd,LB_SETCURSEL,x,0);
- nOldSel=x;
- }
- //SortList1();
- //SendMessage(hBarWnd,SB_SETTEXT,(0 | 0),(LPARAM)" ");
- //SendMessage(hBarWnd,SB_SETTEXT,(2 | 0),(LPARAM)" ");
- bInScroll=FALSE;
- break;
- case WM_COMMAND:
- switch ( LOWORD( wParam ))
- {
- case IDOK:
- if(nTimerNum>=10)
- {
- nTimerNum=10;
- break;
- }
- for(i=0;i<nTimerNum;i++)
- {
- if(strcmp(ti[i].szTimerString,"新定时器")==0)
- return FALSE;
- }
- wsprintf(ti[nTimerNum].szTimerString,"新定时器");
- SendMessage(hListWnd,LB_ADDSTRING,0,(LPARAM)(ti[nTimerNum].szTimerString));
- SendMessage(hListWnd, LB_SETITEMDATA, nTimerNum, (LPARAM) nTimerNum);
- SendMessage(hListWnd, LB_SETCURSEL, nTimerNum,0);
- SendMessage(hWnd,WM_COMMAND,MAKELONG(IDC_LISTTIME,LBN_SELCHANGE),(LPARAM)hListWnd);
- CheckDlgButton(hWnd,IDC_EVERYDAY,BST_UNCHECKED);
- //SetDlgItemInt(hWnd,IDC_SETHOUR,0,FALSE);
- //SetDlgItemInt(hWnd,IDC_SETMIN,0,FALSE);
- nTimerNum++;
- break;
- case IDHELP://"cancel" pushed
- i=SendMessage(hListWnd,LB_GETCURSEL,0,0);
- if(i==LB_ERR)
- {
- nOldSel=-2;
- break;
- }
- j=SendMessage(hListWnd, LB_GETITEMDATA, i, (LPARAM) 0);
- SendMessage(hListWnd,LB_DELETESTRING,i,0L);
- nTimerNum--;
- SortList1();
- ListDel1(j);
- //if(nTimerNum>0)
- //{
- // SendMessage(hListWnd,LB_SETCURSEL,0,0L);
- // SendMessage(hTimelistWnd,WM_COMMAND,MAKELONG(IDC_LISTTIME,LBN_SELCHANGE),(LPARAM)hListWnd);
- //}
- //else
- {
- SendMessage(hBarWnd,SB_SETTEXT,(0 | 0),(LPARAM)" ");
- SendMessage(hBarWnd,SB_SETTEXT,(2 | 0),(LPARAM)" ");
- SetDlgItemText(hWnd,IDC_ALARMINFO,"");
- CheckDlgButton(hWnd,IDC_EVERYDAY,BST_UNCHECKED);
- SetDlgItemInt(hWnd,IDC_SETHOUR,0,FALSE);
- SetDlgItemInt(hWnd,IDC_SETMIN,0,FALSE);
- }
- break;
- case IDCANCEL:
- //Errmsg("Will write later");
- break;
- case IDC_EVERYDAY:
- i=SendMessage(hListWnd,LB_GETCURSEL,0,0);
- if(i==LB_ERR)
- {
- nOldSel=-2;
- break;
- }
- j=SendMessage(hListWnd, LB_GETITEMDATA, i, (LPARAM) 0);
- switch(IsDlgButtonChecked(hWnd,IDC_EVERYDAY))
- {
- case BST_CHECKED:
- if(ti[j].nflag==SUPER)
- ti[j].nflag=E_SUPER;
- else
- ti[j].nflag=EVERYDAY;
- break;
- case BST_UNCHECKED:
- if(ti[j].nflag==E_SUPER)
- ti[j].nflag=SUPER;
- else if(ti[j].nflag==EVERYDAY)
- ti[j].nflag=0;
- break;
- }
- break;
- case IDC_ONEHOUR:
- switch(IsDlgButtonChecked(hWnd,IDC_ONEHOUR))
- {
- case BST_CHECKED:
- nAlarmEveryHour=1;
- break;
- case BST_UNCHECKED:
- nAlarmEveryHour=0;
- break;
- }
- RegAlarm();
- break;
- }
- switch(HIWORD(wParam))
- {
- case EN_KILLFOCUS:
- //i=SendMessage((HWND)lParam,LB_GETCURSEL,0,0);
- if(!bTextChanged)
- break;
- if(nOldSel==-2)
- break;
- j=SendMessage(hListWnd, LB_GETITEMDATA, nOldSel, (LPARAM) 0);
- GetDlgItemText(hWnd,IDC_ALARMINFO,ti[j].szInfo,500);
- bTextChanged=FALSE;
- break;
- case EN_CHANGE:
- switch((int)LOWORD(wParam))
- {
- case IDC_ALARMINFO:
- bTextChanged=TRUE;
- break;
- case IDC_SETHOUR:
- bHourChanged=TRUE;
- break;
- case IDC_SETMIN:
- bMinChanged=TRUE;
- break;
- }
- break;
- case EN_UPDATE:
- switch((int)LOWORD(wParam))
- {
- case IDC_SETHOUR:
- if(bInScroll || bInSel)
- break;
- DoTimerChange(hWnd);
- break;
- case IDC_SETMIN:
- if(bInScroll || bInSel)
- break;
- DoTimerChange(hWnd);
- break;
- }
- break;
- case LBN_SELCHANGE:
- if(bInScroll)
- break;
- bInSel=TRUE;
- i=SendMessage((HWND)lParam,LB_GETCURSEL,0,0);
- if(i==LB_ERR)
- {
- SendMessage(hBarWnd,SB_SETTEXT,(0 | 0),(LPARAM)" ");
- SendMessage(hBarWnd,SB_SETTEXT,(2 | 0),(LPARAM)" ");
- nOldSel=-2;
- break;
- }
- if(nOldSel==-2)
- nOldSel=i;
- else if(bTextChanged)
- {
- j=SendMessage((HWND)lParam, LB_GETITEMDATA, nOldSel, (LPARAM) 0);
- GetDlgItemText(hWnd,IDC_ALARMINFO,ti[j].szInfo,500);
- bTextChanged=FALSE;
- }
- j=SendMessage((HWND)lParam, LB_GETITEMDATA, i, (LPARAM) 0);
- SendMessage(hBarWnd,SB_SETTEXT,(0 | 0),(LPARAM)(szflag[ti[j].nflag]));
- SetDlgItemInt(hWnd,IDC_SETHOUR,ti[j].wHour,FALSE);
- SetDlgItemInt(hWnd,IDC_SETMIN,ti[j].wMinute,FALSE);
- SetDlgItemText(hWnd,IDC_ALARMINFO,ti[j].szInfo);
- if(ti[j].nflag==EVERYDAY || ti[j].nflag==E_SUPER)
- CheckDlgButton(hWnd,IDC_EVERYDAY,BST_CHECKED);
- else
- CheckDlgButton(hWnd,IDC_EVERYDAY,BST_UNCHECKED);
- nOldSel=i;
- bInSel=FALSE;
- break;
- }
- break;
- case WM_CLOSE:
- SortList1();
- WriteTimerInfo();
- btRuning=FALSE;
- bSheet=FALSE;
- EndDialog(hWnd,TRUE);
- return TRUE;
- case WM_NOTIFY:
- switch (((NMHDR FAR *) lParam)->code)
- {
- case PSN_SETACTIVE:
- btRuning=TRUE;
- break;
- case PSN_APPLY:
- if(nOldSel==-2)
- {
- bSheet=FALSE;
- break;
- }
- //GetDlgItemText(hWnd,IDC_ALARMINFO,ti[nOldSel].szInfo,500);
- switch(IsDlgButtonChecked(hWnd,IDC_ONEHOUR))
- {
- case BST_CHECKED:
- nAlarmEveryHour=1;
- break;
- case BST_UNCHECKED:
- nAlarmEveryHour=0;
- break;
- }
- RegAlarm();
- SortList1();
- WriteTimerInfo();
- btRuning=FALSE;
- bSheet=FALSE;
- SetWindowLong(hMainWnd, GWL_STYLE, GetWindowLong(hMainWnd,GWL_STYLE));
- ShowWindow(hMainWnd, SW_SHOW);
- SetWindowLong(hWnd,DWL_MSGRESULT, FALSE);
- return TRUE;
- case PSN_KILLACTIVE:
- //btRuning=FALSE;
- SetWindowLong(hWnd,DWL_MSGRESULT, FALSE);
- return (TRUE);
- case PSN_RESET:
- btRuning=FALSE;
- bSheet=FALSE;
- break;
- case PSN_HELP:
- break;
- }
- default:
- return FALSE;
- }
- return FALSE;
- }
- void TimeToString(void)
- {
- int i;
- for(i=0;i<nTimerNum;i++)
- {
- if(ti[i].wHour<10)
- wsprintf(ti[i].szTimerString,"0%d:",ti[i].wHour);
- else
- wsprintf(ti[i].szTimerString,"%d:",ti[i].wHour);
- if(ti[i].wMinute<10)
- wsprintf(ti[i].szTimerString,"%s0%d",ti[i].szTimerString,ti[i].wMinute);
- else
- wsprintf(ti[i].szTimerString,"%s%d",ti[i].szTimerString,ti[i].wMinute);
- }
- }
- void SortList1(void)
- {
- int i,j,pi[10];
- TIMERINFO tiTemp,tiSort;
- for(i=0;i<nTimerNum;i++)
- {
- pi[i]=SendMessage(hListWnd,LB_GETITEMDATA,i,0L);
- }
- for(i=0;i<nTimerNum;i++)
- {
- if(pi[i]!=i)
- {
- tiSort=ti[pi[i]];
- tiTemp=ti[i];
- ti[i]=tiSort;
- ti[pi[i]]=tiTemp;
- for(j=0;j<nTimerNum;j++)
- {
- if(pi[j]==i)
- pi[j]=pi[i];
- }
- }
- }
- }
- void GetTimerInfo(int n)
- {
- int i;
- char sztemp[500];
- HKEY hKey1;//, hKey2;
- DWORD dwDisposition;
- LONG lRetCode; DWORD dwDate,dwDateSize=sizeof(DWORD);
- DWORD dwtemp;
- lRetCode=RegCreateKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\phonix\sharewareluncher",0, NULL, REG_OPTION_NON_VOLATILE,
- KEY_ALL_ACCESS,NULL,&hKey1,&dwDisposition);
- if (lRetCode != ERROR_SUCCESS)
- {
- Errmsg("Error in creating keyn");//,"Error",MB_OK);
- return;//break;
- }
- for(i=0;i<n;i++)
- {
- wsprintf(sztemp,"TimerHour%d",i);
- lRetCode=RegQueryValueEx(hKey1,sztemp,NULL,&dwtemp,(LPBYTE)(&dwDate),&dwDateSize);
- if (lRetCode != ERROR_SUCCESS)
- ti[i].wHour=0;
- else
- ti[i].wHour=(WORD)dwDate;
- wsprintf(sztemp,"TimerMinute%d",i);
- lRetCode=RegQueryValueEx(hKey1,sztemp,NULL,&dwtemp,(LPBYTE)(&dwDate),&dwDateSize);
- if (lRetCode != ERROR_SUCCESS)
- ti[i].wMinute=0;
- else
- ti[i].wMinute=(WORD)dwDate;
- wsprintf(sztemp,"TimerChar%d",i);
- dwDisposition=500;
- lRetCode=RegQueryValueEx(hKey1,sztemp,NULL,&dwtemp,(LPBYTE)(ti[i].szInfo),&dwDisposition);
- if (lRetCode != ERROR_SUCCESS)
- {
- wsprintf(ti[i].szInfo,"");
- }
- wsprintf(sztemp,"Timerflag%d",i);
- lRetCode=RegQueryValueEx(hKey1,sztemp,NULL,&dwtemp,(LPBYTE)(&dwDate),&dwDateSize);
- if (lRetCode != ERROR_SUCCESS)
- ti[i].nflag=0;
- else
- ti[i].nflag=(WORD)dwDate;
- }
- }
- #pragma argsused
- void ListDel1(int x)
- {
- int i;
- //char sztemp[20];
- HKEY hKey1;//, hKey2;
- DWORD dwDisposition;
- //LONG lRetCode; DWORD dwFlag=(DWORD)nTimerNum,dwDateSize=sizeof(DWORD); //char cmd[150]="SOFTWARE\phonix\sharewareluncher\"; char sz[150];
- RegCreateKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\phonix\sharewareluncher",0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,NULL,&hKey1,&dwDisposition);
- RegSetValueEx ( hKey1,"tiNum",NULL,REG_DWORD,(LPBYTE)(&dwFlag),dwDateSize);
- if(bNoShowDel)
- {
- for(i=x;i<nTimerNum;i++)
- {
- ti[i]=ti[i+1];
- }
- bNoShowDel=FALSE;
- }
- ti[nTimerNum].wHour=0;
- ti[nTimerNum].wMinute=0;
- wsprintf(ti[nTimerNum].szInfo,"");
- wsprintf(ti[nTimerNum].szTimerString,"");
- ti[nTimerNum].nflag=0;
- wsprintf(sz,"TimerHour%d",nTimerNum);
- RegDeleteValue(hKey1,sz);
- wsprintf(sz,"TimerMinute%d",nTimerNum);
- RegDeleteValue(hKey1,sz);
- wsprintf(sz,"TimerChar%d",nTimerNum);
- RegDeleteValue(hKey1,sz);
- wsprintf(sz,"Timerflag%d",nTimerNum);
- RegDeleteValue(hKey1,sz);
- }
- void TtoS(int a,int b,int c)
- {
- titemp=ti[c];
- if(a<10)
- wsprintf(ti[c].szTimerString,"0%d:",a);
- else
- wsprintf(ti[c].szTimerString,"%d:",a);
- if(b<10)
- wsprintf(ti[c].szTimerString,"%s0%d",ti[c].szTimerString,b);
- else
- wsprintf(ti[c].szTimerString,"%s%d",ti[c].szTimerString,b);
- ti[c].wHour=(WORD)a;
- ti[c].wMinute=(WORD)b;
- }
- void WriteTimerInfo(void)
- {
- int i;
- char sztemp[20];
- HKEY hKey1;//, hKey2;
- DWORD dwDisposition;
- LONG lRetCode; DWORD dwFlag=(DWORD)nTimerNum,dwDateSize=sizeof(DWORD);
- lRetCode=RegCreateKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\phonix\sharewareluncher",0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,NULL,&hKey1,&dwDisposition);
- if (lRetCode != ERROR_SUCCESS)
- {
- Errmsg("Error in creating keyn");//,"Error",MB_OK);
- return;//break;
- }
- lRetCode = RegSetValueEx ( hKey1,"tiNum",NULL,REG_DWORD,(LPBYTE)(&dwFlag),dwDateSize);
- // if we failed, note it, and leave
- if (lRetCode != ERROR_SUCCESS)
- {
- Errmsg("Error in getting Section1 valuen");//,"Reg Error",MB_OK);
- return;
- }
- for(i=0;i<nTimerNum;i++)
- {
- wsprintf(sztemp,"TimerHour%d",i);
- dwFlag=ti[i].wHour;
- RegSetValueEx ( hKey1,sztemp,NULL,REG_DWORD,(LPBYTE)(&dwFlag),dwDateSize);
- wsprintf(sztemp,"TimerMinute%d",i);
- dwFlag=ti[i].wMinute;
- RegSetValueEx ( hKey1,sztemp,NULL,REG_DWORD,(LPBYTE)(&dwFlag),dwDateSize);
- wsprintf(sztemp,"TimerChar%d",i);
- RegSetValueEx ( hKey1,sztemp,NULL,REG_SZ,(LPBYTE)(ti[i].szInfo),dwDateSize);
- wsprintf(sztemp,"Timerflag%d",i);
- dwFlag=ti[i].nflag;
- RegSetValueEx ( hKey1,sztemp,NULL,REG_DWORD,(LPBYTE)(&dwFlag),dwDateSize);
- }
- }
- void RegAlarm(void)
- {
- HKEY hKey1;//, hKey2;
- DWORD dwDisposition;
- LONG lRetCode; DWORD dwFlag=(DWORD)nAlarmEveryHour,dwDateSize=sizeof(DWORD);
- lRetCode=RegCreateKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\phonix\sharewareluncher",0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS,NULL,&hKey1,&dwDisposition);
- if (lRetCode != ERROR_SUCCESS)
- {
- Errmsg("Error in creating keyn");//,"Error",MB_OK);
- return;//break;
- }
- lRetCode = RegSetValueEx ( hKey1,"AlarmEveryHour",NULL,REG_DWORD,(LPBYTE)(&dwFlag),dwDateSize);
- // if we failed, note it, and leave
- if (lRetCode != ERROR_SUCCESS)
- Errmsg("Error in getting Section1 valuen");//,"Reg Error",MB_OK);
- }
- void DoTimerChange(HWND hWnd)
- {
- int i,j,a,b;
- i=SendMessage(hListWnd,LB_GETCURSEL,0,0);
- if(i==LB_ERR)
- {
- nOldSel=-2;
- return;
- }
- j=SendMessage(hListWnd, LB_GETITEMDATA, i, (LPARAM) 0);
- a=GetDlgItemInt(hWnd,IDC_SETHOUR,NULL,FALSE);
- if(a<0 || a>23)
- a=0;
- b=GetDlgItemInt(hWnd,IDC_SETMIN,NULL,FALSE);
- if(b<0 || b>59)
- b=0;
- TtoS(a,b,j);
- {
- int x;
- BOOL bf=FALSE;
- for(x=0;x<nTimerNum;x++)
- {
- if(x!=j)
- if(strcmp(ti[j].szTimerString,ti[x].szTimerString)==0)
- {
- bf=TRUE;
- break;
- }
- }
- if(bf)
- {
- ti[j]=titemp;
- return;
- }
- SendMessage(hListWnd,LB_DELETESTRING,i,0L);
- SendMessage(hListWnd,LB_ADDSTRING,0,(LPARAM)(ti[j].szTimerString));
- x=SendMessage(hListWnd,LB_FINDSTRING,-1,(LPARAM)(ti[j].szTimerString));
- SendMessage(hListWnd,LB_SETITEMDATA, x, (LPARAM) j);
- SendMessage(hListWnd,LB_SETCURSEL,x,0);
- nOldSel=x;
- }
- }