comparison src/VisVim/OleAut.h @ 7:3fc0f57ecb91 v7.0001

updated for version 7.0001
author vimboss
date Sun, 13 Jun 2004 20:20:40 +0000
parents
children
comparison
equal deleted inserted replaced
6:c2daee826b8f 7:3fc0f57ecb91
1 #ifndef __OLEAUT_H__
2 #define __OLEAUT_H__
3
4 class COleAutomationControl : public CObject
5 {
6 public:
7 COleAutomationControl ();
8 ~COleAutomationControl ();
9 bool CreateObject (char* ProgId);
10 DISPID GetDispatchId (char* Name);
11 bool GetProperty (char* Name);
12 bool GetProperty (DISPID DispatchId);
13 bool PutProperty (char* Name, LPCTSTR Format, ...);
14 bool PutProperty (DISPID DispatchId, LPCTSTR Format, ...);
15 bool Method (char* Name, LPCTSTR Format = NULL, ...);
16 bool Method (DISPID DispatchId, LPCTSTR Format = NULL, ...);
17 void DeleteObject ();
18 void ErrDiag ();
19 bool IsCreated ()
20 {
21 return m_pDispatch ? true : false;
22 }
23 bool IsAlive ();
24 HRESULT GetResult ()
25 {
26 return m_hResult;
27 }
28 UINT GetErrArgNr ()
29 {
30 return m_nErrArg;
31 }
32 EXCEPINFO* GetExceptionInfo ()
33 {
34 return &m_ExceptionInfo;
35 }
36 LPVARIANT GetResultVariant ()
37 {
38 return &m_VariantResult;
39 }
40
41 protected:
42 bool Invoke (WORD Flags, char* Name, LPCTSTR Format, va_list ArgList);
43 bool Invoke (WORD Flags, DISPID DispatchId, LPCTSTR Format, va_list ArgList);
44
45 protected:
46 IDispatch* m_pDispatch;
47 HRESULT m_hResult;
48 UINT m_nErrArg;
49 EXCEPINFO m_ExceptionInfo;
50 VARIANTARG m_VariantResult;
51 };
52
53 #ifdef UNICODE
54 #define FROM_OLE_STRING(str) str
55 #define FROM_OLE_STRING_BUF(str,buf) str
56 #define TO_OLE_STR(str) str
57 #define TO_OLE_STR_BUF(str,buf) str
58 #define MAX_OLE_STR 1
59 #else
60 #define FROM_OLE_STR(str) ConvertToAnsi(str)
61 #define FROM_OLE_STR_BUF(str,buf) ConvertToAnsiBuf(str,buf)
62 char* ConvertToAnsi (OLECHAR* sUnicode);
63 char* ConvertToAnsiBuf (OLECHAR* sUnicode, char* Buf);
64 #define TO_OLE_STR(str) ConvertToUnicode(str)
65 #define TO_OLE_STR_BUF(str,buf) ConvertToUnicodeBuf(str,buf)
66 OLECHAR* ConvertToUnicode (char* sAscii);
67 OLECHAR* ConvertToUnicodeBuf (char* sAscii, OLECHAR* Buf);
68 // Maximum length of string that can be converted between Ansi & Unicode
69 #define MAX_OLE_STR 500
70 #endif
71
72
73 #endif // __OLEAUT_H__