Click here to Skip to main content
15,920,688 members
Home / Discussions / COM
   

COM

 
QuestionActiveX call OLEDraw to draw Flash(swf) failed, only under Internet Explorer Pin
l_arrow14-Mar-09 18:26
l_arrow14-Mar-09 18:26 
QuestionActive X Control properties - Usage Pin
AssemblySoft13-Mar-09 3:07
AssemblySoft13-Mar-09 3:07 
QuestionEudora Plugin problem Pin
Crazy Kiya re12-Mar-09 20:40
Crazy Kiya re12-Mar-09 20:40 
QuestionCOMException Pin
Reetu Singh11-Mar-09 18:00
Reetu Singh11-Mar-09 18:00 
AnswerRe: COMException Pin
CPallini12-Mar-09 10:40
mveCPallini12-Mar-09 10:40 
QuestionOpen source my OIOIC, a completely new object-oriented mechanism for the C. [modified] Pin
pervise.zhao10-Mar-09 20:36
pervise.zhao10-Mar-09 20:36 
AnswerRe: Open source my OIOIC, a completely new object-oriented mechanism for the C. Pin
pervise.zhao11-Mar-09 15:56
pervise.zhao11-Mar-09 15:56 
QuestionDEVICE COM PORT PROBLEMS IN BIOS Pin
Mr. Noatak10-Mar-09 12:04
Mr. Noatak10-Mar-09 12:04 
AnswerRe: DEVICE COM PORT PROBLEMS IN BIOS Pin
Jonathan Davies10-Mar-09 23:29
Jonathan Davies10-Mar-09 23:29 
GeneralRe: DEVICE COM PORT PROBLEMS IN BIOS Pin
Mr. Noatak11-Mar-09 11:34
Mr. Noatak11-Mar-09 11:34 
GeneralRe: DEVICE COM PORT PROBLEMS IN BIOS Pin
Jonathan Davies11-Mar-09 12:47
Jonathan Davies11-Mar-09 12:47 
QuestionActiveX component can't create object Pin
KSowmya10-Mar-09 5:49
KSowmya10-Mar-09 5:49 
AnswerRe: ActiveX component can't create object Pin
Jonathan Davies10-Mar-09 6:18
Jonathan Davies10-Mar-09 6:18 
AnswerRe: ActiveX component can't create object Pin
Member 427497711-Mar-09 15:59
Member 427497711-Mar-09 15:59 
Questionwhat is "double %" Pin
Larry Pan9-Mar-09 9:03
Larry Pan9-Mar-09 9:03 
AnswerRe: what is "double %" Pin
«_Superman_»9-Mar-09 18:40
professional«_Superman_»9-Mar-09 18:40 
GeneralRe: what is "double %" Pin
Larry Pan10-Mar-09 4:31
Larry Pan10-Mar-09 4:31 
Questionsend a COM object with a BSTR value type in a MSMQ message Pin
jxtamarc9-Mar-09 7:32
jxtamarc9-Mar-09 7:32 
Hi everyone,

I'm trying to send a COM object over a MSMQ message in C++. This is my object :

class ATL_NO_VTABLE CAnalisis :
	public CComObjectRootEx<ccomsinglethreadmodel>,
	public CComCoClass<canalisis,>,
	public ISupportErrorInfo,
	public IDispatchImpl,
	public IPersistStreamInit
{
private:
	typedef struct {
		DOUBLE size;
		float color;
		float light;
		
		BSTR imgName;
		
		BSTR  uname;

	} Image;

	Image img;

</ccomsinglethreadmodel>


Everything goes fine and I can get the whole object but the BSTR types. Floats and integers are properly sent and received. But the BSTR types dont work. I'm trying to send strings and can't find the way. I did try with VARIANT instead and the result was wrong too. Somehow, it looks like the strings are not serialized.

These are some of the get and set functions for my ATL component:

This one works fine:
STDMETHODIMP CAnalisis::getLight(FLOAT* light)
{
	
	*light=img.light;
	return S_OK;
}

STDMETHODIMP CAnalisis::setLight(FLOAT light)
{
	img.light=light;
	return S_OK;
}


This one doesn't :

STDMETHODIMP CAnalisis::getImgName(BSTR* imgName)
{
	*imgName = img.imgName;

	return S_OK;
}

STDMETHODIMP CAnalisis::setImgName(BSTR imgName)
{
	
	img.imgName=imgName;
	return S_OK;
}


and this is the way I create the MSMQ message and fill the values in my producer :

// For these ActiveX components we need only smart interface pointer
		IMSMQQueueInfosPtr	pQueueInfos; 
		IMSMQQueueInfoPtr	pQueueInfo; 
		IMSMQQueuePtr		pQueue;
		IUnknownPtr			pIUnknown;
		// Instanciate the follwing ActiveX components
		IMSMQQueryPtr		pQuery(__uuidof(MSMQQuery));
		IMSMQMessagePtr		pMessage(__uuidof(MSMQMessage));
		

		IAnalisisPtr pAnalisis(__uuidof(Analisis));

                WCHAR *  imagen;		
		imagen = L"imagen1.jpg";
                pAnalisis->setImgName(imagen);

                
                 (...)

                pAnalisis->setFruitSize(20.00);

                 (...)
                 
                pQueueInfo = new IMSMQQueueInfoPtr( __uuidof(MSMQQueueInfo) );
			
		pQueueInfo->PathName = "MYCOMPUTER\\private$\\myprivatequeue";
		
	        pQueue = pQueueInfo->Open(MQ_SEND_ACCESS, MQ_DENY_NONE);
		pMessage->Body = static_cast<iunknown*>(pAnalisis);
                pMessage->Send(pQueue);


If I get the BSTR value in the producer (before serialization), pAnalisis-getImgName(), it works fine. In contrast, when I try to get it in the consumer, after reading the message from the queue, it doesn't return anything. The other values, such as the size, are returned with no trouble.

The thing is: does anyone know how to send a BSTR value inside a COM object through MSMQ ?

I've tried to find some similar examples but unfortunately totally in vain.

PLEASE HELP!!!

thanks.
AnswerRe: send a COM object with a BSTR value type in a MSMQ message Pin
Jonathan Davies9-Mar-09 7:59
Jonathan Davies9-Mar-09 7:59 
GeneralRe: send a COM object with a BSTR value type in a MSMQ message [modified] Pin
jxtamarc10-Mar-09 4:43
jxtamarc10-Mar-09 4:43 
GeneralRe: send a COM object with a BSTR value type in a MSMQ message Pin
Jonathan Davies10-Mar-09 23:53
Jonathan Davies10-Mar-09 23:53 
GeneralRe: send a COM object with a BSTR value type in a MSMQ message Pin
jxtamarc11-Mar-09 0:59
jxtamarc11-Mar-09 0:59 
QuestionUsing IAuthenticate with an MSHTML control Pin
Taka Muraoka9-Mar-09 0:42
Taka Muraoka9-Mar-09 0:42 
Questionproblem during accesing serial port Pin
rexhrishi8-Mar-09 23:20
rexhrishi8-Mar-09 23:20 
AnswerRe: problem during accesing serial port Pin
Jonathan Davies10-Mar-09 1:18
Jonathan Davies10-Mar-09 1:18 

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.