Click here to Skip to main content
15,908,768 members
Home / Discussions / COM
   

COM

 
GeneralRe: Ok. The dumbest 2 questions Pin
CherezZaboro16-May-05 11:01
CherezZaboro16-May-05 11:01 
GeneralRe: Ok. The dumbest 2 questions Pin
rwestgraham16-May-05 11:37
rwestgraham16-May-05 11:37 
GeneralRe: Ok. The dumbest 2 questions Pin
User 21559721-May-05 0:38
User 21559721-May-05 0:38 
GeneralDCOM and C# Pin
Millzy14-May-05 10:22
Millzy14-May-05 10:22 
GeneralSharing enums between COM objects Pin
Sir Garence12-May-05 23:52
sussSir Garence12-May-05 23:52 
GeneralRe: Sharing enums between COM objects Pin
User 21559719-May-05 21:45
User 21559719-May-05 21:45 
GeneralRe: Sharing enums between COM objects Pin
Hariharan.T19-May-05 23:14
Hariharan.T19-May-05 23:14 
GeneralGetting SafeArray** in C++ from VB COM Pin
hanofee12-May-05 22:59
hanofee12-May-05 22:59 
Hi Gurus,

I have to call a function in VB COM, with parameter SAFEARRAY ** (it's originally "ByRef TabList() As String" in VB), as below:
HRESULT bGetTab(SAFEARRAY ** TabList, long* iMaxNumber).

I successfully called it with Smart Pointer without any problem (but seems Smart Pointer is doing early binding, I guess it might not be compatible with the next version of that VB COM).

So, I tried the InvokeHelper to do late binding. It's working with the simple functions generates by ClassWizard, but not with that bGetTab function. Here is my code for InvokeHelper (I have to make it by myself, cause the ClassWizard is not capable to generate for that function)

// Function to get a string table with iMaxNumber elements
// VB Code: Public Function bGetTab(ByRef TabList() As String, ByRef iMaxNumber As Long) As Boolean
BOOL CKMServices::bGetTab(SAFEARRAY **TabList, long *iMaxNumber)
{
BOOL result;
static BYTE parms[] =
VTS_PVARIANT VTS_PI4;

InvokeHelper(GetDispid(this->m_lpDispatch, _T("bGetTab")), DISPATCH_METHOD, VT_BOOL, (void*)&result, parms, TabList, iMaxNumber);

return result;
}

// And how do I call that function
SAFEARRAY *arrTab = NULL;

arrTab = SafeArrayCreateVector(VT_BSTR, 0, iMaxNumber);
if (!arrTab) _com_issue_error(E_OUTOFMEMORY);

if(!m_KMServer->bGetTab(&arrTab, &iMaxNumber))
{// Return custom error message }

I've allocated my TabList before calling. But I'm not sure what the type to put for SAFEARRAY **. I have tried VTS_PBSTR, with the same result (it raised COleException).

Cry | :((

Thanks before,
Hany
GeneralConverting interface pointers Pin
Mikke_x12-May-05 19:20
Mikke_x12-May-05 19:20 
GeneralRe: Converting interface pointers Pin
ursus zeta15-May-05 9:48
ursus zeta15-May-05 9:48 
GeneralStrange behavior of BSTRs in DCOM Pin
morenz12-May-05 3:01
morenz12-May-05 3:01 
GeneralRe: Strange behavior of BSTRs in DCOM Pin
Indagro12-May-05 20:54
Indagro12-May-05 20:54 
GeneralRe: Strange behavior of BSTRs in DCOM Pin
morenz16-May-05 5:19
morenz16-May-05 5:19 
GeneralRe: Strange behavior of BSTRs in DCOM Pin
Indagro18-May-05 23:35
Indagro18-May-05 23:35 
GeneralRe: Strange behavior of BSTRs in DCOM Pin
morenz20-May-05 13:08
morenz20-May-05 13:08 
GeneralRe: Strange behavior of BSTRs in DCOM Pin
Vi212-May-05 21:08
Vi212-May-05 21:08 
GeneralRe: Strange behavior of BSTRs in DCOM Pin
morenz16-May-05 2:52
morenz16-May-05 2:52 
GeneralMS Excel 10.0 object library Pin
Member 164882912-May-05 0:55
Member 164882912-May-05 0:55 
GeneralNeed help in NetMeeting Desktop Sharing Pin
shainisnair12-May-05 0:46
shainisnair12-May-05 0:46 
GeneralUsing two .tlb files which has same class/interface Pin
jabhi197411-May-05 21:26
jabhi197411-May-05 21:26 
GeneralRe: Using two .tlb files which has same class/interface Pin
Indagro12-May-05 21:08
Indagro12-May-05 21:08 
GeneralMTS packages Pin
Pavneet Singh10-May-05 0:58
Pavneet Singh10-May-05 0:58 
GeneralRe: MTS packages Pin
Rizwan Bashir10-May-05 23:22
Rizwan Bashir10-May-05 23:22 
GeneralRe: MTS packages Pin
Pavneet Singh12-May-05 9:03
Pavneet Singh12-May-05 9:03 
GeneralRe: MTS packages Pin
Rizwan Bashir12-May-05 22:34
Rizwan Bashir12-May-05 22:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.