--- mstools/samples/ole/srvrdemo/doc.c 2018/08/09 18:20:49 1.1 +++ mstools/samples/ole/srvrdemo/doc.c 2018/08/09 18:23:58 1.1.1.3 @@ -95,7 +95,11 @@ BOOL CreateNewDoc (LONG lhdoc, LPSTR lps INT i; // Fill in the fields of the document structure. - if (lhdoc == NULL) + + docMain.doctype = doctype; + docMain.oledoc.lpvtbl= &docvtbl; + + if (lhdoc == 0) { if (OLE_OK != OleRegisterServerDoc (srvrMain.lhsrvr, @@ -107,8 +111,6 @@ BOOL CreateNewDoc (LONG lhdoc, LPSTR lps else docMain.lhdoc = lhdoc; - docMain.doctype = doctype; - docMain.oledoc.lpvtbl= &docvtbl; // Reset all the flags because no object numbers have been used. for (i=1; i <= cfObjNums; i++) docMain.rgfObjNums[i] = FALSE; @@ -151,7 +153,7 @@ VOID DestroyDoc (VOID) if (docMain.aName) { GlobalDeleteAtom (docMain.aName); - docMain.aName = NULL; + docMain.aName = '\0'; } if (docMain.hpal) @@ -214,7 +216,7 @@ OLESTATUS APIENTRY DocExecute (LPOLESER * searching for one with that name. Return an error if there is not one. * * LPOLESERVERDOC lpoledoc - The server document - * LPSTR lpszObjectName - The name of the object to get data for + * OLE_LPCSTR lpszObjectName - The name of the object to get data for * LPOLEOBJECT FAR *lplpoleobject - The object's data is put here * LPOLECLIENT lpoleclient - The client structure * @@ -228,7 +230,7 @@ OLESTATUS APIENTRY DocExecute (LPOLESER * */ OLESTATUS APIENTRY DocGetObject - (LPOLESERVERDOC lpoledoc, LPSTR lpszObjectName, + (LPOLESERVERDOC lpoledoc, OLE_LPCSTR lpszObjectName, LPOLEOBJECT FAR *lplpoleobject, LPOLECLIENT lpoleclient) { HWND hwnd; @@ -349,7 +351,7 @@ OLESTATUS APIENTRY DocSave (LPOLESERVER * a linked document depends only on the source file. * * LPOLESERVERDOC lpoledoc - The server document - * LPRECT lprect - The target size in MM_HIMETRIC units + * CONST LPRECT lprect - The target size in MM_HIMETRIC units * * RETURNS: OLE_OK * @@ -359,7 +361,7 @@ OLESTATUS APIENTRY DocSave (LPOLESERVER * */ OLESTATUS APIENTRY DocSetDocDimensions - (LPOLESERVERDOC lpoledoc, LPRECT lprect) + (LPOLESERVERDOC lpoledoc, OLE_CONST RECT FAR * lprect) { if (docMain.doctype == doctypeEmbedded) { @@ -367,9 +369,10 @@ OLESTATUS APIENTRY DocSetDocDimensions // the units are in HIMETRIC rect.right = rect.right - rect.left; - rect.bottom = rect.bottom - rect.top; + // the following was bottom - top + rect.bottom = rect.top - rect.bottom; - HiMetricToDevice (hwndMain, (LPPOINT) &rect.right); + HiMetricToDevice ( (LPPOINT) &rect.right ); MoveWindow (SelectedObjectWindow(), 0, 0, rect.right + 2 * GetSystemMetrics(SM_CXFRAME), rect.bottom + 2 * GetSystemMetrics(SM_CYFRAME), @@ -396,8 +399,8 @@ OLESTATUS APIENTRY DocSetDocDimensions * use their filenames for the title bar text. * * LPOLESERVERDOC lpoledoc - The server document - * LPSTR lpszClient - The name of the client - * LPSTR lpszDoc - The client's name for the document + * OLE_LPCSTR lpszClient - The name of the client + * OLE_LPCSTR lpszDoc - The client's name for the document * * RETURNS: OLE_OK * @@ -405,11 +408,11 @@ OLESTATUS APIENTRY DocSetDocDimensions * */ OLESTATUS APIENTRY DocSetHostNames - (LPOLESERVERDOC lpoledoc, LPSTR lpszClient, LPSTR lpszDoc) + (LPOLESERVERDOC lpoledoc, OLE_LPCSTR lpszClient, OLE_LPCSTR lpszDoc) { - SetTitle (lpszDoc, TRUE); + SetTitle ((LPSTR)lpszDoc, TRUE); lstrcpy ((LPSTR) szClient, lpszClient); - lstrcpy ((LPSTR) szClientDoc, Abbrev(lpszDoc)); + lstrcpy ((LPSTR) szClientDoc, Abbrev((LPSTR)lpszDoc)); UpdateFileMenu (IDM_UPDATE); return OLE_OK; } @@ -425,7 +428,7 @@ OLESTATUS APIENTRY DocSetHostNames * object has its own palette. See ObjSetColorScheme. * * LPOLESERVERDOC lpoledoc - The server document - * LPLOGPALETTE lppal - Suggested palette + * CONST LOGPALETTE FAR * lppal - Suggested palette * * RETURNS: OLE_ERROR_PALETTE if CreatePalette fails, * OLE_OK otherwise @@ -436,7 +439,7 @@ OLESTATUS APIENTRY DocSetHostNames * a palette. */ OLESTATUS APIENTRY DocSetColorScheme - (LPOLESERVERDOC lpoledoc, LPLOGPALETTE lppal) + (LPOLESERVERDOC lpoledoc, OLE_CONST LOGPALETTE FAR * lppal) { HPALETTE hpal = CreatePalette (lppal); @@ -487,7 +490,7 @@ OLESTATUS RevokeDoc (VOID) if ((olestatus = OleRevokeServerDoc(docMain.lhdoc)) > OLE_WAIT_FOR_RELEASE) DestroyDoc(); - docMain.lhdoc = NULL; // A NULL handle indicates that the document + docMain.lhdoc = 0; // A NULL handle indicates that the document // has been revoked or is being revoked. return olestatus; @@ -524,7 +527,7 @@ INT SaveChangesOption (BOOL *pfUpdateLat if (docMain.aName) GlobalGetAtomName (docMain.aName, szTmp, cchFilenameMax); else - szTmp[0] = NULL; + szTmp[0] = '\0'; if (docMain.doctype == doctypeEmbedded) wsprintf (szBuf, "The object has been changed.\n\nUpdate %s before closing the object?", Abbrev (szTmp));