Click here to Skip to main content
15,905,238 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: about MessageBox Pin
David Crow7-Dec-04 3:46
David Crow7-Dec-04 3:46 
GeneralI'm looking for solutions Pin
Rassul Yunussov6-Dec-04 19:24
Rassul Yunussov6-Dec-04 19:24 
GeneralRe: I'm looking for solutions Pin
David Crow7-Dec-04 3:01
David Crow7-Dec-04 3:01 
GeneralRe: I'm looking for solutions Pin
Rassul Yunussov7-Dec-04 4:47
Rassul Yunussov7-Dec-04 4:47 
GeneralRe: I'm looking for solutions Pin
Antony M Kancidrowski7-Dec-04 4:59
Antony M Kancidrowski7-Dec-04 4:59 
GeneralRe: I'm looking for solutions Pin
David Crow7-Dec-04 7:27
David Crow7-Dec-04 7:27 
GeneralSAFEARRAY Pin
Rassul Yunussov6-Dec-04 17:23
Rassul Yunussov6-Dec-04 17:23 
GeneralRe: SAFEARRAY Pin
Steve S7-Dec-04 1:23
Steve S7-Dec-04 1:23 
Your data structures aren't VT_VARIANT, they are VT_RECORD.

You can define structures in an IDL file, and use SAFEARRAY(structname) in the IDL, just like SAFEARRAY(BSTR) or SAFEARRAY(LONG). If the base types are all oleautomation compatible, then you don't need to worry too much about marshalling.

To create and populate an array, you need stuff like this;

CComPtr<irecordinfo> spRI;
hr = GetRecordInfoFromGuids( LIBID_MyLib, 1, 0, 0x409,
__uuidof(structname), &spRI );

if (SUCCEEDED(hr))
{
SAFEARRAY* psa;
structname * pdef;
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = 500;
psa = SafeArrayCreateEx( VT_RECORD, 1, rgsabound, spRI );
if (psa)
{
SafeArrayAccessData(psa, (void**)&pdef);
// can now access pdef[0].xxx, pdef[1].xxx etc
SafeArrayUnaccessData(psa);
}
}

Does that help any?


Steve S
Developer for hire
GeneralRe: SAFEARRAY Pin
Rassul Yunussov7-Dec-04 4:45
Rassul Yunussov7-Dec-04 4:45 
GeneralRe: SAFEARRAY Pin
Steve S7-Dec-04 6:09
Steve S7-Dec-04 6:09 
GeneralCFormView Pin
bluehai6-Dec-04 17:09
bluehai6-Dec-04 17:09 
GeneralRe: CFormView Pin
Antony M Kancidrowski7-Dec-04 5:04
Antony M Kancidrowski7-Dec-04 5:04 
GeneralRe: CFormView Pin
Steve S7-Dec-04 23:51
Steve S7-Dec-04 23:51 
Generalread the DOC file Pin
tiem6-Dec-04 16:35
tiem6-Dec-04 16:35 
GeneralRe: read the DOC file Pin
David Crow7-Dec-04 3:43
David Crow7-Dec-04 3:43 
GeneralCheck file exist Pin
jinxmanh6-Dec-04 15:56
sussjinxmanh6-Dec-04 15:56 
GeneralRe: Check file exist Pin
ThatsAlok6-Dec-04 17:12
ThatsAlok6-Dec-04 17:12 
GeneralRe: Check file exist Pin
PJ Arends6-Dec-04 18:06
professionalPJ Arends6-Dec-04 18:06 
GeneralRe: Check file exist Pin
ThatsAlok6-Dec-04 18:52
ThatsAlok6-Dec-04 18:52 
GeneralRe: Check file exist Pin
David Crow7-Dec-04 3:54
David Crow7-Dec-04 3:54 
GeneralProblem about tab stop Pin
ytod6-Dec-04 14:55
ytod6-Dec-04 14:55 
GeneralRe: Problem about tab stop Pin
ytod6-Dec-04 15:05
ytod6-Dec-04 15:05 
GeneralRe: Problem about tab stop Pin
namaskaaram6-Dec-04 22:19
namaskaaram6-Dec-04 22:19 
GeneralParent window not on the top Pin
Vancouver6-Dec-04 14:34
Vancouver6-Dec-04 14:34 
GeneralRe: Parent window not on the top Pin
Prakash Nadar6-Dec-04 14:38
Prakash Nadar6-Dec-04 14:38 

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.