📄 addmenu.c
字号:
{
if(!InFloppyDisk(0))
{
RegSetValueEx(hKey1,"ver",0,REG_SZ,(LPBYTE)"2.0",5);
bSetAuto=TRUE;
}
}
else if(stricmp(szver,"2.0")<0)
{
RegSetValueEx(hKey1,"ver",0,REG_SZ,(LPBYTE)"2.0",5);
bVerChanged=TRUE;
bSetAuto=TRUE;
}
lRetCode = RegQueryValueEx ( hKey1,"Num",NULL,&dwDisposition,(LPBYTE)(&dwFlag),&dwDateSize);
// if we failed, note it, and leave
if (lRetCode != ERROR_SUCCESS)
{
nAppNum=0;
Errmsg("Error in getting Section1 value\n");//,"Reg Error",MB_OK);
return;
}
nAppNum=(int)dwFlag;
if(dwFlag!=0)
GetAppInfo(dwFlag);
lRetCode = RegQueryValueEx ( hKey1,"tiNum",NULL,&dwDisposition,(LPBYTE)(&dwFlag),&dwDateSize);
// if we failed, note it, and leave
if (lRetCode != ERROR_SUCCESS)
{
nTimerNum=0;
RegSetValueEx ( hKey1,"tiNum",0,REG_DWORD,(LPBYTE)(&dwFlag),dwDateSize);
//Errmsg("Error in getting Section1 value\n");//,"Reg Error",MB_OK);
return;
}
nTimerNum=(int)dwFlag;
if(dwFlag!=0)
GetTimerInfo(dwFlag);
lRetCode = RegQueryValueEx ( hKey1,"AlarmEveryHour",NULL,&dwDisposition,(LPBYTE)(&dwFlag),&dwDateSize);
if (lRetCode != ERROR_SUCCESS)
{
nAlarmEveryHour=0;
RegSetValueEx ( hKey1,"AlarmEveryHour",0,REG_DWORD,(LPBYTE)(&dwFlag),dwDateSize);
return;
}
nAlarmEveryHour=(int)dwFlag;
lRetCode = RegQueryValueEx ( hKey1,"NoMsg",NULL,&dwDisposition,(LPBYTE)(&dwFlag),&dwDateSize);
if (lRetCode != ERROR_SUCCESS)
{
bNoMsg=FALSE;
RegSetValueEx ( hKey1,"NoMsg",0,REG_DWORD,(LPBYTE)(&dwFlag),dwDateSize);
return;
}
bNoMsg=(BOOL)dwFlag;
}
}
void GetAppInfo(DWORD dwNum)
{
HKEY hKey1;//, hKey2;
DWORD dwDisposition;
LONG lRetCode;
DWORD dwDate,dwDateSize=sizeof(DWORD),dwCharSize;
char szAppName[300];
//char cmd[300];
int i;
char szSubKeyName[100],szTemp[]="SOFTWARE\\phonix\\sharewareluncher\\menuitem";
MENUITEMINFO mi;
mi.cbSize=sizeof(mi);
mi.fMask=MIIM_TYPE | MIIM_ID; mi.fType=MFT_STRING; mi.fState=MFS_DEFAULT;
for(i=0;i<(int)dwNum;i++)
{
if(i<10)
wsprintf(szSubKeyName,"%s00%d",szTemp,i);
else
wsprintf(szSubKeyName,"%s0%d",szTemp,i);
lRetCode=RegCreateKeyEx(HKEY_LOCAL_MACHINE,szSubKeyName,0, NULL, REG_OPTION_NON_VOLATILE,
KEY_QUERY_VALUE,NULL,&hKey1,&dwDisposition);
if (lRetCode != ERROR_SUCCESS)
{
Errmsg("Error in creating key\n");//,"Error",MB_OK);
return ;//break;
}
dwCharSize=80;
lRetCode = RegQueryValueEx ( hKey1,"AppName",NULL,&dwDisposition,(LPBYTE)szAppName,&dwCharSize);
// if we failed, note it, and leave
if (lRetCode != ERROR_SUCCESS)
{
Errmsg("Error in getting Section1 value\n");//,"Reg Error",MB_OK);
return ;//break;
}
wsprintf(aiAppInfo[i].szAppName,szAppName);
dwCharSize=300;
lRetCode = RegQueryValueEx ( hKey1,"AppCmdLine",NULL,&dwDisposition,(LPBYTE)szAppName,&dwCharSize);
// if we failed, note it, and leave
if (lRetCode != ERROR_SUCCESS)
{
Errmsg("Error in getting Section1 value\n");//,"Reg Error",MB_OK);
return ;//break;
}
wsprintf(aiAppInfo[i].szAppCmd,szAppName);
lRetCode = RegQueryValueEx ( hKey1,"Year",NULL,&dwDisposition,(LPBYTE)(&dwDate),&dwDateSize);
// if we failed, note it, and leave
if (lRetCode != ERROR_SUCCESS)
{
Errmsg("Error in getting Section1 value\n");//,"Reg Error",MB_OK);
break;
}
aiAppInfo[i].stVrDate.wYear=(WORD)dwDate;
lRetCode = RegQueryValueEx ( hKey1,"Month",NULL,&dwDisposition,(LPBYTE)(&dwDate),&dwDateSize);
// if we failed, note it, and leave
if (lRetCode != ERROR_SUCCESS)
{
Errmsg("Error in getting Section1 value\n");//,"Reg Error",MB_OK);
break;
}
aiAppInfo[i].stVrDate.wMonth=(WORD)dwDate;
lRetCode = RegQueryValueEx ( hKey1,"Day",NULL,&dwDisposition,(LPBYTE)(&dwDate),&dwDateSize);
// if we failed, note it, and leave
if (lRetCode != ERROR_SUCCESS)
{
Errmsg("Error in getting Section1 value\n");//,"Reg Error",MB_OK);
break;
}
aiAppInfo[i].stVrDate.wDay=(WORD)dwDate;
mi.wID=11000+i; //wsprintf(mi.dwTypeData,aiAppInfo[i].szAppName); mi.dwTypeData=aiAppInfo[i].szAppName; mi.cch=strlen(aiAppInfo[i].szAppName); InsertMenuItem(hmenuTrackPopup,CM_SETCLOCK,FALSE,&mi); //InsertMenuItem(hmenuTrackPopup,i,TRUE,&mi); if(i==(int)(dwNum-1)) { mi.fType=MFT_SEPARATOR; InsertMenuItem(hmenuTrackPopup,CM_SETCLOCK,FALSE,&mi);
mi.fType=MFT_STRING;
}
}
}
void AddReg(APPINFO ai)
{
HKEY hKey1;//, hKey2;
DWORD dwDisposition;
LONG lRetCode;
DWORD dwFlag=(DWORD)nAppNum,dwDateSize=sizeof(DWORD);
char cmd[150];
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 key\n");//,"Error",MB_OK);
return;//break;
}
lRetCode = RegSetValueEx ( hKey1,"Num",NULL,REG_DWORD,(LPBYTE)(&dwFlag),dwDateSize);
// if we failed, note it, and leave
if (lRetCode != ERROR_SUCCESS)
{
nAppNum--;
Errmsg("Error in getting Section1 value\n");//,"Reg Error",MB_OK);
return;
}
if(naiIndex==-1)
{
if(nAppNum<10)
wsprintf(cmd,"SOFTWARE\\phonix\\sharewareluncher\\menuitem00%d",nAppNum-1);
else
wsprintf(cmd,"SOFTWARE\\phonix\\sharewareluncher\\menuitem0%d",nAppNum-1);
}
else
{
if(naiIndex<10)
wsprintf(cmd,"SOFTWARE\\phonix\\sharewareluncher\\menuitem00%d",naiIndex);
else
wsprintf(cmd,"SOFTWARE\\phonix\\sharewareluncher\\menuitem0%d",naiIndex);
}
lRetCode=RegCreateKeyEx(HKEY_LOCAL_MACHINE,cmd,0, NULL, REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,NULL,&hKey1,&dwDisposition);
if (lRetCode != ERROR_SUCCESS)
{
Errmsg("Error in creating key\n");//,"Error",MB_OK);
return;//break;
}
dwDateSize=80;
//lRetCode =
RegSetValueEx ( hKey1,"AppName",NULL,REG_SZ,(LPBYTE)(&(ai.szAppName)),dwDateSize);
dwDateSize=300;
//lRetCode =
RegSetValueEx ( hKey1,"AppCmdLine",NULL,REG_SZ,(LPBYTE)(&(ai.szAppCmd)),dwDateSize);
dwDateSize=sizeof(DWORD);
//lRetCode =
RegSetValueEx ( hKey1,"Year",NULL,REG_DWORD,(LPBYTE)(&(ai.stVrDate.wYear)),dwDateSize);
//lRetCode =
RegSetValueEx ( hKey1,"Month",NULL,REG_DWORD,(LPBYTE)(&(ai.stVrDate.wMonth)),dwDateSize);
//lRetCode =
RegSetValueEx ( hKey1,"Day",NULL,REG_DWORD,(LPBYTE)(&(ai.stVrDate.wDay)),dwDateSize);
}
int CutCmdLine(LPSTR s)
{
int i,j;
char szTemp[256]="\0";
for(i=0;i<300;i++)
{
if(s[i]=='\0')
{
j=i;
break;
}
}
for(i=0;i<=j;i++)
{
if(s[i]=='\0')
return 0;
if(s[i]!='e' && s[i]!='c' && s[i]!='b' && s[i]!='s' && s[i]!='E' && s[i]!='C'
&& s[i]!='B' && s[i]!='S')
szTemp[i]=s[i];
else if(i>0)
{
if((j-i)<=2)
return 0;
switch(s[i])
{
case 'e':
case 'E':
if((s[i+1]=='x' || s[i+1]=='X') && (s[i+2]=='e' || s[i+2]=='E') &&
(s[i+3]==' ' || s[i+3]==NULL || s[i+3]=='\0') && s[i-1]=='.')
{
strcat(szTemp,"exe\0");
wsprintf(szErr,szTemp);
return EXE;
}
szTemp[i]=s[i];
break;
case 'c':
case 'C':
if((s[i+1]=='o' || s[i+1]=='O') && (s[i+2]=='m' || s[i+2]=='M') &&
(s[i+3]==' ' || s[i+3]=='\0' || s[i+3]==NULL) && s[i-1]=='.')
{
strcat(szTemp,"com\0");
wsprintf(szErr,szTemp);
return COM;
}
szTemp[i]=s[i];
break;
case 'b':
case 'B':
if((s[i+1]=='a' || s[i+1]=='A') && (s[i+2]=='t' || s[i+2]=='T') &&
(s[i+3]==' ' || s[i+3]=='\0' || s[i+3]==NULL) && s[i-1]=='.')
{
strcat(szTemp,"bat\0");
wsprintf(szErr,szTemp);
return BAT;
}
szTemp[i]=s[i];
break;
case 's':
case 'S':
if((s[i+1]=='c' || s[i+1]=='C') && (s[i+2]=='r' || s[i+2]=='R') &&
(s[i+3]==' ' || s[i+3]=='\0' || s[i+3]==NULL) && s[i-1]=='.')
{
strcat(szTemp,"scr\0");
wsprintf(szErr,szTemp);
return SCR;
}
szTemp[i]=s[i];
break;
default:
szTemp[i]=s[i];
break;
}
}
else
szTemp[i]=s[i];
}
wsprintf(szErr,szTemp);
return 0;
}
/*
void Add_PDOS(void)
{
bAddExe=TRUE;
bAddPDOS=TRUE;
SendMessage(hMainWnd,WM_COMMAND,CM_ADD,0);
}
void domsgAddPDOS(void)
{
char szwin[MAX_PATH];
wsprintf(aiAppInfoTemp.szAppName,"中文DOS方式");
wsprintf(aiAppInfoTemp.szAppCmd,"\0");
GetWindowsDirectory(aiAppInfoTemp.szAppCmd,MAX_PATH);
strcat(aiAppInfoTemp.szAppCmd,"\\command\\pdos95.bat");
if(!CheckExistFile(aiAppInfoTemp.szAppCmd))
{
SetCurrentDirectory(aiAppInfoTemp.szAppCmd);
if(!CheckExistFile("pbios.exe"))
return;
if(!CheckExistFile("font16.exe"))
return;
if(!CheckExistFile("pbios.exe"))
return;
RegisterInfo();
return TRUE;
} */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -