--- mstools/samples/ole/srvrdemo/srvrdemo.c 2018/08/09 18:21:50 1.1.1.2 +++ mstools/samples/ole/srvrdemo/srvrdemo.c 2018/08/09 18:23:58 1.1.1.3 @@ -17,11 +17,11 @@ /* Global variable definitions */ -HWND hwndMain = NULL; +HWND hwndMain = 0; // Used in converting units from pixels to Himetric and vice-versa -int giXppli = NULL; // pixels per logical inch along width -int giYppli = NULL; // pixels per logical inch along height +int giXppli = 0; // pixels per logical inch along width +int giYppli = 0; // pixels per logical inch along height @@ -116,8 +116,8 @@ static BOOL FailedUpdate(HWND); * */ int APIENTRY WinMain( - HANDLE hInstance, - HANDLE hPrevInstance, + HINSTANCE hInstance, + HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow ){ @@ -149,13 +149,14 @@ int APIENTRY WinMain( BOOL fMoreMsgs = TRUE; while (fMoreMsgs) { + if (srvrMain.lhsrvr == 0) OleUnblockServer (srvrMain.lhsrvr, &fMoreMsgs); } // We have taken care of all the messages in the OLE queue fUnblock = FALSE; } - if (!GetMessage(&msg, NULL, NULL, NULL)) + if (!GetMessage(&msg, NULL, 0, 0)) break; if( !TranslateAccelerator(hwndMain, hAccelTable, &msg)) { @@ -192,7 +193,7 @@ static BOOL InitApplication( HANDLE hIns wc.lpszClassName = "MainClass"; wc.lpfnWndProc = (WNDPROC)MainWndProc; - wc.style = NULL; + wc.style = 0; wc.cbClsExtra = 4; wc.cbWndExtra = 0; wc.hInstance = hInstance; @@ -285,7 +286,7 @@ static BOOL InitInstance (HANDLE hInstan if (!hwndMain) return FALSE; - szClient[0] = NULL; + szClient[0] = '\0'; lstrcpy (szClientDoc, "Client Document"); // Initialize global variables with LOGPIXELSX and LOGPIXELSY @@ -387,7 +388,7 @@ LONG APIENTRY MainWndProc if (fWaitingForDocRelease) { ErrorBox ("Waiting for a document to be revoked.\n\rPlease wait."); - return NULL; + return 0; } switch (wID) @@ -424,7 +425,7 @@ LONG APIENTRY MainWndProc fRevokeSrvrOnSrvrRelease = TRUE; - if (!CreateNewDoc (NULL, "(Untitled)", doctypeNew)) + if (!CreateNewDoc (0, "(Untitled)", doctypeNew)) { ErrorBox ("Serious Error: Cannot create new document."); break; @@ -563,7 +564,7 @@ LONG APIENTRY MainWndProc default: return DefWindowProc(hwnd, message, wParam, lParam); } - return NULL; + return 0; } @@ -639,7 +640,7 @@ LONG APIENTRY ObjWndProc if (fWaitingForDocRelease) { ErrorBox ("Waiting for a document to be revoked.\n\rPlease wait."); - return NULL; + return 0; } // Get coordinates of object relative to main window's client area. GetWindowRect (hwnd, (LPRECT)&rect); @@ -656,7 +657,7 @@ LONG APIENTRY ObjWndProc if (fWaitingForDocRelease) { ErrorBox ("Waiting for a document to be revoked.\n\rPlease wait."); - return NULL; + return 0; } BringWindowToTop (hwnd); @@ -741,7 +742,7 @@ LONG APIENTRY ObjWndProc default: return DefWindowProc(hwnd, message, wParam, lParam); } - return NULL; + return 0; } @@ -846,7 +847,7 @@ VOID EmbeddingModeOff (VOID) /* Change File menu so it contains "Save As..." instead of */ /* "Save Copy As..." */ ModifyMenu(hMenu, IDM_SAVEAS, MF_BYCOMMAND|MF_STRING, IDM_SAVEAS, - "Save As.."); + "Save &As.."); /* In non-embedded mode, the user can create new objects. */ EnableMenuItem(hMenu, menuposObject, MF_BYPOSITION | MF_ENABLED); @@ -951,7 +952,7 @@ LPOBJ HwndToLpobj (HWND hwndObj) */ static BOOL CreateUntitledDoc (INT nCmdShow) { - if (!CreateNewDoc (NULL, "(Untitled)", doctypeNew)) + if (!CreateNewDoc (0, "(Untitled)", doctypeNew)) return FALSE; CreateNewObj (FALSE); ShowWindow(hwndMain, nCmdShow); @@ -1040,7 +1041,7 @@ static BOOL ProcessCmdLine (LPSTR lpszLi } } - if (!CreateDocFromFile (szBuf, NULL, doctypeFromFile)) + if (!CreateDocFromFile (szBuf, 0, doctypeFromFile)) { // File not in proper format. if (fEmbedding) @@ -1263,7 +1264,7 @@ VOID Wait (BOOL *pf) if (!fMoreMsgs) // if there are no more messages in the OLE queue, go to system queue { - if (GetMessage (&msg, NULL, NULL, NULL)) + if (GetMessage (&msg, NULL, 0, 0)) { TranslateMessage (&msg); DispatchMessage (&msg); @@ -1309,7 +1310,7 @@ BOOL APIENTRY fnFailedUpdate (HWND hDlg { CHAR szMsg[200]; - szMsg[0] = NULL; + szMsg[0] = '\0'; wsprintf( szMsg,