Click here to Skip to main content
15,913,465 members
Home / Discussions / COM
   

COM

 
AnswerRe: Difference between static_cast and normal casting Pin
guestcat2-May-06 3:20
guestcat2-May-06 3:20 
AnswerRe: Difference between static_cast and normal casting Pin
Stephen Hewitt2-May-06 15:59
Stephen Hewitt2-May-06 15:59 
QuestionWhy Default Interface ??? Pin
NiceNaidu2-May-06 1:33
NiceNaidu2-May-06 1:33 
AnswerRe: Why Default Interface ??? Pin
guestcat2-May-06 1:50
guestcat2-May-06 1:50 
GeneralRe: Why Default Interface ??? Pin
NiceNaidu2-May-06 2:18
NiceNaidu2-May-06 2:18 
GeneralRe: Why Default Interface ??? Pin
Mike Dimmick2-May-06 2:44
Mike Dimmick2-May-06 2:44 
GeneralRe: Why Default Interface ??? Pin
guestcat2-May-06 3:01
guestcat2-May-06 3:01 
QuestionGetRecordInfoFromGUID returns 0x80029C4A Pin
morenz2-May-06 0:07
morenz2-May-06 0:07 
Hi folks,

I'm developing a DCOM Client/Server project under Win2000 SP4 (both client and server) with VC++ 6.0.

An object in this project has to interface with National Instruments Vision Builder 7, which DLLs are registered under \system32 folder (the package works with no problem)

In this object, I have to pass an UDT that is a struct containing a safearray of another struct and two integer (that is, the safearray contains the RGB Values of all the points of my image and the two integers keep the image size). These structures are shown below.

When I compile, I get MIDL warning 2368: Could not set UUID ... etc etc etc... but I've seen that this can be ignored with no problems.

Now, when I run both client and server, I get an error when preparing to pack the safearray. In facts, I call GetRecordInfoFromGuids to build my SafeArray with VT_RECORD. Before, I was not doing error checking and everything seemed to be alright, but I got crashes. Now, that I added an if (FAILED(hr)) statement just after the call, I get a 0x80029C4A value, that is "Cannot load type library/DLL".

Here's the structs:
		typedef <br />
		[uuid(394143BC-4672-4E14-85DB-A96EBCA5A417),<br />
		 version(1.0),<br />
		 helpstring("RGB Representation of a single point")]<br />
		struct RGBValue_struct {<br />
			unsigned char B;     //The blue value of the color.<br />
			unsigned char G;     //The green value of the color.<br />
			unsigned char R;     //The red value of the color.<br />
			unsigned char alpha; //The alpha value of the color, which represents extra information about a color image, such as gamma correction.<br />
		} RGBValue;<br />
<br />
<br />
	typedef<br />
//		{7F7037D8-C4D5-4b75-9C68-A9627EDE914B}<br />
		[uuid(7F7037D8-C4D5-4b75-9C68-A9627EDE914B),<br />
		version(1.0),<br />
		helpstring("IVA_Data COM Wrapper")]<br />
		struct COM_IVA_Data<br />
		{<br />
			SAFEARRAY(PointFloat)	saPoints;<br />
			int			numPoints;<br />
			int			pointIndex;<br />
		}COM_IVA_Data;



Here's the function call :

HRESULT Image2Variant (IVA_Image Source, COM_IVA_Image *Dest)<br />
{<br />
<br />
	HRESULT hr = 0;<br />
	// Initializing dimension descriptor for our SafeArray<br />
	SAFEARRAYBOUND sabRGB[2];<br />
<br />
	sabRGB[0].lLbound = 0;<br />
	sabRGB[0].cElements = Source.columns * Source.rows;<br />
<br />
	hr = SafeArrayDestroy(Dest->saPoints);<br />
	if (hr != 0)<br />
	{<br />
		sprintf(logMessage, "CAugVisionEngine - Image2Variant - SafeArrayDestroy Failed (%ld)",hr);<br />
		WriteLogFile(logMessage);<br />
	}<br />
	Dest->saPoints = NULL;<br />
	IRecordInfo *pUDTRecordInfo = NULL;<br />
	hr = ::GetRecordInfoFromGuids(LIBID_AugSvrLib, 1,0,0,RGBValue_IID, &pUDTRecordInfo);<br />
	if (FAILED(hr))<br />
	{<br />
		sprintf(logMessage,"GetRecordInfoFromGuids failed (0x%X). Invalid Argument.",hr);<br />
		WriteLogFile(logMessage);<br />
		return(-1);<br />
	}<br />
<br />
	Dest->saPoints = SafeArrayCreateEx(/*Dest->vt*/VT_RECORD, 1, sabRGB,pUDTRecordInfo);<br />
	if (Dest->saPoints == NULL)<br />
	{	<br />
		WriteLogFile("Image2Variant - Array Cannot be Created");<br />
		return (-1);<br />
	}<br />
	// First of all, we'll put columns & rows, that are not arrays<br />
<br />
	Dest->columns = Source.columns;<br />
	Dest->rows = Source.rows;<br />
<br />
	// Now, start (looooooooong) loop and put all values in array.<br />
	for (int i = 0; i < Source.columns*Source.rows; i++)<br />
	{<br />
<br />
		RGBValue TempValue = Source.array[i];<br />
		hr = SafeArrayPutElement(Dest->saPoints, (long *)&i/*lDimension*/, &TempValue);<br />
		if (hr != 0)<br />
		{<br />
		<br />
			WriteLogFile("SafeArrayPutElement failed!");<br />
			return (NULL);<br />
		<br />
		}<br />
	}<br />
	<br />
/*	Dest->saPoints = SafeArrayCreateEx(VT_RECORD, 1, sabRGB, pUDTRecordInfo);<br />
	hr = SafeArrayCopy(saRGB, &Dest->saPoints);<br />
<br />
		if (hr != 0)<br />
		{<br />
			switch(hr)<br />
			{<br />
			case E_INVALIDARG:<br />
				WriteLogFile("Invalid Destination SafeArray");<br />
				break;<br />
			case E_OUTOFMEMORY:<br />
				WriteLogFile("Out Of Memory");<br />
				break;<br />
			default:<br />
				WriteLogFile("Unknown Error");<br />
			}<br />
			return (NULL);<br />
		<br />
		}<br />
	WriteLogFile ("Returning OK");<br />
*/	return (S_OK);<br />
}



Here's the method prototype where I make the above function call:

In .IDL:
HRESULT loadImage([in]BSTR FileName, [out, retval]COM_IVA_Image *IVAImage);

In .H
STDMETHOD(loadImage)(/* [in] */ BSTR FileName, /* [out] */ COM_IVA_Image *IVAImage);

Here's what I verified:
1) The typelib is both on source and in executable folder (on both machines);
2) The DLLs are all under \system32 folder. I have moved none of them to my executable folder.
3) proxy/stub DLL is correctly registered in both machines
4)

I'm really stuck. I don't know what to do and I had to release project to customer 2 months ago...

Thanks in advance,
Morenz
AnswerRe: GetRecordInfoFromGUID returns 0x80029C4A Pin
Vibhash Jha3-May-06 2:35
Vibhash Jha3-May-06 2:35 
GeneralRe: GetRecordInfoFromGUID returns 0x80029C4A Pin
morenz3-May-06 23:06
morenz3-May-06 23:06 
QuestionCOM - ROT - Threading - moniker - RPC - Where is the problem? Pin
guestcat1-May-06 22:47
guestcat1-May-06 22:47 
Questionhow to make a transform filter with one input and two out puts in directshow Pin
Ch Mazhar Iqbal1-May-06 21:15
Ch Mazhar Iqbal1-May-06 21:15 
QuestionATL Exe server.. Pin
Siva Sankar Koyi1-May-06 18:37
Siva Sankar Koyi1-May-06 18:37 
AnswerRe: ATL Exe server.. Pin
Vibhash Jha3-May-06 2:45
Vibhash Jha3-May-06 2:45 
AnswerRe: ATL Exe server.. Pin
morenz3-May-06 23:31
morenz3-May-06 23:31 
QuestionCOM Interop not working with VB.NET Pin
brwrob1-May-06 12:00
brwrob1-May-06 12:00 
Questionsearching Microsoft MAPI Control 6.0 Pin
Vasya - dragon27-Apr-06 1:55
Vasya - dragon27-Apr-06 1:55 
QuestionOffice CommandBar Button Pin
HakunaMatada26-Apr-06 3:44
HakunaMatada26-Apr-06 3:44 
AnswerRe: Office CommandBar Button Pin
Michael Dunn26-Apr-06 8:02
sitebuilderMichael Dunn26-Apr-06 8:02 
GeneralRe: Office CommandBar Button Pin
HakunaMatada26-Apr-06 17:36
HakunaMatada26-Apr-06 17:36 
GeneralRe: Office CommandBar Button Pin
HakunaMatada26-Apr-06 19:00
HakunaMatada26-Apr-06 19:00 
GeneralRe: Office CommandBar Button Pin
Stephen Hewitt26-Apr-06 21:18
Stephen Hewitt26-Apr-06 21:18 
GeneralRe: Office CommandBar Button Pin
Michael Dunn27-Apr-06 19:40
sitebuilderMichael Dunn27-Apr-06 19:40 
GeneralRe: Office CommandBar Button Pin
HakunaMatada27-Apr-06 20:24
HakunaMatada27-Apr-06 20:24 
GeneralRe: Office CommandBar Button Pin
Michael Dunn27-Apr-06 20:36
sitebuilderMichael Dunn27-Apr-06 20:36 

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.