BOOL CInterfacePluginV2App::InitInstance() { CWinApp::InitInstance(); shutdowndialog=false; //Get global timeout settings out of registry if(regMyReg.KeyExists(regkey,HKEY_LOCAL_MACHINE)) { regMyReg.Open( regkey, HKEY_LOCAL_MACHINE ); if(regMyReg["enableTimeout"].Exists()) { enabletimeout=regMyReg["enabletimeout"]; timeoutdelay=regMyReg["timeoutdelay"]; } else { enabletimeout=TRUE; timeoutdelay=30; regMyReg["enabletimeout"]=enabletimeout; regMyReg["timeoutdelay"]=timeoutdelay; } regMyReg.Close(); } else { regMyReg.Open( regkey, HKEY_LOCAL_MACHINE ); enabletimeout=TRUE; timeoutdelay=30; regMyReg["enabletimeout"]=enabletimeout; regMyReg["timeoutdelay"]=timeoutdelay; regMyReg.Close(); } InitializeCriticalSectionAndSpinCount(&CriticalSection,0x80000400); return TRUE; }
void ScanExistingRegistryEntry(XPIDSTRUCT *scanstruct) { CString xpidkey=regkey+"\\"+scanstruct->xpidname; if(regMyReg.KeyExists(xpidkey, HKEY_LOCAL_MACHINE)) { //SCN5 was here before, load last settings regMyReg.Open( xpidkey, HKEY_LOCAL_MACHINE ); scanstruct->xpidsetting1.renameport=regMyReg["renameXPID1"]; scanstruct->xpidsetting1.renamename=regMyReg["renamename1"]; scanstruct->xpidsetting2.renameport=regMyReg["renameXPID2"]; scanstruct->xpidsetting2.renamename=regMyReg["renamename2"]; regMyReg.Close(); } else { regMyReg.Open( xpidkey, HKEY_LOCAL_MACHINE ); //Standard settings scanstruct->xpidsetting1.renameport=false; scanstruct->xpidsetting1.renamename=""; scanstruct->xpidsetting2.renameport=false; scanstruct->xpidsetting2.renamename=""; regMyReg.Open( xpidkey, HKEY_LOCAL_MACHINE ); regMyReg["renameXPID1"]=scanstruct->xpidsetting1.renameport; regMyReg["renamename1"]=scanstruct->xpidsetting1.renamename; regMyReg["renameXPID2"]=scanstruct->xpidsetting2.renameport; regMyReg["renamename2"]=scanstruct->xpidsetting2.renamename; CString regvalue; regMyReg.Close(); } }