]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/ole/automtn.h
added wxWxCharBuffer which stands for buffer of wxChars
[wxWidgets.git] / include / wx / msw / ole / automtn.h
CommitLineData
e8b6d59d
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: automtn.h
3// Purpose: OLE automation utilities
4// Author: Julian Smart
5// Modified by:
6// Created: 11/6/98
7// RCS-ID: $Id$
8// Copyright: (c) 1998, Julian Smart
65571936 9// Licence: wxWindows licence
e8b6d59d
JS
10/////////////////////////////////////////////////////////////////////////////
11
e8b6d59d
JS
12#ifndef _WX_AUTOMTN_H_
13#define _WX_AUTOMTN_H_
14
15#include "wx/object.h"
16#include "wx/variant.h"
17
18typedef void WXIDISPATCH;
19typedef unsigned short* WXBSTR;
20
89c684ef
JS
21#ifdef GetObject
22#undef GetObject
23#endif
24
e8b6d59d
JS
25/*
26 * wxAutomationObject
27 * Wraps up an IDispatch pointer and invocation; does variant conversion.
28 */
29
8853b9a8 30class WXDLLEXPORT wxAutomationObject: public wxObject
e8b6d59d
JS
31{
32public:
33 wxAutomationObject(WXIDISPATCH* dispatchPtr = NULL);
34 ~wxAutomationObject();
35
0a0e6a5b 36 // Set/get dispatch pointer
e8b6d59d
JS
37 inline void SetDispatchPtr(WXIDISPATCH* dispatchPtr) { m_dispatchPtr = dispatchPtr; };
38 inline WXIDISPATCH* GetDispatchPtr() const { return m_dispatchPtr; }
39
0a0e6a5b
WS
40 // Get a dispatch pointer from the current object associated
41 // with a class id, such as "Excel.Application"
42 bool GetInstance(const wxString& classId) const;
e8b6d59d 43
0a0e6a5b
WS
44 // Get a dispatch pointer from a new instance of the the class
45 bool CreateInstance(const wxString& classId) const;
e8b6d59d 46
0a0e6a5b
WS
47 // Low-level invocation function. Pass either an array of variants,
48 // or an array of pointers to variants.
e8b6d59d
JS
49 bool Invoke(const wxString& member, int action,
50 wxVariant& retValue, int noArgs, wxVariant args[], const wxVariant* ptrArgs[] = 0) const;
51
0a0e6a5b
WS
52 // Invoke a member function
53 wxVariant CallMethod(const wxString& method, int noArgs, wxVariant args[]);
54 wxVariant CallMethodArray(const wxString& method, int noArgs, const wxVariant **args);
e8b6d59d 55
0a0e6a5b
WS
56 // Convenience function
57 wxVariant CallMethod(const wxString& method,
58 const wxVariant& arg1 = wxNullVariant, const wxVariant& arg2 = wxNullVariant,
59 const wxVariant& arg3 = wxNullVariant, const wxVariant& arg4 = wxNullVariant,
60 const wxVariant& arg5 = wxNullVariant, const wxVariant& arg6 = wxNullVariant);
e8b6d59d 61
0a0e6a5b 62 // Get/Put property
e8b6d59d 63 wxVariant GetProperty(const wxString& property, int noArgs = 0, wxVariant args[] = (wxVariant*) NULL) const;
0a0e6a5b
WS
64 wxVariant GetPropertyArray(const wxString& property, int noArgs, const wxVariant **args) const;
65 wxVariant GetProperty(const wxString& property,
66 const wxVariant& arg1, const wxVariant& arg2 = wxNullVariant,
67 const wxVariant& arg3 = wxNullVariant, const wxVariant& arg4 = wxNullVariant,
68 const wxVariant& arg5 = wxNullVariant, const wxVariant& arg6 = wxNullVariant);
e8b6d59d 69
c55fd2c6 70 bool PutPropertyArray(const wxString& property, int noArgs, const wxVariant **args);
e8b6d59d 71 bool PutProperty(const wxString& property, int noArgs, wxVariant args[]) ;
0a0e6a5b
WS
72 bool PutProperty(const wxString& property,
73 const wxVariant& arg1, const wxVariant& arg2 = wxNullVariant,
74 const wxVariant& arg3 = wxNullVariant, const wxVariant& arg4 = wxNullVariant,
75 const wxVariant& arg5 = wxNullVariant, const wxVariant& arg6 = wxNullVariant);
76
77 // Uses DISPATCH_PROPERTYGET
78 // and returns a dispatch pointer. The calling code should call Release
79 // on the pointer, though this could be implicit by constructing an wxAutomationObject
80 // with it and letting the destructor call Release.
e8b6d59d 81 WXIDISPATCH* GetDispatchProperty(const wxString& property, int noArgs, wxVariant args[]) const;
24f4ad95 82 WXIDISPATCH* GetDispatchProperty(const wxString& property, int noArgs, const wxVariant **args) const;
e8b6d59d 83
0a0e6a5b
WS
84 // A way of initialising another wxAutomationObject with a dispatch object,
85 // without having to deal with nasty IDispatch pointers.
86 bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs = 0, wxVariant args[] = (wxVariant*) NULL) const;
87 bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs, const wxVariant **args) const;
e8b6d59d 88
e8b6d59d
JS
89public:
90 WXIDISPATCH* m_dispatchPtr;
22f3361e
VZ
91
92 DECLARE_NO_COPY_CLASS(wxAutomationObject)
e8b6d59d
JS
93};
94
e8b6d59d
JS
95
96#endif
97 // _WX_AUTOMTN_H_