Click here to Skip to main content
15,916,449 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++ STL help... using pointer in STL map Pin
Anonymous23-Jun-04 14:20
Anonymous23-Jun-04 14:20 
QuestionHow to Enable/Disable the hibernation support in VC++ Pin
ErisonWu22-Jun-04 21:57
ErisonWu22-Jun-04 21:57 
GeneralChange cursor in a region of a CStatic Pin
doctorpi22-Jun-04 21:52
doctorpi22-Jun-04 21:52 
GeneralRe: Change cursor in a region of a CStatic Pin
Johan Rosengren22-Jun-04 22:21
Johan Rosengren22-Jun-04 22:21 
Questionhow to find all folders which are shared fully in my drive??? Pin
ngocdq22-Jun-04 21:34
ngocdq22-Jun-04 21:34 
AnswerRe: how to find all folders which are shared fully in my drive??? Pin
shri_3120-Sep-04 3:26
shri_3120-Sep-04 3:26 
GeneralCalling a C++ dll in VB with strucures & strings Pin
Cedric Moonen22-Jun-04 21:21
Cedric Moonen22-Jun-04 21:21 
GeneralRe: Calling a C++ dll in VB with strucures & strings Pin
Antony M Kancidrowski22-Jun-04 23:22
Antony M Kancidrowski22-Jun-04 23:22 
If you change the type to a VARIANT and do the following you should be able to pass a collection of strings through to it. I have not tried this with VB but it ought to work.

int __stdcall TestFunc(VARIANT var)
{
  // Check the variant type and contents
  if ((var.vt & VT_ARRAY) == 0)
    return E_INVALIDARG;
<br>
  if ((var.vt & VT_BSTR) == 0)
    return E_INVALIDARG;
<br>
  // OK, we have a safe array of BSTRs
  SAFEARRAY*	pSA = var.parray;
  BSTR*		bstrArray;
<br>
  // Lock the data
  SafeArrayAccessData(pSA, reinterpret_cast<void**>(&bstrArray));
<br>
  for (unsigned i = 0; i < pSA->rgsabound->cElements; i++)
  {
    // do something with bstrArray[i];
  }
<br>
  // Allow others to use it
  SafeArrayUnaccessData(pSA);
}



Some C++ test code

  // Generate the safe array for the data
  VARIANT		var;
  int		nSize = <size of array>;
<br>
  VariantInit(&var);
<br>
  var.vt = VT_ARRAY | VT_BSTR;
<br>
  SAFEARRAY*		pSA;
  SAFEARRAYBOUND	bounds = {nSize, 0};		// nSize items starting with index 0
<br>
  pSA = SafeArrayCreate(VT_BSTR, 1, &bounds);
<br>
  BSTR*	bstrArray;
<br>
  // Access the data and add the new items
  SafeArrayAccessData(pSA, reinterpret_cast<void**>(&bstrArray));
<br>
  for (int i = 0; i < nSize; i++)
  {
    // Set the element of bstrArray[i]
  }
<br>
  SafeArrayUnaccessData(pSA);
<br>
  var.parray = pSA;
<br>
  // Call TestFunc with var as parameter


Hope that helps

Ant.

I'm hard, yet soft.
I'm coloured, yet clear.
I'm fuity and sweet.
I'm jelly, what am I? Muse on it further, I shall return!
- David Williams (Little Britain)

GeneralSelect File Control. Pin
zooosta22-Jun-04 20:52
zooosta22-Jun-04 20:52 
GeneralRe: Select File Control. Pin
V.22-Jun-04 21:24
professionalV.22-Jun-04 21:24 
GeneralRe: Select File Control. Pin
zooosta23-Jun-04 13:10
zooosta23-Jun-04 13:10 
GeneralRegQueryValueEx Pin
22-Jun-04 20:16
suss22-Jun-04 20:16 
GeneralRe: RegQueryValueEx Pin
Sir.Ixildore22-Jun-04 20:38
Sir.Ixildore22-Jun-04 20:38 
QuestionHow to change caption of a button on a property page? Pin
Rajesh_K_Sharma22-Jun-04 19:29
Rajesh_K_Sharma22-Jun-04 19:29 
AnswerRe: How to change caption of a button on a property page? Pin
Antony M Kancidrowski22-Jun-04 23:34
Antony M Kancidrowski22-Jun-04 23:34 
Generalalert messages Pin
ask_you22-Jun-04 19:12
ask_you22-Jun-04 19:12 
GeneralRe: alert messages Pin
bneacetp22-Jun-04 19:23
bneacetp22-Jun-04 19:23 
GeneralRe: alert messages Pin
ask_you22-Jun-04 19:46
ask_you22-Jun-04 19:46 
GeneralRe: alert messages Pin
bneacetp22-Jun-04 19:47
bneacetp22-Jun-04 19:47 
GeneralRe: alert messages Pin
ask_you22-Jun-04 22:26
ask_you22-Jun-04 22:26 
GeneralRe: alert messages Pin
jmkhael23-Jun-04 1:35
jmkhael23-Jun-04 1:35 
GeneralRe: alert messages Pin
ask_you23-Jun-04 17:27
ask_you23-Jun-04 17:27 
QuestionHow to packaged an MFC project? Pin
ngocdq22-Jun-04 17:59
ngocdq22-Jun-04 17:59 
AnswerRe: How to packaged an MFC project? Pin
bneacetp22-Jun-04 18:13
bneacetp22-Jun-04 18:13 
AnswerRe: How to packaged an MFC project? Pin
Anthony_Yio22-Jun-04 23:56
Anthony_Yio22-Jun-04 23:56 

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.