annotate src/VisVim/OleAut.cpp @ 3666:46896c29edd7 v7.3.593

updated for version 7.3.593 Problem: No easy way to decide if b:browsefilter will work. Solution: Add the browsefilter feature.
author Bram Moolenaar <bram@vim.org>
date Tue, 10 Jul 2012 13:41:14 +0200
parents beed57a8fcd1
children 04736b4030ec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 // Class for creating OLE automation controllers.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 // CreateObject() creates an automation object
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 // Invoke() will call a property or method of the automation object.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 // GetProperty() returns a property
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 // SetProperty() changes a property
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 // Method() invokes a method
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 // For example, the following VB code will control Microsoft Word:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 // Private Sub Form_Load()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 // Dim wb As Object
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 // Set wb = CreateObject("Word.Basic")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 // wb.AppShow
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 // wb.FileNewDefault
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 // wb.Insert "This is a test"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 // wb.FileSaveAs "c:\sample.doc)"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 // End Sub
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 // A C++ automation controller that does the same can be written as follows:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 // the helper functions:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 // Void FormLoad ()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 // {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 // COleAutomationControl Aut;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 // Aut.CreateObject("Word.Basic");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 // Aut.Method ("AppShow");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 // Aut.Method ("FileNewDefault");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 // Aut.Method ("Insert", "s", (LPOLESTR) OLESTR ("This is a test"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 // Aut.Method ("FileSaveAs", "s", OLESTR ("c:\\sample.doc"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 // }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 #include "stdafx.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 #include <stdarg.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 #include "oleaut.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 #ifdef _DEBUG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 #define new DEBUG_NEW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 #undef THIS_FILE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 static char THIS_FILE[] = __FILE__;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 static bool CountArgsInFormat (LPCTSTR Format, UINT* nArgs);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 static LPCTSTR GetNextVarType (LPCTSTR Format, VARTYPE* pVarType);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 COleAutomationControl::COleAutomationControl ()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 m_pDispatch = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 m_hResult = NOERROR;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 m_nErrArg = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 VariantInit (&m_VariantResult);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 COleAutomationControl::~COleAutomationControl ()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 DeleteObject ();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 void COleAutomationControl::DeleteObject ()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 if (m_pDispatch)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 m_pDispatch->Release ();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 m_pDispatch = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 // Creates an instance of the Automation object and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 // obtains it's IDispatch interface.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 // Parameters:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 // ProgId ProgID of Automation object
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 bool COleAutomationControl::CreateObject (char* ProgId)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 CLSID ClsId; // CLSID of automation object
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 LPUNKNOWN pUnknown = NULL; // IUnknown of automation object
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 // Retrieve CLSID from the progID that the user specified
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 LPOLESTR OleProgId = TO_OLE_STR (ProgId);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 m_hResult = CLSIDFromProgID (OleProgId, &ClsId);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 if (FAILED (m_hResult))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 goto error;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 // Create an instance of the automation object and ask for the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 // IDispatch interface
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 m_hResult = CoCreateInstance (ClsId, NULL, CLSCTX_SERVER,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 IID_IUnknown, (void**) &pUnknown);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 if (FAILED (m_hResult))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 goto error;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 m_hResult = pUnknown->QueryInterface (IID_IDispatch, (void**) &m_pDispatch);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 if (FAILED (m_hResult))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 goto error;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 pUnknown->Release ();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 return true;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 error:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 if (pUnknown)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 pUnknown->Release ();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 if (m_pDispatch)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 m_pDispatch->Release ();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 return false;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 // Return the dispatch id of a named service
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 // This id can be used in subsequent calls to GetProperty (), SetProperty () and
1207
beed57a8fcd1 updated for version 7.1b
vimboss
parents: 7
diff changeset
114 // Method (). This is the preferred method when performance is important.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 DISPID COleAutomationControl::GetDispatchId (char* Name)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 DISPID DispatchId;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 ASSERT (m_pDispatch);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 // Get DISPID of property/method
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 LPOLESTR OleName = TO_OLE_STR (Name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 m_hResult = m_pDispatch->GetIDsOfNames (IID_NULL, &OleName, 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 LOCALE_USER_DEFAULT, &DispatchId);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 if (FAILED (m_hResult))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 return DispatchId;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 // The following functions use these parameters:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 // Parameters:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 // Name Name of property or method.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 // Format Format string that describes the variable list of parameters that
1207
beed57a8fcd1 updated for version 7.1b
vimboss
parents: 7
diff changeset
138 // follows. The format string can contain the following characters.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 // & = mark the following format character as VT_BYREF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 // B = VT_BOOL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 // i = VT_I2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 // I = VT_I4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 // r = VT_R2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 // R = VT_R4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 // c = VT_CY
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 // s = VT_BSTR (string pointer can be passed,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 // BSTR will be allocated by this function).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 // e = VT_ERROR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 // d = VT_DATE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 // v = VT_VARIANT. Use this to pass data types that are not described
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 // in the format string. (For example SafeArrays).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 // D = VT_DISPATCH
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 // U = VT_UNKNOWN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 // ... Arguments of the property or method.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 // Arguments are described by Format.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 //
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 bool COleAutomationControl::GetProperty (char* Name)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 return Invoke (DISPATCH_PROPERTYGET, Name, NULL, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 bool COleAutomationControl::GetProperty (DISPID DispatchId)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 return Invoke (DISPATCH_PROPERTYGET, DispatchId, NULL, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 bool COleAutomationControl::PutProperty (char* Name, LPCTSTR Format, ...)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 va_list ArgList;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 va_start (ArgList, Format);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 bool bRet = Invoke (DISPATCH_PROPERTYPUT, Name, Format, ArgList);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 va_end (ArgList);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 return bRet;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 bool COleAutomationControl::PutProperty (DISPID DispatchId, LPCTSTR Format, ...)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 va_list ArgList;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 va_start (ArgList, Format);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 bool bRet = Invoke (DISPATCH_PROPERTYPUT, DispatchId, Format, ArgList);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 va_end (ArgList);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 return bRet;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 bool COleAutomationControl::Method (char* Name, LPCTSTR Format, ...)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 va_list ArgList;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 va_start (ArgList, Format);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 bool bRet = Invoke (DISPATCH_METHOD, Name, Format, ArgList);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 va_end (ArgList);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 return bRet;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 bool COleAutomationControl::Method (DISPID DispatchId, LPCTSTR Format, ...)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 va_list ArgList;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 va_start (ArgList, Format);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 bool bRet = Invoke (DISPATCH_METHOD, DispatchId, Format, ArgList);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 va_end (ArgList);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 return bRet;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 bool COleAutomationControl::Invoke (WORD Flags, char* Name,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 LPCTSTR Format, va_list ArgList)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 DISPID DispatchId = GetDispatchId (Name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 if (! DispatchId)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 return false;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 return Invoke (Flags, DispatchId, Format, ArgList);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 bool COleAutomationControl::Invoke (WORD Flags, DISPID DispatchId,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 LPCTSTR Format, va_list ArgList)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 UINT ArgCount = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 VARIANTARG* ArgVector = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 ASSERT (m_pDispatch);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 DISPPARAMS DispatchParams;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 memset (&DispatchParams, 0, sizeof (DispatchParams));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 // Determine number of arguments
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 if (Format)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 CountArgsInFormat (Format, &ArgCount);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 // Property puts have a named argument that represents the value that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 // the property is being assigned.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 DISPID DispIdNamed = DISPID_PROPERTYPUT;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 if (Flags & DISPATCH_PROPERTYPUT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 if (ArgCount == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 m_hResult = ResultFromScode (E_INVALIDARG);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 return false;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 DispatchParams.cNamedArgs = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 DispatchParams.rgdispidNamedArgs = &DispIdNamed;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 if (ArgCount)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 // Allocate memory for all VARIANTARG parameters
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 ArgVector = (VARIANTARG*) CoTaskMemAlloc (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 ArgCount * sizeof (VARIANTARG));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 if (! ArgVector)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 m_hResult = ResultFromScode (E_OUTOFMEMORY);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 return false;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 memset (ArgVector, 0, sizeof (VARIANTARG) * ArgCount);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 // Get ready to walk vararg list
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 LPCTSTR s = Format;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 VARIANTARG *p = ArgVector + ArgCount - 1; // Params go in opposite order
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 for (;;)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 VariantInit (p);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 if (! (s = GetNextVarType (s, &p->vt)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 if (p < ArgVector)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 m_hResult = ResultFromScode (E_INVALIDARG);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 goto Cleanup;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 switch (p->vt)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 case VT_I2:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 V_I2 (p) = va_arg (ArgList, short);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 case VT_I4:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 V_I4 (p) = va_arg (ArgList, long);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 case VT_R4:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 V_R4 (p) = va_arg (ArgList, float);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 case VT_DATE:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 case VT_R8:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 V_R8 (p) = va_arg (ArgList, double);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 case VT_CY:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 V_CY (p) = va_arg (ArgList, CY);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 case VT_BSTR:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 V_BSTR (p) = SysAllocString (va_arg (ArgList,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 OLECHAR*));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 if (! p->bstrVal)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 m_hResult = ResultFromScode (E_OUTOFMEMORY);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 p->vt = VT_EMPTY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 goto Cleanup;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 case VT_DISPATCH:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 V_DISPATCH (p) = va_arg (ArgList, LPDISPATCH);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 case VT_ERROR:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 V_ERROR (p) = va_arg (ArgList, SCODE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 case VT_BOOL:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 V_BOOL (p) = va_arg (ArgList, BOOL) ? -1 : 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 case VT_VARIANT:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 *p = va_arg (ArgList, VARIANTARG);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 case VT_UNKNOWN:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 V_UNKNOWN (p) = va_arg (ArgList, LPUNKNOWN);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 case VT_I2 | VT_BYREF:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 V_I2REF (p) = va_arg (ArgList, short*);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 case VT_I4 | VT_BYREF:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 V_I4REF (p) = va_arg (ArgList, long*);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 case VT_R4 | VT_BYREF:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 V_R4REF (p) = va_arg (ArgList, float*);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 case VT_R8 | VT_BYREF:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 V_R8REF (p) = va_arg (ArgList, double*);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331 case VT_DATE | VT_BYREF:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332 V_DATEREF (p) = va_arg (ArgList, DATE*);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 case VT_CY | VT_BYREF:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335 V_CYREF (p) = va_arg (ArgList, CY*);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 case VT_BSTR | VT_BYREF:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338 V_BSTRREF (p) = va_arg (ArgList, BSTR*);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 case VT_DISPATCH | VT_BYREF:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 V_DISPATCHREF (p) = va_arg (ArgList, LPDISPATCH*);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343 case VT_ERROR | VT_BYREF:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344 V_ERRORREF (p) = va_arg (ArgList, SCODE*);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346 case VT_BOOL | VT_BYREF:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 BOOL* pBool = va_arg (ArgList, BOOL*);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 *pBool = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351 V_BOOLREF (p) = (VARIANT_BOOL*) pBool;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 case VT_VARIANT | VT_BYREF:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 V_VARIANTREF (p) = va_arg (ArgList, VARIANTARG*);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 case VT_UNKNOWN | VT_BYREF:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 V_UNKNOWNREF (p) = va_arg (ArgList, LPUNKNOWN*);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361 default:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 m_hResult = ResultFromScode (E_INVALIDARG);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 goto Cleanup;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 --p; // Get ready to fill next argument
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 DispatchParams.cArgs = ArgCount;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 DispatchParams.rgvarg = ArgVector;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376 // Initialize return variant, in case caller forgot. Caller can pass
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 // NULL if return value is not expected.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378 VariantInit (&m_VariantResult);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 // Make the call
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381 m_hResult = m_pDispatch->Invoke (DispatchId, IID_NULL, LOCALE_USER_DEFAULT,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382 Flags, &DispatchParams, &m_VariantResult,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 &m_ExceptionInfo, &m_nErrArg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385 Cleanup:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386 // Cleanup any arguments that need cleanup
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387 if (ArgCount)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389 VARIANTARG* p = ArgVector;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391 while (ArgCount--)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 switch (p->vt)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395 case VT_BSTR:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396 VariantClear (p);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399 ++p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 CoTaskMemFree (ArgVector);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 return FAILED (m_hResult) ? false : true;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 #define CASE_SCODE(sc) \
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 case sc: \
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409 lstrcpy((char*)ErrName, (char*)#sc); \
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412 void COleAutomationControl::ErrDiag ()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414 char ErrName[200];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
415
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416 SCODE sc = GetScode (m_hResult);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
417 switch (sc)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
418 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
419 // SCODE's defined in SCODE.H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
420 CASE_SCODE (S_OK)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
421 CASE_SCODE (S_FALSE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
422 CASE_SCODE (E_UNEXPECTED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
423 CASE_SCODE (E_OUTOFMEMORY)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424 CASE_SCODE (E_INVALIDARG)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
425 CASE_SCODE (E_NOINTERFACE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
426 CASE_SCODE (E_POINTER)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
427 CASE_SCODE (E_HANDLE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
428 CASE_SCODE (E_ABORT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
429 CASE_SCODE (E_FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
430 CASE_SCODE (E_ACCESSDENIED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
431
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
432 // SCODE's defined in OLE2.H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
433 CASE_SCODE (OLE_E_OLEVERB)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
434 CASE_SCODE (OLE_E_ADVF)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
435 CASE_SCODE (OLE_E_ENUM_NOMORE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
436 CASE_SCODE (OLE_E_ADVISENOTSUPPORTED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
437 CASE_SCODE (OLE_E_NOCONNECTION)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
438 CASE_SCODE (OLE_E_NOTRUNNING)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
439 CASE_SCODE (OLE_E_NOCACHE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
440 CASE_SCODE (OLE_E_BLANK)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
441 CASE_SCODE (OLE_E_CLASSDIFF)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
442 CASE_SCODE (OLE_E_CANT_GETMONIKER)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
443 CASE_SCODE (OLE_E_CANT_BINDTOSOURCE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
444 CASE_SCODE (OLE_E_STATIC)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
445 CASE_SCODE (OLE_E_PROMPTSAVECANCELLED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
446 CASE_SCODE (OLE_E_INVALIDRECT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
447 CASE_SCODE (OLE_E_WRONGCOMPOBJ)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
448 CASE_SCODE (OLE_E_INVALIDHWND)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
449 CASE_SCODE (OLE_E_NOT_INPLACEACTIVE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
450 CASE_SCODE (OLE_E_CANTCONVERT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
451 CASE_SCODE (OLE_E_NOSTORAGE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
452
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
453 CASE_SCODE (DV_E_FORMATETC)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
454 CASE_SCODE (DV_E_DVTARGETDEVICE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
455 CASE_SCODE (DV_E_STGMEDIUM)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
456 CASE_SCODE (DV_E_STATDATA)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
457 CASE_SCODE (DV_E_LINDEX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
458 CASE_SCODE (DV_E_TYMED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
459 CASE_SCODE (DV_E_CLIPFORMAT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
460 CASE_SCODE (DV_E_DVASPECT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
461 CASE_SCODE (DV_E_DVTARGETDEVICE_SIZE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
462 CASE_SCODE (DV_E_NOIVIEWOBJECT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
463
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
464 CASE_SCODE (OLE_S_USEREG)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
465 CASE_SCODE (OLE_S_STATIC)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
466 CASE_SCODE (OLE_S_MAC_CLIPFORMAT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
467
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
468 CASE_SCODE (CONVERT10_E_OLESTREAM_GET)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
469 CASE_SCODE (CONVERT10_E_OLESTREAM_PUT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
470 CASE_SCODE (CONVERT10_E_OLESTREAM_FMT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
471 CASE_SCODE (CONVERT10_E_OLESTREAM_BITMAP_TO_DIB)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
472 CASE_SCODE (CONVERT10_E_STG_FMT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
473 CASE_SCODE (CONVERT10_E_STG_NO_STD_STREAM)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
474 CASE_SCODE (CONVERT10_E_STG_DIB_TO_BITMAP)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
475 CASE_SCODE (CONVERT10_S_NO_PRESENTATION)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
476
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
477 CASE_SCODE (CLIPBRD_E_CANT_OPEN)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
478 CASE_SCODE (CLIPBRD_E_CANT_EMPTY)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
479 CASE_SCODE (CLIPBRD_E_CANT_SET)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
480 CASE_SCODE (CLIPBRD_E_BAD_DATA)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
481 CASE_SCODE (CLIPBRD_E_CANT_CLOSE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
482
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
483 CASE_SCODE (DRAGDROP_E_NOTREGISTERED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
484 CASE_SCODE (DRAGDROP_E_ALREADYREGISTERED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
485 CASE_SCODE (DRAGDROP_E_INVALIDHWND)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
486 CASE_SCODE (DRAGDROP_S_DROP)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
487 CASE_SCODE (DRAGDROP_S_CANCEL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
488 CASE_SCODE (DRAGDROP_S_USEDEFAULTCURSORS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
489
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
490 CASE_SCODE (OLEOBJ_E_NOVERBS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
491 CASE_SCODE (OLEOBJ_E_INVALIDVERB)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
492 CASE_SCODE (OLEOBJ_S_INVALIDVERB)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
493 CASE_SCODE (OLEOBJ_S_CANNOT_DOVERB_NOW)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
494 CASE_SCODE (OLEOBJ_S_INVALIDHWND)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
495 CASE_SCODE (INPLACE_E_NOTUNDOABLE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
496 CASE_SCODE (INPLACE_E_NOTOOLSPACE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
497 CASE_SCODE (INPLACE_S_TRUNCATED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
498
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
499 // SCODE's defined in COMPOBJ.H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
500 CASE_SCODE (CO_E_NOTINITIALIZED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
501 CASE_SCODE (CO_E_ALREADYINITIALIZED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
502 CASE_SCODE (CO_E_CANTDETERMINECLASS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
503 CASE_SCODE (CO_E_CLASSSTRING)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
504 CASE_SCODE (CO_E_IIDSTRING)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
505 CASE_SCODE (CO_E_APPNOTFOUND)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
506 CASE_SCODE (CO_E_APPSINGLEUSE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
507 CASE_SCODE (CO_E_ERRORINAPP)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
508 CASE_SCODE (CO_E_DLLNOTFOUND)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
509 CASE_SCODE (CO_E_ERRORINDLL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
510 CASE_SCODE (CO_E_WRONGOSFORAPP)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
511 CASE_SCODE (CO_E_OBJNOTREG)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
512 CASE_SCODE (CO_E_OBJISREG)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
513 CASE_SCODE (CO_E_OBJNOTCONNECTED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
514 CASE_SCODE (CO_E_APPDIDNTREG)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
515 CASE_SCODE (CLASS_E_NOAGGREGATION)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
516 CASE_SCODE (CLASS_E_CLASSNOTAVAILABLE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
517 CASE_SCODE (REGDB_E_READREGDB)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
518 CASE_SCODE (REGDB_E_WRITEREGDB)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
519 CASE_SCODE (REGDB_E_KEYMISSING)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
520 CASE_SCODE (REGDB_E_INVALIDVALUE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
521 CASE_SCODE (REGDB_E_CLASSNOTREG)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
522 CASE_SCODE (REGDB_E_IIDNOTREG)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
523 CASE_SCODE (RPC_E_CALL_REJECTED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
524 CASE_SCODE (RPC_E_CALL_CANCELED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
525 CASE_SCODE (RPC_E_CANTPOST_INSENDCALL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
526 CASE_SCODE (RPC_E_CANTCALLOUT_INASYNCCALL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
527 CASE_SCODE (RPC_E_CANTCALLOUT_INEXTERNALCALL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
528 CASE_SCODE (RPC_E_CONNECTION_TERMINATED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
529 CASE_SCODE (RPC_E_SERVER_DIED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
530 CASE_SCODE (RPC_E_CLIENT_DIED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
531 CASE_SCODE (RPC_E_INVALID_DATAPACKET)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
532 CASE_SCODE (RPC_E_CANTTRANSMIT_CALL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
533 CASE_SCODE (RPC_E_CLIENT_CANTMARSHAL_DATA)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
534 CASE_SCODE (RPC_E_CLIENT_CANTUNMARSHAL_DATA)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
535 CASE_SCODE (RPC_E_SERVER_CANTMARSHAL_DATA)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
536 CASE_SCODE (RPC_E_SERVER_CANTUNMARSHAL_DATA)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
537 CASE_SCODE (RPC_E_INVALID_DATA)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
538 CASE_SCODE (RPC_E_INVALID_PARAMETER)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
539 CASE_SCODE (RPC_E_CANTCALLOUT_AGAIN)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
540 CASE_SCODE (RPC_E_UNEXPECTED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
541
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
542 // SCODE's defined in DVOBJ.H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
543 CASE_SCODE (DATA_S_SAMEFORMATETC)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
544 CASE_SCODE (VIEW_E_DRAW)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
545 CASE_SCODE (VIEW_S_ALREADY_FROZEN)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
546 CASE_SCODE (CACHE_E_NOCACHE_UPDATED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
547 CASE_SCODE (CACHE_S_FORMATETC_NOTSUPPORTED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
548 CASE_SCODE (CACHE_S_SAMECACHE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
549 CASE_SCODE (CACHE_S_SOMECACHES_NOTUPDATED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
550
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
551 // SCODE's defined in STORAGE.H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
552 CASE_SCODE (STG_E_INVALIDFUNCTION)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
553 CASE_SCODE (STG_E_FILENOTFOUND)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
554 CASE_SCODE (STG_E_PATHNOTFOUND)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
555 CASE_SCODE (STG_E_TOOMANYOPENFILES)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
556 CASE_SCODE (STG_E_ACCESSDENIED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
557 CASE_SCODE (STG_E_INVALIDHANDLE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
558 CASE_SCODE (STG_E_INSUFFICIENTMEMORY)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
559 CASE_SCODE (STG_E_INVALIDPOINTER)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
560 CASE_SCODE (STG_E_NOMOREFILES)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
561 CASE_SCODE (STG_E_DISKISWRITEPROTECTED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
562 CASE_SCODE (STG_E_SEEKERROR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
563 CASE_SCODE (STG_E_WRITEFAULT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
564 CASE_SCODE (STG_E_READFAULT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
565 CASE_SCODE (STG_E_SHAREVIOLATION)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
566 CASE_SCODE (STG_E_LOCKVIOLATION)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
567 CASE_SCODE (STG_E_FILEALREADYEXISTS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
568 CASE_SCODE (STG_E_INVALIDPARAMETER)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
569 CASE_SCODE (STG_E_MEDIUMFULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
570 CASE_SCODE (STG_E_ABNORMALAPIEXIT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
571 CASE_SCODE (STG_E_INVALIDHEADER)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
572 CASE_SCODE (STG_E_INVALIDNAME)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
573 CASE_SCODE (STG_E_UNKNOWN)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
574 CASE_SCODE (STG_E_UNIMPLEMENTEDFUNCTION)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
575 CASE_SCODE (STG_E_INVALIDFLAG)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
576 CASE_SCODE (STG_E_INUSE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
577 CASE_SCODE (STG_E_NOTCURRENT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
578 CASE_SCODE (STG_E_REVERTED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
579 CASE_SCODE (STG_E_CANTSAVE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
580 CASE_SCODE (STG_E_OLDFORMAT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
581 CASE_SCODE (STG_E_OLDDLL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
582 CASE_SCODE (STG_E_SHAREREQUIRED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
583 CASE_SCODE (STG_E_NOTFILEBASEDSTORAGE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
584 CASE_SCODE (STG_E_EXTANTMARSHALLINGS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
585 CASE_SCODE (STG_S_CONVERTED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
586
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
587 // SCODE's defined in STORAGE.H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
588 CASE_SCODE (MK_E_CONNECTMANUALLY)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
589 CASE_SCODE (MK_E_EXCEEDEDDEADLINE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
590 CASE_SCODE (MK_E_NEEDGENERIC)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
591 CASE_SCODE (MK_E_UNAVAILABLE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
592 CASE_SCODE (MK_E_SYNTAX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
593 CASE_SCODE (MK_E_NOOBJECT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
594 CASE_SCODE (MK_E_INVALIDEXTENSION)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
595 CASE_SCODE (MK_E_INTERMEDIATEINTERFACENOTSUPPORTED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
596 CASE_SCODE (MK_E_NOTBINDABLE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
597 CASE_SCODE (MK_E_NOTBOUND)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
598 CASE_SCODE (MK_E_CANTOPENFILE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
599 CASE_SCODE (MK_E_MUSTBOTHERUSER)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
600 CASE_SCODE (MK_E_NOINVERSE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
601 CASE_SCODE (MK_E_NOSTORAGE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
602 CASE_SCODE (MK_E_NOPREFIX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
603 CASE_SCODE (MK_S_REDUCED_TO_SELF)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
604 CASE_SCODE (MK_S_ME)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
605 CASE_SCODE (MK_S_HIM)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
606 CASE_SCODE (MK_S_US)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
607 CASE_SCODE (MK_S_MONIKERALREADYREGISTERED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
609 // SCODE's defined in DISPATCH.H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
610 CASE_SCODE (DISP_E_UNKNOWNINTERFACE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
611 CASE_SCODE (DISP_E_MEMBERNOTFOUND)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
612 CASE_SCODE (DISP_E_PARAMNOTFOUND)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
613 CASE_SCODE (DISP_E_TYPEMISMATCH)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
614 CASE_SCODE (DISP_E_UNKNOWNNAME)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
615 CASE_SCODE (DISP_E_NONAMEDARGS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
616 CASE_SCODE (DISP_E_BADVARTYPE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
617 CASE_SCODE (DISP_E_EXCEPTION)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
618 CASE_SCODE (DISP_E_OVERFLOW)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
619 CASE_SCODE (DISP_E_BADINDEX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
620 CASE_SCODE (DISP_E_UNKNOWNLCID)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
621 CASE_SCODE (DISP_E_ARRAYISLOCKED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
622 CASE_SCODE (DISP_E_BADPARAMCOUNT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
623 CASE_SCODE (DISP_E_PARAMNOTOPTIONAL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
624 CASE_SCODE (DISP_E_BADCALLEE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
625 CASE_SCODE (DISP_E_NOTACOLLECTION)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
626
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
627 CASE_SCODE (TYPE_E_BUFFERTOOSMALL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
628 CASE_SCODE (TYPE_E_INVDATAREAD)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
629 CASE_SCODE (TYPE_E_UNSUPFORMAT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
630 CASE_SCODE (TYPE_E_REGISTRYACCESS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
631 CASE_SCODE (TYPE_E_LIBNOTREGISTERED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
632 CASE_SCODE (TYPE_E_UNDEFINEDTYPE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
633 CASE_SCODE (TYPE_E_QUALIFIEDNAMEDISALLOWED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
634 CASE_SCODE (TYPE_E_INVALIDSTATE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
635 CASE_SCODE (TYPE_E_WRONGTYPEKIND)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
636 CASE_SCODE (TYPE_E_ELEMENTNOTFOUND)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
637 CASE_SCODE (TYPE_E_AMBIGUOUSNAME)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
638 CASE_SCODE (TYPE_E_NAMECONFLICT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
639 CASE_SCODE (TYPE_E_UNKNOWNLCID)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
640 CASE_SCODE (TYPE_E_DLLFUNCTIONNOTFOUND)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
641 CASE_SCODE (TYPE_E_BADMODULEKIND)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
642 CASE_SCODE (TYPE_E_SIZETOOBIG)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
643 CASE_SCODE (TYPE_E_DUPLICATEID)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
644 CASE_SCODE (TYPE_E_TYPEMISMATCH)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
645 CASE_SCODE (TYPE_E_OUTOFBOUNDS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
646 CASE_SCODE (TYPE_E_IOERROR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
647 CASE_SCODE (TYPE_E_CANTCREATETMPFILE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
648 CASE_SCODE (TYPE_E_CANTLOADLIBRARY)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
649 CASE_SCODE (TYPE_E_INCONSISTENTPROPFUNCS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
650 CASE_SCODE (TYPE_E_CIRCULARTYPE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
651
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
652 default:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
653 lstrcpy (ErrName, "UNKNOWN SCODE");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
654 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
655
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
656 char Buf[256];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
657 sprintf (Buf, "An OLE error occured:\r\nCode = %s\r\nResult = %lx.",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
658 (char*) ErrName, m_hResult);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
659 MessageBox (NULL, Buf, "OLE Error", MB_OK);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
660 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
661
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
662
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
663 static bool CountArgsInFormat (LPCTSTR Format, UINT* pArgCount)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
664 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
665 *pArgCount = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
666
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
667 if (! Format)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
668 return true;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
669
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
670 while (*Format)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
671 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
672 if (*Format == '&')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
673 Format++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
674
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
675 switch (*Format)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
676 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
677 case 'b':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
678 case 'i':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
679 case 'I':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
680 case 'r':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
681 case 'R':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
682 case 'c':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
683 case 's':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
684 case 'e':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
685 case 'd':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
686 case 'v':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
687 case 'D':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
688 case 'U':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
689 ++ (*pArgCount);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
690 Format++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
691 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
692 case '\0':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
693 default:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
694 return false;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
695 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
696 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
697 return true;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
698 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
699
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
700 static LPCTSTR GetNextVarType (LPCTSTR Format, VARTYPE* pVarType)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
701 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
702 *pVarType = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
703 if (*Format == '&')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
704 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
705 *pVarType = VT_BYREF;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
706 Format++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
707 if (!*Format)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
708 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
709 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
710 switch (*Format)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
711 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
712 case 'b':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
713 *pVarType |= VT_BOOL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
714 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
715 case 'i':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
716 *pVarType |= VT_I2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
717 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
718 case 'I':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
719 *pVarType |= VT_I4;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
720 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
721 case 'r':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
722 *pVarType |= VT_R4;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
723 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
724 case 'R':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
725 *pVarType |= VT_R8;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
726 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
727 case 'c':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
728 *pVarType |= VT_CY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
729 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
730 case 's':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
731 *pVarType |= VT_BSTR;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
732 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
733 case 'e':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
734 *pVarType |= VT_ERROR;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
735 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
736 case 'd':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
737 *pVarType |= VT_DATE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
738 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
739 case 'v':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
740 *pVarType |= VT_VARIANT;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
741 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
742 case 'U':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
743 *pVarType |= VT_UNKNOWN;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
744 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
745 case 'D':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
746 *pVarType |= VT_DISPATCH;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
747 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
748 case '\0':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
749 return NULL; // End of Format string
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
750 default:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
751 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
752 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
753 return ++Format;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
754 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
755
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
756 #ifndef UNICODE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
757 char* ConvertToAnsi (OLECHAR* sUnicode)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
758 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
759 static char BufAscii[MAX_OLE_STR];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
760 return ConvertToAnsiBuf (sUnicode, BufAscii);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
761 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
762
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
763 char* ConvertToAnsiBuf (OLECHAR* sUnicode, char* BufAscii)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
764 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
765 WideCharToMultiByte (CP_ACP, 0, sUnicode, -1, BufAscii, MAX_OLE_STR, NULL, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
766 return BufAscii;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
767 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
768
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
769 OLECHAR* ConvertToUnicode (char* sAscii)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
770 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
771 static OLECHAR BufUnicode[MAX_OLE_STR];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
772 return ConvertToUnicodeBuf (sAscii, BufUnicode);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
773 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
774
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
775 OLECHAR* ConvertToUnicodeBuf (char* sAscii, OLECHAR* BufUnicode)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
776 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
777 MultiByteToWideChar (CP_ACP, 0, sAscii, -1, BufUnicode, MAX_OLE_STR);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
778 return BufUnicode;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
779 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
780 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
781