Windows NT ( 2)



         

SRVCTRL - 2


wc.lpszClassName = szAppName;

if(!RegisterClassEx(&wc))

if(!RegisterClass((LPWNDCLASS)&wc.style))

return FALSE;

//

hWnd = CreateWindow(szAppName, szAppTitle,

WS_OVERLAPPEDWINDOW,

CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,

NULL, NULL, hInst, NULL);

if(!hWnd) return(FALSE);

//

//

ShowWindow(hWnd, nCmdShow);

UpdateWindow(hWnd);

while(GetMessage(&msg, NULL, 0, 0))

{

TranslateMessage(&msg);

DispatchMessage(&msg);

}

return msg.wParam;

}

// -----------------------------------------------------

// WndProc

// -----------------------------------------------------

LRESULT WINAPI

WndProc(HWND hWnd, UINT msg, WPARAM wParam,

LPARAM lParam)

{

switch(msg)

{

HANDLE_MSG(hWnd, WM_COMMAND, WndProc_OnCommand);

HANDLE_MSG(hWnd, WM_DESTROY, WndProc_OnDestroy);

default:

return(DefWindowProc(hWnd, msg, wParam, lParam));

}

}

// -----------------------------------------------------

// WndProc_OnDestroy

// -----------------------------------------------------

#pragma warning(disable: 4098)

void WndProc_OnDestroy(HWND hWnd)

{

PostQuitMessage(0);

return 0L;

}

// -----------------------------------------------------

// WndProc_OnCommand

// -----------------------------------------------------

#pragma warning(disable: 4098)

void WndProc_OnCommand(HWND hWnd, int id,

HWND hwndCtl, UINT codeNotify)

{

//

SC_HANDLEschService;

//

SC_HANDLEschSCManager;

LPQUERY_SERVICE_CONFIG lpBuf;

DWORD dwBytesNeeded;

char szBuf[1024];

switch (id)

{

case ID_FILE_EXIT:

{

//

PostQuitMessage(0);

return 0L;

break;

}