diff options
author | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
---|---|---|
committer | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
commit | e611b132f9b8abe35b362e5870b74bce94a1e58e (patch) | |
tree | a5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/oleutest/simpsvr | |
download | NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2 NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip |
Diffstat (limited to 'private/oleutest/simpsvr')
42 files changed, 8882 insertions, 0 deletions
diff --git a/private/oleutest/simpsvr/app.cpp b/private/oleutest/simpsvr/app.cpp new file mode 100644 index 000000000..bc096c968 --- /dev/null +++ b/private/oleutest/simpsvr/app.cpp @@ -0,0 +1,987 @@ +//********************************************************************** +// File name: app.cpp +// +// Implementation file for the CSimpSvrApp Class +// +// Functions: +// +// See app.h for a list of member functions. +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** + +#include "pre.h" +#include "obj.h" +#include "app.h" +#include "doc.h" +#include "icf.h" +#include <msgfiltr.h> + +#include "initguid.h" +DEFINE_GUID(GUID_SIMPLE, 0xBCF6D4A0, 0xBE8C, 0x1068, 0xB6, 0xD4, 0x00, 0xDD, 0x01, 0x0C, 0x05, 0x09); + +#ifdef WIN32 +extern BOOL CALLBACK About(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam); +#endif + +//+------------------------------------------------------------------------- +// +// Function: SimpsvrMsgCallBack +// +// Synopsis: Tell Standard Message Filter not to toss windows messages +// +// Arguments: [pmsg] - first message in the queue +// +// History: dd-mmm-yy Author Comment +// 19-May-94 ricksa author +// +//-------------------------------------------------------------------------- +BOOL CALLBACK SimpsvrMsgCallBack(MSG *pmsg) +{ + // We don't care about any of the in particular. We simply care that + // our messages are not tossed not matter what. + return TRUE; +} + +//********************************************************************** +// +// CSimpSvrApp::CSimpSvrApp() +// +// Purpose: +// +// Constructor for CSimpSvrApp +// +// Parameters: +// +// None +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// SetRectEmpty Windows API +// +// Comments: +// +// +//******************************************************************** + +CSimpSvrApp::CSimpSvrApp() +{ + TestDebugOut(TEXT("In CSimpSvrApp's Constructor \r\n")); + + // Set Ref Count + m_nCount = 0; + + // clear members + m_hAppWnd = NULL; + m_hInst = NULL; + m_lpDoc = NULL; + + // clear flags + m_fInitialized = FALSE; + + // used for inplace + SetRectEmpty(&nullRect); +} + +//********************************************************************** +// +// CSimpSvrApp::~CSimpSvrApp() +// +// Purpose: +// +// Destructor for CSimpSvrApp Class. +// +// Parameters: +// +// None +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// DestroyWindow Windows API +// CSimpSvrApp::IsInitialized APP.H +// OleUninitialize OLE API +// +//******************************************************************** + +CSimpSvrApp::~CSimpSvrApp() +{ + TestDebugOut(TEXT("In CSimpSvrApp's Destructor\r\n")); + + /* The Simple Server is structured so that SimpSvrApp is ALWAYS the + * last one to be released, after all the SimpSvrDoc and SimpSvrObj are + * released. So, we don't need to do any clean up to the SimpSvrDoc + * and SimpSvrObj objects. + */ + + // Revoke our message filter as the last step. + CoRegisterMessageFilter(NULL, NULL); + + // need to uninit the library... + if (IsInitialized()) + OleUninitialize(); + + DestroyWindow(m_hAppWnd); +} + + +//********************************************************************** +// +// CSimpSvrApp::QueryInterface +// +// Purpose: +// +// Used for interface negotiation at Application Level +// +// Parameters: +// +// REFIID riid - A reference to the interface that is +// being queried. +// +// LPVOID FAR* ppvObj - An out parameter to return a pointer to +// the interface. +// +// Return Value: +// +// S_OK - The interface is supported. +// E_NOINTERFACE - The interface is not supported +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// ResultFromScode OLE API +// IUnknown::AddRef APP.CPP +// +// +// +//******************************************************************** + +STDMETHODIMP CSimpSvrApp::QueryInterface(REFIID riid, LPVOID FAR* ppvObj) +{ + TestDebugOut(TEXT("In CSimpSvrApp::QueryInterface\r\n")); + + SCODE sc = S_OK; + + if (IsEqualIID(riid, IID_IUnknown)) + *ppvObj = this; + else + { + *ppvObj = NULL; + sc = E_NOINTERFACE; + } + + if (*ppvObj) + ((LPUNKNOWN)*ppvObj)->AddRef(); + + // asking for something we don't understand at this level. + return ResultFromScode(sc); +} + +//********************************************************************** +// +// CSimpSvrApp::AddRef +// +// Purpose: +// +// Adds to the reference count at the Application level. +// +// Parameters: +// +// None +// +// Return Value: +// +// ULONG - The new reference count of the application. +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// Comments: +// +// Due to the reference counting model that is used in this +// implementation, this reference count is the sum of the +// reference counts on all interfaces of all objects open +// in the application. +// +//******************************************************************** + +STDMETHODIMP_(ULONG) CSimpSvrApp::AddRef() +{ + TestDebugOut(TEXT("In CSimpSvrApp::AddRef\r\n")); + return ++m_nCount; +} + +//********************************************************************** +// +// CSimpSvrApp::Release +// +// Purpose: +// +// Decrements the reference count at this level +// +// Parameters: +// +// None +// +// Return Value: +// +// ULONG - The new reference count of the application. +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// Comments: +// +// Due to the reference counting model that is used in this +// implementation, this reference count is the sum of the +// reference counts on all interfaces of all objects open +// in the application. +// +//******************************************************************** + +STDMETHODIMP_(ULONG) CSimpSvrApp::Release() +{ + TestDebugOut(TEXT("In CSimpSvrApp::Release\r\n")); + + if (--m_nCount==0) + { + delete this; + return(0); + } + + return m_nCount; +} + +//********************************************************************** +// +// CSimpSvrApp::fInitApplication +// +// Purpose: +// +// Initializes the application +// +// Parameters: +// +// HANDLE hInstance - Instance handle of the application. +// +// Return Value: +// +// TRUE - Application was successfully initialized. +// FALSE - Application could not be initialized +// +// Function Calls: +// Function Location +// +// LoadIcon Windows API +// LoadCursor Windows API +// GetStockObject Windows API +// RegisterClass Windows API +// RegisterHatchWindowClass OUTLUI.DLL +// +// +//******************************************************************** + +BOOL CSimpSvrApp::fInitApplication(HANDLE hInstance) +{ + WNDCLASS wc; + + // Fill in window class structure with parameters that describe the + // main window. + + wc.style = NULL; // Class style(s). + wc.lpfnWndProc = MainWndProc; // Function to retrieve messages for + // windows of this class. + wc.cbClsExtra = 0; // No per-class extra data. + wc.cbWndExtra = 0; // No per-window extra data. + wc.hInstance = (HINSTANCE) hInstance; // Application that owns the class. + wc.hIcon = LoadIcon((HINSTANCE) hInstance, TEXT("SimpSvr")); + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); + + wc.lpszMenuName = TEXT("SimpSvrMENU"); // Name of menu resource in .RC file. + wc.lpszClassName = TEXT("SimpSvrWClass"); // Name used in call to CreateWindow. + + if (!RegisterClass(&wc)) + return FALSE; + + wc.style = CS_VREDRAW | CS_HREDRAW; // Class style(s). + wc.lpfnWndProc = DocWndProc; // Function to retrieve messages for + // windows of this class. + wc.cbClsExtra = 0; // No per-class extra data. + wc.cbWndExtra = 0; // No per-window extra data. + wc.hInstance = (HINSTANCE) hInstance; // Application that owns the class. + wc.hIcon = NULL; + wc.hCursor = LoadCursor(NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); + wc.lpszMenuName = NULL; + + wc.lpszClassName = TEXT("DocWClass"); // Name used in call to CreateWindow. + + // Register the window class and return success/failure code. + + if (!RegisterClass(&wc)) + return FALSE; + + return (RegisterHatchWindowClass((HINSTANCE) hInstance)); +} + +//********************************************************************** +// +// CSimpSvrApp::fInitInstance +// +// Purpose: +// +// Instance initialization. +// +// Parameters: +// +// HANDLE hInstance - App. Instance Handle. +// +// int nCmdShow - Show parameter from WinMain +// +// Return Value: +// +// TRUE - Initialization Successful +// FALSE - Initialization Failed. +// +// +// Function Calls: +// Function Location +// +// CreateWindow Windows API +// InvalidateRect Windows API +// ShowWindow Windows API +// UpdateWindow Windows API +// CoRegisterClassObject OLE API +// OleBuildVersion OLE API +// OleInitialize OLE API +// CSimpSvrDoc::CreateObject DOC.CPP +// +// Comments: +// +// Note that successful Initalization of the OLE libraries +// is remembered so the UnInit is only called if needed. +// +//******************************************************************** + +BOOL CSimpSvrApp::fInitInstance (HANDLE hInstance, int nCmdShow, + CClassFactory FAR * lpClassFactory) +{ + m_hInst = (HINSTANCE) hInstance; + +#ifndef WIN32 + /* Since OLE is part of the operating system in Win32, we don't need to + * check the version number in Win32. + */ + DWORD dwVer = OleBuildVersion(); + + // check to see if we are compatible with this version of the libraries + if (HIWORD(dwVer) != rmm || LOWORD(dwVer) < rup) + { +#ifdef _DEBUG + TestDebugOut("WARNING: Incompatible OLE library version\r\n"); +#else + return FALSE; +#endif + } + +#endif // WIN32 + + // initialize the libraries + if (OleInitialize(NULL) == NOERROR) + m_fInitialized = TRUE; + + // Load our accelerators + if ((m_hAccel = LoadAccelerators(m_hInst, TEXT("SimpsvrAccel"))) == NULL) + { + // Load failed so abort + TestDebugOut(TEXT("ERROR: Accelerator Table Load FAILED\r\n")); + return FALSE; + } + + + // Create the "application" windows + m_hAppWnd = CreateWindow (TEXT("SimpSvrWClass"), + TEXT("Simple OLE 2.0 Server"), + WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, + CW_USEDEFAULT, + CW_USEDEFAULT, + CW_USEDEFAULT, + NULL, + NULL, + (HINSTANCE) hInstance, + NULL); + + if (!m_hAppWnd) + return FALSE; + + // Because there default call control behavior tosses messages + // which cause intermittent failures of the test, we install a + // message filter to get around the problem. + IMessageFilter *pmf = OleStdMsgFilter_Create(m_hAppWnd, + TEXT("Simple OLE 2.0 Server"), SimpsvrMsgCallBack, NULL); + + if (pmf == NULL) + { + // this call failed so we are hosed. So fail the whole thing + TestDebugOut( + TEXT("CSimpSvrApp::fInitInstance OleStdMsgFilter_Create fails\n")); + return FALSE; + } + + HRESULT hr = CoRegisterMessageFilter(pmf, NULL); + + if (FAILED(hr)) + { + // this call failed so we are hosed. So fail the whole thing + TestDebugOut( + TEXT("CSimpSvrApp::fInitInstance CoRegisterMessageFilter fails\n")); + return FALSE; + } + + // The message filter keeps a reference to this object so we don't have + // to remember anything about it -- except of course to deregister it. + pmf->Release(); + + // if not started by OLE, then show the Window, and create a "fake" object, else + // Register a pointer to IClassFactory so that OLE can instruct us to make an + // object at the appropriate time. + if (!m_fStartByOle) + { + ShowAppWnd(nCmdShow); + m_lpDoc->CreateObject(IID_IOleObject, (LPVOID FAR *)&m_OleObject); + InvalidateRect(m_lpDoc->GethDocWnd(), NULL, TRUE); + } + else + { + lpClassFactory = new CClassFactory(this); + + if (!lpClassFactory) + { + /* Memory allocation fails + */ + return(FALSE); + } + + // shouldn't pass an API an object with a zero ref count + lpClassFactory->AddRef(); + + if ( + CoRegisterClassObject(GUID_SIMPLE, + (IUnknown FAR *)lpClassFactory, + CLSCTX_LOCAL_SERVER, + REGCLS_SINGLEUSE, + &m_dwRegisterClass) != S_OK + ) + TestDebugOut(TEXT("CSimpSvrApp::fInitInstance \ + CoRegisterClassObject fails\n")); + + // remove artificial Ref. count + lpClassFactory->Release(); + } + + return m_fInitialized; +} + + +//+------------------------------------------------------------------------- +// +// Member: CSimpSvrApp::HandleDrawItem (public) +// +// Synopsis: Handles the Draw Item message for the owner draw menu for color +// +// Arguments: [lpdis] -- pointer to draw item structure +// +// Algorithm: If the request is to draw the item, we create a solid brush +// based on the color for the menu. Make a copy of the rectangle +// input. Finally, we shrink the rectangle in size and then fill +// it with the color. +// +// History: dd-mmm-yy Author Comment +// 02-May-94 ricksa author +// +// Notes: +// +//-------------------------------------------------------------------------- +void CSimpSvrApp::HandleDrawItem(LPDRAWITEMSTRUCT lpdis) +{ + HBRUSH hbr; + RECT rc; + + if (lpdis->itemAction == ODA_DRAWENTIRE) + { + // Paint the color item in the color requested. + hbr = CreateSolidBrush(lpdis->itemData); + CopyRect((LPRECT)&rc, (LPRECT)&lpdis->rcItem); + InflateRect((LPRECT)&rc, -10, -10); + FillRect(lpdis->hDC, &rc, hbr); + DeleteObject(hbr); + } +} + + + +//+------------------------------------------------------------------------- +// +// Member: CSimpSvrApp::HandleChangeColors (public) +// +// Synopsis: Handles change between owner draw and regular menu +// +// Algorithm: Reset the checked state of the menu item. If it is an owner +// draw menu requested, then we reset all the menu items to that. +// Otherwise, we set it to the reqular menu items. +// +// History: dd-mmm-yy Author Comment +// 02-May-94 ricksa author +// +// Notes: +// +//-------------------------------------------------------------------------- +void CSimpSvrApp::HandleChangeColors(void) +{ + // Get a handle to the Colors menu + HMENU hMenu = m_lpDoc->GetColorMenu(); + + // Get the current state of the item + BOOL fOwnerDraw = GetMenuState(hMenu, IDM_COLOROWNERDR, MF_BYCOMMAND) + & MF_CHECKED; + + // Toggle the state of the item. + CheckMenuItem(hMenu, IDM_COLOROWNERDR, + MF_BYCOMMAND | (fOwnerDraw ? MF_UNCHECKED : MF_CHECKED)); + + if (!fOwnerDraw) + { + // Change the items to owner-draw items. Pass the RGB value for the + // color as the application-supplied data. This makes it easier for + // us to draw the items. + ModifyMenu(hMenu, IDM_RED, MF_OWNERDRAW | MF_BYCOMMAND, IDM_RED, + (LPSTR) RGB (255,0,0)); + ModifyMenu(hMenu, IDM_GREEN, MF_OWNERDRAW | MF_BYCOMMAND, IDM_GREEN, + (LPSTR)RGB (0,255,0)); + ModifyMenu(hMenu, IDM_BLUE, MF_OWNERDRAW | MF_BYCOMMAND, IDM_BLUE, + (LPSTR)RGB (0,0,255)); + } + else + { + // Change the items to normal text items. */ + ModifyMenu(hMenu, IDM_RED, MF_BYCOMMAND, IDM_RED, "Red"); + ModifyMenu(hMenu, IDM_GREEN, MF_BYCOMMAND, IDM_GREEN, "Green"); + ModifyMenu(hMenu, IDM_BLUE, MF_BYCOMMAND, IDM_BLUE, "Blue"); + } +} + + +//********************************************************************** +// +// CSimpSvrApp::lCommandHandler +// +// Purpose: +// +// Handles the processing of WM_COMMAND. +// +// Parameters: +// +// HWND hWnd - Handle to the application Window +// +// UINT message - message (always WM_COMMAND) +// +// WPARAM wParam - Same as passed to the WndProc +// +// LPARAM lParam - Same as passed to the WndProc +// +// Return Value: +// +// NULL +// +// Function Calls: +// Function Location +// +// GetClientRect Windows API +// MessageBox Windows API +// DialogBox Windows API +// MakeProcInstance Windows API +// FreeProcInstance Windows API +// SendMessage Windows API +// DefWindowProc Windows API +// InvalidateRect Windows API +// CSimpSvrDoc::InsertObject DOC.CPP +// CSimpSvrObj::SetColor OBJ.CPP +// CSimpSvrObj::RotateColor OBJ.CPP +// +// +//******************************************************************** + +long CSimpSvrApp::lCommandHandler (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + // In Win32, the upper word of wParam is the notify code. Since we + // don't care about this code, we dump it. + wParam = LOWORD(wParam); + + switch (wParam) { + // bring up the About box + case IDM_ABOUT: + { +#ifdef WIN32 + DialogBox(m_hInst, // current instance + TEXT("AboutBox"), // resource to use + m_hAppWnd, // parent handle + About); // About() instance address +#else + FARPROC lpProcAbout = MakeProcInstance((FARPROC)About, m_hInst); + + DialogBox(m_hInst, // current instance + TEXT("AboutBox"), // resource to use + m_hAppWnd, // parent handle + lpProcAbout); // About() instance address + + FreeProcInstance(lpProcAbout); +#endif // WIN32 + + break; + } + + // exit the application + case IDM_EXIT: + SendMessage(hWnd, WM_SYSCOMMAND, SC_CLOSE, 0L); + break; + + case IDM_RED: + m_lpDoc->GetObj()->SetColor (128, 0, 0); + InvalidateRect(m_lpDoc->GethDocWnd(), NULL, TRUE); + break; + + case IDM_GREEN: + m_lpDoc->GetObj()->SetColor (0,128, 0); + InvalidateRect(m_lpDoc->GethDocWnd(), NULL, TRUE); + break; + + case IDM_BLUE: + m_lpDoc->GetObj()->SetColor (0, 0, 128); + InvalidateRect(m_lpDoc->GethDocWnd(), NULL, TRUE); + break; + + case IDM_COLOROWNERDR: + HandleChangeColors(); + break; + + default: + return (DefWindowProc(hWnd, message, wParam, lParam)); + } // end of switch + return NULL; +} + +//********************************************************************** +// +// CSimpSvrApp::lSizeHandler +// +// Purpose: +// +// Handles the WM_SIZE message +// +// Parameters: +// +// HWND hWnd - Handle to the application Window +// +// UINT message - message (always WM_SIZE) +// +// WPARAM wParam - Same as passed to the WndProc +// +// LPARAM lParam - Same as passed to the WndProc +// +// Return Value: +// +// LONG - returned from the "document" resizing +// +// Function Calls: +// Function Location +// +// GetClientRect Windows API +// CSimpSvrDoc::lResizeDoc DOC.CPP +// +// +//******************************************************************** + +long CSimpSvrApp::lSizeHandler (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + RECT rect; + + GetClientRect(m_hAppWnd, &rect); + return m_lpDoc->lResizeDoc(&rect); +} + +//********************************************************************** +// +// CSimpSvrApp::lCreateDoc +// +// Purpose: +// +// Handles the creation of a document. +// +// Parameters: +// +// HWND hWnd - Handle to the application Window +// +// UINT message - message (always WM_CREATE) +// +// WPARAM wParam - Same as passed to the WndProc +// +// LPARAM lParam - Same as passed to the WndProc +// +// Return Value: +// +// NULL +// +// Function Calls: +// Function Location +// +// GetClientRect Windows API +// CSimpSvrDoc::Create DOC.CPP +// +// +//******************************************************************** + +long CSimpSvrApp::lCreateDoc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + RECT rect; + + GetClientRect(hWnd, &rect); + + m_lpDoc = CSimpSvrDoc::Create(this, &rect, hWnd); + + return NULL; +} + + + +//********************************************************************** +// +// CSimpSvrApp::PaintApp +// +// Purpose: +// +// Handles the painting of the doc window. +// +// +// Parameters: +// +// HDC hDC - hDC to the Doc Window. +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// CSimpSvrDoc::PaintDoc DOC.CPP +// +// +// +//******************************************************************** + +void CSimpSvrApp::PaintApp (HDC hDC) +{ + + // if we supported multiple documents, we would enumerate + // through each of the open documents and call paint. + + if (m_lpDoc) + m_lpDoc->PaintDoc(hDC); + +} + +//********************************************************************** +// +// CSimpSvrApp::ParseCmdLine +// +// Purpose: +// +// Determines if the app was started by OLE +// +// +// Parameters: +// +// LPSTR lpCmdLine - Pointer to the command line +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// lstrlen Windows API +// lstrcmp Windows API +// +// +// Comments: +// +// Parses the command line looking for the -Embedding or /Embedding +// flag. +// +//******************************************************************** + +void CSimpSvrApp::ParseCmdLine(LPSTR lpCmdLine) +{ + CHAR szTemp[255]; + + m_fStartByOle = TRUE; + + ::ParseCmdLine (lpCmdLine, &m_fStartByOle, szTemp); + +} + +//********************************************************************** +// +// CSimpSvrApp::SetStatusText +// +// Purpose: +// +// Blanks out the text in the status bar +// +// +// Parameters: +// +// None +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// CSimpSvrDoc::SetStatusText DOC.CPP +// +// +//******************************************************************** + +void CSimpSvrApp::SetStatusText() +{ + m_lpDoc->SetStatusText(); +} + + +//********************************************************************** +// +// CSimpSvrApp::IsInPlaceActive +// +// Purpose: +// +// Safely determines from the app level if currently inplace active. +// +// +// Parameters: +// +// None +// +// Return Value: +// +// TRUE - Inplace active +// FALSE - Not Inplace active +// +// Function Calls: +// Function Location +// +// CSimpSvrDoc::GetObject DOC.H +// CSimpSvrObj:IsInPlaceActive OBJ.H +// +// +//******************************************************************** + +BOOL CSimpSvrApp::IsInPlaceActive() +{ + BOOL retval = FALSE; + + if (m_lpDoc) + if (m_lpDoc->GetObj()) + retval = m_lpDoc->GetObj()->IsInPlaceActive(); + + return retval; +} + +//********************************************************************** +// +// CSimpSvrApp::ShowAppWnd +// +// Purpose: +// +// Shows the Application Window +// +// Parameters: +// +// int nCmdShow - Window State +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// ShowWindow Windows API +// UpdateWindow Windows API +// CoLockObjectExternal OLE API +// +//******************************************************************** + +void CSimpSvrApp::ShowAppWnd(int nCmdShow) +{ + if (CoLockObjectExternal(this, TRUE, FALSE) != S_OK) + TestDebugOut(TEXT("CSimpSvrApp::ShowAppWnd \ + CoLockObjectExternal fails\n")); + ShowWindow (m_hAppWnd, nCmdShow); + UpdateWindow (m_hAppWnd); +} + +//********************************************************************** +// +// CSimpSvrApp::ShowAppWnd +// +// Purpose: +// +// Hides the Application Window +// +// Parameters: +// +// None +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// ShowWindow Windows API +// CoLockObjectExternal OLE API +// +//******************************************************************** + +void CSimpSvrApp::HideAppWnd() +{ + if (CoLockObjectExternal(this, FALSE, TRUE) != S_OK) + TestDebugOut(TEXT("CSimpSvrApp::HideAppWnd \ + CoLockObjectExternal fails\n")); + ShowWindow (m_hAppWnd, SW_HIDE); +} + + diff --git a/private/oleutest/simpsvr/app.h b/private/oleutest/simpsvr/app.h new file mode 100644 index 000000000..3c1c9f656 --- /dev/null +++ b/private/oleutest/simpsvr/app.h @@ -0,0 +1,87 @@ +//********************************************************************** +// File name: app.h +// +// Definition of CSimpSvrApp +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** + +#if !defined( _APP_H_) +#define _APP_H_ + +class CSimpSvrDoc; +interface CClassFactory; + +class CSimpSvrApp : public IUnknown +{ +private: + + int m_nCount; // reference count + + HINSTANCE m_hInst; // application instance + BOOL m_fStartByOle; // TRUE if app started by OLE + DWORD m_dwRegisterClass; // returned by RegisterClassFactory + + LPOLEOBJECT m_OleObject; // pointer to "dummy" object + + + CSimpSvrDoc FAR * m_lpDoc; // pointer to document object + BOOL m_fInitialized; // OLE initialization flag + + RECT nullRect; // used in inplace negotiation + + // Convert to/from owner draw menus + void HandleChangeColors(void); + + +public: + + HWND m_hAppWnd; // main window handle + + HACCEL m_hAccel; // Accelerators + + + // IUnknown Interfaces + STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj); + STDMETHODIMP_(ULONG) AddRef(); + STDMETHODIMP_(ULONG) Release(); + + // Initialization methods + + CSimpSvrApp(); // Constructor + ~CSimpSvrApp(); // Destructor + + + BOOL fInitApplication (HANDLE hInstance); + BOOL fInitInstance (HANDLE hInstance, int nCmdShow, CClassFactory FAR * lpClassFactory); + + // Message handling methods + + long lCommandHandler (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + long lSizeHandler (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + long lCreateDoc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + void PaintApp(HDC hDC); + void HandleDrawItem(LPDRAWITEMSTRUCT lpdis); + + // Utility functions + void ParseCmdLine(LPSTR lpCmdLine); + void SetStatusText(); + BOOL IsInPlaceActive(); + void ShowAppWnd(int nCmdShow=SW_SHOWNORMAL); + void HideAppWnd(); + + + // member variable access + inline HWND GethAppWnd() { return m_hAppWnd; }; + inline HINSTANCE GethInst() { return m_hInst; }; + inline BOOL IsStartedByOle() { return m_fStartByOle; }; + inline BOOL IsInitialized() { return m_fInitialized; }; + inline DWORD GetRegisterClass() { return m_dwRegisterClass; }; + inline CSimpSvrDoc FAR * GetDoc() { return m_lpDoc; }; + inline void ClearDoc() { m_lpDoc = NULL; }; + inline LPOLEOBJECT GetOleObject() { return m_OleObject; }; + + friend interface CClassFactory; // make the contained class a friend +}; + +#endif diff --git a/private/oleutest/simpsvr/bang.ico b/private/oleutest/simpsvr/bang.ico Binary files differnew file mode 100644 index 000000000..90fe0f220 --- /dev/null +++ b/private/oleutest/simpsvr/bang.ico diff --git a/private/oleutest/simpsvr/daytona/makefile b/private/oleutest/simpsvr/daytona/makefile new file mode 100644 index 000000000..6ee4f43fa --- /dev/null +++ b/private/oleutest/simpsvr/daytona/makefile @@ -0,0 +1,6 @@ +# +# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source +# file to this component. This file merely indirects to the real make file +# that is shared by all the components of NT OS/2 +# +!INCLUDE $(NTMAKEENV)\makefile.def diff --git a/private/oleutest/simpsvr/daytona/sources b/private/oleutest/simpsvr/daytona/sources new file mode 100644 index 000000000..59f3f7fbc --- /dev/null +++ b/private/oleutest/simpsvr/daytona/sources @@ -0,0 +1,42 @@ +TARGETNAME=SIMPSVR +TARGETTYPE=PROGRAM +TARGETPATH=OBJ +TARGETLIBS= \ + $(GUI32_LIBS) \ + $(WIN32_LIBS) \ + $(CRT_LIBS) \ + $(NT_CRT) \ + $(LIBRARY_PATH)\ole32.lib \ + $(LIBRARY_PATH)\shell32.lib \ + $(LIBRARY_PATH)\comdlg32.lib \ + ..\..\letest\ole2ui\daytona\obj\*\ole2u32a.lib \ + $(LIBRARY_PATH)\uuid.lib + +BLDCRT=1 +UMTYPE=windows +UMENTRY=winmain +#UMLIBS= \ +# ..\..\libs\daytona\*\common.lib + +INCLUDES=..;..\..\inc;..\..\letest\ole2ui + +C_DEFINES=-DWIN32 -DDEBUG -DINC_OLE2 -DCLIENT -DWINDOWS + +NTDEBUG=ntsd +NTDEBUGTYPE=both +MSC_OPTIMIZATION=/Od + +SOURCES= \ +..\APP.CPP \ +..\DOC.CPP \ +..\ICF.CPP \ +..\IDO.CPP \ +..\IEC.CPP \ +..\IOIPAO.CPP \ +..\IOIPO.CPP \ +..\IOO.CPP \ +..\IPS.CPP \ +..\OBJ.CPP \ +..\PRE.CPP \ +..\SIMPSVR.CPP \ +..\SIMPSVR.RC diff --git a/private/oleutest/simpsvr/debug.log b/private/oleutest/simpsvr/debug.log new file mode 100644 index 000000000..8ac64d636 --- /dev/null +++ b/private/oleutest/simpsvr/debug.log @@ -0,0 +1 @@ +NULL CLSID @ 135250 doesn't support debug dumping diff --git a/private/oleutest/simpsvr/default.ico b/private/oleutest/simpsvr/default.ico Binary files differnew file mode 100644 index 000000000..4542c57d3 --- /dev/null +++ b/private/oleutest/simpsvr/default.ico diff --git a/private/oleutest/simpsvr/depend.mk b/private/oleutest/simpsvr/depend.mk new file mode 100644 index 000000000..e2bbcbe83 --- /dev/null +++ b/private/oleutest/simpsvr/depend.mk @@ -0,0 +1,271 @@ +# +# Built automatically +# + +# +# Source files +# + +$(OBJDIR)\simpsvr.obj $(OBJDIR)\simpsvr.lst: .\simpsvr.cpp \ + $(CAIROLE)\h\export\coguid.h $(CAIROLE)\h\export\compobj.h \ + $(CAIROLE)\h\export\dvobj.h $(CAIROLE)\h\export\initguid.h \ + $(CAIROLE)\h\export\moniker.h $(CAIROLE)\h\export\ole2.h \ + $(CAIROLE)\h\export\ole2ver.h $(CAIROLE)\h\export\oleguid.h \ + $(CAIROLE)\h\export\scode.h $(CAIROLE)\h\export\storage.h \ + $(COMMON)\ih\winnot.h $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h \ + $(CRTINC)\assert.h $(CRTINC)\ctype.h $(CRTINC)\dos.h \ + $(CRTINC)\excpt.h $(CRTINC)\stdarg.h $(CRTINC)\stdlib.h \ + $(CRTINC)\string.h $(OSINC)\cderr.h $(OSINC)\commdlg.h $(OSINC)\dde.h \ + $(OSINC)\ddeml.h $(OSINC)\dlgs.h $(OSINC)\lzexpand.h \ + $(OSINC)\mmsystem.h $(OSINC)\nb30.h $(OSINC)\ole.h $(OSINC)\rpc.h \ + $(OSINC)\rpcdce.h $(OSINC)\rpcdcep.h $(OSINC)\rpcnsi.h \ + $(OSINC)\rpcnterr.h $(OSINC)\shellapi.h $(OSINC)\winbase.h \ + $(OSINC)\wincon.h $(OSINC)\windef.h $(OSINC)\windows.h \ + $(OSINC)\winerror.h $(OSINC)\wingdi.h $(OSINC)\winnetwk.h \ + $(OSINC)\winnls.h $(OSINC)\winnt.h $(OSINC)\winperf.h \ + $(OSINC)\winreg.h $(OSINC)\winsock.h $(OSINC)\winspool.h \ + $(OSINC)\winsvc.h $(OSINC)\winuser.h $(OSINC)\winver.h \ + ..\ole2ui\ole2ui.h ..\ole2ui\olestd.h .\app.h .\doc.h .\icf.h \ + .\ido.h .\iec.h .\ioipao.h .\ioipo.h .\ioo.h .\ips.h .\obj.h \ + .\pre.h .\resource.h .\simpsvr.h + +$(OBJDIR)\pre.obj $(OBJDIR)\pre.lst: .\pre.cpp $(CAIROLE)\h\export\coguid.h \ + $(CAIROLE)\h\export\compobj.h $(CAIROLE)\h\export\dvobj.h \ + $(CAIROLE)\h\export\initguid.h $(CAIROLE)\h\export\moniker.h \ + $(CAIROLE)\h\export\ole2.h $(CAIROLE)\h\export\ole2ver.h \ + $(CAIROLE)\h\export\oleguid.h $(CAIROLE)\h\export\scode.h \ + $(CAIROLE)\h\export\storage.h $(COMMON)\ih\winnot.h \ + $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h $(CRTINC)\assert.h \ + $(CRTINC)\ctype.h $(CRTINC)\dos.h $(CRTINC)\excpt.h \ + $(CRTINC)\stdarg.h $(CRTINC)\string.h $(OSINC)\cderr.h \ + $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h $(OSINC)\dlgs.h \ + $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h $(OSINC)\nb30.h \ + $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h $(OSINC)\rpcdcep.h \ + $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h $(OSINC)\shellapi.h \ + $(OSINC)\winbase.h $(OSINC)\wincon.h $(OSINC)\windef.h \ + $(OSINC)\windows.h $(OSINC)\winerror.h $(OSINC)\wingdi.h \ + $(OSINC)\winnetwk.h $(OSINC)\winnls.h $(OSINC)\winnt.h \ + $(OSINC)\winperf.h $(OSINC)\winreg.h $(OSINC)\winsock.h \ + $(OSINC)\winspool.h $(OSINC)\winsvc.h $(OSINC)\winuser.h \ + $(OSINC)\winver.h ..\ole2ui\ole2ui.h ..\ole2ui\olestd.h .\pre.h \ + .\resource.h .\simpsvr.h + +$(OBJDIR)\obj.obj $(OBJDIR)\obj.lst: .\obj.cpp $(CAIROLE)\h\export\coguid.h \ + $(CAIROLE)\h\export\compobj.h $(CAIROLE)\h\export\dvobj.h \ + $(CAIROLE)\h\export\initguid.h $(CAIROLE)\h\export\moniker.h \ + $(CAIROLE)\h\export\ole2.h $(CAIROLE)\h\export\ole2ver.h \ + $(CAIROLE)\h\export\oleguid.h $(CAIROLE)\h\export\scode.h \ + $(CAIROLE)\h\export\storage.h $(COMMON)\ih\winnot.h \ + $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h $(CRTINC)\assert.h \ + $(CRTINC)\ctype.h $(CRTINC)\dos.h $(CRTINC)\excpt.h \ + $(CRTINC)\stdarg.h $(CRTINC)\string.h $(OSINC)\cderr.h \ + $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h $(OSINC)\dlgs.h \ + $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h $(OSINC)\nb30.h \ + $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h $(OSINC)\rpcdcep.h \ + $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h $(OSINC)\shellapi.h \ + $(OSINC)\winbase.h $(OSINC)\wincon.h $(OSINC)\windef.h \ + $(OSINC)\windows.h $(OSINC)\winerror.h $(OSINC)\wingdi.h \ + $(OSINC)\winnetwk.h $(OSINC)\winnls.h $(OSINC)\winnt.h \ + $(OSINC)\winperf.h $(OSINC)\winreg.h $(OSINC)\winsock.h \ + $(OSINC)\winspool.h $(OSINC)\winsvc.h $(OSINC)\winuser.h \ + $(OSINC)\winver.h ..\ole2ui\ole2ui.h ..\ole2ui\olestd.h .\app.h \ + .\doc.h .\icf.h .\ido.h .\iec.h .\ioipao.h .\ioipo.h .\ioo.h \ + .\ips.h .\obj.h .\pre.h .\resource.h .\simpsvr.h + +$(OBJDIR)\ips.obj $(OBJDIR)\ips.lst: .\ips.cpp $(CAIROLE)\h\export\coguid.h \ + $(CAIROLE)\h\export\compobj.h $(CAIROLE)\h\export\dvobj.h \ + $(CAIROLE)\h\export\initguid.h $(CAIROLE)\h\export\moniker.h \ + $(CAIROLE)\h\export\ole2.h $(CAIROLE)\h\export\ole2ver.h \ + $(CAIROLE)\h\export\oleguid.h $(CAIROLE)\h\export\scode.h \ + $(CAIROLE)\h\export\storage.h $(COMMON)\ih\winnot.h \ + $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h $(CRTINC)\assert.h \ + $(CRTINC)\ctype.h $(CRTINC)\dos.h $(CRTINC)\excpt.h \ + $(CRTINC)\stdarg.h $(CRTINC)\string.h $(OSINC)\cderr.h \ + $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h $(OSINC)\dlgs.h \ + $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h $(OSINC)\nb30.h \ + $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h $(OSINC)\rpcdcep.h \ + $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h $(OSINC)\shellapi.h \ + $(OSINC)\winbase.h $(OSINC)\wincon.h $(OSINC)\windef.h \ + $(OSINC)\windows.h $(OSINC)\winerror.h $(OSINC)\wingdi.h \ + $(OSINC)\winnetwk.h $(OSINC)\winnls.h $(OSINC)\winnt.h \ + $(OSINC)\winperf.h $(OSINC)\winreg.h $(OSINC)\winsock.h \ + $(OSINC)\winspool.h $(OSINC)\winsvc.h $(OSINC)\winuser.h \ + $(OSINC)\winver.h ..\ole2ui\ole2ui.h ..\ole2ui\olestd.h .\app.h \ + .\doc.h .\ido.h .\iec.h .\ioipao.h .\ioipo.h .\ioo.h .\ips.h \ + .\obj.h .\pre.h .\resource.h .\simpsvr.h + +$(OBJDIR)\ioo.obj $(OBJDIR)\ioo.lst: .\ioo.cpp $(CAIROLE)\h\export\coguid.h \ + $(CAIROLE)\h\export\compobj.h $(CAIROLE)\h\export\dvobj.h \ + $(CAIROLE)\h\export\initguid.h $(CAIROLE)\h\export\moniker.h \ + $(CAIROLE)\h\export\ole2.h $(CAIROLE)\h\export\ole2ver.h \ + $(CAIROLE)\h\export\oleguid.h $(CAIROLE)\h\export\scode.h \ + $(CAIROLE)\h\export\storage.h $(COMMON)\ih\winnot.h \ + $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h $(CRTINC)\assert.h \ + $(CRTINC)\ctype.h $(CRTINC)\dos.h $(CRTINC)\excpt.h \ + $(CRTINC)\stdarg.h $(CRTINC)\string.h $(OSINC)\cderr.h \ + $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h $(OSINC)\dlgs.h \ + $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h $(OSINC)\nb30.h \ + $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h $(OSINC)\rpcdcep.h \ + $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h $(OSINC)\shellapi.h \ + $(OSINC)\winbase.h $(OSINC)\wincon.h $(OSINC)\windef.h \ + $(OSINC)\windows.h $(OSINC)\winerror.h $(OSINC)\wingdi.h \ + $(OSINC)\winnetwk.h $(OSINC)\winnls.h $(OSINC)\winnt.h \ + $(OSINC)\winperf.h $(OSINC)\winreg.h $(OSINC)\winsock.h \ + $(OSINC)\winspool.h $(OSINC)\winsvc.h $(OSINC)\winuser.h \ + $(OSINC)\winver.h ..\ole2ui\ole2ui.h ..\ole2ui\olestd.h .\app.h \ + .\doc.h .\ido.h .\iec.h .\ioipao.h .\ioipo.h .\ioo.h .\ips.h \ + .\obj.h .\pre.h .\resource.h .\simpsvr.h + +$(OBJDIR)\ioipo.obj $(OBJDIR)\ioipo.lst: .\ioipo.cpp \ + $(CAIROLE)\h\export\coguid.h $(CAIROLE)\h\export\compobj.h \ + $(CAIROLE)\h\export\dvobj.h $(CAIROLE)\h\export\initguid.h \ + $(CAIROLE)\h\export\moniker.h $(CAIROLE)\h\export\ole2.h \ + $(CAIROLE)\h\export\ole2ver.h $(CAIROLE)\h\export\oleguid.h \ + $(CAIROLE)\h\export\scode.h $(CAIROLE)\h\export\storage.h \ + $(COMMON)\ih\winnot.h $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h \ + $(CRTINC)\math.h $(CRTINC)\assert.h $(CRTINC)\ctype.h $(CRTINC)\dos.h \ + $(CRTINC)\excpt.h $(CRTINC)\stdarg.h $(CRTINC)\string.h \ + $(OSINC)\cderr.h $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h \ + $(OSINC)\dlgs.h $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h \ + $(OSINC)\nb30.h $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h \ + $(OSINC)\rpcdcep.h $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h \ + $(OSINC)\shellapi.h $(OSINC)\winbase.h $(OSINC)\wincon.h \ + $(OSINC)\windef.h $(OSINC)\windows.h $(OSINC)\winerror.h \ + $(OSINC)\wingdi.h $(OSINC)\winnetwk.h $(OSINC)\winnls.h \ + $(OSINC)\winnt.h $(OSINC)\winperf.h $(OSINC)\winreg.h \ + $(OSINC)\winsock.h $(OSINC)\winspool.h $(OSINC)\winsvc.h \ + $(OSINC)\winuser.h $(OSINC)\winver.h ..\ole2ui\ole2ui.h \ + ..\ole2ui\olestd.h .\app.h .\doc.h .\ido.h .\iec.h .\ioipao.h \ + .\ioipo.h .\ioo.h .\ips.h .\obj.h .\pre.h .\resource.h .\simpsvr.h + +$(OBJDIR)\ioipao.obj $(OBJDIR)\ioipao.lst: .\ioipao.cpp \ + $(CAIROLE)\h\export\coguid.h $(CAIROLE)\h\export\compobj.h \ + $(CAIROLE)\h\export\dvobj.h $(CAIROLE)\h\export\initguid.h \ + $(CAIROLE)\h\export\moniker.h $(CAIROLE)\h\export\ole2.h \ + $(CAIROLE)\h\export\ole2ver.h $(CAIROLE)\h\export\oleguid.h \ + $(CAIROLE)\h\export\scode.h $(CAIROLE)\h\export\storage.h \ + $(COMMON)\ih\winnot.h $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h \ + $(CRTINC)\assert.h $(CRTINC)\ctype.h $(CRTINC)\dos.h \ + $(CRTINC)\excpt.h $(CRTINC)\stdarg.h $(CRTINC)\string.h \ + $(OSINC)\cderr.h $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h \ + $(OSINC)\dlgs.h $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h \ + $(OSINC)\nb30.h $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h \ + $(OSINC)\rpcdcep.h $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h \ + $(OSINC)\shellapi.h $(OSINC)\winbase.h $(OSINC)\wincon.h \ + $(OSINC)\windef.h $(OSINC)\windows.h $(OSINC)\winerror.h \ + $(OSINC)\wingdi.h $(OSINC)\winnetwk.h $(OSINC)\winnls.h \ + $(OSINC)\winnt.h $(OSINC)\winperf.h $(OSINC)\winreg.h \ + $(OSINC)\winsock.h $(OSINC)\winspool.h $(OSINC)\winsvc.h \ + $(OSINC)\winuser.h $(OSINC)\winver.h ..\ole2ui\ole2ui.h \ + ..\ole2ui\olestd.h .\app.h .\doc.h .\ido.h .\iec.h .\ioipao.h \ + .\ioipo.h .\ioo.h .\ips.h .\obj.h .\pre.h .\resource.h .\simpsvr.h + +$(OBJDIR)\iec.obj $(OBJDIR)\iec.lst: .\iec.cpp $(CAIROLE)\h\export\coguid.h \ + $(CAIROLE)\h\export\compobj.h $(CAIROLE)\h\export\dvobj.h \ + $(CAIROLE)\h\export\initguid.h $(CAIROLE)\h\export\moniker.h \ + $(CAIROLE)\h\export\ole2.h $(CAIROLE)\h\export\ole2ver.h \ + $(CAIROLE)\h\export\oleguid.h $(CAIROLE)\h\export\scode.h \ + $(CAIROLE)\h\export\storage.h $(COMMON)\ih\winnot.h \ + $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h $(CRTINC)\assert.h \ + $(CRTINC)\ctype.h $(CRTINC)\dos.h $(CRTINC)\excpt.h \ + $(CRTINC)\stdarg.h $(CRTINC)\string.h $(OSINC)\cderr.h \ + $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h $(OSINC)\dlgs.h \ + $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h $(OSINC)\nb30.h \ + $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h $(OSINC)\rpcdcep.h \ + $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h $(OSINC)\shellapi.h \ + $(OSINC)\winbase.h $(OSINC)\wincon.h $(OSINC)\windef.h \ + $(OSINC)\windows.h $(OSINC)\winerror.h $(OSINC)\wingdi.h \ + $(OSINC)\winnetwk.h $(OSINC)\winnls.h $(OSINC)\winnt.h \ + $(OSINC)\winperf.h $(OSINC)\winreg.h $(OSINC)\winsock.h \ + $(OSINC)\winspool.h $(OSINC)\winsvc.h $(OSINC)\winuser.h \ + $(OSINC)\winver.h ..\ole2ui\ole2ui.h ..\ole2ui\olestd.h .\app.h \ + .\doc.h .\ido.h .\iec.h .\ioipao.h .\ioipo.h .\ioo.h .\ips.h \ + .\obj.h .\pre.h .\resource.h .\simpsvr.h + +$(OBJDIR)\ido.obj $(OBJDIR)\ido.lst: .\ido.cpp $(CAIROLE)\h\export\coguid.h \ + $(CAIROLE)\h\export\compobj.h $(CAIROLE)\h\export\dvobj.h \ + $(CAIROLE)\h\export\initguid.h $(CAIROLE)\h\export\moniker.h \ + $(CAIROLE)\h\export\ole2.h $(CAIROLE)\h\export\ole2ver.h \ + $(CAIROLE)\h\export\oleguid.h $(CAIROLE)\h\export\scode.h \ + $(CAIROLE)\h\export\storage.h $(COMMON)\ih\winnot.h \ + $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h $(CRTINC)\assert.h \ + $(CRTINC)\ctype.h $(CRTINC)\dos.h $(CRTINC)\excpt.h \ + $(CRTINC)\stdarg.h $(CRTINC)\string.h $(OSINC)\cderr.h \ + $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h $(OSINC)\dlgs.h \ + $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h $(OSINC)\nb30.h \ + $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h $(OSINC)\rpcdcep.h \ + $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h $(OSINC)\shellapi.h \ + $(OSINC)\winbase.h $(OSINC)\wincon.h $(OSINC)\windef.h \ + $(OSINC)\windows.h $(OSINC)\winerror.h $(OSINC)\wingdi.h \ + $(OSINC)\winnetwk.h $(OSINC)\winnls.h $(OSINC)\winnt.h \ + $(OSINC)\winperf.h $(OSINC)\winreg.h $(OSINC)\winsock.h \ + $(OSINC)\winspool.h $(OSINC)\winsvc.h $(OSINC)\winuser.h \ + $(OSINC)\winver.h ..\ole2ui\ole2ui.h ..\ole2ui\olestd.h .\app.h \ + .\doc.h .\ido.h .\iec.h .\ioipao.h .\ioipo.h .\ioo.h .\ips.h \ + .\obj.h .\pre.h .\resource.h .\simpsvr.h + +$(OBJDIR)\icf.obj $(OBJDIR)\icf.lst: .\icf.cpp $(CAIROLE)\h\export\coguid.h \ + $(CAIROLE)\h\export\compobj.h $(CAIROLE)\h\export\dvobj.h \ + $(CAIROLE)\h\export\initguid.h $(CAIROLE)\h\export\moniker.h \ + $(CAIROLE)\h\export\ole2.h $(CAIROLE)\h\export\ole2ver.h \ + $(CAIROLE)\h\export\oleguid.h $(CAIROLE)\h\export\scode.h \ + $(CAIROLE)\h\export\storage.h $(COMMON)\ih\winnot.h \ + $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h $(CRTINC)\assert.h \ + $(CRTINC)\ctype.h $(CRTINC)\dos.h $(CRTINC)\excpt.h \ + $(CRTINC)\stdarg.h $(CRTINC)\string.h $(OSINC)\cderr.h \ + $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h $(OSINC)\dlgs.h \ + $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h $(OSINC)\nb30.h \ + $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h $(OSINC)\rpcdcep.h \ + $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h $(OSINC)\shellapi.h \ + $(OSINC)\winbase.h $(OSINC)\wincon.h $(OSINC)\windef.h \ + $(OSINC)\windows.h $(OSINC)\winerror.h $(OSINC)\wingdi.h \ + $(OSINC)\winnetwk.h $(OSINC)\winnls.h $(OSINC)\winnt.h \ + $(OSINC)\winperf.h $(OSINC)\winreg.h $(OSINC)\winsock.h \ + $(OSINC)\winspool.h $(OSINC)\winsvc.h $(OSINC)\winuser.h \ + $(OSINC)\winver.h ..\ole2ui\ole2ui.h ..\ole2ui\olestd.h .\app.h \ + .\doc.h .\icf.h .\pre.h .\resource.h .\simpsvr.h + +$(OBJDIR)\doc.obj $(OBJDIR)\doc.lst: .\doc.cpp $(CAIROLE)\h\export\coguid.h \ + $(CAIROLE)\h\export\compobj.h $(CAIROLE)\h\export\dvobj.h \ + $(CAIROLE)\h\export\initguid.h $(CAIROLE)\h\export\moniker.h \ + $(CAIROLE)\h\export\ole2.h $(CAIROLE)\h\export\ole2ver.h \ + $(CAIROLE)\h\export\oleguid.h $(CAIROLE)\h\export\scode.h \ + $(CAIROLE)\h\export\storage.h $(COMMON)\ih\winnot.h \ + $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h $(CRTINC)\assert.h \ + $(CRTINC)\ctype.h $(CRTINC)\dos.h $(CRTINC)\excpt.h \ + $(CRTINC)\stdarg.h $(CRTINC)\string.h $(OSINC)\cderr.h \ + $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h $(OSINC)\dlgs.h \ + $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h $(OSINC)\nb30.h \ + $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h $(OSINC)\rpcdcep.h \ + $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h $(OSINC)\shellapi.h \ + $(OSINC)\winbase.h $(OSINC)\wincon.h $(OSINC)\windef.h \ + $(OSINC)\windows.h $(OSINC)\winerror.h $(OSINC)\wingdi.h \ + $(OSINC)\winnetwk.h $(OSINC)\winnls.h $(OSINC)\winnt.h \ + $(OSINC)\winperf.h $(OSINC)\winreg.h $(OSINC)\winsock.h \ + $(OSINC)\winspool.h $(OSINC)\winsvc.h $(OSINC)\winuser.h \ + $(OSINC)\winver.h ..\ole2ui\ole2ui.h ..\ole2ui\olestd.h .\app.h \ + .\doc.h .\ido.h .\iec.h .\ioipao.h .\ioipo.h .\ioo.h .\ips.h \ + .\obj.h .\pre.h .\resource.h .\simpsvr.h + +$(OBJDIR)\app.obj $(OBJDIR)\app.lst: .\app.cpp $(CAIROLE)\h\export\coguid.h \ + $(CAIROLE)\h\export\compobj.h $(CAIROLE)\h\export\dvobj.h \ + $(CAIROLE)\h\export\initguid.h $(CAIROLE)\h\export\moniker.h \ + $(CAIROLE)\h\export\ole2.h $(CAIROLE)\h\export\ole2ver.h \ + $(CAIROLE)\h\export\oleguid.h $(CAIROLE)\h\export\scode.h \ + $(CAIROLE)\h\export\storage.h $(COMMON)\ih\winnot.h \ + $(COMMONINC)\disptype.h $(COMMONINC)\stgprop.h $(CRTINC)\assert.h \ + $(CRTINC)\ctype.h $(CRTINC)\dos.h $(CRTINC)\excpt.h \ + $(CRTINC)\stdarg.h $(CRTINC)\string.h $(OSINC)\cderr.h \ + $(OSINC)\commdlg.h $(OSINC)\dde.h $(OSINC)\ddeml.h $(OSINC)\dlgs.h \ + $(OSINC)\lzexpand.h $(OSINC)\mmsystem.h $(OSINC)\nb30.h \ + $(OSINC)\ole.h $(OSINC)\rpc.h $(OSINC)\rpcdce.h $(OSINC)\rpcdcep.h \ + $(OSINC)\rpcnsi.h $(OSINC)\rpcnterr.h $(OSINC)\shellapi.h \ + $(OSINC)\winbase.h $(OSINC)\wincon.h $(OSINC)\windef.h \ + $(OSINC)\windows.h $(OSINC)\winerror.h $(OSINC)\wingdi.h \ + $(OSINC)\winnetwk.h $(OSINC)\winnls.h $(OSINC)\winnt.h \ + $(OSINC)\winperf.h $(OSINC)\winreg.h $(OSINC)\winsock.h \ + $(OSINC)\winspool.h $(OSINC)\winsvc.h $(OSINC)\winuser.h \ + $(OSINC)\winver.h ..\ole2ui\ole2ui.h ..\ole2ui\olestd.h .\app.h \ + .\doc.h .\icf.h .\ido.h .\iec.h .\ioipao.h .\ioipo.h .\ioo.h \ + .\ips.h .\obj.h .\pre.h .\resource.h .\simpsvr.h + diff --git a/private/oleutest/simpsvr/dirs b/private/oleutest/simpsvr/dirs new file mode 100644 index 000000000..e0e16d167 --- /dev/null +++ b/private/oleutest/simpsvr/dirs @@ -0,0 +1,3 @@ +DIRS= +OPTIONAL_DIRS= \ + daytona diff --git a/private/oleutest/simpsvr/doc.cpp b/private/oleutest/simpsvr/doc.cpp new file mode 100644 index 000000000..ccc4c053d --- /dev/null +++ b/private/oleutest/simpsvr/doc.cpp @@ -0,0 +1,688 @@ +//********************************************************************** +// File name: DOC.CPP +// +// Implementation file for CSimpSvrDoc. +// +// Functions: +// +// See DOC.H for Class Definition +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** + +#include "pre.h" +#include "obj.h" +#include "app.h" +#include "doc.h" + +//********************************************************************** +// +// CSimpSvrDoc::Create +// +// Purpose: +// +// Creation for the CSimpSvrDoc Class +// +// Parameters: +// +// CSimpSvrApp FAR * lpApp - Pointer to the CSimpSvrApp Class +// +// LPRECT lpRect - Client area rect of "frame" window +// +// HWND hWnd - Window Handle of "frame" window +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// StgCreateDocfile OLE API +// CreateWindow Windows API +// ShowWindow Windows API +// UpdateWindow Windows API +// CSimpSvrDoc::CSimpSvrDoc DOC.CPP +// CreateHatchWindow OLE2UI +// +// Comments: +// +// This routine was added so that failure could be returned +// from object creation. +// +//******************************************************************** + +CSimpSvrDoc FAR * CSimpSvrDoc::Create(CSimpSvrApp FAR *lpApp, LPRECT lpRect,HWND hWnd) +{ + CSimpSvrDoc FAR * lpTemp = new CSimpSvrDoc(lpApp, hWnd); + + if (!lpTemp) + return NULL; + + // create the document Window + lpTemp->m_hDocWnd = CreateWindow( + TEXT("DocWClass"), + NULL, + WS_CHILD | WS_CLIPSIBLINGS, + lpRect->left, + lpRect->top, + lpRect->right, + lpRect->bottom, + hWnd, + NULL, + lpApp->GethInst(), + NULL); + + if (!lpTemp->m_hDocWnd) + goto error; + + lpTemp->ShowDocWnd(); + + lpTemp->m_hHatchWnd = CreateHatchWindow( lpTemp->m_hDocWnd, lpApp->GethInst()); + + lpTemp->HideHatchWnd(); + + return (lpTemp); + +error: + delete (lpTemp); + return NULL; + +} + +//********************************************************************** +// +// CSimpSvrDoc::CSimpSvrDoc +// +// Purpose: +// +// Constructor for the CSimpSvrDoc Class +// +// Parameters: +// +// CSimpSvrApp FAR * lpApp - Pointer to the CSimpSvrApp Class +// +// HWND hWnd - Window Handle of "frame" window +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// GetMenu Windows API +// GetSubMenu Windows API +// +// Comments: +// +//******************************************************************** + +CSimpSvrDoc::CSimpSvrDoc(CSimpSvrApp FAR * lpApp,HWND hWnd) +{ + TestDebugOut(TEXT("In CSimpSvrDoc's Constructor\r\n")); + m_lpApp = lpApp; + m_nCount = 0; + m_lpObj = NULL; + + // set up menu handles + m_hMainMenu = GetMenu(hWnd); + m_hColorMenu = GetSubMenu(m_hMainMenu, 1); + m_hHelpMenu = GetSubMenu(m_hMainMenu, 2); + + +} + +//********************************************************************** +// +// CSimpSvrDoc::~CSimpSvrDoc +// +// Purpose: +// +// Destructor for CSimpSvrDoc +// +// Parameters: +// +// None +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// DestroyWindow Windows API +// CSimpSvrApp::ClearDoc APP.CPP +// +// Comments: +// +//******************************************************************** + +CSimpSvrDoc::~CSimpSvrDoc() +{ + TestDebugOut(TEXT("In CSimpSvrDoc's Destructor\r\n")); + + // Clear the Doc object pointer so that the SimpSvrApp won't be able + // to access invalid objects. (same for the SimpSvrObj) + if (m_lpApp) + m_lpApp->ClearDoc(); + + if (m_lpObj) + m_lpObj->ClearDoc(); + + DestroyWindow(m_hHatchWnd); + DestroyWindow(m_hDocWnd); +} + + +//********************************************************************** +// +// CSimpSvrDoc::QueryInterface +// +// Purpose: +// +// Return a pointer to a requested interface +// +// Parameters: +// +// REFIID riid - ID of interface to be returned +// LPVOID FAR* ppvObj - Location to return the interface +// +// Return Value: +// +// E_NOINTERFACE - Always +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CSimpSvrApp::QueryInterface APP.CPP +// +// Comments: +// +// Since the document could contain multiple objects, all +// interfaces except those associated with the document should +// be returned. In this implementation, there are no doc level +// interfaces. +// +//******************************************************************** + +STDMETHODIMP CSimpSvrDoc::QueryInterface(REFIID riid, LPVOID FAR* ppvObj) +{ + TestDebugOut(TEXT("In CSimpSvrDoc::QueryInterface\r\n")); + + SCODE sc = E_NOINTERFACE; + + if (IsEqualIID(riid, IID_IUnknown)) + { + AddRef(); + *ppvObj = this; + sc = S_OK; + } + + return ResultFromScode(sc); +} + +//********************************************************************** +// +// CSimpSvrDoc::AddRef +// +// Purpose: +// +// Increments the document level reference count +// +// Parameters: +// +// None +// +// Return Value: +// +// UINT - The current reference count on the document +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CSimpSvrApp::AddRef APP.CPP +// +// Comments: +// +// The reference count at this level reflects the total ref. +// count of all interfaces on all objects contained within +// this document. Note that it also "trickles up" the +// ref count to the app level. +// +//******************************************************************** + +STDMETHODIMP_(ULONG) CSimpSvrDoc::AddRef() +{ + TestDebugOut(TEXT("In CSimpSvrDoc::AddRef\r\n")); + // AddRef the app, but return the doc count + m_lpApp->AddRef(); + + return ++m_nCount; +} + +//********************************************************************** +// +// CSimpSvrDoc::Release +// +// Purpose: +// +// Decrements the document level reference count +// +// Parameters: +// +// None +// +// Return Value: +// +// UINT - The current reference count on the document +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CSimpSvrApp::Release APP.CPP +// +// Comments: +// +// The reference count at this level reflects the total ref. +// count of all interfaces on all objects contained within +// this document. Note that it also "trickles up" the +// ref count to the app level. +// +//******************************************************************** + +STDMETHODIMP_(ULONG) CSimpSvrDoc::Release() +{ + TestDebugOut(TEXT("In CSimpSvrDoc::Release\r\n")); + // Release the app, but return the app count + m_lpApp->Release(); + + if (--m_nCount== 0) + { + delete this; + return(0); + } + return m_nCount; +} + +//********************************************************************** +// +// CSimpSvrDoc::lResizeDoc +// +// Purpose: +// +// Resizes the document +// +// Parameters: +// +// LPRECT lpRect - The size of the client are of the "frame" +// Window. +// +// Return Value: +// +// NULL +// +// Function Calls: +// Function Location +// +// MoveWindow Windows API +// +// +//******************************************************************** + +long CSimpSvrDoc::lResizeDoc(LPRECT lpRect) +{ + MoveWindow(m_hDocWnd, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom, TRUE); + return NULL; +} + + +//********************************************************************** +// +// CSimpSvrDoc::PaintDoc +// +// Purpose: +// +// Paints the Document +// +// Parameters: +// +// HDC hDC - hDC of the document Window +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// CSimpSvrObj::Draw OBJ.CPP +// CSimpSvrObj::GetDataAdviseHolder OBJ.H +// CSimpSvrObj::GetDataObject OBJ.H +// CSimpAppObj::IsStartedByOle APP.CPP +// IDataAdviseHolder::SendOnDataChange OLE API +// +// +//******************************************************************** + +void CSimpSvrDoc::PaintDoc (HDC hDC) +{ + + // if the object hasn't been created yet, then don't draw + if (m_lpObj) + m_lpObj->Draw(hDC,FALSE); + else + return; + + // Sending a data change every time we paint, but only if we + // were started by OLE + if (m_lpApp->IsStartedByOle()) + m_lpObj->SendOnDataChange( ); +} + + + +//********************************************************************** +// +// CSimpSvrDoc::CreateObject +// +// Purpose: +// Handles the creation of a SimpSvrObj. +// +// Parameters: +// +// +// Return Value: +// +// S_OK if the function succeeds, otherwise E_FAIL +// +// Function Calls: +// Function Location +// +// CSimpSvrObj::CSimpSvrObj OBJ.CPP +// CSimpSvrOjb::QueryInterface OBJ.CPP +// +// +//******************************************************************** + +HRESULT CSimpSvrDoc::CreateObject(REFIID riid, LPVOID FAR *ppvObject) +{ + SCODE sc = E_FAIL; + + m_lpObj = new CSimpSvrObj(this); + + if (m_lpObj) + { + m_lpObj->QueryInterface(riid, ppvObject); + sc = S_OK; + } + + return ResultFromScode(sc); +} + +//********************************************************************** +// +// CSimpSvrDoc::Close +// +// Purpose: +// +// Closes the object +// +// Parameters: +// +// None +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CSimpSvrObj::AddRef OBJ.CPP +// CSimpSvrObj::Release OBJ.CPP +// CSimpSvrObj::IsInPlaceActive OBJ.H +// CSimpSvrObj::GetOleInPlaceObject OBJ.H +// CSimpSvrObj::ClearOleClientSite OBJ.H +// CSimpSvrObj::GetDataAdviseHolder OBJ.H +// CSimpSvrObj::GetOleClientSite OBJ.H +// CSimpSvrObj::ClearDataAdviseHolder OBJ.H +// CSimpSvrObj::GetOleAdviseHolder OBJ.H +// CSimpSvrObj::ClearOleAdviseHolder OBJ.H +// IOleInPlaceObject::InPlaceDeactivate Container +// IOleClientSite::SaveObject Container +// IOleClientSite::OnShowWindow Container +// IOleClientSite::Release Container +// IDataAdviseHolder::SendOnDataChange OLE +// IDataAdviseHolder::Release OLE +// IOleAdviseHolder::SendOnClose OLE +// IOleAdviseHolder::Release OLE +// +// +//******************************************************************** + +void CSimpSvrDoc::Close() +{ + TestDebugOut(TEXT("In CSimpSvrDoc::Close() \r\n")); + + m_lpObj->AddRef(); // hold object alive + + // if the object is currently inplace active, then deactivate + if (m_lpObj->IsInPlaceActive()) + m_lpObj->GetOleInPlaceObject()->InPlaceDeactivate(); + + // unregister from the ROT... + if (m_lpObj->GetRotRegister()) + { + LPRUNNINGOBJECTTABLE lpRot; + + if (GetRunningObjectTable (0, &lpRot) == NOERROR ) + { + lpRot->Revoke(m_lpObj->GetRotRegister()); + lpRot->Release(); + } + } + + // if we have a clientsite, instruct it to save the object + if (m_lpObj->GetOleClientSite()) + { + m_lpObj->GetOleClientSite()->SaveObject(); + m_lpObj->GetOleClientSite()->OnShowWindow(FALSE); + } + + // Do a final SendOnDataChange for those containers that have specified the + // ADF_DATAONSTOP flag. + if (m_lpObj->GetDataAdviseHolder()) + { + m_lpObj->GetDataAdviseHolder()->SendOnDataChange( m_lpObj->GetDataObject(), 0, ADVF_DATAONSTOP); + } + + + // Tell the container that we are shutting down. + if (m_lpObj->GetOleAdviseHolder()) + { + m_lpObj->GetOleAdviseHolder()->SendOnClose(); + } + + // release our streams and storage + m_lpObj->GetPersistStorage()->ReleaseStreamsAndStorage(); + + // Disconnect the object. NOTE: This call should not do anything + // unless the container has cause a GP Fault or some other problem + // has occured... + TestDebugOut(TEXT("*** Before CoDisconnectObject *** \r\n")); + + CoDisconnectObject((LPUNKNOWN)m_lpObj, 0); + + TestDebugOut(TEXT("*** After CoDisconnectObject *** \r\n")); + + m_lpObj->Release(); // let object close + +} + + +//********************************************************************** +// +// CSimpSvrDoc::SetStatusText +// +// Purpose: +// +// Sets the Container's status bar text +// +// Parameters: +// +// None +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// CSimpSvrObj::IsInPlaceActive OBJ.CPP +// IOleInPlaceFrame::SetStatusText Container +// +// Comments: +// +// Even though there is no status line in this sample, this +// method must be called on WM_MENUSELECT to clear the last +// message in the status line. +// +//******************************************************************** + +void CSimpSvrDoc::SetStatusText() +{ + if (m_lpObj->IsInPlaceActive()) + m_lpObj->GetInPlaceFrame()->SetStatusText(OLESTR("\0")); + +} + +//********************************************************************** +// +// CSimpSvrDoc::ShowDocWnd +// +// Purpose: +// +// Shows the Document Window +// +// Parameters: +// +// None +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// ShowWindow Windows API +// UpdateWindow Windows API +// +// Comments: +// +//******************************************************************** + +void CSimpSvrDoc::ShowDocWnd() +{ + ShowWindow(m_hDocWnd, SW_SHOWNORMAL); // Show the window + UpdateWindow(m_hDocWnd); // Sends WM_PAINT message +} + +//********************************************************************** +// +// CSimpSvrDoc::ShowHatchWnd +// +// Purpose: +// +// Shows the hatch Window +// +// Parameters: +// +// None +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// ShowWindow Windows API +// +// Comments: +// +//******************************************************************** + +void CSimpSvrDoc::ShowHatchWnd() +{ + ShowWindow(m_hHatchWnd, SW_SHOW); +} + +//********************************************************************** +// +// CSimpSvrDoc::HideDocWnd +// +// Purpose: +// +// Hides the DocumentWindow +// +// Parameters: +// +// None +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// ShowWindow Windows API +// +// Comments: +// +//******************************************************************** + +void CSimpSvrDoc::HideDocWnd() +{ + ShowWindow(m_hDocWnd, SW_HIDE); +} + +//********************************************************************** +// +// CSimpSvrDoc::HideHatchWnd +// +// Purpose: +// +// Hides the Hatch Window +// +// Parameters: +// +// None +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// ShowWindow Windows API +// +// Comments: +// +//******************************************************************** + +void CSimpSvrDoc::HideHatchWnd() +{ + ShowWindow(m_hHatchWnd, SW_HIDE); +} diff --git a/private/oleutest/simpsvr/doc.h b/private/oleutest/simpsvr/doc.h new file mode 100644 index 000000000..15c8d40bc --- /dev/null +++ b/private/oleutest/simpsvr/doc.h @@ -0,0 +1,70 @@ +//********************************************************************** +// File name: doc.h +// +// Definition of CSimpSvrDoc +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** + +#if !defined( _DOC_H_ ) +#define _DOC_H_ + +class CSimpSvrApp; +class CSimpSvrObj; + +class CSimpSvrDoc : IUnknown +{ +private: + int m_nCount; + + CSimpSvrApp FAR * m_lpApp; + CSimpSvrObj FAR * m_lpObj; + HMENU m_hMainMenu; + HMENU m_hColorMenu; + HMENU m_hHelpMenu; + + HWND m_hDocWnd; + HWND m_hHatchWnd; + +public: + static CSimpSvrDoc FAR * Create(CSimpSvrApp FAR *lpApp, LPRECT lpRect,HWND hWnd); + + CSimpSvrDoc(); + CSimpSvrDoc(CSimpSvrApp FAR *lpApp, HWND hWnd); + ~CSimpSvrDoc(); + +// IUnknown Interfaces + STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj); + STDMETHODIMP_(ULONG) AddRef(); + STDMETHODIMP_(ULONG) Release(); + + long lResizeDoc(LPRECT lpRect); + long lAddVerbs(); + + BOOL Load(LPTSTR lpszFileName); + void PaintDoc(HDC hDC); + void lButtonDown(WPARAM wParam,LPARAM lParam); + + HRESULT CreateObject(REFIID riid, LPVOID FAR *ppvObject); + + void Close(); + void SetStatusText(); + void ShowDocWnd(); + void ShowHatchWnd(); + void CSimpSvrDoc::HideDocWnd(); + void CSimpSvrDoc::HideHatchWnd(); + +// member access + inline HMENU GetMainMenu() { return m_hMainMenu; }; + inline HMENU GetColorMenu() { return m_hColorMenu; }; + inline HMENU GetHelpMenu() { return m_hHelpMenu; } ; + inline HWND GethDocWnd() { return m_hDocWnd; }; + inline HWND GethHatchWnd() { return m_hHatchWnd; }; + inline HWND GethAppWnd() { return m_lpApp->GethAppWnd(); }; + inline CSimpSvrApp FAR * GetApp() { return m_lpApp; }; + inline CSimpSvrObj FAR * GetObj() { return m_lpObj; }; + inline void ClearObj() { m_lpObj = NULL; }; + +}; + +#endif diff --git a/private/oleutest/simpsvr/filelist.mk b/private/oleutest/simpsvr/filelist.mk new file mode 100644 index 000000000..2c1337a49 --- /dev/null +++ b/private/oleutest/simpsvr/filelist.mk @@ -0,0 +1,71 @@ +############################################################################ +# +# Microsoft Windows +# Copyright (C) Microsoft Corporation, 1992 - 1992. +# All rights reserved. +# +############################################################################ + + +# +# Name of target. Include an extension (.dll, .lib, .exe) +# If the target is part of the release, set RELEASE to 1. +# + +TARGET = simpsvr.exe +RELEASE = 0 +TARGET_DESCRIPTION = "$(PLATFORM) $(BUILDTYPE) Simple Server" + + +# +# Source files. Remember to prefix each name with .\ +# + +CFILES = +CPPFILES = .\simpsvr.cpp \ + .\app.cpp \ + .\doc.cpp \ + .\icf.cpp \ + .\ido.cpp \ + .\iec.cpp \ + .\ioipao.cpp \ + .\ioipo.cpp \ + .\ioo.cpp \ + .\ips.cpp \ + .\obj.cpp \ + .\pre.cpp +RCFILES = .\simpsvr.rc + +# +# Libraries and other object files to link. +# +OBJFILES = +LIBS = $(CAIROLE)\ilib\$(OBJDIR)\ole232.lib \ + $(CAIROLE)\ilib\$(OBJDIR)\storag32.lib \ + $(CAIROLE)\ilib\$(OBJDIR)\compob32.lib \ + ..\ole2ui\$(OBJDIR)\ole2uixd.lib + +DEFFILE = .\simpsvr.def + + +# +# Precompiled headers. +# + +PXXFILE = +PFILE = +CINC = -I..\ole2ui -I..\ole2ui\resource\usa \ + -I..\ole2ui\resource\static +!if "$(EXPORT)"=="0" +CINC = $(CINC) -I$(CAIROLE)\h -I$(CAIROLE)\common +!else +CINC = $(CINC) -I$(CAIROLE)\h\export +!endif + +CFLAGS=/D_DEBUG + +# For Chicago Build +!if "$(OPSYS)"=="DOS" +CFLAGS=$(CFLAGS) /D_INC_OLE +!endif + diff --git a/private/oleutest/simpsvr/icf.cpp b/private/oleutest/simpsvr/icf.cpp new file mode 100644 index 000000000..4f2403411 --- /dev/null +++ b/private/oleutest/simpsvr/icf.cpp @@ -0,0 +1,228 @@ +//********************************************************************** +// File name: ICF.CPP +// +// Implementation file for the CClassFactory Class +// +// Functions: +// +// See icf.h for a list of member functions. +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** + +#include "pre.h" +#include "app.h" +#include "doc.h" +#include "icf.h" + +//********************************************************************** +// +// CClassFactory::QueryInterface +// +// Purpose: +// Used for interface negotiation +// +// Parameters: +// +// REFIID riid - Interface being queried for. +// +// LPVOID FAR *ppvObj - Out pointer for the interface. +// +// Return Value: +// +// S_OK - Success +// E_NOINTERFACE - Failure +// +// Function Calls: +// Function Location +// +// CClassFactory::AddRef ICF.CPP +// +//******************************************************************** + +STDMETHODIMP CClassFactory::QueryInterface ( REFIID riid, LPVOID FAR* ppvObj) +{ + TestDebugOut(TEXT("In CClassFactory::QueryInterface\r\n")); + + SCODE sc = S_OK; + + if (IsEqualIID(riid, IID_IUnknown) || + IsEqualIID(riid, IID_IClassFactory) ) + *ppvObj = this; + else + { + *ppvObj = NULL; + sc = E_NOINTERFACE; + } + + if (*ppvObj) + ((LPUNKNOWN)*ppvObj)->AddRef(); + + // pass it on to the Application object + return ResultFromScode(sc); +} + +//********************************************************************** +// +// CClassFactory::AddRef +// +// Purpose: +// +// Increments the reference count on CClassFactory and the application +// object. +// +// Parameters: +// +// None +// +// Return Value: +// +// The Reference count on CClassFactory +// +// Function Calls: +// Function Location +// +// OuputDebugString Windows API +// +//******************************************************************** + + +STDMETHODIMP_(ULONG) CClassFactory::AddRef () +{ + TestDebugOut(TEXT("In CClassFactory::AddRef\r\n")); + + return ++m_nCount; +} + +//********************************************************************** +// +// CClassFactory::Release +// +// Purpose: +// +// Decrements the reference count of CClassFactory and the +// application object. +// +// Parameters: +// +// None +// +// Return Value: +// +// The new reference count +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +//******************************************************************** + + +STDMETHODIMP_(ULONG) CClassFactory::Release () +{ + TestDebugOut(TEXT("In CClassFactory::Release\r\n")); + + if (--m_nCount== 0) + { + delete this; + return(0); + } + return m_nCount; +} + + +//********************************************************************** +// +// CClassFactory::CreateInstance +// +// Purpose: +// +// Instantiates a new OLE object +// +// Parameters: +// +// LPUNKNOWN pUnkOuter - Pointer to the controlling unknown +// +// REFIID riid - The interface type to fill in ppvObject +// +// LPVOID FAR* ppvObject - Out pointer for the object +// +// Return Value: +// +// S_OK - Creation was successful +// CLASS_E_NOAGGREGATION - Tried to be created as part of an aggregate +// +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CSimpSvrDoc::CreateObject DOC.CPP +// +//******************************************************************** + +STDMETHODIMP CClassFactory::CreateInstance ( LPUNKNOWN pUnkOuter, + REFIID riid, + LPVOID FAR* ppvObject) +{ + HRESULT hErr; + + TestDebugOut(TEXT("In CClassFactory::CreateInstance\r\n")); + + // need to NULL the out parameter + *ppvObject = NULL; + + // we don't support aggregation... + if (pUnkOuter) + { + hErr = ResultFromScode(CLASS_E_NOAGGREGATION); + goto error; + } + + hErr = m_lpApp->m_lpDoc->CreateObject(riid, ppvObject); + +error: + return hErr; +} + +//********************************************************************** +// +// CClassFactory::LockServer +// +// Purpose: +// To lock the server and keep an open object application in memory +// +// Parameters: +// +// BOOL fLock - TRUE to lock the server, FALSE to unlock it +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CoLockObjectExternal OLE API +// ResultFromScode OLE API +// +// +//******************************************************************** + +STDMETHODIMP CClassFactory::LockServer ( BOOL fLock) +{ + HRESULT hRes; + + TestDebugOut(TEXT("In CClassFactory::LockServer\r\n")); + + if ((hRes=CoLockObjectExternal(m_lpApp, fLock, TRUE)) != S_OK) + { + TestDebugOut(TEXT("CClassFactory::LockServer \ + CoLockObjectExternal fails\n")); + return(hRes); + } + + return ResultFromScode( S_OK); +} diff --git a/private/oleutest/simpsvr/icf.h b/private/oleutest/simpsvr/icf.h new file mode 100644 index 000000000..302428d8e --- /dev/null +++ b/private/oleutest/simpsvr/icf.h @@ -0,0 +1,46 @@ +//********************************************************************** +// File name: icf.h +// +// Definition of CClassFactory +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** + +#if !defined( _ICF_H_) +#define _ICF_H_ + +class CSimpSvrApp; + +interface CClassFactory : IClassFactory +{ +private: + int m_nCount; // reference count + CSimpSvrApp FAR * m_lpApp; + +public: + CClassFactory::CClassFactory(CSimpSvrApp FAR * lpApp) + { + TestDebugOut(TEXT("In CClassFactory's Constructor\r\n")); + m_lpApp = lpApp; + m_nCount = 0; + }; + CClassFactory::~CClassFactory() + { + TestDebugOut(TEXT("In CClassFactory's Destructor\r\n")); + }; + + // IUnknown Methods + + STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppvObj); + STDMETHODIMP_(ULONG) AddRef (); + STDMETHODIMP_(ULONG) Release (); + + STDMETHODIMP CreateInstance (LPUNKNOWN pUnkOuter, + REFIID riid, + LPVOID FAR* ppvObject); + STDMETHODIMP LockServer ( BOOL fLock); + +}; + +#endif + diff --git a/private/oleutest/simpsvr/ido.cpp b/private/oleutest/simpsvr/ido.cpp new file mode 100644 index 000000000..bed297507 --- /dev/null +++ b/private/oleutest/simpsvr/ido.cpp @@ -0,0 +1,529 @@ +//********************************************************************** +// File name: IDO.CPP +// +// Implementation file for the CDataObject Class +// +// Functions: +// +// See ido.h for a list of member functions. +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** + +#include "pre.h" +#include "obj.h" +#include "ido.h" +#include "app.h" +#include "doc.h" + +//********************************************************************** +// +// CDataObject::QueryInterface +// +// Purpose: +// Used for interface negotiation +// +// Parameters: +// +// REFIID riid - Interface being queried for. +// +// LPVOID FAR *ppvObj - Out pointer for the interface. +// +// Return Value: +// +// S_OK - Success +// E_NOINTERFACE - Failure +// +// Function Calls: +// Function Location +// +// CSimpSvrObj::QueryInterface OBJ.CPP +// +//******************************************************************** + + +STDMETHODIMP CDataObject::QueryInterface ( REFIID riid, LPVOID FAR* ppvObj) +{ + TestDebugOut(TEXT("In CDataObject::QueryInterface\r\n")); + + return m_lpObj->QueryInterface(riid, ppvObj); +} + +//********************************************************************** +// +// CDataObject::AddRef +// +// Purpose: +// +// Increments the reference count on CSimpSvrObj. CDataObject is +// a nested class of CSimpSvrObj, so we don't need a separate +// reference count for CDataObject. We can just use the reference +// count of CSimpSvrObj. +// +// Parameters: +// +// None +// +// Return Value: +// +// The new Reference count on CSimpSvrObject +// +// Function Calls: +// Function Location +// +// OuputDebugString Windows API +// CSimpSvrObj::AddRef OBJ.CPP +// +//******************************************************************** + +STDMETHODIMP_(ULONG) CDataObject::AddRef () +{ + TestDebugOut(TEXT("In CDataObject::AddRef\r\n")); + + return( m_lpObj->AddRef() ); +} + +//********************************************************************** +// +// CDataObject::Release +// +// Purpose: +// +// Decrements the reference count on CSimpSvrObj. CDataObject is +// a nested class of CSimpSvrObj, so we don't need a separate +// reference count for CDataObject. We can just use the reference +// count of CSimpSvrObj. +// +// Parameters: +// +// None +// +// Return Value: +// +// The new reference count of the CSimpSvrObj. +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CSimpSvrObj::Release OBJ.CPP +// +//******************************************************************** + +STDMETHODIMP_(ULONG) CDataObject::Release () +{ + TestDebugOut(TEXT("In CDataObject::Release\r\n")); + + return( m_lpObj->Release() ); +} + +//********************************************************************** +// +// CDataObject::QueryGetData +// +// Purpose: +// +// Called to determine if our object supports a particular +// FORMATETC. +// +// Parameters: +// +// LPFORMATETC pformatetc - Pointer to the FORMATETC being queried for. +// +// Return Value: +// +// DATA_E_FORMATETC - The FORMATETC is not supported +// S_OK - The FORMATETC is supported. +// +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// ResultFromScode OLE API +// +//******************************************************************** + + +STDMETHODIMP CDataObject::QueryGetData ( LPFORMATETC pformatetc ) +{ + SCODE sc = DATA_E_FORMATETC; + + TestDebugOut(TEXT("In CDataObject::QueryGetData\r\n")); + + // check the validity of the formatetc. + if ( (pformatetc->cfFormat == CF_METAFILEPICT) && + (pformatetc->dwAspect == DVASPECT_CONTENT) && + (pformatetc->tymed == TYMED_MFPICT) ) + sc = S_OK; + + return ResultFromScode(sc); +} + +//********************************************************************** +// +// CDataObject::DAdvise +// +// Purpose: +// +// Called by the container when it would like to be notified of +// changes in the object data. +// +// Parameters: +// +// FORMATETC FAR* pFormatetc - The format the container is interested in. +// +// DWORD advf - The type of advise to be set up. +// +// LPADVISESINK pAdvSink - Pointer to the containers IAdviseSink +// +// DWORD FAR* pdwConnection - Out parameter to return a unique connection id. +// +// Return Value: +// +// passed on from IDataAdviseHolder +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CreateDataAdviseHolder OLE API +// IDataAdviseHolder::Advise OLE API +// +// +//******************************************************************** + + +STDMETHODIMP CDataObject::DAdvise ( FORMATETC FAR* pFormatetc, DWORD advf, + LPADVISESINK pAdvSink, DWORD FAR* pdwConnection) +{ + HRESULT hRes; + + TestDebugOut(TEXT("In CDataObject::DAdvise\r\n")); + + // if no DataAdviseHolder has been created, then create one. + if (!m_lpObj->m_lpDataAdviseHolder) + { + hRes=CreateDataAdviseHolder(&m_lpObj->m_lpDataAdviseHolder); + if (hRes != S_OK) + { + TestDebugOut(TEXT("CDataObject::DAdvise \ + cannot CreateDataAdviseHolder\n")); + return(hRes); + } + } + + // pass on to the DataAdviseHolder + return m_lpObj->m_lpDataAdviseHolder->Advise( this, pFormatetc, advf, + pAdvSink, pdwConnection); +} + +//********************************************************************** +// +// CDataObject::GetData +// +// Purpose: +// +// Returns the data in the format specified in pformatetcIn. +// +// Parameters: +// +// LPFORMATETC pformatetcIn - The format requested by the caller +// +// LPSTGMEDIUM pmedium - The medium requested by the caller +// +// Return Value: +// +// DATA_E_FORMATETC - Format not supported +// S_OK - Success +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CSimpSvrObj::GetMetaFilePict() OBJ.CPP +// ResultFromScode OLE API +// +//******************************************************************** + +STDMETHODIMP CDataObject::GetData ( LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium ) +{ + SCODE sc = DATA_E_FORMATETC; + + TestDebugOut(TEXT("In CDataObject::GetData\r\n")); + + // Check to the FORMATETC and fill pmedium if valid. + if ( (pformatetcIn->cfFormat == CF_METAFILEPICT) && + (pformatetcIn->dwAspect == DVASPECT_CONTENT) && + (pformatetcIn->tymed & TYMED_MFPICT) ) + { + HANDLE hmfPict = m_lpObj->GetMetaFilePict(); + pmedium->tymed = TYMED_MFPICT; + pmedium->hGlobal = hmfPict; + pmedium->pUnkForRelease = NULL; + sc = S_OK; + } + + return ResultFromScode( sc ); +} + +//********************************************************************** +// +// CDataObject::DUnadvise +// +// Purpose: +// +// Breaks down an Advise connection. +// +// Parameters: +// +// DWORD dwConnection - Advise connection ID. +// +// Return Value: +// +// Returned from the DataAdviseHolder. +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// IDataAdviseHolder::Unadvise OLE +// +//******************************************************************** + +STDMETHODIMP CDataObject::DUnadvise ( DWORD dwConnection) +{ + TestDebugOut(TEXT("In CDataObject::DUnadvise\r\n")); + + return m_lpObj->m_lpDataAdviseHolder->Unadvise(dwConnection); +} + +//********************************************************************** +// +// CDataObject::GetDataHere +// +// Purpose: +// +// Called to get a data format in a caller supplied location +// +// Parameters: +// +// LPFORMATETC pformatetc - FORMATETC requested +// +// LPSTGMEDIUM pmedium - Medium to return the data +// +// Return Value: +// +// DATA_E_FORMATETC - We don't support the requested format +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// Comments: +// +// In this simple implementation, we don't really support this +// method, we just always return DATA_E_FORMATETC. +// +//******************************************************************** + + +STDMETHODIMP CDataObject::GetDataHere ( LPFORMATETC pformatetc, + LPSTGMEDIUM pmedium ) +{ + TestDebugOut(TEXT("In CDataObject::GetDataHere\r\n")); + return ResultFromScode( DATA_E_FORMATETC); +} + +//********************************************************************** +// +// CDataObject::GetCanonicalFormatEtc +// +// Purpose: +// +// Returns a FORMATETC that is equivalent to the one passed in. +// +// Parameters: +// +// LPFORMATETC pformatetc - FORMATETC to be tested. +// +// LPFORMATETC pformatetcOut - Out ptr for returned FORMATETC. +// +// Return Value: +// +// DATA_S_SAMEFORMATETC - Use the same formatetc as was passed. +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CoGetMalloc OLE API +// IMalloc::Alloc OLE +// IMalloc::Release OLE +// _fmemcpy C run-time +// +//******************************************************************** + + +STDMETHODIMP CDataObject::GetCanonicalFormatEtc ( LPFORMATETC pformatetc, + LPFORMATETC pformatetcOut) +{ + HRESULT hresult; + TestDebugOut(TEXT("In CDataObject::GetCanonicalFormatEtc\r\n")); + + if (!pformatetcOut) + return ResultFromScode(E_INVALIDARG); + + /* OLE2NOTE: we must make sure to set all out parameters to NULL. */ + pformatetcOut->ptd = NULL; + + if (!pformatetc) + return ResultFromScode(E_INVALIDARG); + + // OLE2NOTE: we must validate that the format requested is supported + if ((hresult = QueryGetData(pformatetc)) != NOERROR) + return hresult; + + /* OLE2NOTE: an app that is insensitive to target device (as + ** SimpSvr is) should fill in the lpformatOut parameter + ** but NULL out the "ptd" field; it should return NOERROR if the + ** input formatetc->ptd what non-NULL. this tells the caller + ** that it is NOT necessary to maintain a separate screen + ** rendering and printer rendering. if should return + ** DATA_S_SAMEFORMATETC if the input and output formatetc's are + ** identical. + */ + + *pformatetcOut = *pformatetc; + if (pformatetc->ptd == NULL) + return ResultFromScode(DATA_S_SAMEFORMATETC); + else + { + pformatetcOut->ptd = NULL; + return NOERROR; + } +} + +//********************************************************************** +// +// CDataObject::SetData +// +// Purpose: +// +// Called to set the data for the object. +// +// Parameters: +// +// LPFORMATETC pformatetc - the format of the data being passed +// +// STGMEDIUM FAR * pmedium - the location of the data. +// +// BOOL fRelease - Defines the ownership of the medium +// +// Return Value: +// +// DATA_E_FORMATETC - Not a valid FORMATETC for this object +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// Comments: +// +// This simple object does not support having its data set, so an +// error value is always returned. +// +//******************************************************************** + + +STDMETHODIMP CDataObject::SetData ( LPFORMATETC pformatetc, STGMEDIUM FAR * pmedium, + BOOL fRelease) +{ + TestDebugOut(TEXT("In CDataObject::SetData\r\n")); + return ResultFromScode( DATA_E_FORMATETC ); +} + +//********************************************************************** +// +// CDataObject::EnumFormatEtc +// +// Purpose: +// +// Enumerates the formats supported by this object. +// +// Parameters: +// +// DWORD dwDirection - Order of enumeration. +// +// LPENUMFORMATETC FAR* ppenumFormatEtc - Place to return a pointer +// to the enumerator. +// +// Return Value: +// +// OLE_S_USEREG - Indicates that OLE should consult the REG DB +// to enumerate the formats. +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// Comments: +// +// This simple implementation just returns OLE_SUSEREG +// +//******************************************************************** + + +STDMETHODIMP CDataObject::EnumFormatEtc ( DWORD dwDirection, + LPENUMFORMATETC FAR* ppenumFormatEtc) +{ + TestDebugOut(TEXT("In CDataObject::EnumFormatEtc\r\n")); + // need to NULL the out parameter + *ppenumFormatEtc = NULL; + return ResultFromScode( OLE_S_USEREG ); +} + +//********************************************************************** +// +// CDataObject::EnumDAdvise +// +// Purpose: +// +// Returns an enumerator that enumerates all of the advises +// set up on this data object. +// +// Parameters: +// +// LPENUMSTATDATA FAR* ppenumAdvise - An out ptr in which to +// return the enumerator. +// +// Return Value: +// +// Passed back from IDataAdviseHolder::EnumAdvise +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// IDAtaAdviseHolder::EnumAdvise OLE +// +// Comments: +// +// This just delegates to the DataAdviseHolder. +// +//******************************************************************** + + +STDMETHODIMP CDataObject::EnumDAdvise ( LPENUMSTATDATA FAR* ppenumAdvise) +{ + TestDebugOut(TEXT("In CDataObject::EnumDAdvise\r\n")); + // need to NULL the out parameter + *ppenumAdvise = NULL; + + return m_lpObj->m_lpDataAdviseHolder->EnumAdvise(ppenumAdvise); +} + + diff --git a/private/oleutest/simpsvr/ido.h b/private/oleutest/simpsvr/ido.h new file mode 100644 index 000000000..be46b1ecf --- /dev/null +++ b/private/oleutest/simpsvr/ido.h @@ -0,0 +1,51 @@ +//********************************************************************** +// File name: ido.h +// +// Definition of CDataObject +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** +#if !defined( _IDO_H_) +#define _IDO_H_ + + +#include <ole2.h> +#include "obj.h" + +class CSimpSvrObj; + +interface CDataObject : public IDataObject +{ +private: + CSimpSvrObj FAR * m_lpObj; + +public: + CDataObject::CDataObject(CSimpSvrObj FAR * lpSimpSvrObj) + { + m_lpObj = lpSimpSvrObj; + }; + + CDataObject::~CDataObject() {}; + + STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppvObj); + STDMETHODIMP_(ULONG) AddRef (); + STDMETHODIMP_(ULONG) Release (); + + STDMETHODIMP DAdvise ( FORMATETC FAR* pFormatetc, DWORD advf, + LPADVISESINK pAdvSink, DWORD FAR* pdwConnection); + STDMETHODIMP DUnadvise ( DWORD dwConnection); + STDMETHODIMP EnumDAdvise ( LPENUMSTATDATA FAR* ppenumAdvise); + STDMETHODIMP EnumFormatEtc ( DWORD dwDirection, + LPENUMFORMATETC FAR* ppenumFormatEtc); + STDMETHODIMP GetCanonicalFormatEtc ( LPFORMATETC pformatetc, + LPFORMATETC pformatetcOut); + STDMETHODIMP GetData ( LPFORMATETC pformatetcIn, LPSTGMEDIUM pmedium ); + STDMETHODIMP GetDataHere ( LPFORMATETC pformatetc, LPSTGMEDIUM pmedium ); + STDMETHODIMP QueryGetData ( LPFORMATETC pformatetc ); + STDMETHODIMP SetData ( LPFORMATETC pformatetc, STGMEDIUM FAR * pmedium, + BOOL fRelease); + + +}; + +#endif diff --git a/private/oleutest/simpsvr/iec.cpp b/private/oleutest/simpsvr/iec.cpp new file mode 100644 index 000000000..0a53df994 --- /dev/null +++ b/private/oleutest/simpsvr/iec.cpp @@ -0,0 +1,197 @@ +//********************************************************************** +// File name: IEC.CPP +// +// Implementation file for the CExternalConnection Class +// +// Functions: +// +// See iec.h for a list of member functions. +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** + +#include "pre.h" +#include "obj.h" +#include "iec.h" +#include "app.h" +#include "doc.h" + +//********************************************************************** +// +// CExternalConnection::QueryInterface +// +// Purpose: +// Used for interface negotiation +// +// Parameters: +// +// REFIID riid - Interface being queried for. +// +// LPVOID FAR *ppvObj - Out pointer for the interface. +// +// Return Value: +// +// S_OK - Success +// E_NOINTERFACE - Failure +// +// Function Calls: +// Function Location +// +// CSimpSvrObj::QueryInterface OBJ.CPP +// +//******************************************************************** + +STDMETHODIMP CExternalConnection::QueryInterface (REFIID riid, LPVOID FAR* ppvObj) +{ + TestDebugOut(TEXT("In CExternalConnection::QueryInterface\r\n")); + + return m_lpObj->QueryInterface(riid, ppvObj); +} + +//********************************************************************** +// +// CExternalConnection::AddRef +// +// Purpose: +// +// Increments the reference count on CSimpSvrObj object. Since +// CExternalConnection is a nested class of CSimpSvrObj, we don't +// need a separate reference count for CExternalConnection. We +// can just use the reference count of CSimpSvrObj. +// +// Parameters: +// +// None +// +// Return Value: +// +// The new reference count of the CSimpSvrObj +// +// Function Calls: +// Function Location +// +// OuputDebugString Windows API +// CSimpSvrObj::AddRef OBJ.CPP +// +//******************************************************************** + +STDMETHODIMP_(ULONG) CExternalConnection::AddRef () +{ + TestDebugOut(TEXT("In CExternalConnection::AddRef\r\n")); + + return( m_lpObj->AddRef() ); +} + +//********************************************************************** +// +// CExternalConnection::Release +// +// Purpose: +// +// Decrements the reference count on CSimpSvrObj object. Since +// CExternalConnection is a nested class of CSimpSvrObj, we don't +// need a separate reference count for CExternalConnection. We +// can just use the reference count of CSimpSvrObj. +// +// Parameters: +// +// None +// +// Return Value: +// +// The new reference count of CSimpSvrObj +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CSimpSvrObj::Release OBJ.CPP +// +//******************************************************************** + +STDMETHODIMP_(ULONG) CExternalConnection::Release () +{ + TestDebugOut(TEXT("In CExternalConnection::Release\r\n")); + + return m_lpObj->Release(); +} + +//********************************************************************** +// +// CExternalConnection::AddConnection +// +// Purpose: +// +// Called when another connection is made to the object. +// +// Parameters: +// +// DWORD extconn - Type of connection +// +// DWORD reserved - Reserved +// +// Return Value: +// +// Strong connection count +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +//******************************************************************** + +STDMETHODIMP_(DWORD) CExternalConnection::AddConnection (DWORD extconn, DWORD reserved) +{ + TestDebugOut(TEXT("In CExternalConnection::AddConnection\r\n")); + + if (extconn & EXTCONN_STRONG) + return ++m_dwStrong; + + return 0; +} + +//********************************************************************** +// +// CExternalConnection::ReleaseConnection +// +// Purpose: +// +// Called when a connection to the object is released. +// +// Parameters: +// +// DWORD extconn - Type of Connection +// +// DWORD reserved - Reserved +// +// BOOL fLastReleaseCloses - Close flag +// +// Return Value: +// +// The new reference count +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// COleObject::Close IOO.CPP +// +// +//******************************************************************** + +STDMETHODIMP_(DWORD) CExternalConnection::ReleaseConnection (DWORD extconn, DWORD reserved, BOOL fLastReleaseCloses) +{ + TestDebugOut(TEXT("In CExternalConnection::ReleaseConnection\r\n")); + + if (extconn & EXTCONN_STRONG) + { + DWORD dwSave = --m_dwStrong; + + if (!m_dwStrong && fLastReleaseCloses) + m_lpObj->m_OleObject.Close(OLECLOSE_SAVEIFDIRTY); + + return dwSave; + } + return 0; +} diff --git a/private/oleutest/simpsvr/iec.h b/private/oleutest/simpsvr/iec.h new file mode 100644 index 000000000..a54f0f1c2 --- /dev/null +++ b/private/oleutest/simpsvr/iec.h @@ -0,0 +1,43 @@ +//********************************************************************** +// File name: iec.h +// +// Definition of CExternalConnection +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** +#if !defined( _IEC_H_) +#define _IEC_H_ + + +#include <ole2.h> +#include "obj.h" + +class CSimpSvrObj; + +interface CExternalConnection : public IExternalConnection +{ +private: + CSimpSvrObj FAR * m_lpObj; // Ptr to object + DWORD m_dwStrong; // Connection Count + +public: + CExternalConnection::CExternalConnection(CSimpSvrObj FAR * lpSimpSvrObj) + { + m_lpObj = lpSimpSvrObj; + m_dwStrong = 0; + }; + + CExternalConnection::~CExternalConnection() {}; + + // *** IUnknown methods *** + STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppvObj); + STDMETHODIMP_(ULONG) AddRef (); + STDMETHODIMP_(ULONG) Release (); + + // *** IExternalConnection methods *** + STDMETHODIMP_(DWORD) AddConnection (DWORD extconn, DWORD reserved); + STDMETHODIMP_(DWORD) ReleaseConnection (DWORD extconn, DWORD reserved, BOOL fLastReleaseCloses); +}; + +#endif + diff --git a/private/oleutest/simpsvr/ioipao.cpp b/private/oleutest/simpsvr/ioipao.cpp new file mode 100644 index 000000000..7ac8a5799 --- /dev/null +++ b/private/oleutest/simpsvr/ioipao.cpp @@ -0,0 +1,404 @@ +//********************************************************************** +// File name: IOIPAO.CPP +// +// Implementation file for the CClassFactory Class +// +// Functions: +// +// See ioipao.h for a list of member functions. +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** + +#include "pre.h" +#include "obj.h" +#include "ioipao.h" +#include "app.h" +#include "doc.h" + +//********************************************************************** +// +// COleInPlaceActiveObject::QueryInterface +// +// Purpose: +// Used for interface negotiation +// +// Parameters: +// +// REFIID riid - Interface being queried for. +// +// LPVOID FAR *ppvObj - Out pointer for the interface. +// +// Return Value: +// +// S_OK - Success +// E_NOINTERFACE - Failure +// +// Function Calls: +// Function Location +// +// CSimpSvrObj::QueryInterface OBJ.CPP +// +// +//******************************************************************** + +STDMETHODIMP COleInPlaceActiveObject::QueryInterface ( REFIID riid, LPVOID FAR* ppvObj) +{ + TestDebugOut(TEXT("In COleInPlaceActiveObject::QueryInterface\r\n")); + // need to NULL the out parameter + return m_lpObj->QueryInterface(riid, ppvObj); +} + +//********************************************************************** +// +// COleInPlaceActiveObject::AddRef +// +// Purpose: +// +// Increments the reference count on CSimpSvrObj. Since +// COleInPlaceActiveObject is a nested class of CSimpSvrObj, we don't +// need a separate reference count for COleInPlaceActiveObject. We +// can use the reference count of CSimpSvrObj. +// +// Parameters: +// +// None +// +// Return Value: +// +// The new reference count on the CSimpSvrObj +// +// Function Calls: +// Function Location +// +// OuputDebugString Windows API +// CSimpSvrObj::AddRef OBJ.CPP +// +// +//******************************************************************** + +STDMETHODIMP_(ULONG) COleInPlaceActiveObject::AddRef () +{ + TestDebugOut(TEXT("In COleInPlaceActiveObject::AddRef\r\n")); + + return m_lpObj->AddRef(); +} + +//********************************************************************** +// +// COleInPlaceActiveObject::Release +// +// Purpose: +// +// Decrements the reference count on CSimpSvrObj. Since +// COleInPlaceActiveObject is a nested class of CSimpSvrObj, we don't +// need a separate reference count for COleInPlaceActiveObject. We +// can use the reference count of CSimpSvrObj. +// +// Parameters: +// +// None +// +// Return Value: +// +// The new reference count +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CSimpSvrObj::Release OBJ.CPP +// +// +//******************************************************************** + +STDMETHODIMP_(ULONG) COleInPlaceActiveObject::Release () +{ + TestDebugOut(TEXT("In COleInPlaceActiveObject::Release\r\n")); + + return m_lpObj->Release(); +} + +//********************************************************************** +// +// COleInPlaceActiveObject::OnDocWindowActivate +// +// Purpose: +// +// Called when the doc window (in an MDI App) is (de)activated. +// +// Parameters: +// +// BOOL fActivate - TRUE if activating, FALSE if deactivating +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// IOleInPlaceFrame::SetActiveObject Container +// CSimpSvrObject::AddFrameLevelUI OBJ.CPP +// +// +//******************************************************************** + +STDMETHODIMP COleInPlaceActiveObject::OnDocWindowActivate ( BOOL fActivate ) +{ + TestDebugOut(TEXT("In COleInPlaceActiveObject::OnDocWindowActivate\r\n")); + + // Activating? + if (fActivate) + m_lpObj->AddFrameLevelUI(); + + // No frame level tools to remove... + + return ResultFromScode(S_OK); +} + +//********************************************************************** +// +// COleInPlaceActiveObject::OnFrameWindowActivate +// +// Purpose: +// +// Called when the Frame window is (de)activating +// +// Parameters: +// +// BOOL fActivate - TRUE if activating, FALSE if Deactivating +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// SetFocus Windows API +// +// +// Comments: +// +// +//******************************************************************** + +STDMETHODIMP COleInPlaceActiveObject::OnFrameWindowActivate ( BOOL fActivate) +{ + TestDebugOut(TEXT("In COleInPlaceActiveObject::OnFrameWindowActivate\r\n")); + + // set the focus to the object window if we are activating. +/* if (fActivate) + SetFocus(m_lpObj->m_lpDoc->GethDocWnd()); */ + + return ResultFromScode( S_OK ); +} + +//********************************************************************** +// +// COleInPlaceActiveObject::GetWindow +// +// Purpose: +// +// Gets the objects Window Handle. +// +// Parameters: +// +// HWND FAR* lphwnd - Location to return the window handle. +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CSimpSvrDoc::GethDocWnd DOC.H +// +// +//******************************************************************** + +STDMETHODIMP COleInPlaceActiveObject::GetWindow ( HWND FAR* lphwnd) +{ + TestDebugOut(TEXT("In COleInPlaceActiveObject::GetWindow\r\n")); + // need to NULL the out parameter + *lphwnd = m_lpObj->m_lpDoc->GethDocWnd(); + return ResultFromScode( S_OK ); +} + +//********************************************************************** +// +// COleInPlaceActiveObject::ContextSensitiveHelp +// +// Purpose: +// +// Used to implement Context Sensitive help +// +// Parameters: +// +// None +// +// Return Value: +// +// E_NOTIMPL +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// +// Comments: +// +// See TECHNOTES.WRI include with the OLE SDK for proper +// implementation of this function. +// +//******************************************************************** + +STDMETHODIMP COleInPlaceActiveObject::ContextSensitiveHelp ( BOOL fEnterMode ) +{ + TestDebugOut(TEXT("In COleInPlaceActiveObject::ContextSensitiveHelp\r\n")); + return ResultFromScode( E_NOTIMPL); +} + +//********************************************************************** +// +// COleInPlaceActiveObject::TranslateAccelerator +// +// Purpose: +// +// Used for translating accelerators in .DLL objects. +// +// Parameters: +// +// LPMSG lpmsg - Pointer to a message +// +// Return Value: +// +// S_FALSE +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// +// Comments: +// +// This method should never be called since we are implemented +// in an executable. +// +//******************************************************************** + +STDMETHODIMP COleInPlaceActiveObject::TranslateAccelerator ( LPMSG lpmsg) +{ + TestDebugOut(TEXT("In COleInPlaceActiveObject::TranslateAccelerator\r\n")); + // no accelerator table, return FALSE + return ResultFromScode( S_FALSE ); +} + +//********************************************************************** +// +// COleInPlaceActiveObject::ResizeBorder +// +// Purpose: +// +// Called when the border changes size. +// +// Parameters: +// +// LPCRECT lprectBorder - New Border +// +// LPOLEINPLACEUIWINDOW lpUIWindow - Pointer to UIWindow +// +// BOOL fFrameWindow - True if lpUIWindow is the +// frame window. +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// +// Comments: +// +// Need to call SetBorderSpace again... +// +//******************************************************************** + +STDMETHODIMP COleInPlaceActiveObject::ResizeBorder ( LPCRECT lprectBorder, + LPOLEINPLACEUIWINDOW lpUIWindow, + BOOL fFrameWindow) +{ + HRESULT hRes; + + TestDebugOut(TEXT("In COleInPlaceActiveObject::ResizeBorder\r\n")); + + // should always have an inplace frame... + if ((hRes=m_lpObj->GetInPlaceFrame()->SetBorderSpace(NULL)) != S_OK) + { + TestDebugOut(TEXT("COleInPlaceActiveObject::ResizeBorder \ + SetBorderSpace fails\n")); + return(hRes); + } + + + // There will only be a UIWindow if in an MDI container + if (m_lpObj->GetUIWindow()) + { + if((hRes=m_lpObj->GetUIWindow()->SetBorderSpace(NULL)) != S_OK) + { + TestDebugOut(TEXT("COleInPlaceActiveObject::ResizeBorder \ + SetBorderSpace fails\n")); + return(hRes); + } + } + + return ResultFromScode( S_OK ); +} + +//********************************************************************** +// +// COleInPlaceActiveObject::EnableModeless +// +// Purpose: +// +// Called to enable/disable modeless dialogs. +// +// Parameters: +// +// BOOL fEnable - TRUE to enable, FALSE to disable +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// +// Comments: +// +// Called by the container when a model dialog box is added/removed +// from the screen. The appropriate action for a server application +// is to disable/enable any modeless dialogs currently being displayed. +// Since this application doesn't display any modeless dialogs, +// this method is essentially ignored. +// +//******************************************************************** + +STDMETHODIMP COleInPlaceActiveObject::EnableModeless ( BOOL fEnable) +{ + TestDebugOut(TEXT("In COleInPlaceActiveObject::EnableModeless\r\n")); + return ResultFromScode( S_OK ); +} diff --git a/private/oleutest/simpsvr/ioipao.h b/private/oleutest/simpsvr/ioipao.h new file mode 100644 index 000000000..d064e8a9e --- /dev/null +++ b/private/oleutest/simpsvr/ioipao.h @@ -0,0 +1,48 @@ +//********************************************************************** +// File name: IOIPAO.H +// +// Definition of COleInPlaceActiveObject +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** + +#if !defined( _IOIPAO_H_) +#define _IOIPAO_H_ + + +#include <ole2.h> +#include "obj.h" + +class CSimpSvrObj; + +interface COleInPlaceActiveObject : public IOleInPlaceActiveObject +{ +private: + CSimpSvrObj FAR * m_lpObj; + +public: + COleInPlaceActiveObject::COleInPlaceActiveObject(CSimpSvrObj FAR * lpSimpSvrObj) + { + m_lpObj = lpSimpSvrObj; // set up the back ptr + }; + COleInPlaceActiveObject::~COleInPlaceActiveObject() {}; // destructor + +// IUnknown Methods + + STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppvObj); + STDMETHODIMP_(ULONG) AddRef (); + STDMETHODIMP_(ULONG) Release (); + + STDMETHODIMP OnDocWindowActivate ( BOOL fActivate) ; + STDMETHODIMP OnFrameWindowActivate ( BOOL fActivate) ; + STDMETHODIMP GetWindow ( HWND FAR* lphwnd); + STDMETHODIMP ContextSensitiveHelp ( BOOL fEnterMode); + STDMETHODIMP TranslateAccelerator ( LPMSG lpmsg); + STDMETHODIMP ResizeBorder ( LPCRECT lprectBorder, + LPOLEINPLACEUIWINDOW lpUIWindow, + BOOL fFrameWindow); + STDMETHODIMP EnableModeless ( BOOL fEnable); + +}; + +#endif diff --git a/private/oleutest/simpsvr/ioipo.cpp b/private/oleutest/simpsvr/ioipo.cpp new file mode 100644 index 000000000..c7379ab02 --- /dev/null +++ b/private/oleutest/simpsvr/ioipo.cpp @@ -0,0 +1,400 @@ +//********************************************************************** +// File name: IOIPO.CPP +// +// Implementation file for the CClassFactory Class +// +// Functions: +// +// See ioipo.h for a list of member functions. +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** + +#include "pre.h" +#include "obj.h" +#include "ioipo.h" +#include "app.h" +#include "doc.h" +#include "math.h" + +//********************************************************************** +// +// COleInPlaceObject::QueryInterface +// +// Purpose: +// Used for interface negotiation +// +// Parameters: +// +// REFIID riid - Interface being queried for. +// +// LPVOID FAR *ppvObj - Out pointer for the interface. +// +// Return Value: +// +// S_OK - Success +// E_NOINTERFACE - Failure +// +// Function Calls: +// Function Location +// +// CSimpSvrObj::QueryInterface OBJ.CPP +// +// +//******************************************************************** + +STDMETHODIMP COleInPlaceObject::QueryInterface ( REFIID riid, LPVOID FAR* ppvObj) +{ + TestDebugOut(TEXT("In COleInPlaceObject::QueryInterface\r\n")); + // need to NULL the out parameter + *ppvObj = NULL; + return m_lpObj->QueryInterface(riid, ppvObj); +} + +//********************************************************************** +// +// COleInPlaceObject::AddRef +// +// Purpose: +// +// Increments the reference count of CSimpSvrObj. Since +// COleInPlaceObject is a nested class of CSimpSvrObj, we don't need +// to have a separate reference count for COleInPlaceObject. We can +// use the reference count of CSimpSvrObj. +// +// Parameters: +// +// None +// +// Return Value: +// +// The new reference count of CSimpSvrObj +// +// Function Calls: +// Function Location +// +// OuputDebugString Windows API +// CSimpSvrObj::AddRef OBJ.CPP +// +// +//******************************************************************** + +STDMETHODIMP_(ULONG) COleInPlaceObject::AddRef () +{ + TestDebugOut(TEXT("In COleInPlaceObject::AddRef\r\n")); + return m_lpObj->AddRef(); +} + +//********************************************************************** +// +// COleInPlaceObject::Release +// +// Purpose: +// +// Decrements the reference count of CSimpSvrObj. Since +// COleInPlaceObject is a nested class of CSimpSvrObj, we don't need +// to have a separate reference count for COleInPlaceObject. We can +// use the reference count of CSimpSvrObj. +// +// Parameters: +// +// None +// +// Return Value: +// +// The new reference count of CSimpSvrObj +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CSimpSvrObj::Release OBJ.CPP +// +// +//******************************************************************** + +STDMETHODIMP_(ULONG) COleInPlaceObject::Release () +{ + TestDebugOut(TEXT("In COleInPlaceObject::Release\r\n")); + return m_lpObj->Release(); +} + +//********************************************************************** +// +// COleInPlaceObject::InPlaceDeactivate +// +// Purpose: +// +// Called to deactivat the object +// +// Parameters: +// +// None +// +// Return Value: +// NOERROR +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// IOleInPlaceSite::OnInPlaceDeactivate Container +// IOleInPlaceSite::Release Container +// CSimpSvrObj::DeactivateUI OBJ.CPP +// CSimpSvrObj::DoInPlaceHide OBJ.CPP +// +//******************************************************************** + +STDMETHODIMP COleInPlaceObject::InPlaceDeactivate() +{ + TestDebugOut(TEXT("In COleInPlaceObject::InPlaceDeactivate\r\n")); + + // if not inplace active, return NOERROR + if (!m_lpObj->m_fInPlaceActive) + return NOERROR; + + // clear inplace flag + m_lpObj->m_fInPlaceActive = FALSE; + + // deactivate the UI + m_lpObj->DeactivateUI(); + m_lpObj->DoInPlaceHide(); + + // tell the container that we are deactivating. + if (m_lpObj->m_lpIPSite) + { + HRESULT hRes; + if ((hRes=m_lpObj->m_lpIPSite->OnInPlaceDeactivate()) != S_OK) + { + TestDebugOut(TEXT("COleInPlaceObject::InPlaceDeactivate \ + OnInPlaceDeactivate fails\n")); + } + m_lpObj->m_lpIPSite->Release(); + m_lpObj->m_lpIPSite =NULL; + } + + return ResultFromScode(S_OK); +} + +//********************************************************************** +// +// COleInPlaceObject::UIDeactivate +// +// Purpose: +// +// Instructs us to remove our UI. +// +// Parameters: +// +// None +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CSimpSvrObj::DeactivateUI OBJ.CPP +// +// +//******************************************************************** + +STDMETHODIMP COleInPlaceObject::UIDeactivate() +{ + TestDebugOut(TEXT("In COleInPlaceObject::UIDeactivate\r\n")); + + m_lpObj->DeactivateUI(); + + return ResultFromScode (S_OK); +} + +//********************************************************************** +// +// COleInPlaceObject::SetObjectRects +// +// Purpose: +// +// Called when the container clipping region or the object position +// changes. +// +// Parameters: +// +// LPCRECT lprcPosRect - New Position Rect. +// +// LPCRECT lprcClipRect - New Clipping Rect. +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// IntersectRect Windows API +// OffsetRect Windows API +// CopyRect Windows API +// MoveWindow Windows API +// CSimpSvrDoc::GethHatchWnd DOC.H +// CSimpSvrDoc::gethDocWnd DOC.h +// SetHatchWindowSize OLE2UI +// +// +//******************************************************************** + +STDMETHODIMP COleInPlaceObject::SetObjectRects ( LPCRECT lprcPosRect, LPCRECT lprcClipRect) +{ + TestDebugOut(TEXT("In COleInPlaceObject::SetObjectRects\r\n")); + + RECT resRect; + POINT pt; + + // Get the intersection of the clipping rect and the position rect. + IntersectRect(&resRect, lprcPosRect, lprcClipRect); + + m_lpObj->m_xOffset = abs (resRect.left - lprcPosRect->left); + m_lpObj->m_yOffset = abs (resRect.top - lprcPosRect->top); + + m_lpObj->m_scale = (float)(lprcPosRect->right - lprcPosRect->left)/m_lpObj->m_size.x; + + if (m_lpObj->m_scale == 0) + m_lpObj->m_scale = 1.0F; + + TCHAR szBuffer[255]; + + wsprintf(szBuffer, TEXT("New Scale %3d\r\n"), m_lpObj->m_scale); + + TestDebugOut(szBuffer); + + // Adjust the size of the Hatch Window. + SetHatchWindowSize(m_lpObj->m_lpDoc->GethHatchWnd(),(LPRECT) lprcPosRect, (LPRECT) lprcClipRect, &pt); + + // offset the rect + OffsetRect(&resRect, pt.x, pt.y); + + CopyRect(&m_lpObj->m_posRect, lprcPosRect); + + // Move the actual object window + MoveWindow(m_lpObj->m_lpDoc->GethDocWnd(), + resRect.left, + resRect.top, + resRect.right - resRect.left, + resRect.bottom - resRect.top, + TRUE); + + + return ResultFromScode( S_OK ); +} + +//********************************************************************** +// +// COleInPlaceObject::GetWindow +// +// Purpose: +// +// Returns the Window handle of the inplace object +// +// Parameters: +// +// HWND FAR* lphwnd - Out pointer in which to return the window +// Handle. +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CSimpleDoc::GethDocWnd DOC.H +// +// +//******************************************************************** + +STDMETHODIMP COleInPlaceObject::GetWindow ( HWND FAR* lphwnd) +{ + TestDebugOut(TEXT("In COleInPlaceObject::GetWindow\r\n")); + *lphwnd = m_lpObj->m_lpDoc->GethDocWnd(); + + return ResultFromScode( S_OK ); +} + +//********************************************************************** +// +// COleInPlaceObject::ContextSensitiveHelp +// +// Purpose: +// +// Used in performing Context Sensitive Help +// +// Parameters: +// +// BOOL fEnterMode - Flag to determine if enter or exiting +// Context Sensitive Help. +// +// Return Value: +// +// E_NOTIMPL +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// Comments: +// +// This function is not implemented due to the fact that it is +// beyond the scope of a simple object. All *real* applications +// are going to want to implement this function, otherwise any +// container that supports context sensitive help will not work +// properly while the object is in place. +// +// See TECHNOTES.WRI include with the OLE SDK for details on +// Implementing this method. +// +//******************************************************************** + +STDMETHODIMP COleInPlaceObject::ContextSensitiveHelp ( BOOL fEnterMode) +{ + TestDebugOut(TEXT("In COleInPlaceObject::ContextSensitiveHelp\r\n")); + return ResultFromScode( E_NOTIMPL); +} + +//********************************************************************** +// +// COleInPlaceObject::ReactivateAndUndo +// +// Purpose: +// +// Called when the container wants to undo the last edit made in +// the object. +// +// Parameters: +// +// None +// +// Return Value: +// +// INPLACE_E_NOTUNDOABLE +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// Comments: +// +// Since this server does not support undo, the value +// INPLACE_E_NOTUNDOABLE is always returned. +// +//******************************************************************** + +STDMETHODIMP COleInPlaceObject::ReactivateAndUndo () +{ + TestDebugOut(TEXT("In COleInPlaceObject::ReactivateAndUndo\r\n")); + return ResultFromScode( INPLACE_E_NOTUNDOABLE ); +} + diff --git a/private/oleutest/simpsvr/ioipo.h b/private/oleutest/simpsvr/ioipo.h new file mode 100644 index 000000000..da45b4254 --- /dev/null +++ b/private/oleutest/simpsvr/ioipo.h @@ -0,0 +1,43 @@ +//********************************************************************** +// File name: ioipo.h +// +// Definition of COleInPlaceObject +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** + +#if !defined( _IOIPO_H_) +#define _IOIPO_H_ + + +#include <ole2.h> +#include "obj.h" + +class CSimpSvrObj; + +interface COleInPlaceObject : public IOleInPlaceObject +{ +private: + CSimpSvrObj FAR * m_lpObj; + +public: + COleInPlaceObject::COleInPlaceObject(CSimpSvrObj FAR * lpSimpSvrObj) + { + m_lpObj = lpSimpSvrObj; + }; + COleInPlaceObject::~COleInPlaceObject() {}; + +// IUnknown Methods + STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppvObj); + STDMETHODIMP_(ULONG) AddRef (); + STDMETHODIMP_(ULONG) Release (); + + STDMETHODIMP InPlaceDeactivate (); + STDMETHODIMP UIDeactivate () ; + STDMETHODIMP SetObjectRects ( LPCRECT lprcPosRect, LPCRECT lprcClipRect); + STDMETHODIMP GetWindow ( HWND FAR* lphwnd) ; + STDMETHODIMP ContextSensitiveHelp ( BOOL fEnterMode); + STDMETHODIMP ReactivateAndUndo (); +}; + +#endif diff --git a/private/oleutest/simpsvr/ioo.cpp b/private/oleutest/simpsvr/ioo.cpp new file mode 100644 index 000000000..8973969db --- /dev/null +++ b/private/oleutest/simpsvr/ioo.cpp @@ -0,0 +1,1085 @@ +//********************************************************************** +// File name: IOO.CPP +// +// Implementation file for the COleObject Class +// +// Functions: +// +// See ioo.h for a list of member functions. +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** + +#include "pre.h" +#include "obj.h" +#include "ioo.h" +#include "app.h" +#include "doc.h" + +#define VERB_OPEN 1 + +//********************************************************************** +// +// COleObject::QueryInterface +// +// Purpose: +// Used for interface negotiation +// +// Parameters: +// +// REFIID riid - Interface being queried for. +// +// LPVOID FAR *ppvObj - Out pointer for the interface. +// +// Return Value: +// +// S_OK - Success +// E_NOINTERFACE - Failure +// +// Function Calls: +// Function Location +// +// CSimpSvrObj::QueryInterface OBJ.CPP +// +// +//******************************************************************** + +STDMETHODIMP COleObject::QueryInterface ( REFIID riid, LPVOID FAR* ppvObj) +{ + TestDebugOut(TEXT("In COleObject::QueryInterface\r\n")); + return m_lpObj->QueryInterface(riid, ppvObj); +} + +//********************************************************************** +// +// COleObject::AddRef +// +// Purpose: +// +// Increments the reference count on CSimpSvrObj. Since COleObject +// is a nested class of CSimpSvrObj, we don't need an extra reference +// count for COleObject. We can safely use the reference count of +// CSimpSvrObj. +// +// Parameters: +// +// None +// +// Return Value: +// +// The new reference count on the CSimpSvrObj +// +// Function Calls: +// Function Location +// +// OuputDebugString Windows API +// CSimpSvrObj::AddRef OBJ.CPP +// +// +//******************************************************************** + +STDMETHODIMP_(ULONG) COleObject::AddRef () +{ + TestDebugOut(TEXT("In COleObject::AddRef\r\n")); + return m_lpObj->AddRef(); +} + +//********************************************************************** +// +// COleObject::Release +// +// Purpose: +// +// Decrements the reference count on CSimpSvrObj. Since COleObject +// is a nested class of CSimpSvrObj, we don't need an extra reference +// count for COleObject. We can safely use the reference count of +// CSimpSvrObj. +// +// Parameters: +// +// None +// +// Return Value: +// +// The new reference count of CSimpSvrObj +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CSimpSvrObj::Release OBJ.CPP +// +// +//******************************************************************** + +STDMETHODIMP_(ULONG) COleObject::Release () +{ + TestDebugOut(TEXT("In COleObject::Release\r\n")); + return m_lpObj->Release(); +} + +//********************************************************************** +// +// COleObject::SetClientSite +// +// Purpose: +// +// Called to notify the object of it's client site. +// +// Parameters: +// +// LPOLECLIENTSITE pClientSite - ptr to new client site +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// IOleClientSite::Release Container +// IOleClientSite::AddRef Container +// +// +//******************************************************************** + +STDMETHODIMP COleObject::SetClientSite ( LPOLECLIENTSITE pClientSite) +{ + TestDebugOut(TEXT("In COleObject::SetClientSite\r\n")); + + // if we already have a client site, release it. + if (m_lpObj->m_lpOleClientSite) + { + m_lpObj->m_lpOleClientSite->Release(); + m_lpObj->m_lpOleClientSite = NULL; + } + + // store copy of the client site. + m_lpObj->m_lpOleClientSite = pClientSite; + + // AddRef it so it doesn't go away. + if (m_lpObj->m_lpOleClientSite) + m_lpObj->m_lpOleClientSite->AddRef(); + + return ResultFromScode(S_OK); +} + +//********************************************************************** +// +// COleObject::Advise +// +// Purpose: +// +// Called to set up an advise on the OLE object. +// +// Parameters: +// +// LPADVISESINK pAdvSink - ptr to the Advise Sink for notification +// +// DWORD FAR* pdwConnection - place to return the connection ID. +// +// Return Value: +// +// Passed back from IOleAdviseHolder::Advise. +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CreateOleAdviseHolder OLE API +// IOleAdviseHolder::Advise OLE +// +// +//******************************************************************** + +STDMETHODIMP COleObject::Advise ( LPADVISESINK pAdvSink, DWORD FAR* pdwConnection) +{ + TestDebugOut(TEXT("In COleObject::Advise\r\n")); + + // if we haven't made an OleAdviseHolder yet, make one. + if (!m_lpObj->m_lpOleAdviseHolder) + { + HRESULT hRes; + if ((hRes=CreateOleAdviseHolder(&m_lpObj->m_lpOleAdviseHolder))!=S_OK) + { + TestDebugOut(TEXT("CreateOleAdviseHolder fails\n")); + return(hRes); + } + } + + // pass this call onto the OleAdviseHolder. + return m_lpObj->m_lpOleAdviseHolder->Advise(pAdvSink, pdwConnection); +} + +//********************************************************************** +// +// COleObject::SetHostNames +// +// Purpose: +// +// Called to pass strings for Window titles. +// +// Parameters: +// +// LPCOLESTR szContainerApp - ptr to string describing Container App +// +// LPCOLESTR szContainerObj - ptr to string describing Object +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// Comments: +// +// This routine is called so that the server application can +// set the window title appropriately. +// +//******************************************************************** + +STDMETHODIMP COleObject::SetHostNames ( LPCOLESTR szContainerApp, LPCOLESTR szContainerObj) +{ + TestDebugOut(TEXT("In COleObject::SetHostNames\r\n")); + + return ResultFromScode( S_OK); +} + +//********************************************************************** +// +// COleObject::DoVerb +// +// Purpose: +// +// Called by the container application to invoke a verb. +// +// Parameters: +// +// LONG iVerb - The value of the verb to be +// invoked. +// +// LPMSG lpmsg - The message that caused the +// verb to be invoked. +// +// LPOLECLIENTSITE pActiveSite - Ptr to the active client site. +// +// LONG lindex - Used in extended layout +// +// HWND hwndParent - This should be the window handle of +// the window in which we are contained. +// This value could be used to "fake" +// inplace activation in a manner similar +// to Video for Windows in OLE 1.0. +// +// LPCRECT lprcPosRect - The rectangle that contains the object +// within hwndParent. Also used to +// "fake" inplace activation. +// +// Return Value: +// +// OLE_E_NOTINPLACEACTIVE - Returned if attempted to undo while not +// inplace active. +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// ShowWindow Windows API +// CSimpSvrObj::DoInPlaceActivate OBJ.CPP +// CSimpSvrObj::DoInPlaceHide OBJ.CPP +// COleObject::OpenEdit IOO.CPP +// CSimpSvrDoc::GethDocWnd DOC.H +// COleInPlaceObj::InPlaceDeactivate IOIPO.CPP +// +// Comments: +// +// Be sure to look at TECHNOTES.WRI included with the OLE +// SDK for a description of handling the inplace verbs +// properly. +// +//******************************************************************** + +STDMETHODIMP COleObject::DoVerb ( LONG iVerb, + LPMSG lpmsg, + LPOLECLIENTSITE pActiveSite, + LONG lindex, + HWND hwndParent, + LPCRECT lprcPosRect) +{ + TestDebugOut(TEXT("In COleObject::DoVerb\r\n")); + + switch (iVerb) + { + case OLEIVERB_SHOW: + case OLEIVERB_PRIMARY: + if (m_fOpen) + SetFocus(m_lpObj->m_lpDoc->GethAppWnd()); + else if (m_lpObj->DoInPlaceActivate(iVerb) == FALSE) + OpenEdit(pActiveSite); + break; + + case OLEIVERB_UIACTIVATE: + if (m_fOpen) + return ResultFromScode (E_FAIL); + + // inplace activate + if (!m_lpObj->DoInPlaceActivate(iVerb)) + return ResultFromScode (E_FAIL); + break; + + case OLEIVERB_DISCARDUNDOSTATE: + // don't have to worry about this situation as we don't + // support an undo state. + if (!m_lpObj->m_fInPlaceActive) + return ResultFromScode(OLE_E_NOT_INPLACEACTIVE); + break; + + case OLEIVERB_HIDE: + // if inplace active, do an "inplace" hide, otherwise + // just hide the app window. + if (m_lpObj->m_fInPlaceActive) + { + // clear inplace flag + m_lpObj->m_fInPlaceActive = FALSE; + + // deactivate the UI + m_lpObj->DeactivateUI(); + m_lpObj->DoInPlaceHide(); + } + else + m_lpObj->m_lpDoc->GetApp()->HideAppWnd(); + break; + + case OLEIVERB_OPEN: + case VERB_OPEN: + // if inplace active, deactivate + if (m_lpObj->m_fInPlaceActive) + m_lpObj->m_OleInPlaceObject.InPlaceDeactivate(); + + // open into another window. + OpenEdit(pActiveSite); + break; + + default: + if (iVerb < 0) + return ResultFromScode(E_FAIL); + } + + return ResultFromScode( S_OK); +} + +//********************************************************************** +// +// COleObject::GetExtent +// +// Purpose: +// +// Returns the extent of the object. +// +// Parameters: +// +// DWORD dwDrawAspect - The aspect in which to get the size. +// +// LPSIZEL lpsizel - Out ptr to return the size. +// +// Return Value: +// S_OK if the aspect is DVASPECT_CONTENT +// E_FAIL otherwise +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// XformWidthInPixelsToHimetric OLE2UI +// XformHeightInPixelsToHimetric OLE2UI +// +// +//******************************************************************** + +STDMETHODIMP COleObject::GetExtent ( DWORD dwDrawAspect, LPSIZEL lpsizel) +{ + TestDebugOut(TEXT("In COleObject::GetExtent\r\n")); + + SCODE sc = E_FAIL; + + // Only DVASPECT_CONTENT is supported.... + if (dwDrawAspect == DVASPECT_CONTENT) + { + sc = S_OK; + + // return the correct size in HIMETRIC... + lpsizel->cx = XformWidthInPixelsToHimetric(NULL, m_lpObj->m_size.x); + lpsizel->cy = XformHeightInPixelsToHimetric(NULL, m_lpObj->m_size.y); + } + + return ResultFromScode( sc ); +} + +//********************************************************************** +// +// COleObject::Update +// +// Purpose: +// +// Called to get the most up to date data +// +// Parameters: +// +// None +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// IDataAdviseHolder::SendOnDataChange OLE +// +// +//******************************************************************** + +STDMETHODIMP COleObject::Update() +{ + TestDebugOut(TEXT("In COleObject::Update\r\n")); + + // force an update + m_lpObj->SendOnDataChange(); + + return ResultFromScode( S_OK ); +} + +//********************************************************************** +// +// COleObject::Close +// +// Purpose: +// +// Called when the OLE object needs to be closed +// +// Parameters: +// +// DWORD dwSaveOption - Flags to instruct the server how to prompt +// the user. +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CSimpSvrDoc::Close DOC.CPP +// +// +//******************************************************************** + +STDMETHODIMP COleObject::Close ( DWORD dwSaveOption) +{ + TestDebugOut(TEXT("In COleObject::Close\r\n")); + + // delegate to the document object. + m_lpObj->m_lpDoc->Close(); + + return ResultFromScode( S_OK ); +} + +//********************************************************************** +// +// COleObject::Unadvise +// +// Purpose: +// +// Breaks down an OLE advise that has been set up on this object. +// +// Parameters: +// +// DWORD dwConnection - Connection that needs to be broken down +// +// Return Value: +// +// Passed back from IOleAdviseHolder::Unadvise +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// IOleAdviseHolder::Unadvise OLE +// +// +//******************************************************************** + +STDMETHODIMP COleObject::Unadvise ( DWORD dwConnection) +{ + TestDebugOut(TEXT("In COleObject::Unadvise\r\n")); + + // pass on to OleAdviseHolder. + return m_lpObj->m_lpOleAdviseHolder->Unadvise(dwConnection); +} + +//********************************************************************** +// +// COleObject::EnumVerbs +// +// Purpose: +// +// Enumerates the verbs associated with this object. +// +// Parameters: +// +// LPENUMOLEVERB FAR* ppenumOleVerb - Out ptr in which to return +// the enumerator +// +// Return Value: +// +// OLE_S_USEREG - Instructs OLE to use the verbs found in the +// REG DB for this server. +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// Comments: +// +// In a .DLL, an application cannot return OLE_S_USEREG. This is +// due to the fact that the default object handler is not being +// used, and the container is really making direct function calls +// into the server .DLL. +// +//******************************************************************** + +STDMETHODIMP COleObject::EnumVerbs ( LPENUMOLEVERB FAR* ppenumOleVerb) +{ + TestDebugOut(TEXT("In COleObject::EnumVerbs\r\n")); + + return ResultFromScode( OLE_S_USEREG ); +} + +//********************************************************************** +// +// COleObject::GetClientSite +// +// Purpose: +// +// Called to get the current client site of the object. +// +// Parameters: +// +// LPOLECLIENTSITE FAR* ppClientSite - Out ptr in which to return the +// client site. +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// +//******************************************************************** + +STDMETHODIMP COleObject::GetClientSite ( LPOLECLIENTSITE FAR* ppClientSite) +{ + TestDebugOut(TEXT("In COleObject::GetClientSite\r\n")); + *ppClientSite = m_lpObj->m_lpOleClientSite; + return ResultFromScode( S_OK ); +} + +//********************************************************************** +// +// COleObject::SetMoniker +// +// Purpose: +// +// Used to set the objects moniker +// +// Parameters: +// +// DWORD dwWhichMoniker - Type of moniker being set +// +// LPMONIKER pmk - Pointer to the moniker +// +// Return Value: +// S_OK +// E_FAIL if the Moniker cannot be set +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// +//******************************************************************** + +STDMETHODIMP COleObject::SetMoniker ( DWORD dwWhichMoniker, LPMONIKER pmk) +{ + TestDebugOut(TEXT("In COleObject::SetMoniker\r\n")); + + LPMONIKER lpmk; + HRESULT hRes; + + if (! m_lpObj->GetOleClientSite()) + return ResultFromScode (E_FAIL); + + if (m_lpObj->GetOleClientSite()->GetMoniker (OLEGETMONIKER_ONLYIFTHERE, OLEWHICHMK_OBJFULL, &lpmk) != NOERROR) + return ResultFromScode (E_FAIL); + + + if (m_lpObj->GetOleAdviseHolder()) + { + if ((hRes=m_lpObj->GetOleAdviseHolder()->SendOnRename(lpmk))!=S_OK) + TestDebugOut(TEXT("SendOnRename fails\n")); + } + + LPRUNNINGOBJECTTABLE lpRot; + + if (GetRunningObjectTable(0, &lpRot) == NOERROR) + { + if (m_lpObj->m_dwRegister) + lpRot->Revoke(m_lpObj->m_dwRegister); + + if ( ((hRes=lpRot->Register(0, m_lpObj, lpmk, + &m_lpObj->m_dwRegister))!=S_OK) || + (hRes!=ResultFromScode(MK_S_MONIKERALREADYREGISTERED))) + TestDebugOut(TEXT("Running Object Table Register fails\n")); + + lpRot->Release(); + } + + + return ResultFromScode( S_OK ); +} + +//********************************************************************** +// +// COleObject::GetMoniker +// +// Purpose: +// returns a moniker from the client site +// +// Parameters: +// +// DWORD dwAssign - Assignment for the moniker +// +// DWORD dwWhichMoniker - Which moniker to return +// +// LPMONIKER FAR* ppmk - An out ptr to return the moniker +// +// Return Value: +// +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// +//******************************************************************** + +STDMETHODIMP COleObject::GetMoniker ( DWORD dwAssign, DWORD dwWhichMoniker, + LPMONIKER FAR* ppmk) +{ + TestDebugOut(TEXT("In COleObject::GetMoniker\r\n")); + // need to NULL the out parameter + *ppmk = NULL; + + return m_lpObj->GetOleClientSite()->GetMoniker(OLEGETMONIKER_ONLYIFTHERE, + OLEWHICHMK_OBJFULL, ppmk); +} + +//********************************************************************** +// +// COleObject::InitFromData +// +// Purpose: +// +// Initialize the object from the passed pDataObject. +// +// Parameters: +// +// LPDATAOBJECT pDataObject - Pointer to data transfer object +// to be used in the initialization +// +// BOOL fCreation - TRUE if the object is currently being +// created. +// +// DWORD dwReserved - Reserved +// +// Return Value: +// +// S_FALSE +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// Comments: +// +// We don't support this functionality, so we will always return +// error. +// +//******************************************************************** + +STDMETHODIMP COleObject::InitFromData ( LPDATAOBJECT pDataObject, + BOOL fCreation, + DWORD dwReserved) +{ + TestDebugOut(TEXT("In COleObject::InitFromData\r\n")); + + return ResultFromScode( S_FALSE ); +} + +//********************************************************************** +// +// COleObject::GetClipboardData +// +// Purpose: +// +// Returns an IDataObject that is the same as doing an OleSetClipboard +// +// Parameters: +// +// DWORD dwReserved - Reserved +// +// LPDATAOBJECT FAR* ppDataObject - Out ptr for the Data Object. +// +// Return Value: +// +// OLE_E_NOTSUPPORTED +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// Comments: +// +// Support of this method is optional. +// +//******************************************************************** + +STDMETHODIMP COleObject::GetClipboardData ( DWORD dwReserved, + LPDATAOBJECT FAR* ppDataObject) +{ + TestDebugOut(TEXT("In COleObject::GetClipboardData\r\n")); + // NULL the out ptr + *ppDataObject = NULL; + return ResultFromScode( E_NOTIMPL ); +} + +//********************************************************************** +// +// COleObject::IsUpToDate +// +// Purpose: +// +// Determines if an object is up to date +// +// Parameters: +// +// None +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// Comments: +// +// Our embedded object is always up to date. This function is +// particularly useful in linking situations. +// +//******************************************************************** + +STDMETHODIMP COleObject::IsUpToDate() +{ + TestDebugOut(TEXT("In COleObject::IsUpToDate\r\n")); + return ResultFromScode( S_OK ); +} + +//********************************************************************** +// +// COleObject::GetUserClassID +// +// Purpose: +// +// Returns the applications CLSID +// +// Parameters: +// +// CLSID FAR* pClsid - Out ptr to return the CLSID +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CPersistStorage::GetClassID IPS.CPP +// +// Comments: +// +// This function is just delegated to IPS::GetClassID. +// +//******************************************************************** + +STDMETHODIMP COleObject::GetUserClassID ( CLSID FAR* pClsid) +{ + TestDebugOut(TEXT("In COleObject::GetUserClassID\r\n")); + + return ( m_lpObj->m_PersistStorage.GetClassID(pClsid) ); +} + +//********************************************************************** +// +// COleObject::GetUserType +// +// Purpose: +// +// Used to get a user presentable id for this object +// +// Parameters: +// +// DWORD dwFormOfType - The ID requested +// +// LPOLESTR FAR* pszUserType - Out ptr to return the string +// +// Return Value: +// +// OLE_S_USEREG - Use the reg db to get these entries. +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// Comment: +// In this implementation, we delegate to the default handler's +// implementation using the registration database to provide +// the requested info. +// +//******************************************************************** + +STDMETHODIMP COleObject::GetUserType ( DWORD dwFormOfType, + LPOLESTR FAR* pszUserType) +{ + TestDebugOut(TEXT("In COleObject::GetUserType\r\n")); + + return ResultFromScode( OLE_S_USEREG ); +} + +//********************************************************************** +// +// COleObject::SetExtent +// +// Purpose: +// +// Called to set the extent of the object. +// +// Parameters: +// +// DWORD dwDrawAspect - Aspect to have its size set +// +// LPSIZEL lpsizel - New size of the object. +// +// Return Value: +// +// E_NOTIMPL - This function is not curently implemented. +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// Comments: +// +// See TECHNOTES.WRI include with the OLE SDK for proper +// implementation of this function. +// +// +//******************************************************************** + +STDMETHODIMP COleObject::SetExtent ( DWORD dwDrawAspect, LPSIZEL lpsizel) +{ + TestDebugOut(TEXT("In COleObject::SetExtent\r\n")); + return ResultFromScode( E_NOTIMPL); +} + +//********************************************************************** +// +// COleObject::EnumAdvise +// +// Purpose: +// +// Returns an enumerate which enumerates the outstanding advises +// associated with this OLE object. +// +// Parameters: +// +// LPENUMSTATDATA FAR* ppenumAdvise - Out ptr in which to return +// the enumerator. +// +// Return Value: +// +// Passed on from IOleAdviseHolder::EnumAdvise. +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// IOleAdviseHolder::EnumAdvise OLE +// +// +//******************************************************************** + +STDMETHODIMP COleObject::EnumAdvise ( LPENUMSTATDATA FAR* ppenumAdvise) +{ + TestDebugOut(TEXT("In COleObject::EnumAdvise\r\n")); + // need to NULL the out parameter + *ppenumAdvise = NULL; + + // pass on to the OLE Advise holder. + return m_lpObj->m_lpOleAdviseHolder->EnumAdvise(ppenumAdvise); +} + +//********************************************************************** +// +// COleObject::GetMiscStatus +// +// Purpose: +// +// Return status information about the object +// +// Parameters: +// +// DWORD dwAspect - Aspect interested in. +// +// DWORD FAR* pdwStatus - Out ptr in which to return the bits. +// +// Return Value: +// +// OLE_S_USEREG - Use the reg db to get these entries. +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// Comment: +// In this implementation, we delegate to the default handler's +// implementation using the registration database to provide +// the requested info. +// +// +//******************************************************************** + +STDMETHODIMP COleObject::GetMiscStatus ( DWORD dwAspect, DWORD FAR* pdwStatus) +{ + TestDebugOut(TEXT("In COleObject::GetMiscStatus\r\n")); + // need to NULL the out parameter + *pdwStatus = NULL; + return ResultFromScode( OLE_S_USEREG ); +} + +//********************************************************************** +// +// COleObject::SetColorScheme +// +// Purpose: +// +// Used to set the palette for the object to use. +// +// Parameters: +// +// LPLOGPALETTE lpLogpal - Pointer to the LOGPALETTE to be used. +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// Comments: +// +// This server ignores this method. +// +//******************************************************************** + +STDMETHODIMP COleObject::SetColorScheme ( LPLOGPALETTE lpLogpal) +{ + TestDebugOut(TEXT("In COleObject::SetColorScheme\r\n")); + return ResultFromScode( S_OK ); +} + +//********************************************************************** +// +// COleObject::OpenEdit +// +// Purpose: +// +// Used to Open the object into a seperate window. +// +// Parameters: +// +// LPOLECLIENTSITE pActiveSite - Pointer to the Active clientsite. +// +// Return Value: +// +// None. +// +// Function Calls: +// Function Location +// +// IOleClientSite::OnShowWindow Container +// ShowWindow Windows API +// UpdateWindow Windows API +// TestDebugOut Windows API +// CSimpSvrDoc::GethAppWnd DOC.H +// CSimpSvrDoc::GethHatchWnd DOC.H +// +// +//******************************************************************** + +void COleObject::OpenEdit(LPOLECLIENTSITE pActiveSite) +{ + if (m_lpObj->GetOleClientSite()) + m_lpObj->GetOleClientSite()->ShowObject(); + + + m_fOpen = TRUE; + + // tell the site we are opening so the object can be hatched out. + if (m_lpObj->GetOleClientSite()) + m_lpObj->GetOleClientSite()->OnShowWindow(TRUE); + + + m_lpObj->m_lpDoc->ShowDocWnd(); + + m_lpObj->m_lpDoc->HideHatchWnd(); + + // Show app window. + m_lpObj->m_lpDoc->GetApp()->ShowAppWnd(); + + SetFocus(m_lpObj->m_lpDoc->GethAppWnd()); +} + diff --git a/private/oleutest/simpsvr/ioo.h b/private/oleutest/simpsvr/ioo.h new file mode 100644 index 000000000..39163311a --- /dev/null +++ b/private/oleutest/simpsvr/ioo.h @@ -0,0 +1,71 @@ +//********************************************************************** +// File name: ioo.h +// +// Definition of COleObject +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** +#if !defined( _IOO_H_) +#define _IOO_H_ + + +#include <ole2.h> +#include "obj.h" + +class CSimpSvrObj; + +interface COleObject : public IOleObject +{ +private: + CSimpSvrObj FAR * m_lpObj; + BOOL m_fOpen; + +public: + COleObject::COleObject(CSimpSvrObj FAR * lpSimpSvrObj) + { + m_lpObj = lpSimpSvrObj; + m_fOpen = FALSE; + }; + COleObject::~COleObject() + { + }; + STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppvObj); + STDMETHODIMP_(ULONG) AddRef (); + STDMETHODIMP_(ULONG) Release (); + + STDMETHODIMP SetClientSite (LPOLECLIENTSITE pClientSite); + STDMETHODIMP Advise (LPADVISESINK pAdvSink, DWORD FAR* pdwConnection); + STDMETHODIMP SetHostNames ( LPCOLESTR szContainerApp, LPCOLESTR szContainerObj); + STDMETHODIMP DoVerb ( LONG iVerb, + LPMSG lpmsg, + LPOLECLIENTSITE pActiveSite, + LONG lindex, + HWND hwndParent, + LPCRECT lprcPosRect); + STDMETHODIMP GetExtent ( DWORD dwDrawAspect, LPSIZEL lpsizel); + STDMETHODIMP Update () ; + STDMETHODIMP Close ( DWORD dwSaveOption) ; + STDMETHODIMP Unadvise ( DWORD dwConnection); + STDMETHODIMP EnumVerbs ( LPENUMOLEVERB FAR* ppenumOleVerb) ; + STDMETHODIMP GetClientSite ( LPOLECLIENTSITE FAR* ppClientSite); + STDMETHODIMP SetMoniker ( DWORD dwWhichMoniker, LPMONIKER pmk); + STDMETHODIMP GetMoniker ( DWORD dwAssign, DWORD dwWhichMoniker, + LPMONIKER FAR* ppmk); + STDMETHODIMP InitFromData ( LPDATAOBJECT pDataObject, + BOOL fCreation, + DWORD dwReserved); + STDMETHODIMP GetClipboardData ( DWORD dwReserved, + LPDATAOBJECT FAR* ppDataObject); + STDMETHODIMP IsUpToDate (); + STDMETHODIMP GetUserClassID ( CLSID FAR* pClsid); + STDMETHODIMP GetUserType ( DWORD dwFormOfType, LPOLESTR FAR* pszUserType); + STDMETHODIMP SetExtent ( DWORD dwDrawAspect, LPSIZEL lpsizel); + STDMETHODIMP EnumAdvise ( LPENUMSTATDATA FAR* ppenumAdvise); + STDMETHODIMP GetMiscStatus ( DWORD dwAspect, DWORD FAR* pdwStatus); + STDMETHODIMP SetColorScheme ( LPLOGPALETTE lpLogpal); + + void OpenEdit(LPOLECLIENTSITE pActiveSite); + +}; + +#endif diff --git a/private/oleutest/simpsvr/ips.cpp b/private/oleutest/simpsvr/ips.cpp new file mode 100644 index 000000000..3e84b8aab --- /dev/null +++ b/private/oleutest/simpsvr/ips.cpp @@ -0,0 +1,654 @@ +//********************************************************************** +// File name: ips.cpp +// +// Implementation file for the CSimpSvrApp Class +// +// Functions: +// +// See ips.h for a list of member functions. +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** + +#include "pre.h" +#include "obj.h" +#include "ips.h" +#include "app.h" +#include "doc.h" + +DEFINE_GUID(GUID_SIMPLE, 0xBCF6D4A0, 0xBE8C, 0x1068, 0xB6, 0xD4, 0x00, 0xDD, 0x01, 0x0C, 0x05, 0x09); + +//********************************************************************** +// +// CPersistStorage::QueryInterface +// +// Purpose: +// Used for interface negotiation +// +// Parameters: +// +// REFIID riid - Interface being queried for. +// +// LPVOID FAR *ppvObj - Out pointer for the interface. +// +// Return Value: +// +// S_OK - Success +// E_NOINTERFACE - Failure +// +// Function Calls: +// Function Location +// +// CSimpSvrObj::QueryInterface OBJ.CPP +// +// +//******************************************************************** + +STDMETHODIMP CPersistStorage::QueryInterface ( REFIID riid, LPVOID FAR* ppvObj) +{ + TestDebugOut(TEXT("In CPersistStorage::QueryInterface\r\n")); + // need to NULL the out parameter + return m_lpObj->QueryInterface(riid, ppvObj); +} + +//********************************************************************** +// +// CPersistStorage::AddRef +// +// Purpose: +// +// Increments the reference count on CSimpSvrObj. Since CPersistStorage +// is a nested class of CSimpSvrObj, we don't need an extra reference +// count for CPersistStorage. We can safely use the reference count of +// CSimpSvrObj. +// +// +// Parameters: +// +// None +// +// Return Value: +// +// The new reference count of CSimpSvrObj +// +// Function Calls: +// Function Location +// +// OuputDebugString Windows API +// CSimpSvrObj::AddRef OBJ.CPP +// +// +//******************************************************************** + +STDMETHODIMP_(ULONG) CPersistStorage::AddRef () +{ + TestDebugOut(TEXT("In CPersistStorage::AddRef\r\n")); + return m_lpObj->AddRef(); +} + +//********************************************************************** +// +// CPersistStorage::Release +// +// Purpose: +// +// Decrements the reference count on CSimpSvrObj. Since CPersistStorage +// is a nested class of CSimpSvrObj, we don't need an extra reference +// count for CPersistStorage. We can safely use the reference count of +// CSimpSvrObj. +// +// Parameters: +// +// None +// +// Return Value: +// +// The new reference count of CSimpSvrObj +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CSimpSvrObj::Release OBJ.CPP +// +// +//******************************************************************** + +STDMETHODIMP_(ULONG) CPersistStorage::Release () +{ + TestDebugOut(TEXT("In CPersistStorage::Release\r\n")); + return m_lpObj->Release(); +} + +//********************************************************************** +// +// CPersistStorage::InitNew +// +// Purpose: +// +// Used to give a new OLE object a ptr to its storage. +// +// Parameters: +// +// LPSTORAGE pStg - Pointer to the storage +// +// Return Value: +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// IStorage::Release OLE +// IStorage::AddRef OLE +// +// +//******************************************************************** + +STDMETHODIMP CPersistStorage::InitNew (LPSTORAGE pStg) +{ + TestDebugOut(TEXT("In CPersistStorage::InitNew\r\n")); + + // release any streams and storages that may be open + ReleaseStreamsAndStorage(); + + m_lpObj->m_lpStorage = pStg; + + // AddRef the new Storage + if (m_lpObj->m_lpStorage) + m_lpObj->m_lpStorage->AddRef(); + + CreateStreams(m_lpObj->m_lpStorage); + + return ResultFromScode(S_OK); +} + +//********************************************************************** +// +// CPersistStorage::GetClassID +// +// Purpose: +// +// Returns the CLSID of this object. +// +// Parameters: +// +// LPCLSID lpClassID - Out ptr in which to return the CLSID +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// +//******************************************************************** + +STDMETHODIMP CPersistStorage::GetClassID ( LPCLSID lpClassID) +{ + TestDebugOut(TEXT("In CPersistStorage::GetClassID\r\n")); + + *lpClassID = GUID_SIMPLE; + + return ResultFromScode( S_OK ); +} + +//********************************************************************** +// +// CPersistStorage::Save +// +// Purpose: +// +// Instructs the object to save itself into the storage. +// +// Parameters: +// +// LPSTORAGE pStgSave - Storage in which the object should be saved +// +// BOOL fSameAsLoad - TRUE if pStgSave is the same as the storage +// that the object was originally created with. +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CPersistStorage::InitNew IPS.CPP +// CSimpSvrObj::SaveToStorage OBJ.CPP +// +// +// Comments: +// +// A real app will want better error checking in this method. +// +//******************************************************************** + +STDMETHODIMP CPersistStorage::Save ( LPSTORAGE pStgSave, BOOL fSameAsLoad) +{ + TestDebugOut(TEXT("In CPersistStorage::Save\r\n")); + + // save the data + m_lpObj->SaveToStorage (pStgSave, fSameAsLoad); + + m_lpObj->m_fSaveWithSameAsLoad = fSameAsLoad; + m_lpObj->m_fNoScribbleMode = TRUE; + + return ResultFromScode( S_OK ); +} + +//********************************************************************** +// +// CPersistStorage::SaveCompleted +// +// Purpose: +// +// Called when the container is finished saving the object +// +// Parameters: +// +// LPSTORAGE pStgNew - ptr to the new storage +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// +//******************************************************************** + +STDMETHODIMP CPersistStorage::SaveCompleted ( LPSTORAGE pStgNew) +{ + TestDebugOut(TEXT("In CPersistStorage::SaveCompleted\r\n")); + + if (pStgNew) + { + ReleaseStreamsAndStorage(); + m_lpObj->m_lpStorage = pStgNew; + m_lpObj->m_lpStorage->AddRef(); + OpenStreams(pStgNew); + } + + + /* OLE2NOTE: it is only legal to perform a Save or SaveAs operation + ** on an embedded object. if the document is a file-based document + ** then we can not be changed to a IStorage-base object. + ** + ** fSameAsLoad lpStgNew Type of Save Send OnSave + ** --------------------------------------------------------- + ** TRUE NULL SAVE YES + ** TRUE ! NULL SAVE * YES + ** FALSE ! NULL SAVE AS YES + ** FALSE NULL SAVE COPY AS NO + ** + ** * this is a strange case that is possible. it is inefficient + ** for the caller; it would be better to pass lpStgNew==NULL for + ** the Save operation. + */ + + if ( pStgNew || m_lpObj->m_fSaveWithSameAsLoad) + { + if (m_lpObj->m_fNoScribbleMode) + if ( + m_lpObj->GetOleAdviseHolder()->SendOnSave()!=S_OK + // normally would clear a + // dirty bit + ) + TestDebugOut(TEXT("SendOnSave fails\n")); + m_lpObj->m_fSaveWithSameAsLoad = FALSE; + } + + m_lpObj->m_fNoScribbleMode = FALSE; + + return ResultFromScode( S_OK ); +} + +//********************************************************************** +// +// CPersistStorage::Load +// +// Purpose: +// +// Instructs the object to be loaded from storage. +// +// Parameters: +// +// LPSTORAGE pStg - Ptr to the storage in which to be loaded +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CSimpSvrObj::LoadFromStorage OBJ.CPP +// +// +// Comments: +// +// A real app will want better error checking in this method. +// +//******************************************************************** + +STDMETHODIMP CPersistStorage::Load ( LPSTORAGE pStg) +{ + TestDebugOut(TEXT("In CPersistStorage::Load\r\n")); + + // remember the storage + if (m_lpObj->m_lpStorage) + { + m_lpObj->m_lpStorage->Release(); + m_lpObj->m_lpStorage = NULL; + } + + m_lpObj->m_lpStorage = pStg; + + m_lpObj->m_lpStorage->AddRef(); + + OpenStreams(m_lpObj->m_lpStorage); + + m_lpObj->LoadFromStorage(); + + + return ResultFromScode( S_OK ); +} + + +//********************************************************************** +// +// CPersistStorage::IsDirty +// +// Purpose: +// +// Returns whether or not the object is dirty w/respect to its +// Storage +// +// Parameters: +// +// None +// +// Return Value: +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// +// +// Comments: +// +// This sample does not implement this function, although a +// real application should. +// +//******************************************************************** + +STDMETHODIMP CPersistStorage::IsDirty() +{ + TestDebugOut(TEXT("In CPersistStorage::IsDirty\r\n")); + return ResultFromScode( S_OK ); +} + +//********************************************************************** +// +// CPersistStorage::HandsOffStorage +// +// Purpose: +// +// Forces the object to release its handle to its storage. +// +// Parameters: +// +// None +// +// Return Value: +// +// S_OK +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// IStorage::Release OLE +// +//******************************************************************** + +STDMETHODIMP CPersistStorage::HandsOffStorage () +{ + TestDebugOut(TEXT("In CPersistStorage::HandsOffStorage\r\n")); + + ReleaseStreamsAndStorage(); + + return ResultFromScode( S_OK ); +} + +//********************************************************************** +// +// CPersistStorage::CreateStreams +// +// Purpose: +// +// Creates the streams that are held open for the object's lifetime. +// +// Parameters: +// +// LPSTORAGE lpStg - Storage in which to create the streams +// +// Return Value: +// +// none +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// IStorage::Release OLE +// IStream::Release OLE +// IStorage::CreateStream OLE +// +// +//******************************************************************** + +void CPersistStorage::CreateStreams(LPSTORAGE lpStg) +{ + if (m_lpObj->m_lpColorStm) + m_lpObj->m_lpColorStm->Release(); + + if (m_lpObj->m_lpSizeStm) + m_lpObj->m_lpSizeStm->Release(); + + // create a stream to save the colors + if ( + lpStg->CreateStream ( OLESTR("RGB"), + STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, + 0, + 0, + &m_lpObj->m_lpColorStm) + !=S_OK + ) + TestDebugOut(TEXT("CreateStreams fails\n")); + + // create a stream to save the size + if ( + lpStg->CreateStream ( OLESTR("size"), + STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, + 0, + 0, + &m_lpObj->m_lpSizeStm) + !=S_OK + ) + TestDebugOut(TEXT("CreateStreams fails\n")); +} + +//********************************************************************** +// +// CPersistStorage::OpenStreams +// +// Purpose: +// +// Opens the streams in a storage. +// +// Parameters: +// +// LPSTORAGE lpStg - Storage in which to open the streams. +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// IStream::Release OLE +// IStorage::OpenStream OLE +// +// +//******************************************************************** + +void CPersistStorage::OpenStreams(LPSTORAGE lpStg) +{ + if (m_lpObj->m_lpColorStm) + m_lpObj->m_lpColorStm->Release(); + + if (m_lpObj->m_lpSizeStm) + m_lpObj->m_lpSizeStm->Release(); + + // open the color stream + if ( + lpStg->OpenStream ( OLESTR("RGB"), + 0, + STGM_READWRITE | STGM_SHARE_EXCLUSIVE, + 0, + &m_lpObj->m_lpColorStm) + !=S_OK + ) + TestDebugOut(TEXT("OpenStream fails\n")); + + + // open the color stream + if ( + lpStg->OpenStream ( OLESTR("size"), + 0, + STGM_READWRITE | STGM_SHARE_EXCLUSIVE, + 0, + &m_lpObj->m_lpSizeStm) + !=S_OK + ) + TestDebugOut(TEXT("OpenStream fails\n")); + +} + +//********************************************************************** +// +// CPersistStorage::ReleaseStreamsAndStorage +// +// Purpose: +// +// Releases the stream and storage ptrs +// +// Parameters: +// +// None +// +// Return Value: +// None +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// IStream::Release OLE +// IStorage::Release OLE +// +//******************************************************************** + +void CPersistStorage::ReleaseStreamsAndStorage() +{ + if (m_lpObj->m_lpColorStm) + { + m_lpObj->m_lpColorStm->Release(); + m_lpObj->m_lpColorStm = NULL; + } + + if (m_lpObj->m_lpSizeStm) + { + m_lpObj->m_lpSizeStm->Release(); + m_lpObj->m_lpSizeStm = NULL; + } + + if (m_lpObj->m_lpStorage) + { + m_lpObj->m_lpStorage->Release(); + m_lpObj->m_lpStorage = NULL; + } +} + +//********************************************************************** +// +// CPersistStorage::CreateStreams +// +// Purpose: +// +// Creates temporary streams in a storage. +// +// Parameters: +// +// LPSTORAGE lpStg - Pointer to the storage +// +// LPSTREAM FAR* lplpTempColor - Color Stream +// +// LPSTREAM FAR* lplpTempSize - Size Stream +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// IStorage::Release OLE +// +// +//******************************************************************** + +void CPersistStorage::CreateStreams(LPSTORAGE lpStg, + LPSTREAM FAR* lplpTempColor, + LPSTREAM FAR* lplpTempSize) +{ + // create a stream to save the colors + if ( + lpStg->CreateStream ( OLESTR("RGB"), + STGM_READWRITE | STGM_SHARE_EXCLUSIVE | + STGM_CREATE, + 0, + 0, + lplpTempColor) + !=S_OK + ) + TestDebugOut(TEXT("CreateStreams fails\n")); + + // create a stream to save the size + if ( + lpStg->CreateStream ( OLESTR("size"), + STGM_READWRITE | STGM_SHARE_EXCLUSIVE | + STGM_CREATE, + 0, + 0, + lplpTempSize) + !=S_OK + ) + TestDebugOut(TEXT("CreateStreams fails\n")); +} diff --git a/private/oleutest/simpsvr/ips.h b/private/oleutest/simpsvr/ips.h new file mode 100644 index 000000000..b779691e1 --- /dev/null +++ b/private/oleutest/simpsvr/ips.h @@ -0,0 +1,50 @@ +//********************************************************************** +// File name: ips.h +// +// Definition of CPersistStorage +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** + +#if !defined( _IPS_H_) +#define _IPS_H_ + + +#include <ole2.h> +#include "obj.h" + +class CSimpSvrObj; + +interface CPersistStorage : IPersistStorage +{ +private: + CSimpSvrObj FAR * m_lpObj; + BOOL m_fSameAsLoad; + +public: + CPersistStorage::CPersistStorage(CSimpSvrObj FAR * lpSimpSvrObj) + { + m_lpObj = lpSimpSvrObj; + }; + CPersistStorage::~CPersistStorage() {}; + + STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppvObj); + STDMETHODIMP_(ULONG) AddRef (); + STDMETHODIMP_(ULONG) Release (); + + STDMETHODIMP InitNew (LPSTORAGE pStg); + STDMETHODIMP GetClassID ( LPCLSID lpClassID) ; + STDMETHODIMP Save ( LPSTORAGE pStgSave, BOOL fSameAsLoad) ; + STDMETHODIMP SaveCompleted ( LPSTORAGE pStgNew); + STDMETHODIMP Load ( LPSTORAGE pStg); + STDMETHODIMP IsDirty (); + STDMETHODIMP HandsOffStorage (); + + void ReleaseStreamsAndStorage(); + void OpenStreams(LPSTORAGE lpStg); + void CreateStreams(LPSTORAGE lpStg); + void CreateStreams(LPSTORAGE lpStg, LPSTREAM FAR *lpTempColor, LPSTREAM FAR *lpTempSize); + +}; + +#endif diff --git a/private/oleutest/simpsvr/makefile b/private/oleutest/simpsvr/makefile new file mode 100644 index 000000000..21eedcbe0 --- /dev/null +++ b/private/oleutest/simpsvr/makefile @@ -0,0 +1,12 @@ +# +# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source +# file to this component. This file merely indirects to the real make file +# that is shared by all the components of NT OS/2 +# +!ifdef NTMAKEENV +all: + echo $(BUILDMSG) +clean: all +!else +!INCLUDE $(NTMAKEENV)\makefile.def +!endif diff --git a/private/oleutest/simpsvr/makefile.new b/private/oleutest/simpsvr/makefile.new new file mode 100644 index 000000000..375852f98 --- /dev/null +++ b/private/oleutest/simpsvr/makefile.new @@ -0,0 +1,198 @@ +# ============================================================================ +# File: M A K E F I L E +# +# NMAKE description file for the SIMPSVR (in-place server) sample +# +# This is a part of the Microsoft OLE 2.0 sample library. +# Copyright (C) Microsoft Corporation, 1992-1993. All Rights Reserved. +# ============================================================================ +# +# Usage: NMAKE (build DEBUG exe) +# NMAKE DEBUG=0 (build RELEASE exe) +# +# ============================================================================ + +DEBUG=1 +WIN32=1 +MACHINE_TYPE=i386 +APPNAME=simpsvr +LANG=USA + +OPSYS=NT1X +EXPORT=1 + +############################################################################# +# The following needs to be changed when we ship the sample app. Plus the +# locations of simpsvr.exe and the UI libraries. (Look for D_LIBS, R_LIBS, +# and $(APPNAME).exe) Also, we don't need the EXPORT above. +# + +!if "$(OPSYS)"=="NT1X" +OBJDIR=OBJi1d + +# Location for NT SDK headers and libraries +NT_INC_DIR=$(IMPORT)\$(OPSYS)\h\sdk;$(IMPORT)\$(OPSYS)\h\sdk\crt; +NT_LIB_DIR=$(IMPORT)\$(OPSYS)\lib\$(OBJDIR) +!else +OBJDIR=OBJidd + +# Location for Chicago SDK headers and libraries +NT_INC_DIR=$(IMPORT)\CHICAGO\h;$(IMPORT)\CHICAGO\h\crt; +NT_LIB_DIR=$(IMPORT)\CHICAGO\lib +!endif + +# path for OLE headers and libraries +!if "$(EXPORT)"=="1" +OLE232_INC_DIR=$(CAIROLE)\h\export;$(NT_INC_DIR) +!else +OLE232_INC_DIR=$(CAIROLE)\h;$(CAIROLE)\common;$(NT_INC_DIR) +!endif # EXPORT + +OLE232_LIB_DIR=$(CAIROLE)\ilib\$(OBJDIR);$(NT_LIB_DIR) + +# location of the UI libraries +OLE2UI_DIR=..\ole2ui +OLE2UI_LIB_DIR=..\ole2ui\$(OBJDIR) + +# tools that we are using in this build +CL=$(IMPORT)\n386\bin\cl +LINK=$(COMMON)\bin\link +RC=$(COMMON)\bin\rc + +# Ensure that "nmake clean" will pick this file to do the cleaning. +NMAKE=nmake -f makefile.new + +# The location of resources from the UI library +RES=RESOURCE + +############################################################################# + +GOAL: set_vars $(APPNAME).exe + +PCH=pre + +SRCS=$(PCH).cpp app.cpp $(APPNAME).cpp icf.cpp iec.cpp ioipo.cpp ips.cpp \ + doc.cpp ido.cpp ioipao.cpp ioo.cpp obj.cpp + +INCS=$(PCH).h $(APPNAME).h obj.h ioipao.h ioipo.h ioo.h ips.h ido.h iec.h \ + app.h doc.h + +OBJS=$(SRCS:cpp=obj) + +############################################################################# + +# +# Set the resource directories. These are the directories where we pull our +# resources from. You may need to change these to point to the proper location +# of the OLE2UI resources, or just copy all the .DLG and .BMP files into your +# project's directory. +# + +!if "$(RES_DIRS)"=="" +RES_DIRS = $(OLE2UI_DIR)\$(RES)\STATIC;$(OLE2UI_DIR)\$(RES)\$(LANG) +!endif + +!if "$(WIN32)"=="1" +# +# 32-bit C/C++ Compiler +# +G_LIBS=advapi32.lib crtdll.lib gdi32.lib kernel32.lib user32.lib ntdll.lib \ + ole232.lib storag32.lib compob32.lib +WIN32FLAGS= /DUNICODE /D_WINDOWS /D_UNICODE /DINC_OLE2 /D_MT /DSTRICT \ + /Di386=1 /D_X86_=1 +# For Chicago Build +!if "$(OPSYS)"=="DOS" +WIN32FLAGS=$(WIN32FLAGS) /D_INC_OLE /DWIN32=200 /D_CHICAGO_=200 +!else +WIN32FLAGS=$(WIN32FLAGS) /DWIN32=100 +!endif +G_CPPFLAGS=/G4f /W3 /Zp8 /Gz $(WIN32FLAGS) /Gys /Yu$(PCH).h +D_CPPFLAGS=/Z7 /Od /D_DEBUG /DDBG=1 +R_CPPFLAGS=/O1 /Gs /Ogit +G_LINKFLAGS=/NOD /MACHINE:$(MACHINE_TYPE) /SECTION:.rsrc,r \ + /SECTION:.guids,r /merge:.CRT=.data /STACK:16384 +D_LINKFLAGS=/DEBUGTYPE:both,fixup /DEBUG:mapped,full +R_LINKFLAGS=/RELEASE +D_LIBS=$(OLE2UI_DIR)\$(OBJDIR)\ole2uixd.lib #..\lib\moleuicd +R_LIBS=$(OLE2UI_DIR)\$(OBJDIR)\ole2uix.lib #..\lib\moleuic +!else +# +# 16-bit C/C++ Compiler +# +G_LIBS=ole2 compobj storage libw shell +G_CPPFLAGS=/AM /G2 /W3 /Zp /Yu$(PCH).h /GA /GEs +D_CPPFLAGS=/Zi /Od /f /D_DEBUG +R_CPPFLAGS=/O1 /Gs +G_LINKFLAGS=/NOD /ONERROR:NOEXE /NOE /BATCH /STACK:16384 +D_LINKFLAGS=/COD +R_LINKFLAGS=/FAR /PACKC +D_LIBS=mlibcew ..\lib\moleuicd +R_LIBS=mlibcew ..\lib\moleuic +!endif + +!if "$(DEBUG)"=="0" +CPPFLAGS=$(G_CPPFLAGS) $(R_CPPFLAGS) +LINKFLAGS=$(G_LINKFLAGS) $(R_LINKFLAGS) +LIBS=$(R_LIBS) $(G_LIBS) +!else +CPPFLAGS=$(G_CPPFLAGS) $(D_CPPFLAGS) +LINKFLAGS=$(G_LINKFLAGS) $(D_LINKFLAGS) +LIBS=$(D_LIBS) $(G_LIBS) +!endif #//DEBUG + +############################################################################# + +set_vars: + set INCLUDE=$(OLE232_INC_DIR);$(OLE2UI_DIR);$(INCLUDE) + set LIB=$(OLE232_LIB_DIR);$(OLE2UI_LIB_DIR);$(LIB) + +############################################################################# + +$(APPNAME).exe: $(OBJS) $(APPNAME).def $(APPNAME).res +!if "$(WIN32)"=="1" + $(LINK) $(LINKFLAGS) @<< +$(OBJS: = ^ +) +$(LIBS: = ^ +) +$(APPNAME).res +/MAP:$(APPNAME).map +/OUT:$(APPNAME).exe +<< +!else + $(LINK) $(LINKFLAGS) @<< +$(OBJS: = +^ +), +$(APPNAME), +$(APPNAME), +$(LIBS: = +^ +), +$(APPNAME); +<< + $(RC) /k /t $(APPNAME).res +!endif + +$(PCH).obj: $(INCS) $(PCH).cpp + $(NMAKE) clean + $(CL) $(CPPFLAGS) /Yc$(PCH).h /c $(PCH).cpp + +.cpp.obj: + $(CL) @<< +$(CPPFLAGS) /c $< +<< + +$(APPNAME).res: resource.h $(APPNAME).h + $(RC) /r /I$(RES_DIRS) $(APPNAME).rc + +clean: + if exist $(APPNAME).exe erase $(APPNAME).exe + if exist *.pch erase *.pch + if exist *.obj erase *.obj + if exist *.sbr erase *.sbr + if exist *.pdb erase *.pdb + if exist *.map erase *.map + if exist *.res erase *.res + if exist *.aps erase *.aps + if exist *.bsc erase *.bsc + if exist *.wsp erase *.wsp + if exist *.vcw erase *.vcw diff --git a/private/oleutest/simpsvr/obj.cpp b/private/oleutest/simpsvr/obj.cpp new file mode 100644 index 000000000..586c20347 --- /dev/null +++ b/private/oleutest/simpsvr/obj.cpp @@ -0,0 +1,1151 @@ +//********************************************************************** +// File name: obj.cpp +// +// Implementation file for the CSimpSvrApp Class +// +// Functions: +// +// See obj.h for a list of member functions. +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** + +#include "pre.h" +#include "obj.h" +#include "ioo.h" +#include "ido.h" +#include "ips.h" +#include "icf.h" +#include "ioipao.h" +#include "ioipo.h" +#include "app.h" +#include "doc.h" + +//********************************************************************** +// +// CSimpSvrObj::QueryInterface +// +// Purpose: +// +// Used for interface negotiation at the "Object" level. +// +// Parameters: +// +// REFIID riid - A reference to the interface that is +// being queried. +// +// LPVOID FAR* ppvObj - An out parameter to return a pointer to +// the interface. +// +// Return Value: +// +// S_OK - The interface is supported. +// E_NOINTERFACE - The interface is not supported +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// ResultFromScode OLE API +// IUnknown::AddRef OBJ.CPP, IOO.CPP, IDO.CPP, IPS.CPP +// IOIPO.CPP, IOIPAO.CPP +// +// +//******************************************************************** + +STDMETHODIMP CSimpSvrObj::QueryInterface ( REFIID riid, LPVOID FAR* ppvObj) +{ + TestDebugOut(TEXT("In CSimpSvrObj::QueryInterface\r\n")); + + SCODE sc = S_OK; + + if (IsEqualIID(riid, IID_IUnknown)) + *ppvObj = this; + else if (IsEqualIID(riid, IID_IOleObject)) + *ppvObj = &m_OleObject; + else if (IsEqualIID(riid, IID_IDataObject)) + *ppvObj = &m_DataObject; + else if ( IsEqualIID(riid, IID_IPersistStorage) || + IsEqualIID(riid, IID_IPersist) ) + *ppvObj = &m_PersistStorage; + else if (IsEqualIID(riid, IID_IOleInPlaceObject)) + *ppvObj = &m_OleInPlaceObject; + else if (IsEqualIID(riid, IID_IOleInPlaceActiveObject)) + *ppvObj = &m_OleInPlaceActiveObject; + else + if (IsEqualIID(riid, IID_IExternalConnection)) + *ppvObj = &m_ExternalConnection; + else + { + *ppvObj = NULL; + sc = E_NOINTERFACE; + } + + if (*ppvObj) + ((LPUNKNOWN)*ppvObj)->AddRef(); + + return ResultFromScode( sc ); +} + +//********************************************************************** +// +// CSimpSvrObj::AddRef +// +// Purpose: +// +// Adds to the reference count at the Object level. +// +// Parameters: +// +// None +// +// Return Value: +// +// ULONG - The new reference count of the Object. +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CSimpSvrDoc::AddRef DOC.CPP +// +// Comments: +// +// Due to the reference counting model that is used in this +// implementation, this reference count is the sum of the +// reference counts on all interfaces. (ie IDataObject, +// IExternalConnection, IPersistStorage, IOleInPlaceActiveObject, +// IOleObject, IOleInPlaceObject) +// +//******************************************************************** + +STDMETHODIMP_(ULONG) CSimpSvrObj::AddRef () +{ + TestDebugOut(TEXT("In CSimpSvrObj::AddRef\r\n")); + + m_lpDoc->AddRef(); + + return ++m_nCount; +} + +//********************************************************************** +// +// CSimpSvrObj::Release +// +// Purpose: +// +// Decrements the reference count at this level +// +// Parameters: +// +// None +// +// Return Value: +// +// ULONG - The new reference count of the object. +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CSimpSvrDoc::Release DOC.CPP +// CSimpSvrDoc::ClearObj DOC.H +// +// Comments: +// +// Due to the reference counting model that is used in this +// implementation, this reference count is the sum of the +// reference counts on all interfaces. (ie IDataObject, +// IExternalConnection, IPersistStorage, IOleInPlaceActiveObject, +// IOleObject, IOleInPlaceObject) +// +//******************************************************************** + +STDMETHODIMP_(ULONG) CSimpSvrObj::Release () +{ + TestDebugOut(TEXT("In CSimpSvrObj::Release\r\n")); + + /* The SimpSvrObj destructor needs to access SimpSvrDoc. We want to + * hold on to the SimpSvrDoc object until we have deleted our own. + */ + CSimpSvrDoc *lpDoc=m_lpDoc; + + if (--m_nCount== 0) + { + /* We still have Doc object. But SimpSvrObj object is going away. + * So, we need to clear the obj pointer in the Doc object. + */ + lpDoc->ClearObj(); + + delete this; + + lpDoc->Release(); + return(0); + } + + lpDoc->Release(); + return m_nCount; +} + +//********************************************************************** +// +// CSimpSvrObj::CSimpSvrObj +// +// Purpose: +// +// Constructor for CSimpSvrObj. Initialize the members variables +// +// Parameters: +// +// CSimpSvrDoc FAR * lpSimpSvrDoc - ptr to the doc object +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// +//******************************************************************** +#pragma warning (disable : 4355) + // "this" used in base initializer list warning. This + // can be disabled because we are not using "this" in + // the constructor for these objects, rather we are + // just storing it for future use... +CSimpSvrObj::CSimpSvrObj(CSimpSvrDoc FAR * lpSimpSvrDoc) : + m_OleObject(this), + m_DataObject(this), + m_PersistStorage(this), + m_OleInPlaceActiveObject(this), + m_OleInPlaceObject(this), + m_ExternalConnection(this) +#pragma warning (default : 4355) // Turn the warning back on + +{ + m_lpDoc = lpSimpSvrDoc; + m_nCount = 0; + m_fInPlaceActive = FALSE; + m_fInPlaceVisible = FALSE; + m_fUIActive = FALSE; + m_hmenuShared = NULL; + m_hOleMenu = NULL; + + m_dwRegister = 0; + + m_lpFrame = NULL; + m_lpCntrDoc = NULL; + + m_lpStorage = NULL; + m_lpColorStm = NULL; + m_lpSizeStm = NULL; + m_lpOleClientSite = NULL; + m_lpOleAdviseHolder = NULL; + m_lpDataAdviseHolder = NULL; + m_lpIPSite = NULL; + + // The default object is red + m_red = 128; + m_green = 0; + m_blue = 0; + + m_size.x = 100; + m_size.y = 100; + + m_xOffset = 0; + m_yOffset = 0; + + m_scale = 1.0F; + + m_fSaveWithSameAsLoad = FALSE; + m_fNoScribbleMode = FALSE; + +} + +//********************************************************************** +// +// CSimpSvrObj::~CSimpSvrObj +// +// Purpose: +// +// Destructor for CSimpSvrObj +// +// Parameters: +// +// None +// +// Return Value: +// None +// +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// PostMessage Windows API +// CSimpSvrDoc::GetApp DOC.H +// CSimpSvrDoc::GethAppWnd DOC.H +// CSimpSvrApp::IsStartedByOle APP.CPP +// IDataAdviseHolder OLE +// IOleAdviseHolder OLE +// IOleClientSite OLE +// +// Comment: +// We need to release the DataAdviseHolder, OleClientSite and +// OleAdviseHolder if they are created by our CSimpSvrObj. +// +// +//******************************************************************** + +CSimpSvrObj::~CSimpSvrObj() +{ + TestDebugOut(TEXT("In CSimpSvrObj's Destructor \r\n")); + + // if we were started by ole, post ourselves a close message + if (m_lpDoc->GetApp()->IsStartedByOle()) + PostMessage(m_lpDoc->GethAppWnd(), WM_SYSCOMMAND, SC_CLOSE, 0L); + + /* We need to release our Data Advise Holder when we destroy our + * object. + */ + if (m_lpDataAdviseHolder) + { + m_lpDataAdviseHolder->Release(); + } + + if (m_lpOleAdviseHolder) + { + m_lpOleAdviseHolder->Release(); + } + + if (m_lpOleClientSite) + { + m_lpOleClientSite->Release(); + } +} + +//********************************************************************** +// +// CSimpSvrObj::Draw +// +// Purpose: +// +// Draws the object into an arbitrary DC +// +// Parameters: +// +// HDC hDC - DC to draw into +// +// Return Value: +// +// NONE +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CreateBrushIndirect Windows API +// SelectObject Windows API +// Rectangle Windows API +// DeleteObject Windows API +// +// +//******************************************************************** + +void CSimpSvrObj::Draw (HDC hDC, BOOL m_fMeta) +{ + LOGBRUSH lb; + + TestDebugOut(TEXT("In CSimpSvrObj::Draw\r\n")); + + TCHAR szBuffer[255]; + + wsprintf(szBuffer, TEXT("Drawing Scale %3d\r\n"),m_scale); + + TestDebugOut(szBuffer); + + if (!m_fMeta) + { + SetMapMode(hDC, MM_ANISOTROPIC); + SetWindowOrg(hDC, (int)(m_xOffset/m_scale), (int)(m_yOffset/m_scale)); + SetWindowExt(hDC, m_size.x, m_size.y); + SetViewportExt(hDC, (int)(m_size.x*m_scale), (int)(m_size.y*m_scale)); + } + + // fill out a LOGBRUSH + lb.lbStyle = BS_SOLID; + lb.lbColor = RGB(m_red, m_green, m_blue); + lb.lbHatch = 0; + + // create the brush + HBRUSH hBrush = CreateBrushIndirect(&lb); + + // select the brush + HBRUSH hOldBrush = (HBRUSH) SelectObject(hDC, hBrush); + HPEN hPen = CreatePen(PS_INSIDEFRAME, 6, RGB(0, 0, 0)); + + HPEN hOldPen = (HPEN) SelectObject(hDC, hPen); + + // draw the rectangle + Rectangle (hDC, 0, 0, m_size.x, m_size.y); + + // restore the pen + hPen = (HPEN) SelectObject(hDC, hOldPen); + + // free the pen + DeleteObject(hPen); + + // restore the old brush + hBrush = (HBRUSH) SelectObject(hDC, hOldBrush); + + // free the brush + DeleteObject(hBrush); +} + +//********************************************************************** +// +// CSimpSvrObj::GetMetaFilePict +// +// Purpose: +// +// Returns a handle to a metafile representation of the object. +// +// Parameters: +// +// None +// +// Return Value: +// +// Handle to the metafile. +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// GlobalAlloc Windows API +// GlobalLock Windows API +// SetWindowOrg Windows API +// SetWindowExt Windows API +// CreateMetaFile Windows API +// CloseMetaFile Windows API +// GlobalUnlock Windows API +// XformWidthInPixelsToHimetric OLE2UI +// XformHeightInPixelsToHimetric OLE2UI +// CSimpSvrObj::Draw OBJ.CPP +// +// +//******************************************************************** + +HANDLE CSimpSvrObj::GetMetaFilePict() +{ + HANDLE hMFP; + METAFILEPICT FAR * lpMFP; + POINT pt; + + TestDebugOut(TEXT("In CSimpSvrObj::GetMetaFilePict\r\n")); + + // allocate the memory for the METAFILEPICT structure + hMFP = GlobalAlloc (GMEM_SHARE | GHND, sizeof (METAFILEPICT) ); + if (!hMFP) + { + /* GlobalAlloc fails. Cannot allocate global memory. + */ + return(NULL); + } + lpMFP = (METAFILEPICT FAR*) GlobalLock(hMFP); + if (!lpMFP) + { + /* Cannot lock the allocated memory. + */ + return(NULL); + } + + // get the size of the object in HIMETRIC + pt.x = XformWidthInPixelsToHimetric(NULL, m_size.x); + pt.y = XformHeightInPixelsToHimetric(NULL, m_size.y); + + // fill out the METAFILEPICT structure + lpMFP->mm = MM_ANISOTROPIC; + lpMFP->xExt = pt.x; + lpMFP->yExt = pt.y; + + // Create the metafile + HDC hDC = CreateMetaFile(NULL); + + if (hDC) + { + SetWindowOrg (hDC, 0, 0); + SetWindowExt (hDC, m_size.x, + m_size.y); + + Draw(hDC); + + lpMFP->hMF = CloseMetaFile(hDC); + } + + // unlock the metafilepict + GlobalUnlock(hMFP); + + return hMFP; +} + + +//********************************************************************** +// +// CSimpSvrObj::SaveToStorage +// +// Purpose: +// +// Saves the object to the passed storage +// +// Parameters: +// +// LPSTORAGE lpStg - Storage in which to save the object +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// IStorage::CreateStream OLE +// IStream::Write OLE +// IStream::Release OLE +// +// Comments: +// +// A real app will want to do better error checking / returning +// +//******************************************************************** + +void CSimpSvrObj::SaveToStorage (LPSTORAGE lpStg, BOOL fSameAsLoad) +{ + TestDebugOut(TEXT("In CSimpSvrObj::SaveToStorage\r\n")); + + LPSTREAM lpTempColor, lpTempSize; + + if (!fSameAsLoad) + m_PersistStorage.CreateStreams( lpStg, &lpTempColor, &lpTempSize); + else + { + lpTempColor = m_lpColorStm; + lpTempColor->AddRef(); + lpTempSize = m_lpSizeStm; + lpTempSize->AddRef(); + } + + ULARGE_INTEGER uli; + + uli.LowPart = 0; + uli.HighPart = 0; + + if ( lpTempColor->SetSize(uli) != S_OK ) + goto EXIT; // we don't want to proceed further if fails + if ( lpTempSize->SetSize(uli) != S_OK ) + goto EXIT; + + LARGE_INTEGER li; + + li.LowPart = 0; + li.HighPart = 0; + + if ( lpTempColor->Seek(li, STREAM_SEEK_SET, NULL) != S_OK ) + goto EXIT; + if ( lpTempSize->Seek(li, STREAM_SEEK_SET, NULL) != S_OK ) + goto EXIT; + + // write the colors to the stream + if ( lpTempColor->Write(&m_red, sizeof(m_red), NULL) != S_OK ) + goto EXIT; + if ( lpTempColor->Write(&m_green, sizeof(m_green), NULL) != S_OK ) + goto EXIT; + if ( lpTempColor->Write(&m_blue, sizeof(m_blue), NULL) != S_OK ) + goto EXIT; + + // write the size to the stream + if ( lpTempSize->Write(&m_size, sizeof(m_size), NULL) != S_OK ) + goto EXIT; + + TestDebugOut(TEXT("SaveToStorage exits normally\n")); + +EXIT: + lpTempColor->Release(); + lpTempSize->Release(); +} + +//********************************************************************** +// +// CSimpSvrObj::LoadFromStorage +// +// Purpose: +// +// Loads the object from the passed storage +// +// Parameters: +// +// LPSTORAGE lpStg - Storage in which to load the object from +// +// Return Value: +// +// None. +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// IStorage::OpenStream OLE +// IStream::Read OLE +// IStream::Release OLE +// +// +//******************************************************************** + +void CSimpSvrObj::LoadFromStorage () +{ + TestDebugOut(TEXT("In CSimpSvrObj::LoadFromStorage\r\n")); + + // Read the colors + if ( m_lpColorStm->Read(&m_red, sizeof(m_red), NULL) != S_OK ) + return; + if ( m_lpColorStm->Read(&m_green, sizeof(m_green), NULL) != S_OK ) + return; + if ( m_lpColorStm->Read(&m_blue, sizeof(m_blue), NULL) != S_OK ) + return; + + // read the size + if ( m_lpSizeStm->Read(&m_size, sizeof(m_size), NULL) != S_OK ) + return; + + TestDebugOut(TEXT("LoadFromStorage exits normally\n")); + +} + +//********************************************************************** +// +// CSimpSvrObj::DoInPlaceActivate +// +// Purpose: +// +// Does the inplace activation for the object +// +// Parameters: +// +// LONG lVerb - Verb that caused this function to be called +// +// Return Value: +// +// TRUE/FALSE depending on success or failure. +// +// Function Calls: +// Function Location +// +// IOleClientSite::QueryInterface Container +// IOleClientSite::ShowObject Container +// IOleInPlaceSite::CanInPlaceActivate Container +// IOleInPlaceSite::Release Container +// IOleInPlaceSite::OnInPlaceActivate Container +// IOleInPlaceSite::GetWindow Container +// IOleInPlaceSite::GetWindowContext Container +// IOleInPlaceSite::OnUIActivate Container +// IOleInPlaceSite::Release Container +// IOleInPlaceFrame::SetActiveObject Container +// IOleInPlaceUIWindow::SetActiveObject Container +// TestDebugOut Windows API +// ShowWindow Windows API +// SetParent Windows API +// IntersectRect Windows API +// OffsetRect Windows API +// MoveWindow Windows API +// CopyRect Windows API +// SetFocus Windows API +// SetHatchWindowSize OLE2UI +// CSimpSvrObj::AssembleMenus OBJ.CPP +// CSimpSvrObj::AddFrameLevelUI OBJ.CPP +// +// +// Comments: +// +// Be sure to read TECHNOTES.WRI included with the OLE SDK +// for details on implementing inplace activation. +// +//******************************************************************** + +BOOL CSimpSvrObj::DoInPlaceActivate (LONG lVerb) +{ + BOOL retval = FALSE; + RECT posRect, clipRect; + + + TestDebugOut(TEXT("In CSimpSvrObj::DoInPlaceActivate\r\n")); + + // if not currently in place active + if (!m_fInPlaceActive) + { + // get the inplace site + if (m_lpOleClientSite->QueryInterface(IID_IOleInPlaceSite, + (LPVOID FAR *)&m_lpIPSite) != NOERROR) + goto error; + + + // if the inplace site could not be obtained, or refuses to inplace + // activate then goto error. + if (m_lpIPSite == NULL || m_lpIPSite->CanInPlaceActivate() != NOERROR) + { + if (m_lpIPSite) + m_lpIPSite->Release(); + m_lpIPSite = NULL; + goto error; + } + + // tell the site that we are activating. + if (m_lpIPSite->OnInPlaceActivate() != S_OK) + TestDebugOut(TEXT("OnInPlaceActivate fails\n")); + + m_fInPlaceActive = TRUE; + } + + // if not currently inplace visibl + if (!m_fInPlaceVisible) + { + m_fInPlaceVisible = TRUE; + + // get the window handle of the site + if (m_lpIPSite->GetWindow(&m_hWndParent) != S_OK) + TestDebugOut(TEXT("GetWindow fails\n")); + + // get window context from the container + m_FrameInfo.cb = sizeof(OLEINPLACEFRAMEINFO); + if (m_lpIPSite->GetWindowContext ( &m_lpFrame, + &m_lpCntrDoc, + &posRect, + &clipRect, + &m_FrameInfo) != S_OK) + TestDebugOut(TEXT("GetWindowContext fails\n")); + + if (sizeof(OLEINPLACEFRAMEINFO) != m_FrameInfo.cb) + { + TestDebugOut(TEXT("WARNING! GetWindowContext call " + "modified FrameInfo.cb!\n")); + } + + + // show the hatch window + m_lpDoc->ShowHatchWnd(); + + // Set the parenting + SetParent (m_lpDoc->GethHatchWnd(), m_hWndParent); + SetParent (m_lpDoc->GethDocWnd(), m_lpDoc->GethHatchWnd()); + + // tell the client site to show the object + if (m_lpOleClientSite->ShowObject() != S_OK) + TestDebugOut(TEXT("ShowObject fails\n")); + + RECT resRect; + + // figure out the "real" size of the object + IntersectRect(&resRect, &posRect, &clipRect); + CopyRect(&m_posRect, &posRect); + + POINT pt; + + // adjust our hatch window size + SetHatchWindowSize ( m_lpDoc->GethHatchWnd(), + &resRect, + &posRect, + &pt); + + // calculate the actual object rect inside the hatchwnd. + OffsetRect (&resRect, pt.x, pt.y); + + // move the object window + MoveWindow(m_lpDoc->GethDocWnd(), + resRect.left, + resRect.top, + resRect.right - resRect.left, + resRect.bottom - resRect.top, + FALSE); + + // create the combined window + AssembleMenus(); + } + + // if not UIActive + if (!m_fUIActive) + { + m_fUIActive = TRUE; + + // tell the inplace site that we are activating + m_lpIPSite->OnUIActivate(); + + // set the focus to our object window + SetFocus(m_lpDoc->GethDocWnd()); + + // set the active object on the frame + if (m_lpFrame->SetActiveObject(&m_OleInPlaceActiveObject, + OLESTR("Simple OLE 2.0 Server")) != S_OK) + TestDebugOut(TEXT("SetActiveObject fails\n")); + + // set the active object on the Doc, if available. + if (m_lpCntrDoc) + if (m_lpCntrDoc->SetActiveObject(&m_OleInPlaceActiveObject, + OLESTR("Simple OLE 2.0 Server")) != S_OK) + TestDebugOut(TEXT("SetActiveObjet fails\n")); + + // add the frame level UI. + AddFrameLevelUI(); + } + + retval = TRUE; +error: + return retval; +} + +//********************************************************************** +// +// CSimpSvrObj::AssembleMenus +// +// Purpose: +// +// Creates the combined menus used during inplace activation. +// +// Parameters: +// +// None +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// CreateMenu Windows API +// IOleInPlaceFrame::InsertMenus Container +// InsertMenu Windows API +// DestroyMenu Windows API +// OleCreateMenuDescriptor OLE API +// +// +//******************************************************************** + +void CSimpSvrObj::AssembleMenus() +{ + TestDebugOut(TEXT("In CSimpSvrObj::AssembleMenus\r\n")); + OLEMENUGROUPWIDTHS menugroupwidths; + + m_hmenuShared = NULL; + + // Create the menu resource + m_hmenuShared = CreateMenu(); + + // have the contaner insert its menus + if (m_lpFrame->InsertMenus (m_hmenuShared, &menugroupwidths) == NOERROR) + { + int nFirstGroup = (int) menugroupwidths.width[0]; + + // insert the server menus + InsertMenu( m_hmenuShared, nFirstGroup, MF_BYPOSITION | MF_POPUP, + (UINT)m_lpDoc->GetColorMenu(), TEXT("&Color")); + menugroupwidths.width[1] = 1; + menugroupwidths.width[3] = 0; + menugroupwidths.width[5] = 0; + } + else + { + // Destroy the menu resource + DestroyMenu(m_hmenuShared); + m_hmenuShared = NULL; + } + + // tell OLE to create the menu descriptor + m_hOleMenu = OleCreateMenuDescriptor(m_hmenuShared, &menugroupwidths); + if (!m_hOleMenu) + TestDebugOut(TEXT("OleCreateMenuDescriptor fails\n")); +} + +//********************************************************************** +// +// CSimpSvrObj::AddFrameLevelUI +// +// Purpose: +// +// Adds the Frame level user interface +// +// Parameters: +// +// None +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// IOleInPlaceFrame::SetMenu Container +// IOleInPlaceFrame::SetBorderSpace Container +// IOleInPlaceUIWindow::SetBorderSpace Container +// CSimpSvrDoc::GethDocWnd DOC.H +// +// +//******************************************************************** + +void CSimpSvrObj::AddFrameLevelUI() +{ + TestDebugOut(TEXT("In CSimpSvrObj::AddFrameLevelUI\r\n")); + + // add the combined menu + if ( m_lpFrame->SetMenu(m_hmenuShared, m_hOleMenu, + m_lpDoc->GethDocWnd()) != S_OK ) + return; + + // do hatched border + SetParent (m_lpDoc->GethHatchWnd(), m_hWndParent); + SetParent (m_lpDoc->GethDocWnd(), m_lpDoc->GethHatchWnd()); + + // set the border space. Normally we would negotiate for toolbar + // space at this point. Since this server doesn't have a toolbar, + // this isn't needed... + if (m_lpFrame) + if (m_lpFrame->SetBorderSpace(NULL) != S_OK) + return; + + if (m_lpCntrDoc) + if (m_lpCntrDoc->SetBorderSpace(NULL) != S_OK) + return; + + TestDebugOut(TEXT("AddFrameLevelUI exits\n")); + +} + +//********************************************************************** +// +// CSimpSvrObj::DoInPlaceHide +// +// Purpose: +// +// Hides the object while inplace actvie +// +// Parameters: +// +// None +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// SetParent Windows API +// CSimpSvrDoc::GethDocWnd DOC.H +// CSimpSvrDoc::GethAppWnd DOC.H +// CSimpSvrDoc::GethHatchWnd DOC.H +// CSimpSvrObj::DisassembleMenus OBJ.CPP +// IOleInPlaceFrame::Release Container +// IOleInPlaceUIWindow::Release Container +// +// +// Comments: +// +// Be sure to read TECHNOTES.WRI included with the OLE SDK +// for details on implementing inplace activation. +// +//******************************************************************** + +void CSimpSvrObj::DoInPlaceHide() +{ + TestDebugOut(TEXT("In CSimpSvrObj::DoInPlaceHide\r\n")); + + // if we aren't inplace visible, then this routine is a NOP, + if (!m_fInPlaceVisible) + return; + + m_fInPlaceVisible = FALSE; + + // change the parenting + SetParent (m_lpDoc->GethDocWnd(), m_lpDoc->GethAppWnd()); + SetParent (m_lpDoc->GethHatchWnd(),m_lpDoc->GethDocWnd()); + + // rip down the combined menus + DisassembleMenus(); + + // release the inplace frame + m_lpFrame->Release(); + + m_lpFrame = NULL; // only holding one ref. to frame. + + // release the UIWindow if it is there. + if (m_lpCntrDoc) + m_lpCntrDoc->Release(); + + m_lpCntrDoc = NULL; + +} + +//********************************************************************** +// +// CSimpSvrObj::DisassembleMenus +// +// Purpose: +// +// Disassembles the combined menus used in inplace activation +// +// Parameters: +// +// None +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// TestDebugOut Windows API +// OleDestroyMenuDescriptor OLE API +// RemoveMenu Windows API +// IOleInPlaceFrame::RemoveMenus Container +// DestroyMenu Windows API +// +// Comments: +// +// Be sure to read TECHNOTES.WRI included with the OLE SDK +// for details on implementing inplace activation. +// +//******************************************************************** + +void CSimpSvrObj::DisassembleMenus() +{ + // destroy the menu descriptor + OleDestroyMenuDescriptor(m_hOleMenu); + + if (m_hmenuShared) + { + // remove the menus that we added + RemoveMenu( m_hmenuShared, 1, MF_BYPOSITION); + + // have the container remove its menus + if (m_lpFrame->RemoveMenus(m_hmenuShared) != S_OK) + TestDebugOut(TEXT("RemoveMenus fails\n")); + + // Destroy the menu resource + DestroyMenu(m_hmenuShared); + + m_hmenuShared = NULL; + } +} + +//********************************************************************** +// +// CSimpSvrObj::SendOnDataChange +// +// Purpose: +// +// Uses the data advise holder to send a data change, then updates +// the ROT to note the time of change. +// +// Parameters: +// +// None +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// IDataAdviseHolder::SendOnDataChange OLE API +// GetRunningObjectTable OLE API +// CoFileTimeNow OLE API +// IRunningObjectTable::NoteChangeTime OLE API +// +// +//******************************************************************** + +void CSimpSvrObj::SendOnDataChange() +{ + if (m_lpDataAdviseHolder) + if (m_lpDataAdviseHolder->SendOnDataChange( (LPDATAOBJECT) + &m_DataObject, 0, 0)) + TestDebugOut(TEXT("SendOnDataChange fails\n")); + + LPRUNNINGOBJECTTABLE lpRot; + + GetRunningObjectTable(0, &lpRot); + + if ( lpRot && m_dwRegister) + { + + FILETIME ft; + CoFileTimeNow(&ft); + + lpRot->NoteChangeTime(m_dwRegister, &ft); + + lpRot->Release(); + } +} + + +//********************************************************************** +// +// CSimpSvrObj::DeactivateUI +// +// Purpose: +// +// Breaks down the inplace ui +// +// Parameters: +// +// None +// +// Return Value: +// +// None +// +// Function Calls: +// Function Location +// +// SetParent Windows API +// IOleInPlaceUIWindow::SetActiveObject Container +// IOleInPlaceFrame::SetActiveObject Container +// IOleInPlaceSite::UIDeactivate Container +// +// +//******************************************************************** + +void CSimpSvrObj::DeactivateUI() +{ + // if not UI active, or no pointer to IOleInPlaceFrame, then + // return NOERROR + if (!(m_fUIActive || m_lpFrame)) + return; + else + { + m_fUIActive = FALSE; + + // remove hatching + SetParent (m_lpDoc->GethDocWnd(), m_lpDoc->GethAppWnd()); + SetParent (m_lpDoc->GethHatchWnd(),m_lpDoc->GethDocWnd()); + + // if in an MDI container, call SetActiveObject on the DOC. + if (m_lpCntrDoc) + if (m_lpCntrDoc->SetActiveObject(NULL, NULL) != S_OK) + TestDebugOut(TEXT("Fail in SetActiveObject\n")); + + if (m_lpFrame->SetActiveObject(NULL, NULL) != S_OK) + TestDebugOut(TEXT("Fail in SetActiveObject\n")); + + // tell the container that our UI is going away. + if (m_lpIPSite) + if (m_lpIPSite->OnUIDeactivate(FALSE) != S_OK) + TestDebugOut(TEXT("Fail in OnUIDeactivate\n")); + } +} + diff --git a/private/oleutest/simpsvr/obj.h b/private/oleutest/simpsvr/obj.h new file mode 100644 index 000000000..e7258802f --- /dev/null +++ b/private/oleutest/simpsvr/obj.h @@ -0,0 +1,141 @@ +//********************************************************************** +// File name: obj.h +// +// Definition of CSimpSvrObj +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** + +#if !defined( _OBJ_H_) +#define _OBJ_H_ + +#include "ioipao.h" +#include "ioipo.h" +#include "ioo.h" +#include "ips.h" +#include "ido.h" +#include "iec.h" + +class CSimpSvrDoc; +interface COleObject; +interface CPersistStorage; +interface CDataObject; +interface COleInPlaceActiveObject; +interface COleInPlaceObject; +interface CExternalConnection; + +class CSimpSvrObj : public IUnknown +{ +private: + CSimpSvrDoc FAR * m_lpDoc; // Back pointer + int m_nCount; // reference count + BOOL m_fInPlaceActive; // Used during InPlace Negotiation + BOOL m_fInPlaceVisible; // " " " " " " " " " + BOOL m_fUIActive; // " " " " " " " " " + HMENU m_hmenuShared; // " " " " " " " " " + HOLEMENU m_hOleMenu; // " " " " " " " " " + RECT m_posRect; // " " " " " " " " " + OLEINPLACEFRAMEINFO m_FrameInfo; + BOOL m_fSaveWithSameAsLoad; + BOOL m_fNoScribbleMode; + + DWORD m_dwRegister; // Registered in ROT + + int m_red, m_green, m_blue; // current color + POINT m_size; // current size + int m_xOffset; + int m_yOffset; + float m_scale; + + HWND m_hWndParent; // parent window handle + + // interfaces used + LPSTORAGE m_lpStorage; + LPSTREAM m_lpColorStm, m_lpSizeStm; + LPOLECLIENTSITE m_lpOleClientSite; // IOleClientSite + LPOLEADVISEHOLDER m_lpOleAdviseHolder; // IOleAdviseHolder + LPDATAADVISEHOLDER m_lpDataAdviseHolder; // IDataAdviseHolder + LPOLEINPLACEFRAME m_lpFrame; // IOleInPlaceFrame + LPOLEINPLACEUIWINDOW m_lpCntrDoc; // IOleInPlaceUIWindow + LPOLEINPLACESITE m_lpIPSite; // IOleInPlaceSite + + // interface implemented + COleObject m_OleObject; // IOleObject + CPersistStorage m_PersistStorage; // IPersistStorage + CDataObject m_DataObject; // IDataObject + COleInPlaceActiveObject m_OleInPlaceActiveObject; // IOleInPlaceActiveObject + COleInPlaceObject m_OleInPlaceObject; // IOleInPlaceObject + CExternalConnection m_ExternalConnection; + +public: + STDMETHODIMP QueryInterface (REFIID riid, LPVOID FAR* ppvObj); + STDMETHODIMP_(ULONG) AddRef (); + STDMETHODIMP_(ULONG) Release (); + +// construction/destruction + CSimpSvrObj(CSimpSvrDoc FAR * lpSimpSvrDoc); + ~CSimpSvrObj(); + +// utility functions + void Draw(HDC hDC, BOOL fMetaDC = TRUE); + void PaintObj(HDC hDC); + void lButtonDown(WPARAM wParam,LPARAM lParam); + HANDLE GetMetaFilePict(); + void SaveToStorage (LPSTORAGE lpStg, BOOL fSameAsLoad); + void LoadFromStorage (); + +// visual editing helper functions + BOOL DoInPlaceActivate (LONG lVerb); + void AssembleMenus(); + void AddFrameLevelUI(); + void DoInPlaceHide(); + void DisassembleMenus(); + void SendOnDataChange(); + void DeactivateUI(); + +// member variable access + inline BOOL IsInPlaceActive() { return m_fInPlaceActive; }; + inline BOOL IsInPlaceVisible() { return m_fInPlaceVisible; }; + inline BOOL IsUIActive() { return m_fUIActive; }; + inline HWND GetParent() { return m_hWndParent; }; + inline LPSTORAGE GetStorage() { return m_lpStorage; }; + inline LPOLECLIENTSITE GetOleClientSite() { return m_lpOleClientSite; }; + inline LPDATAADVISEHOLDER GetDataAdviseHolder() { return m_lpDataAdviseHolder; }; + inline LPOLEADVISEHOLDER GetOleAdviseHolder() { return m_lpOleAdviseHolder; }; + inline LPOLEINPLACEFRAME GetInPlaceFrame() { return m_lpFrame; }; + inline LPOLEINPLACEUIWINDOW GetUIWindow() { return m_lpCntrDoc; }; + inline LPOLEINPLACESITE GetInPlaceSite() { return m_lpIPSite; }; + inline COleObject FAR * GetOleObject() { return &m_OleObject; }; + inline CPersistStorage FAR * GetPersistStorage() { return &m_PersistStorage; }; + inline CDataObject FAR * GetDataObject() { return &m_DataObject; }; + inline COleInPlaceActiveObject FAR * GetOleInPlaceActiveObject() { return &m_OleInPlaceActiveObject; }; + inline COleInPlaceObject FAR * GetOleInPlaceObject() { return &m_OleInPlaceObject; }; + inline void ClearOleClientSite() { m_lpOleClientSite = NULL; }; + inline void ClearDataAdviseHolder() { m_lpDataAdviseHolder = NULL; }; + inline void ClearOleAdviseHolder() { m_lpOleAdviseHolder = NULL; }; + inline LPRECT GetPosRect() { return &m_posRect; }; + inline LPPOINT GetSize() { return &m_size; }; + inline LPOLEINPLACEFRAMEINFO GetFrameInfo() {return &m_FrameInfo;}; + inline DWORD GetRotRegister() { return m_dwRegister; }; + inline void ClearDoc() { m_lpDoc = NULL; }; + + // member manipulation + inline void SetColor (int nRed, int nGreen, int nBlue) + { m_red = nRed; m_green = nGreen; m_blue = nBlue; }; + + inline void RotateColor() + { m_red+=10; m_green+=10; m_blue+=10;}; + + +// all of the interface implementations should be friends of this +// class +friend interface COleObject; +friend interface CPersistStorage; +friend interface CDataObject; +friend interface COleInPlaceActiveObject; +friend interface COleInPlaceObject; +friend interface CExternalConnection; + +}; +#endif + diff --git a/private/oleutest/simpsvr/pre.cpp b/private/oleutest/simpsvr/pre.cpp new file mode 100644 index 000000000..9603f4089 --- /dev/null +++ b/private/oleutest/simpsvr/pre.cpp @@ -0,0 +1,9 @@ +//********************************************************************** +// File name: pre.cpp +// +// Used for precompiled headers +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** + +#include "pre.h" diff --git a/private/oleutest/simpsvr/pre.h b/private/oleutest/simpsvr/pre.h new file mode 100644 index 000000000..a4354e08b --- /dev/null +++ b/private/oleutest/simpsvr/pre.h @@ -0,0 +1,29 @@ +//********************************************************************** +// File name: pre.h +// +// Used for precompiled headers +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** + +#if !defined( _PRE_H_) +#define _PRE_H_ + +#include <windows.h> + +#include <ole2.h> +#include <ole2ui.h> +#include <assert.h> +#include <string.h> +#include "simpsvr.h" +#include "resource.h" +extern "C" void TestDebugOut(LPSTR psz); +#ifndef WIN32 +/* Since OLE is part of the operating system in Win32, we don't need to + * check the version number in Win32. + */ +#include <ole2ver.h> +#endif // WIN32 + + +#endif diff --git a/private/oleutest/simpsvr/readme.txt b/private/oleutest/simpsvr/readme.txt new file mode 100644 index 000000000..47995de7b --- /dev/null +++ b/private/oleutest/simpsvr/readme.txt @@ -0,0 +1,32 @@ +Simpsvr +-------- +This sample is the simplest OLE 2.0 object that can be written and +still support the visual editing feature. The object that this server +supports is a colored square with a black border. + +See the MAKEFILE for compilation instructions. + + +Simple Server Objects Overview +------------------------------ +Simple server consists of three main objects. The top level is CSimpSvrApp, +under which is CSimpSvrDoc, and the innermost level is CSimpSvrObj.CSimpSvrApp +is used to hold all the main window information. (eg. handle to the main +window, handles to the main, color, and help menus and the application +instance) Therefore, CSimpSvrApp always exists as long as the simple server +application is alive. The CSimpSvrApp instantiates the Class Factory, if +simple server is started as embedding. (ie. started by OLE) The next level +object is CSimpSvrDoc object. It is instantiated by the time CSimpSvrApp is +created. It manipulates the document window and also the hatch window. +(See OLE2UI for detail on the hatch window) The CSimpSvrObj, the innermost +simple server object, shows six OLE interfaces implementations in its nested +classes. The six OLE interfaces demonstrated are IOleObject, IPersistStorage, +IDataObject,IOleInPlaceActiveObject,IOleInPlaceObject,and IExternalConnection. +These six interfaces are implemented as different classes namely: COleObject, +CPersistStorage, CDataObject, COleInPlaceActiveObject, COleInPlaceObject, +and CExternalConnection. The CSimpSvrObj handles the drawing of the object +and all the OLE connections between the container and the server. + + + +
\ No newline at end of file diff --git a/private/oleutest/simpsvr/resource.h b/private/oleutest/simpsvr/resource.h new file mode 100644 index 000000000..33ab749ae --- /dev/null +++ b/private/oleutest/simpsvr/resource.h @@ -0,0 +1,32 @@ +//{{NO_DEPENDENCIES}} +// App Studio generated include file. +// Used by SIMPSVR.RC +// +#define IDM_OPEN 102 +#define IDM_SAVE 103 +#define IDM_SAVEAS 104 +#define IDM_PRINT 105 +#define IDM_EXIT 106 +#define IDM_UNDO 107 +#define IDM_CUT 108 +#define IDM_COPY 109 +#define IDM_PASTE 110 +#define ID_EDIT_INSERTOBJECT 111 +#define IDM_INSERTOBJECT 111 +#define IDM_NEW 112 +#define IDM_RED 113 +#define IDM_GREEN 114 +#define IDM_BLUE 115 +#define IDM_COLOROWNERDR 116 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS + +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 117 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/private/oleutest/simpsvr/simpsvr.cpp b/private/oleutest/simpsvr/simpsvr.cpp new file mode 100644 index 000000000..deedbae65 --- /dev/null +++ b/private/oleutest/simpsvr/simpsvr.cpp @@ -0,0 +1,454 @@ +//********************************************************************** +// File name: simpsvr.cpp +// +// Main source file for the simple OLE 2.0 server +// +// Functions: +// +// WinMain - Program entry point +// MainWndProc - Processes messages for the frame window +// About - Processes messages for the about dialog +// DocWndProc - Processes messages for the doc window +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** + +#include "pre.h" +#include "obj.h" +#include "app.h" +#include "doc.h" +#include "icf.h" +#include <stdlib.h> +#include <testmess.h> + +#define MEASUREITEMWIDTH 40 +#define MEASUREITEMHEIGHT 40 + +// This line is needed for the debug utilities in OLE2UI +extern "C" { + OLEDBGDATA_MAIN(TEXT("SIMPSVR")) +} + +BOOL fBeVerbose = FALSE; +extern "C" +void TestDebugOut(LPSTR psz) +{ + if (fBeVerbose) + { + OutputDebugStringA(psz); + } +} + +CSimpSvrApp FAR * lpCSimpSvrApp; +CClassFactory FAR * lpClassFactory; + +//********************************************************************** +// +// WinMain +// +// Purpose: +// +// Program entry point +// +// Parameters: +// +// HANDLE hInstance - Instance handle for this instance +// +// HANDLE hPrevInstance - Instance handle for the last instance +// +// LPSTR lpCmdLine - Pointer to the command line +// +// int nCmdShow - Window State +// +// Return Value: +// +// msg.wParam +// +// Function Calls: +// Function Location +// +// CSimpSvrApp::CSimpSvrApp APP.CPP +// CSimpSvrApp::fInitApplication APP.CPP +// CSimpSvrApp::fInitInstance APP.CPP +// CSimpSvrApp::HandleAccelerators APP.CPP +// CSimpSvrApp::~CSimpSvrApp APP.CPP +// OleUIInitialize OLE2UI +// OleUIUninitialize OLE2UI +// GetMessage Windows API +// TranslateMessage Windows API +// DispatchMessage Windows API +// +// +//******************************************************************** + +int PASCAL WinMain +#ifdef WIN32 + (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +#else + (HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +#endif +{ + MSG msg; + fBeVerbose = GetProfileInt("OLEUTEST","BeVerbose",0); + + if(fBeVerbose == 0) + { + fBeVerbose = GetProfileInt("OLEUTEST","simpsvr",0); + } + + TestDebugOut(TEXT("Starting Simpsvr.....\n")); + + // recommended size for OLE apps + SetMessageQueue(96); + + lpCSimpSvrApp = new CSimpSvrApp; + + if (!lpCSimpSvrApp) + { + /* memory allocation error. We cannot carry on. + */ + MessageBox(NULL, TEXT("Out of Memory"), TEXT("SimpSvr"), + MB_SYSTEMMODAL | MB_ICONHAND); + return(FALSE); + } + + lpCSimpSvrApp->AddRef(); // need the app ref. count at 1 to hold the + // app alive. + + lpCSimpSvrApp->ParseCmdLine(lpCmdLine); + + // app initialization + if (!hPrevInstance) + if (!lpCSimpSvrApp->fInitApplication(hInstance)) + { + // We need to release CSimpSvrApp before we go away + lpCSimpSvrApp->Release(); + return (FALSE); + } + + // instance initialization + if (!lpCSimpSvrApp->fInitInstance(hInstance, nCmdShow, lpClassFactory)) + { + // We need to release CSimpSvrApp before we go away + lpCSimpSvrApp->Release(); + return (FALSE); + } + + /* Initialization required for OLE 2 UI library. This call is + ** needed ONLY if we are using the static link version of the UI + ** library. If we are using the DLL version, we should NOT call + ** this function in our application. + ** The 3rd and 4th parameters passed the OleUIInitialize + ** function are strings which are used to name two custom + ** control classes used by the OLE2UI library. These strings + ** must be unique for each application that uses the OLE2UI + ** library. These strings are typically composed by combining + ** the APPNAME with a suffix in order to be unique for a + ** particular application. The special symbols "SZCLASSICONBOX" + ** and "SZCLASSRESULTIMAGE" are used define these strings. These + ** symbols must be defined in a header file that is included + ** both in this file AND the resource file that included the + ** "OLE2UI.RC" resoure file. These symbols should be used in the + ** call to OleUIInitialize and are referenced in the INSOBJ.DLG + ** and PASTESPL.DLG resouce files of the OLE2UI library. + */ + if (!OleUIInitialize(hInstance, hPrevInstance, TEXT(SZCLASSICONBOX), + TEXT(SZCLASSRESULTIMAGE))) + { + OleDbgOut(TEXT("Could not initialize OLEUI library\n")); + + // We need to release CSimpSvrApp before we go away + lpCSimpSvrApp->Release(); + + return FALSE; + } + + // message loop + while (GetMessage(&msg, NULL, NULL, NULL)) + { + // Is this an accelerator for us? -- Remember that this server + // only has one window and only processes one object at a time. + if (TranslateAccelerator(lpCSimpSvrApp->GethAppWnd(), + lpCSimpSvrApp->m_hAccel, &msg)) + { + // Yes -- so we can loop for the next message + continue; + } + + if (lpCSimpSvrApp->IsInPlaceActive()) + { + // Only key messages need to be sent to OleTranslateAccelerator. + // Any other message would result in an extra FAR call to occur + // for that message processing... + + if ((msg.message >= WM_KEYFIRST) && (msg.message <= WM_KEYLAST)) + { + // OleTranslateAccelerator MUST be called, even though this + // application does not have an accelerator table. This has + // to be done in order for the mneumonics for the top level + // menu items to work properly. + + if (OleTranslateAccelerator( + lpCSimpSvrApp->GetDoc()->GetObj()->GetInPlaceFrame(), + lpCSimpSvrApp->GetDoc()->GetObj()->GetFrameInfo(), + &msg) == NOERROR) + { + continue; + } + } + } + + TranslateMessage(&msg); /* Translates virtual key codes */ + DispatchMessage(&msg); /* Dispatches message to window */ + } + + // De-initialization for UI libraries. Just like OleUIInitialize, this + // funciton is needed ONLY if we are using the static link version of the + // OLE UI library. + OleUIUninitialize(); + + return (msg.wParam); /* Returns the value from PostQuitMessage */ +} + + +//********************************************************************** +// +// MainWndProc +// +// Purpose: +// +// Processes messages for the main frame window +// +// Parameters: +// +// HWND hWnd - Window handle for frame window +// +// UINT message - Message value +// +// WPARAM wParam - Message info +// +// LPARAM lParam - Message info +// +// Return Value: +// +// long +// +// Function Calls: +// Function Location +// +// CSimpSvrApp::lCommandHandler APP.CPP +// CSimpSvrApp::DestroyDocs APP.CPP +// CSimpSvrApp::lCreateDoc APP.CPP +// CSimpSvrApp::lSizeHandler APP.CPP +// CGameDoc::lAddVerbs DOC.CPP +// PostQuitMessage Windows API +// DefWindowProc Windows API +// +// +//******************************************************************** + +long FAR PASCAL EXPORT MainWndProc(HWND hWnd,UINT message,WPARAM wParam, + LPARAM lParam) +{ + + switch (message) + { + case WM_CLOSE: + TestDebugOut(TEXT("*** In WM_CLOSE *** \r\n")); + + // if there is still a document + if (lpCSimpSvrApp->GetDoc()) + + // if there is still an object within a document + if (lpCSimpSvrApp->GetDoc()->GetObj()) + // this case occurs if there is still + // an outstanding Ref count on the object + // when the app is trying to go away. + // typically this case will occur in + // the "open" editing mode. + // + // Close the document + lpCSimpSvrApp->GetDoc()->Close(); + + // hide the app window + lpCSimpSvrApp->HideAppWnd(); + + // if we were started by ole, unregister the class factory, + // otherwise remove the ref count on our dummy OLE object + if (lpCSimpSvrApp->IsStartedByOle()) + { + if (CoRevokeClassObject(lpCSimpSvrApp->GetRegisterClass()) + != S_OK) + TestDebugOut(TEXT("Fail in CoRevokeClassObject\n")); + } + else + lpCSimpSvrApp->GetOleObject()->Release(); + + lpCSimpSvrApp->Release(); // This should close the app. + + break; + + case WM_COMMAND: // message: command from application menu + return lpCSimpSvrApp->lCommandHandler(hWnd, message, + wParam, lParam); + break; + + case WM_CREATE: + return lpCSimpSvrApp->lCreateDoc(hWnd, message, wParam, lParam); + break; + + case WM_DESTROY: // message: window being destroyed + PostQuitMessage(0); + break; + + case WM_MEASUREITEM: + ((LPMEASUREITEMSTRUCT)lParam)->itemWidth = MEASUREITEMWIDTH; + ((LPMEASUREITEMSTRUCT)lParam)->itemHeight = MEASUREITEMHEIGHT; + break; + + case WM_DRAWITEM: + lpCSimpSvrApp->HandleDrawItem((LPDRAWITEMSTRUCT) lParam); + break; + + case WM_SIZE: + return lpCSimpSvrApp->lSizeHandler(hWnd, message, wParam, lParam); + + default: // Passes it on if unproccessed + return (DefWindowProc(hWnd, message, wParam, lParam)); + } + return (NULL); +} + + +//********************************************************************** +// +// About +// +// Purpose: +// +// Processes dialog box messages +// +// Parameters: +// +// HWND hWnd - Window handle for dialog box +// +// UINT message - Message value +// +// WPARAM wParam - Message info +// +// LPARAM lParam - Message info +// +// Return Value: +// +// +// Function Calls: +// Function Location +// +// EndDialog Windows API +// +// +//******************************************************************** + +BOOL +#ifdef WIN32 + CALLBACK +#else + FAR PASCAL EXPORT +#endif + About(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam) +{ + switch (message) + { + case WM_INITDIALOG: /* message: initialize dialog box */ + return (TRUE); + + case WM_COMMAND: /* message: received a command */ + if (wParam == IDOK /* "OK" box selected? */ + || wParam == IDCANCEL) /* System menu close command? */ + { + EndDialog(hDlg, TRUE); /* Exits the dialog box */ + return (TRUE); + } + break; + } + return (FALSE); /* Didn't process a message */ +} + +//********************************************************************** +// +// DocWndProc +// +// Purpose: +// +// Processes dialog box messages +// +// Parameters: +// +// HWND hWnd - Window handle for doc window +// +// UINT message - Message value +// +// WPARAM wParam - Message info +// +// LPARAM lParam - Message info +// +// Return Value: +// +// Function Calls: +// Function Location +// +// CSimpSvrApp::PaintApp APP.CPP +// BeginPaint Windows API +// EndPaint Windows API +// DefWindowProc Windows API +// IOleObject::QueryInterface Object +// IOleInPlaceObject::UIDeactivate Object +// IOleObject::DoVerb Object +// IOleInPlaceObject::Release Object +// +// +//******************************************************************** + +long FAR PASCAL EXPORT DocWndProc(HWND hWnd,UINT message,WPARAM wParam, + LPARAM lParam) +{ + HDC hDC; + PAINTSTRUCT ps; + + switch (message) + { + case WM_COMMAND: // message: command from application menu + return lpCSimpSvrApp->lCommandHandler(hWnd, message, + wParam, lParam); + break; + + case WM_PAINT: + hDC = BeginPaint(hWnd, &ps); + + // tell the app class to paint itself + if (lpCSimpSvrApp) + lpCSimpSvrApp->PaintApp (hDC); + + EndPaint(hWnd, &ps); + break; + + case WM_MENUSELECT: + lpCSimpSvrApp->SetStatusText(); + break; + + case WM_MEASUREITEM: + ((LPMEASUREITEMSTRUCT)lParam)->itemWidth = MEASUREITEMWIDTH; + ((LPMEASUREITEMSTRUCT)lParam)->itemHeight = MEASUREITEMHEIGHT; + break; + + case WM_DRAWITEM: + lpCSimpSvrApp->HandleDrawItem((LPDRAWITEMSTRUCT) lParam); + break; + + + default: /* Passes it on if unproccessed */ + return (DefWindowProc(hWnd, message, wParam, lParam)); + } + return (NULL); +} + diff --git a/private/oleutest/simpsvr/simpsvr.def b/private/oleutest/simpsvr/simpsvr.def new file mode 100644 index 000000000..b0bba115b --- /dev/null +++ b/private/oleutest/simpsvr/simpsvr.def @@ -0,0 +1,26 @@ +; module-definition file for generic -- used by LINK.EXE + +NAME SIMPSVR ; application's module name + +DESCRIPTION 'Sample Microsoft Windows Application' + +EXETYPE WINDOWS ; required for all Windows applications + +STUB 'WINSTUB.EXE' ; Generates error message if application + ; is run without Windows + +;CODE can be moved in memory and discarded/reloaded +CODE PRELOAD MOVEABLE DISCARDABLE + +;DATA must be MULTIPLE if program can be invoked more than once +DATA PRELOAD MOVEABLE MULTIPLE + + +HEAPSIZE 1024 +STACKSIZE 16000 + + +; All functions that will be called by any Windows routine +; MUST be exported. + + diff --git a/private/oleutest/simpsvr/simpsvr.h b/private/oleutest/simpsvr/simpsvr.h new file mode 100644 index 000000000..df252579a --- /dev/null +++ b/private/oleutest/simpsvr/simpsvr.h @@ -0,0 +1,49 @@ +//********************************************************************** +// File name: simpsvr.h +// +// Copyright (c) 1993 Microsoft Corporation. All rights reserved. +//********************************************************************** +#define IDM_ABOUT 100 +#define IDM_INSERT 101 +#define IDM_VERB0 1000 + +int PASCAL WinMain +#ifdef WIN32 + (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow); +#else + (HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpCmdLine, int nCmdShow); +#endif + +BOOL InitApplication(HANDLE hInstance); +BOOL InitInstance(HANDLE hInstance, int nCmdShow); +long FAR PASCAL EXPORT MainWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); +long FAR PASCAL EXPORT DocWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); +#ifdef WIN32 +BOOL CALLBACK About(HWND hDlg, UINT message, WORD wParam, LONG lParam); +#else +BOOL FAR PASCAL EXPORT About(HWND hDlg, UINT message, WORD wParam, LONG lParam); +#endif + +#define SZCLASSICONBOX "SimpSvrIBClass" +#define SZCLASSRESULTIMAGE "SimpSvrRIClass" + +#ifdef WIN32 + // The following functions are all obsolete in Win32. + // By using the following macros, we can use the app in both Win16 and + // Win32 + #define SetWindowOrg(h,x,y) SetWindowOrgEx((h),(x),(y),NULL) + #define SetWindowExt(h,x,y) SetWindowExtEx((h),(x),(y),NULL) + #define SetViewportExt(h,x,y) SetViewportExtEx((h),(x),(y),NULL) + #ifndef EXPORT + #define EXPORT + #endif +#else + + #ifndef EXPORT + // _export is obsolete in Win32 + #define EXPORT _export + #endif + +#endif + + diff --git a/private/oleutest/simpsvr/simpsvr.ico b/private/oleutest/simpsvr/simpsvr.ico Binary files differnew file mode 100644 index 000000000..f351bc754 --- /dev/null +++ b/private/oleutest/simpsvr/simpsvr.ico diff --git a/private/oleutest/simpsvr/simpsvr.mak b/private/oleutest/simpsvr/simpsvr.mak new file mode 100644 index 000000000..213722358 --- /dev/null +++ b/private/oleutest/simpsvr/simpsvr.mak @@ -0,0 +1,439 @@ +# Microsoft Visual C++ generated build script - Do not modify + +PROJ = SIMPSVR +DEBUG = 1 +PROGTYPE = 0 +CALLER = +ARGS = +DLLS = +D_RCDEFINES = /d_DEBUG +R_RCDEFINES = /dNDEBUG +ORIGIN = MSVC +ORIGIN_VER = 1.00 +PROJPATH = C:\OLE2SAMP\SIMPSVR\ +USEMFC = 0 +CC = cl +CPP = cl +CXX = cl +CCREATEPCHFLAG = +CPPCREATEPCHFLAG = /YcPRE.H +CUSEPCHFLAG = +CPPUSEPCHFLAG = /YuPRE.H +FIRSTC = +FIRSTCPP = PRE.CPP +RC = rc +CFLAGS_D_WEXE = /nologo /G2 /W3 /Zi /AM /Od /D "_DEBUG" /FR /GA /Fd"BMGAME.PDB" +CFLAGS_R_WEXE = /nologo /G2 /W3 /AM /O1 /D "NDEBUG" /FR /GA /Fp"BMGAME.PCH" +LFLAGS_D_WEXE = /NOLOGO /NOD /ALIGN:16 /ONERROR:NOEXE /CO +LFLAGS_R_WEXE = /NOLOGO /NOD /ALIGN:16 /ONERROR:NOEXE +LIBS_D_WEXE = oldnames libw mlibcew ole2 storage ole2uixd commdlg.lib shell.lib +LIBS_R_WEXE = oldnames libw mlibcew ole2 storage outlui commdlg.lib shell.lib +RCFLAGS = /nologo +RESFLAGS = /nologo /k +RUNFLAGS = +DEFFILE = SIMPSVR.DEF +OBJS_EXT = +LIBS_EXT = +!if "$(DEBUG)" == "1" +CFLAGS = $(CFLAGS_D_WEXE) +LFLAGS = $(LFLAGS_D_WEXE) +LIBS = $(LIBS_D_WEXE) +MAPFILE = nul +RCDEFINES = $(D_RCDEFINES) +!else +CFLAGS = $(CFLAGS_R_WEXE) +LFLAGS = $(LFLAGS_R_WEXE) +LIBS = $(LIBS_R_WEXE) +MAPFILE = nul +RCDEFINES = $(R_RCDEFINES) +!endif +!if [if exist MSVC.BND del MSVC.BND] +!endif +SBRS = PRE.SBR \ + ICF.SBR \ + IDO.SBR \ + IOIPAO.SBR \ + IOIPO.SBR \ + IOO.SBR \ + IPS.SBR \ + OBJ.SBR \ + SIMPSVR.SBR \ + DOC.SBR \ + IEC.SBR \ + APP.SBR + + +APP_DEP = c:\ole2samp\simpsvr\pre.h \ + c:\ole2samp\release\ole2.h \ + c:\ole2samp\release\compobj.h \ + c:\ole2samp\release\scode.h \ + c:\ole2samp\release\initguid.h \ + c:\ole2samp\release\coguid.h \ + c:\ole2samp\release\oleguid.h \ + c:\ole2samp\release\dvobj.h \ + c:\ole2samp\release\storage.h \ + c:\ole2samp\release\moniker.h \ + c:\ole2samp\release\ole2ui.h \ + c:\ole2samp\release\olestd.h \ + c:\ole2samp\simpsvr\simpsvr.h \ + c:\ole2samp\release\ole2ver.h \ + c:\ole2samp\simpsvr\obj.h \ + c:\ole2samp\simpsvr\ioipao.h \ + c:\ole2samp\simpsvr\ioipo.h \ + c:\ole2samp\simpsvr\ioo.h \ + c:\ole2samp\simpsvr\ips.h \ + c:\ole2samp\simpsvr\ido.h \ + c:\ole2samp\simpsvr\iec.h \ + c:\ole2samp\simpsvr\app.h \ + c:\ole2samp\simpsvr\doc.h \ + c:\ole2samp\simpsvr\icf.h + + +ICF_DEP = c:\ole2samp\simpsvr\pre.h \ + c:\ole2samp\release\ole2.h \ + c:\ole2samp\release\compobj.h \ + c:\ole2samp\release\scode.h \ + c:\ole2samp\release\initguid.h \ + c:\ole2samp\release\coguid.h \ + c:\ole2samp\release\oleguid.h \ + c:\ole2samp\release\dvobj.h \ + c:\ole2samp\release\storage.h \ + c:\ole2samp\release\moniker.h \ + c:\ole2samp\release\ole2ui.h \ + c:\ole2samp\release\olestd.h \ + c:\ole2samp\simpsvr\simpsvr.h \ + c:\ole2samp\release\ole2ver.h \ + c:\ole2samp\simpsvr\app.h \ + c:\ole2samp\simpsvr\doc.h \ + c:\ole2samp\simpsvr\icf.h + + +IDO_DEP = c:\ole2samp\simpsvr\pre.h \ + c:\ole2samp\release\ole2.h \ + c:\ole2samp\release\compobj.h \ + c:\ole2samp\release\scode.h \ + c:\ole2samp\release\initguid.h \ + c:\ole2samp\release\coguid.h \ + c:\ole2samp\release\oleguid.h \ + c:\ole2samp\release\dvobj.h \ + c:\ole2samp\release\storage.h \ + c:\ole2samp\release\moniker.h \ + c:\ole2samp\release\ole2ui.h \ + c:\ole2samp\release\olestd.h \ + c:\ole2samp\simpsvr\simpsvr.h \ + c:\ole2samp\release\ole2ver.h \ + c:\ole2samp\simpsvr\obj.h \ + c:\ole2samp\simpsvr\ioipao.h \ + c:\ole2samp\simpsvr\ioipo.h \ + c:\ole2samp\simpsvr\ioo.h \ + c:\ole2samp\simpsvr\ips.h \ + c:\ole2samp\simpsvr\ido.h \ + c:\ole2samp\simpsvr\iec.h \ + c:\ole2samp\simpsvr\app.h \ + c:\ole2samp\simpsvr\doc.h + + +IOIPAO_DEP = c:\ole2samp\simpsvr\pre.h \ + c:\ole2samp\release\ole2.h \ + c:\ole2samp\release\compobj.h \ + c:\ole2samp\release\scode.h \ + c:\ole2samp\release\initguid.h \ + c:\ole2samp\release\coguid.h \ + c:\ole2samp\release\oleguid.h \ + c:\ole2samp\release\dvobj.h \ + c:\ole2samp\release\storage.h \ + c:\ole2samp\release\moniker.h \ + c:\ole2samp\release\ole2ui.h \ + c:\ole2samp\release\olestd.h \ + c:\ole2samp\simpsvr\simpsvr.h \ + c:\ole2samp\release\ole2ver.h \ + c:\ole2samp\simpsvr\obj.h \ + c:\ole2samp\simpsvr\ioipao.h \ + c:\ole2samp\simpsvr\ioipo.h \ + c:\ole2samp\simpsvr\ioo.h \ + c:\ole2samp\simpsvr\ips.h \ + c:\ole2samp\simpsvr\ido.h \ + c:\ole2samp\simpsvr\iec.h \ + c:\ole2samp\simpsvr\app.h \ + c:\ole2samp\simpsvr\doc.h + + +IOIPO_DEP = c:\ole2samp\simpsvr\pre.h \ + c:\ole2samp\release\ole2.h \ + c:\ole2samp\release\compobj.h \ + c:\ole2samp\release\scode.h \ + c:\ole2samp\release\initguid.h \ + c:\ole2samp\release\coguid.h \ + c:\ole2samp\release\oleguid.h \ + c:\ole2samp\release\dvobj.h \ + c:\ole2samp\release\storage.h \ + c:\ole2samp\release\moniker.h \ + c:\ole2samp\release\ole2ui.h \ + c:\ole2samp\release\olestd.h \ + c:\ole2samp\simpsvr\simpsvr.h \ + c:\ole2samp\release\ole2ver.h \ + c:\ole2samp\simpsvr\obj.h \ + c:\ole2samp\simpsvr\ioipao.h \ + c:\ole2samp\simpsvr\ioipo.h \ + c:\ole2samp\simpsvr\ioo.h \ + c:\ole2samp\simpsvr\ips.h \ + c:\ole2samp\simpsvr\ido.h \ + c:\ole2samp\simpsvr\iec.h \ + c:\ole2samp\simpsvr\app.h \ + c:\ole2samp\simpsvr\doc.h + + +IOO_DEP = c:\ole2samp\simpsvr\pre.h \ + c:\ole2samp\release\ole2.h \ + c:\ole2samp\release\compobj.h \ + c:\ole2samp\release\scode.h \ + c:\ole2samp\release\initguid.h \ + c:\ole2samp\release\coguid.h \ + c:\ole2samp\release\oleguid.h \ + c:\ole2samp\release\dvobj.h \ + c:\ole2samp\release\storage.h \ + c:\ole2samp\release\moniker.h \ + c:\ole2samp\release\ole2ui.h \ + c:\ole2samp\release\olestd.h \ + c:\ole2samp\simpsvr\simpsvr.h \ + c:\ole2samp\release\ole2ver.h \ + c:\ole2samp\simpsvr\obj.h \ + c:\ole2samp\simpsvr\ioipao.h \ + c:\ole2samp\simpsvr\ioipo.h \ + c:\ole2samp\simpsvr\ioo.h \ + c:\ole2samp\simpsvr\ips.h \ + c:\ole2samp\simpsvr\ido.h \ + c:\ole2samp\simpsvr\iec.h \ + c:\ole2samp\simpsvr\app.h \ + c:\ole2samp\simpsvr\doc.h + + +IPS_DEP = c:\ole2samp\simpsvr\pre.h \ + c:\ole2samp\release\ole2.h \ + c:\ole2samp\release\compobj.h \ + c:\ole2samp\release\scode.h \ + c:\ole2samp\release\initguid.h \ + c:\ole2samp\release\coguid.h \ + c:\ole2samp\release\oleguid.h \ + c:\ole2samp\release\dvobj.h \ + c:\ole2samp\release\storage.h \ + c:\ole2samp\release\moniker.h \ + c:\ole2samp\release\ole2ui.h \ + c:\ole2samp\release\olestd.h \ + c:\ole2samp\simpsvr\simpsvr.h \ + c:\ole2samp\release\ole2ver.h \ + c:\ole2samp\simpsvr\obj.h \ + c:\ole2samp\simpsvr\ioipao.h \ + c:\ole2samp\simpsvr\ioipo.h \ + c:\ole2samp\simpsvr\ioo.h \ + c:\ole2samp\simpsvr\ips.h \ + c:\ole2samp\simpsvr\ido.h \ + c:\ole2samp\simpsvr\iec.h \ + c:\ole2samp\simpsvr\app.h \ + c:\ole2samp\simpsvr\doc.h + + +OBJ_DEP = c:\ole2samp\simpsvr\pre.h \ + c:\ole2samp\release\ole2.h \ + c:\ole2samp\release\compobj.h \ + c:\ole2samp\release\scode.h \ + c:\ole2samp\release\initguid.h \ + c:\ole2samp\release\coguid.h \ + c:\ole2samp\release\oleguid.h \ + c:\ole2samp\release\dvobj.h \ + c:\ole2samp\release\storage.h \ + c:\ole2samp\release\moniker.h \ + c:\ole2samp\release\ole2ui.h \ + c:\ole2samp\release\olestd.h \ + c:\ole2samp\simpsvr\simpsvr.h \ + c:\ole2samp\release\ole2ver.h \ + c:\ole2samp\simpsvr\obj.h \ + c:\ole2samp\simpsvr\ioipao.h \ + c:\ole2samp\simpsvr\ioipo.h \ + c:\ole2samp\simpsvr\ioo.h \ + c:\ole2samp\simpsvr\ips.h \ + c:\ole2samp\simpsvr\ido.h \ + c:\ole2samp\simpsvr\iec.h \ + c:\ole2samp\simpsvr\icf.h \ + c:\ole2samp\simpsvr\app.h \ + c:\ole2samp\simpsvr\doc.h + + +SIMPSVR_DEP = c:\ole2samp\simpsvr\pre.h \ + c:\ole2samp\release\ole2.h \ + c:\ole2samp\release\compobj.h \ + c:\ole2samp\release\scode.h \ + c:\ole2samp\release\initguid.h \ + c:\ole2samp\release\coguid.h \ + c:\ole2samp\release\oleguid.h \ + c:\ole2samp\release\dvobj.h \ + c:\ole2samp\release\storage.h \ + c:\ole2samp\release\moniker.h \ + c:\ole2samp\release\ole2ui.h \ + c:\ole2samp\release\olestd.h \ + c:\ole2samp\simpsvr\simpsvr.h \ + c:\ole2samp\release\ole2ver.h \ + c:\ole2samp\simpsvr\obj.h \ + c:\ole2samp\simpsvr\ioipao.h \ + c:\ole2samp\simpsvr\ioipo.h \ + c:\ole2samp\simpsvr\ioo.h \ + c:\ole2samp\simpsvr\ips.h \ + c:\ole2samp\simpsvr\ido.h \ + c:\ole2samp\simpsvr\iec.h \ + c:\ole2samp\simpsvr\app.h \ + c:\ole2samp\simpsvr\doc.h \ + c:\ole2samp\simpsvr\icf.h + + +SIMPSVR_RCDEP = c:\ole2samp\simpsvr\simpsvr.h + + +DOC_DEP = c:\ole2samp\simpsvr\pre.h \ + c:\ole2samp\release\ole2.h \ + c:\ole2samp\release\compobj.h \ + c:\ole2samp\release\scode.h \ + c:\ole2samp\release\initguid.h \ + c:\ole2samp\release\coguid.h \ + c:\ole2samp\release\oleguid.h \ + c:\ole2samp\release\dvobj.h \ + c:\ole2samp\release\storage.h \ + c:\ole2samp\release\moniker.h \ + c:\ole2samp\release\ole2ui.h \ + c:\ole2samp\release\olestd.h \ + c:\ole2samp\simpsvr\simpsvr.h \ + c:\ole2samp\release\ole2ver.h \ + c:\ole2samp\simpsvr\obj.h \ + c:\ole2samp\simpsvr\ioipao.h \ + c:\ole2samp\simpsvr\ioipo.h \ + c:\ole2samp\simpsvr\ioo.h \ + c:\ole2samp\simpsvr\ips.h \ + c:\ole2samp\simpsvr\ido.h \ + c:\ole2samp\simpsvr\iec.h \ + c:\ole2samp\simpsvr\app.h \ + c:\ole2samp\simpsvr\doc.h + + +IEC_DEP = c:\ole2samp\simpsvr\pre.h \ + c:\ole2samp\release\ole2.h \ + c:\ole2samp\release\compobj.h \ + c:\ole2samp\release\scode.h \ + c:\ole2samp\release\initguid.h \ + c:\ole2samp\release\coguid.h \ + c:\ole2samp\release\oleguid.h \ + c:\ole2samp\release\dvobj.h \ + c:\ole2samp\release\storage.h \ + c:\ole2samp\release\moniker.h \ + c:\ole2samp\release\ole2ui.h \ + c:\ole2samp\release\olestd.h \ + c:\ole2samp\simpsvr\simpsvr.h \ + c:\ole2samp\release\ole2ver.h \ + c:\ole2samp\simpsvr\obj.h \ + c:\ole2samp\simpsvr\ioipao.h \ + c:\ole2samp\simpsvr\ioipo.h \ + c:\ole2samp\simpsvr\ioo.h \ + c:\ole2samp\simpsvr\ips.h \ + c:\ole2samp\simpsvr\ido.h \ + c:\ole2samp\simpsvr\iec.h \ + c:\ole2samp\simpsvr\app.h \ + c:\ole2samp\simpsvr\doc.h + + +PRE_DEP = c:\ole2samp\simpsvr\pre.h \ + c:\ole2samp\release\ole2.h \ + c:\ole2samp\release\compobj.h \ + c:\ole2samp\release\scode.h \ + c:\ole2samp\release\initguid.h \ + c:\ole2samp\release\coguid.h \ + c:\ole2samp\release\oleguid.h \ + c:\ole2samp\release\dvobj.h \ + c:\ole2samp\release\storage.h \ + c:\ole2samp\release\moniker.h \ + c:\ole2samp\release\ole2ui.h \ + c:\ole2samp\release\olestd.h \ + c:\ole2samp\simpsvr\simpsvr.h \ + c:\ole2samp\release\ole2ver.h + + +all: $(PROJ).EXE $(PROJ).BSC + +PRE.OBJ: PRE.CPP $(PRE_DEP) + $(CPP) $(CFLAGS) $(CPPCREATEPCHFLAG) /c PRE.CPP + +ICF.OBJ: ICF.CPP $(ICF_DEP) + $(CPP) $(CFLAGS) $(CPPUSEPCHFLAG) /c ICF.CPP + +IDO.OBJ: IDO.CPP $(IDO_DEP) + $(CPP) $(CFLAGS) $(CPPUSEPCHFLAG) /c IDO.CPP + +IOIPAO.OBJ: IOIPAO.CPP $(IOIPAO_DEP) + $(CPP) $(CFLAGS) $(CPPUSEPCHFLAG) /c IOIPAO.CPP + +IOIPO.OBJ: IOIPO.CPP $(IOIPO_DEP) + $(CPP) $(CFLAGS) $(CPPUSEPCHFLAG) /c IOIPO.CPP + +IOO.OBJ: IOO.CPP $(IOO_DEP) + $(CPP) $(CFLAGS) $(CPPUSEPCHFLAG) /c IOO.CPP + +IPS.OBJ: IPS.CPP $(IPS_DEP) + $(CPP) $(CFLAGS) $(CPPUSEPCHFLAG) /c IPS.CPP + +OBJ.OBJ: OBJ.CPP $(OBJ_DEP) + $(CPP) $(CFLAGS) $(CPPUSEPCHFLAG) /c OBJ.CPP + +SIMPSVR.OBJ: SIMPSVR.CPP $(SIMPSVR_DEP) + $(CPP) $(CFLAGS) $(CPPUSEPCHFLAG) /c SIMPSVR.CPP + +SIMPSVR.RES: SIMPSVR.RC $(SIMPSVR_RCDEP) + $(RC) $(RCFLAGS) $(RCDEFINES) -r SIMPSVR.RC + +DOC.OBJ: DOC.CPP $(DOC_DEP) + $(CPP) $(CFLAGS) $(CPPUSEPCHFLAG) /c DOC.CPP + +IEC.OBJ: IEC.CPP $(IEC_DEP) + $(CPP) $(CFLAGS) $(CPPUSEPCHFLAG) /c IEC.CPP + +APP.OBJ: APP.CPP $(APP_DEP) + $(CPP) $(CFLAGS) $(CPPUSEPCHFLAG) /c APP.CPP + + +$(PROJ).EXE:: SIMPSVR.RES + +$(PROJ).EXE:: PRE.OBJ ICF.OBJ IDO.OBJ IOIPAO.OBJ IOIPO.OBJ IOO.OBJ IPS.OBJ OBJ.OBJ \ + SIMPSVR.OBJ DOC.OBJ IEC.OBJ APP.OBJ $(OBJS_EXT) $(DEFFILE) + echo >NUL @<<$(PROJ).CRF +PRE.OBJ + +ICF.OBJ + +IDO.OBJ + +IOIPAO.OBJ + +IOIPO.OBJ + +IOO.OBJ + +IPS.OBJ + +OBJ.OBJ + +SIMPSVR.OBJ + +DOC.OBJ + +IEC.OBJ + +APP.OBJ + +$(OBJS_EXT) +$(PROJ).EXE +$(MAPFILE) +c:\ole2samp\release\+ +c:\msvc\lib\+ +c:\msvc\mfc\lib\+ +$(LIBS) +$(DEFFILE); +<< + link $(LFLAGS) @$(PROJ).CRF + $(RC) $(RESFLAGS) SIMPSVR.RES $@ + @copy $(PROJ).CRF MSVC.BND + +$(PROJ).EXE:: SIMPSVR.RES + if not exist MSVC.BND $(RC) $(RESFLAGS) SIMPSVR.RES $@ + +run: $(PROJ).EXE + $(PROJ) $(RUNFLAGS) + + +$(PROJ).BSC: $(SBRS) + bscmake @<< +/o$@ $(SBRS) +<< diff --git a/private/oleutest/simpsvr/simpsvr.prj b/private/oleutest/simpsvr/simpsvr.prj Binary files differnew file mode 100644 index 000000000..74893721a --- /dev/null +++ b/private/oleutest/simpsvr/simpsvr.prj diff --git a/private/oleutest/simpsvr/simpsvr.rc b/private/oleutest/simpsvr/simpsvr.rc new file mode 100644 index 000000000..13ba8d6ee --- /dev/null +++ b/private/oleutest/simpsvr/simpsvr.rc @@ -0,0 +1,111 @@ +//Microsoft App Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "simpsvr.h" +#include "ole2ui.rc" + +///////////////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +SimpSvr icon simpsvr.ico + +////////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +SIMPSVRMENU MENU DISCARDABLE +BEGIN + POPUP "&File" + BEGIN + MENUITEM "E&xit", IDM_EXIT + END + POPUP "&Color" + BEGIN + MENUITEM "&Owner Draw Colors", IDM_COLOROWNERDR + MENUITEM SEPARATOR + MENUITEM "&Red", IDM_RED + MENUITEM "&Green", IDM_GREEN + MENUITEM "&Blue", IDM_BLUE + END + POPUP "&Help" + BEGIN + MENUITEM "&About Simpsvr...", IDM_ABOUT + END +END + + +////////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +ABOUTBOX DIALOG DISCARDABLE 22, 17, 144, 75 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "Simple OLE 2.0 Server" +FONT 8, "System" +BEGIN + CTEXT "Microsoft Windows",-1,0,5,144,8 + CTEXT "Simple OLE 2.0 Server",-1,0,14,144,8 + CTEXT "Version 1.0",-1,0,34,144,8 + DEFPUSHBUTTON "OK",IDOK,53,59,32,14,WS_GROUP +END + +SimpsvrAccel ACCELERATORS + BEGIN + "^b", IDM_BLUE + "^r", IDM_RED + "^g", IDM_GREEN + VK_F12, IDM_ABOUT, VIRTKEY, CONTROL + END + +#ifdef APSTUDIO_INVOKED +////////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""simpsvr.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +///////////////////////////////////////////////////////////////////////////////////// +#endif // APSTUDIO_INVOKED + + +#ifndef APSTUDIO_INVOKED +//////////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + + diff --git a/private/oleutest/simpsvr/strings.rc b/private/oleutest/simpsvr/strings.rc new file mode 100644 index 000000000..f3f8c415a --- /dev/null +++ b/private/oleutest/simpsvr/strings.rc @@ -0,0 +1,124 @@ +/* + * STRINGS.RC + * + * strings for the OLE 2.0 UI Support Library. + * + * Copyright (c)1992 Microsoft Corporation, All Right Reserved + */ + + +#include "ole2ui.h" + + +//Stringtable common for all dialogs. +STRINGTABLE + BEGIN + IDS_FILTERS, "All Files (*.*)|*.*|" + IDS_ICONFILTERS, "Icon Files|*.exe;*.dll;*.ico|Programs (*.exe)|*.exe|Libraries (*.dll)|Icons (*.ico)|All Files (*.*)|*.*|" + END + +// browse dialog +STRINGTABLE + BEGIN + IDS_BROWSE "Browse" + END + + +//Insert Object stringtable. +STRINGTABLE + BEGIN + IDS_IORESULTNEW, "Inserts a new %s object into your document." + IDS_IORESULTNEWICON, "Inserts a new %s object into your document. It will be displayed as an icon." + IDS_IORESULTFROMFILE1, "Inserts the contents of the file as an object into your document so that you may activate it using the " + IDS_IORESULTFROMFILE2, "application which created it." + IDS_IORESULTFROMFILEICON2, "application which created it. It will be displayed as an icon." + IDS_IORESULTLINKFILE1, "Inserts a picture of the file contents into your document. The picture will be linked to " + IDS_IORESULTLINKFILE2, "the file so that changes to the file will be reflected in your document." + IDS_IORESULTLINKFILEICON1, "Inserts an icon into your document which represents the file. The icon will be linked to " + IDS_IORESULTLINKFILEICON2, "the file so that changes to the file will be reflected in your document." + END + +//Change Icon stringtable +STRINGTABLE + BEGIN + IDS_CINOICONSINFILE, "There are no icons in %s." + IDS_CIINVALIDFILE, "File %s does not exist." + IDS_CIFILEACCESS, "Unable to open file %s. Access denied." + IDS_CIFILESHARE, "Unable to open file %s. Sharing violation." + IDS_CIFILEOPENFAIL, "Unable to open file %s. General failure." + END + +// Convert stringtable. +STRINGTABLE + BEGIN + IDS_CVRESULTCONVERTLINK, "A linked object must be converted at the source." + IDS_CVRESULTCONVERTTO, "Permanently changes the selected %s object to a %s object." + IDS_CVRESULTNOCHANGE, "The selected %s object will not be converted." + IDS_CVRESULTDISPLAYASICON, " It will be displayed as an icon." + IDS_CVRESULTACTIVATEAS, "Every %s object will be activated as a %s object" + IDS_CVRESULTACTIVATEDIFF, ", but it will not be converted." + END + +//Paste Special stringtable +STRINGTABLE + BEGIN + IDS_PSPASTEDATA, "Inserts the contents of the Clipboard into your document as %s." + IDS_PSPASTEOBJECT, "Inserts the contents of the Clipboard into your document so that you may activate it using %s." + IDS_PSPASTEOBJECTASICON, "Inserts the contents of the Clipboard into your document so that you may activate it using %s. It will be displayed as an icon." + IDS_PSPASTELINKDATA, "Inserts the contents of the Clipboard into your document as %s. Paste Link creates a link to the source file so that changes to the source file will be reflected in your document." + IDS_PSPASTELINKOBJECT, "Inserts a picture of the Clipboard contents into your document. Paste Link creates a link to the source file so that changes to the source file will be reflected in your document." + IDS_PSPASTELINKOBJECTASICON, "Inserts an icon into your document which represents the Clipboard contents. Paste Link creates a link to the source file so that changes to the source file will be reflected in your document." + IDS_PSNONOLE, "Inserts the contents of the Clipboard into your document." + IDS_PSUNKNOWNTYPE, "Unknown Type" + IDS_PSUNKNOWNSRC, "Unknown Source" + IDS_PSUNKNOWNAPP, "the application which created it" + END + +// Busy/Blocked dialog stringtable +STRINGTABLE + BEGIN + IDS_BZRESULTTEXTBUSY "This action cannot be completed because the %s application (%s) is busy. Choose ""Switch To"" to activate %s and correct the problem." + IDS_BZRESULTTEXTNOTRESPONDING "This action cannot be completed because the %s application (%s) is not responding. Choose ""Switch To"" to activate %s and correct the problem." + END + +// OLESTD stringtable +STRINGTABLE + BEGIN + IDS_OLESTDNOCREATEFILE, "Could not create file!" + IDS_OLESTDNOOPENFILE, "Could not open file!" + IDS_OLESTDDISKFULL, "Disk full--unable to complete save operation" + END + +// OLE2UI stringtable +STRINGTABLE + BEGIN + IDS_OLE2UIEDITNOOBJCMD, "&Object" + IDS_OLE2UIEDITLINKCMD_1VERB, "0%s Linked %s &Object" + IDS_OLE2UIEDITOBJECTCMD_1VERB, "0%s %s &Object" + IDS_OLE2UIEDITLINKCMD_NVERB, "Linked %s &Object" + IDS_OLE2UIEDITOBJECTCMD_NVERB, "%s &Object" + IDS_OLE2UIUNKNOWN, "Unknown" + IDS_OLE2UILINK, "Link" + IDS_OLE2UIOBJECT, "Object" + IDS_OLE2UIEDIT, "&Edit" + IDS_OLE2UICONVERT, "&Convert..." + IDS_DEFICONLABEL, "Document" + IDS_OLE2UIPASTELINKEDTYPE, "Linked %s" + END + +// LINKS stringtable +STRINGTABLE + BEGIN + IDS_LINK_AUTO "Automatic" + IDS_LINK_MANUAL "Manual" + IDS_LINK_UNKNOWN "Unavail" + IDS_LINKS "Links" + IDS_FAILED "Operation failed!" + IDS_CHANGESOURCE "Change Source" + IDS_INVALIDSOURCE "Invalid Source : Do you want to correct it?" + IDS_CHANGEADDITIONALLINKS "The selected link has been changed.\nThis document contains additional links to\n%s.\n\nChange additional links?" + IDS_ERR_GETLINKSOURCE "Fail to get source of the link!" + IDS_ERR_GETLINKUPDATEOPTIONS "Fail to get update option of the link!" + IDS_ERR_ADDSTRING "Fail to add item to ListBox!" + IDS_CLOSE "Close" + END |