if (hWnd == 0) | // Check whether values returned by CreateWindow() are valid. |
return (FALSE); |
|
if (lsWindow(hWnd) != TRUE) |
|
return (FALSE); |
|
return(TRUE); | // Window handle hWnd is valid. |
} |
|
// ****************************************************************************************//
// WinMain// // ****************************************************************************************//
int WINAPI WinMain( HINTANCE hInstance. |
|
|
HINSTANCE | hPrevInstance, |
|
LPTSTR | lpCmdLine, |
|
int | ncmdShow) |
|
{ |
|
|
MSG msg; |
|
|
HWND hWnd; |
|
|
long lResult; |
|
|
HKEY hKeyResult; |
|
|
TCHAR TsrName[] = TEXT(“SipTsr.exe”); |
|
|
if ( hWnd = FindWindow( ClassName, NULL)) { |
| |
SIP_ExecutePanel( TEXT(“”)); |
|
|
return FLASE; |
|
|
} |
|
|
if (hPrevInstance == 0) { |
|
|
if (InitApplication(hInstance) == FALSE) |
| |
return(FALSE); |
|
|
} |
|
|
if (InitInstance(hInstance, nCmdShow) == FALSE) |
| |
return(FALSE); |
|
|
lResult = RegOpenKeyEx( HKEY_LOCAL_MACHINE, | // Open Registry | |
TEXT( “Software\\Apps\\SIPManager”), |
|
|
0, KEY_WRITE, &hKeyResult); |
|
|
if ( lResult != ERROR_SUCCESS) |
|
|
return(FALSE); |
|
|
lResult = RegSetValueEx( hKeyResult, |
| // Write Registry |
TEXT( “SIPExeName”), 0, REG_SZ, |
|
|
( unsigned char *)TsrName , sizeof( TsrName)); |
| |
if ( lResult !=ERROR_SUCCESS) |
|
|
return(FALSE); |
|
|
RegCloseKey( hKeyResult); |
| // Close Registry |
While (GetMessage(&msg, NULL, 0, 0) == TRUE) { |
|
DispatchMessage (&msg);
}
return TRUE;
}
30