Click here to Skip to main content
15,910,358 members
Home / Discussions / COM
   

COM

 
Generalerror C2259 Pin
Krishnatv8-Jan-08 18:35
Krishnatv8-Jan-08 18:35 
AnswerRe: error C2259 Pin
Lim Bio Liong9-Jan-08 0:20
Lim Bio Liong9-Jan-08 0:20 
GeneralRe: error C2259 Pin
Krishnatv9-Jan-08 17:53
Krishnatv9-Jan-08 17:53 
GeneralRe: error C2259 Pin
Lim Bio Liong9-Jan-08 19:35
Lim Bio Liong9-Jan-08 19:35 
QuestionHow to access member functions of coclass from its Interface Pin
mandanani8-Jan-08 16:32
mandanani8-Jan-08 16:32 
AnswerRe: How to access member functions of coclass from its Interface Pin
mandanani8-Jan-08 20:42
mandanani8-Jan-08 20:42 
AnswerRe: How to access member functions of coclass from its Interface Pin
prasad_som9-Jan-08 1:29
prasad_som9-Jan-08 1:29 
QuestionHow to using C# Class Library in VC++/COM Pin
Member 42194196-Jan-08 23:45
Member 42194196-Jan-08 23:45 
GeneralRe: How to using C# Class Library in VC++/COM Pin
Mike Dimmick7-Jan-08 11:00
Mike Dimmick7-Jan-08 11:00 
GeneralCOM on MAC Operating System Pin
Gupta Suraj6-Jan-08 22:08
Gupta Suraj6-Jan-08 22:08 
GeneralATL_NO_VTABLE means ..... Pin
tasumisra6-Jan-08 18:18
tasumisra6-Jan-08 18:18 
GeneralRe: ATL_NO_VTABLE means ..... Pin
CPallini6-Jan-08 22:00
mveCPallini6-Jan-08 22:00 
GeneralRe: ATL_NO_VTABLE means ..... Pin
Mike Dimmick6-Jan-08 23:58
Mike Dimmick6-Jan-08 23:58 
QuestionHow to call a function in DLL Pin
chaitannya_m4-Jan-08 4:12
chaitannya_m4-Jan-08 4:12 
QuestionVS2008, MIDL compiler bug Pin
Gary Wheeler4-Jan-08 4:10
Gary Wheeler4-Jan-08 4:10 
GeneralRe: VS2008, MIDL compiler bug Pin
Mike Dimmick6-Jan-08 8:27
Mike Dimmick6-Jan-08 8:27 
GeneralRe: VS2008, MIDL compiler bug Pin
Gary Wheeler7-Jan-08 1:16
Gary Wheeler7-Jan-08 1:16 
GeneralRe: VS2008, MIDL compiler bug Pin
Mike Dimmick7-Jan-08 10:58
Mike Dimmick7-Jan-08 10:58 
GeneralRe: VS2008, MIDL compiler bug Pin
Gary Wheeler8-Jan-08 0:52
Gary Wheeler8-Jan-08 0:52 
GeneralRe: VS2008, MIDL compiler bug Pin
Mike Dimmick8-Jan-08 9:40
Mike Dimmick8-Jan-08 9:40 
GeneralRe: Calling ActiveX DLL from MFC - passing arrays Pin
mla1543-Jan-08 10:05
mla1543-Jan-08 10:05 
GeneralRe: Calling ActiveX DLL from MFC - passing arrays Pin
CPallini3-Jan-08 10:53
mveCPallini3-Jan-08 10:53 
GeneralRe: Calling ActiveX DLL from MFC - passing arrays Pin
mla1543-Jan-08 11:17
mla1543-Jan-08 11:17 
QuestionRe: Calling ActiveX DLL from MFC - passing arrays Pin
CPallini3-Jan-08 21:11
mveCPallini3-Jan-08 21:11 
GeneralRe: Calling ActiveX DLL from MFC - passing arrays Pin
mla1544-Jan-08 3:39
mla1544-Jan-08 3:39 
SAFEARRAY* CreateASafeArray() 
{
	//http://www.geocities.com/Jeff_Louie/safearray.html
	USES_CONVERSION;  // enables use of ATL conversion macro A2W
	char buffer[20];  // used to store ANSI string
	HRESULT hr= S_OK;

	// Create SafeArray of VARIANT BSTRs
	SAFEARRAY *pSA;
	SAFEARRAYBOUND aDim[1];    // a one dimensional array
	aDim[0].lLbound= 0;  // Visual Basic arrays start with index 0
	aDim[0].cElements= 10;
	pSA= SafeArrayCreate(VT_VARIANT,1,aDim);  // create a 1D SafeArray of VARIANTS
	if (pSA != NULL) {
		long aLong[1];
		// iterate over array adding VARIANTs of type VT_BSTR
		for (long l= aDim[0].lLbound; l< (long)(aDim[0].cElements + aDim[0].lLbound); l++) { 
			VARIANT vOut;
			VariantInit(&vOut);
			vOut.vt= VT_BSTR;  // set type
			_ltoa_s(l,buffer,10);  // convert long to ANSI string value
			vOut.bstrVal= ::SysAllocString(A2W(buffer)); // system wide "new"
			aLong[0]= l;  // set index value
			if (hr= SafeArrayPutElement(pSA, aLong, &vOut)) { // "correctly" copies VARIANT
				VariantClear(&vOut);  // release BSTR from memory on error
				SafeArrayDestroy(pSA); // does a deep destroy on error
				return NULL;
			}
			VariantClear(&vOut);  // does a deep destroy of source VARIANT
		} // end iteration
	}
	return pSA;
	// clean up here only if you do not return SafeArray as an [out, retval]
	SafeArrayDestroy(pSA); // again does a deep destroy
}

void CaxDlg::OnBnClickedButton1()
{
	SAFEARRAY *pSA3 = CreateASafeArray ();
}


Regards,
Mike

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.