Click here to Skip to main content
15,895,084 members
Home / Discussions / COM
   

COM

 
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

AnswerRe: Calling ActiveX DLL from MFC - passing arrays Pin
Lim Bio Liong4-Jan-08 23:24
Lim Bio Liong4-Jan-08 23:24 
GeneralRe: Calling ActiveX DLL from MFC - passing arrays [modified] Pin
mla1547-Jan-08 4:24
mla1547-Jan-08 4:24 
GeneralRe: Calling ActiveX DLL from MFC - passing arrays Pin
Lim Bio Liong7-Jan-08 15:10
Lim Bio Liong7-Jan-08 15:10 
QuestionMSSOAPLib30 SoapReader30Class LoadWithParser Error Pin
miauwmiauwmiauw2-Jan-08 19:31
miauwmiauwmiauw2-Jan-08 19:31 
QuestionHow to Use events from VB.NET in VC.NET? Pin
ritz12341-Jan-08 2:38
ritz12341-Jan-08 2:38 
GeneralActiveXControl with empty Parameters in c# Pin
FriendOfAsherah30-Dec-07 23:14
FriendOfAsherah30-Dec-07 23:14 
Questionprinting - dot matrix printer Pin
bijumon Mathew30-Dec-07 18:54
bijumon Mathew30-Dec-07 18:54 
GeneralHey man, COM stands for Component Object Model Pin
CPallini30-Dec-07 21:14
mveCPallini30-Dec-07 21:14 
GeneralShell Extension Left-Click Pin
Jens Frederich28-Dec-07 23:49
Jens Frederich28-Dec-07 23:49 
QuestionOverride GetOverrideKeyPath of IDocHostUIHandler2 interface. Pin
ashdwivedi26-Dec-07 21:07
ashdwivedi26-Dec-07 21:07 
Generalabout dll and exe Pin
Shaileshvb26-Dec-07 17:44
Shaileshvb26-Dec-07 17:44 
GeneralRe: about dll and exe Pin
CPallini26-Dec-07 23:09
mveCPallini26-Dec-07 23:09 
General32bit deskband DLL in Vista64 Pin
exper_t24-Dec-07 21:18
exper_t24-Dec-07 21:18 
GeneralRe: 32bit deskband DLL in Vista64 Pin
«_Superman_»27-Dec-07 22:56
professional«_Superman_»27-Dec-07 22:56 
Questionhow to convert .aspx page to .pdf on fly using asp.net in vb.net Pin
gopal_Pandey20-Dec-07 18:03
gopal_Pandey20-Dec-07 18:03 
Generalexcel object Pin
gauthee20-Dec-07 3:41
gauthee20-Dec-07 3:41 
GeneralRe: excel object Pin
User 21559720-Dec-07 5:17
User 21559720-Dec-07 5:17 

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.