|
|
you could have a look http://www.codeproject.com/atl/#IE+%2F+Explorer+plug%2Dins
|
|
|
|
|
Hello,
I've just tried to handle an OPC-interface with VC++ 6.0
Therefor I create an Instance of the interface to get the a pointer of this interface.
This should be ok,
but...
when I want to get access to the methods of the interface, I always get unknown failure codes back:
Interface Instance:
IOPCBrowseServerAddressSpace* InstantiateOPCBrowseServerAddressSpace(wchar_t ServerName[])
{
HRESULT hr;
CLSID CLSID_OPCServer;
CLSID CLSID_OPCServer2;
void** ppIntfObj = NULL;
// Get GUID and UUID from regsitry for COM-Server
hr = CLSIDFromProgID(ServerName, &CLSID_OPCServer2);
ShowError(hr);
// Queue of Class-Instances to create
LONG cmq = 1; // number of class instances to create
MULTI_QI queue[1] = {{&IID_IOPCBrowseServerAddressSpace,
NULL,
0}};
//Create an instance of the IOPCBrowse
hr = CoCreateInstanceEx(CLSID_OPCServer, NULL, CLSCTX_SERVER, /*&CoServerInfo */ NULL,
cmq, queue);
ShowError(hr);
// Return Pointer to the IOPCBrowse Interface
return(IOPCBrowseServerAddressSpace*) queue[0].pItf;
}
In my main-method, I try to work with the interface,
but I only get two different failures as HRESULT:
0x000006F4 in the first attempt.
and 0xC0000005 in the second and third attempt. (this means here Access Violation?)
Implementation in main-method:
CoInitialize(NULL); //Using MS Com library
//Instanciate Browse-Interface
IOPCBrowseServerAddressSpace *pOPCBrowse2 = InstantiateOPCBrowseServerAddressSpace(L"SOFTING.OPCToolboxDemo_ServerDA");
//Declarations for OPCBrowse
HRESULT hr;
OPCBROWSEDIRECTION dwBrowseDir = OPC_BROWSE_TO;
hr = pOPCBrowse2->ChangeBrowsePosition(dwBrowseDir, NULL);
ShowError(hr);
OPCNAMESPACETYPE *pNameSpaceType;
hr = pOPCBrowse2->QueryOrganization(pNameSpaceType);
ShowError(hr);
OPCBROWSETYPE dwBrowseType = OPC_FLAT;
LPENUMSTRING *pIEnumString;
hr = pOPCBrowse2->BrowseOPCItemIDs(dwBrowseType, NULL /*Filter*/, 0, 0, pIEnumString);
ShowError(hr);
...
Where could be my problem.
The interface is defined in an IDL-Sheet from the OPC-Foundation.
Perhaps you've got an intension, if there is anything wrong with my interface handling or coding?
Thanks for your work at this time
Biasto
|
|
|
|
|
Please check the reference count.
Biasto wrote: // Queue of Class-Instances to create
LONG cmq = 1; // number of class instances to create
MULTI_QI queue[1] = {{&IID_IOPCBrowseServerAddressSpace,
NULL,
0}};
//Create an instance of the IOPCBrowse
hr = CoCreateInstanceEx(CLSID_OPCServer, NULL, CLSCTX_SERVER, /*&CoServerInfo */ NULL,
cmq, queue);
ShowError(hr);
// Return Pointer to the IOPCBrowse Interface
return(IOPCBrowseServerAddressSpace*) queue[0].pItf;
}
Just curios, If you retrieve only one instance then why are you using CoCreateInstanceEx?
S o h a i l K a d i w a l a
To Err Is Human; to Debug, Divine
modified 21-Apr-21 21:01pm.
|
|
|
|
|
I get failure when I'm using only CoCreateInstance!
And it doesn't something with COM-related problems.
I've found the solution, just to declare all arguments for the OPC-interface function, in a logical way, otherwith the access to the interfaces fails with an null pointer receive-failure.
Therefore the specification of the opc foundation is very unusual to understand!
|
|
|
|
|
I have a COM/ATL out-of-proc server whose main object is a singleton. I will call this Object A. Object A is called by other out-of-proc servers, but they are on the same machine so I am not worried about DCOM, etc. Object A uses a third party library (another set of COM objects) which generally works well but has a couple of known problems which can crash the Object A server (the problem can be reproduced). I have isolated this library into its own out-of-proc server to protect the Object A server. The library of the new server contains an object (I will call it Object B) which gets a reference to Object A. Object A releases its reference to Object B, but Object B maintains its own reference until its work is done. When the work by Object B is done, it notifies Object A, releases Object A and then releases itself. When all other servers are done and release Object A, then Object A is released and goes away normally.
If in the middle of its work, Object B crashes, it takes down its own server but the server which owns Object A is unharmed... except, that it still thinks there is another server out there which has a reference to it, so it won't shut down when all other out-of-proc servers have released their references.
Object A also maintains a watch on the Object B process so it knows if the Object B process has crashed.
Efforts to decrement the interface count on Object A when Object B crashes were not helpful and could have caused other problems (the reference count in Object A does not appear to be affected by Object B... I am assuming an internal reference count and an external referece count... but if so, where is the external reference count stored and can it be decremented???).
Ultimately, I need to get Object A back to the state it had before it created Object B.
I am also posting this in the ATL forum.
Thanks.
m.bergman
-- For Bruce Schneier, quanta only have one state : afraid.
|
|
|
|
|
Hi,
I have a problem with the Internet Explorer. I added it to my view-class and set it up using the IWebBrowser2-interface.
It all works fine, the browser shows the HTML-content that it is supposed to. But when I click into the browser-area and
then try to set the focus to another control (for example a list ctrl) the browser "steals" the focus. It isn't possible
to type something in another control which is very annoying, of course...do you have an idea what is going on here and
how I can avoid this problem?
mfg Steven
|
|
|
|
|
Hi
I am getting Access violation whenever I Query for IWMSBufferAllocator in my custom plugin.
Here is code
<br />
<br />
IWMSBufferAllocator *pBufAllocator = NULL;<br />
<br />
if(m_spClassFactory)<br />
{<br />
hr = m_spClassFactory->QueryInterface(IID_IWMSBufferAllocator,(void**)&pBufAllocator);<br />
if(FAILED(hr))<br />
return hr;<br />
}<br />
Debug output gives these lines
Access violation reading location 0xfffffffffffffff.
The thread 'Win64 Thread' (0x338) has exited with code 0 (0x0).
First-chance exception at 0x78d67d0d in WMServer.exe: 0x80010105: The server threw an exception.
m_spClassFactory seems good. Its not a null or invlaid pointer. I have also tried with code like MSDN where
hr = m_spClassFactory->QueryInterface(IID_IWMSBufferAllocator,(void**)&pBufAllocator);
is used as
hr = m_spClassFactory->QueryInterface(&pBufAllocator);<br />
Can someone help? There is no other doc available.
-----------------------------
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
I am developing a COM server (.exe or .dll) to add functionality to vbScript. For one, I am wanting to develop a modal dialog window that can be opened from vbscript.
So far I have the dialog able to be opened but wierd things happen. When running in an .exe I get "Server Busy" messages when the dialog is opened modal. When running in a .dll then it seems my dialog goes stale... the controls are there and functional, but the event engine in the dll doesn't appear to be active (this is based on Qt from TrollTech).
I'm hoping there's something simple to get beyond these wierd COM hurdles.
|
|
|
|
|
Hi, I would like knows how I list all net interfaces, so much the ones that are online as offline.
I accept code in any language, preferentially C, C++, C#, VB.NET and VB.
Thanks for any help!
|
|
|
|
|
Hi All ,
I would like to query for an interface in a COM DLL .I don't
know the CLSID of the COM DLL. I tried to use tlbinf32.dll to do this by importing it into my VC++ project using #import, but when I compile , I get errors in the .tlh file that is generated. Anyone who has used this please help .
Thanks in advance!
|
|
|
|
|
Please mention error details!
S o h a i l K a d i w a l a
To Err Is Human; to Debug, Divine
modified 21-Apr-21 21:01pm.
|
|
|
|
|
the errors are like follows:
e:\arcgis\test1\debug\tlbinf32.tlh(179) : error C2059: syntax error : '('
e:\arcgis\test1\debug\tlbinf32.tlh(183) : error C2143: syntax error : missing ';' before '}'
e:\arcgis\test1\debug\tlbinf32.tlh(187) : error C2371: 'TKIND_ENUM' : redefinition; different basic types
c:\program files\microsoft visual studio\vc98\include\oaidl.h(540) : see declaration of 'TKIND_ENUM'
e:\arcgis\test1\debug\tlbinf32.tlh(188) : error C2371: 'TKIND_RECORD' : redefinition; different basic types
c:\program files\microsoft visual studio\vc98\include\oaidl.h(541) : see declaration of 'TKIND_RECORD'
e:\arcgis\test1\debug\tlbinf32.tlh(189) : error C2371: 'TKIND_MODULE' : redefinition; different basic types
c:\program files\microsoft visual studio\vc98\include\oaidl.h(542) : see declaration of 'TKIND_MODULE'
and more ...
|
|
|
|
|
How is it possible for an entire machine's COM pointers to simultaneously unregister themselves?
Cleako
|
|
|
|
|
cleako wrote: COM pointers
What do you mean by that?
cleako wrote: simultaneously unregister themselves
How did you come to that conclusion?
Try describing the problem instead of making an assumption about the cause.
What happens? Can you create objects or not? Error messages?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|
|
Or is he trying to find a way to unregister everything on the system and have fun
S o h a i l K a d i w a l a
To Err Is Human; to Debug, Divine
modified 21-Apr-21 21:01pm.
|
|
|
|
|
We have an app server and a web server. The web server contains all of the COM objects as well as the app server but the web server is supposed to point to the app server and run those COM objects instead of on the itself. Everthing was working and suddenly many COM objects simply could not be located and when the program runs the error message is something along the lines of "Could not create object" and I am guessing the cannot find object error code.
The COM objects have been re-registered but I am curious how they just unregistered themselves, assuming nobody did it and just isnt speaking.
Cleako
|
|
|
|
|
Reword your question to other's understanding.
|
|
|
|
|
Hi all,
Working on sending commands to a device, I have been using the code provided by Ashish Dhar, here : www.codeproject.com/system/serial_com.asp
(I know I should post there, but there are many post without any reply there, so...)
Everything was going fine using this simple code:
char receive_write[] = {0x02, 0x00, 0x02, 0x00, 0x30, 0x01, 0x31, 0x18};
m_theCommPort.Write(receive_write, sizeof(receive_write) );
Now, I need to send a longer string of unsigned char :
unsigned char receive_write[] = {0x02, 0x00, 0x07, 0x00, 0x75, 0x01, 0x00, 0x01, 0x00, 0x91, 0x01, 0x7D, 0xB6};
m_theCommPort.Write(receive_write, sizeof(receive_write) );
Now the device returns a "unknown command" telegram. But the command is the right one.
Write uses WriteFile,
WriteFile returns FALSE and GetLastError returns error 997 : Overlapped I/O operation in process
Is it related to timeout, or to the string length, or either?
Thanks for helping,
Matthieu Deveau
|
|
|
|
|
Hi,
The 'error' ERROR_IO_PENDING (=997) just tells you that the method WriteFile has returned before all the data have been transmitted. This is usually the reason why someone uses overlapped operations - you don't want to block your application waiting for the IO operation to finish.
I recommend that you do some reading on overlapped operations. You should find a lot material on this site.
Regards,
Tim
|
|
|
|
|
Hi,
I have a .tlb-file which only contains Interfaces for a COM-Application.
How can I use this Interfaces in C#?
How can I "instantiate" these Interfaces to use the functions they provide?
Thanks in advance,
Andy
|
|
|
|
|
Hello all,
I am using visual basic6 for creating the DLLS. Can anyone help me how can i move on to VB.Net or C#.NET COM. I am new to .Net technology.
Thanks in Advance..
bharath.s
|
|
|
|
|
hello,
in my prj i ve mat files that i want to add to the com builder of matlab which have version MATLAB COM BUILDER 1.0.
com builder add only *.m files and mex files(*.dll) pls suggest how to add mat file to com builder
|
|
|
|
|
I have referenced a VB6 DLL and I have access to it and all is well. The problem is that I have had to make changes to that DLL and other applications point to it.
The question is this, does the application need that original DLL in the original location or just simply registered on the server, and just trying this it looks like it needs to be in that original location??
Cleako
|
|
|
|
|
I'm on a .NET project, and I need to be able to (with .NET code):
1. Open a library that contains COM objects.
2. Find the class GUID, interface GUID, and description of each and every COM object in the library. In other words, it's sort of like using reflection on a COM library using .NET code.
Any help is greatly appreciated.
|
|
|
|
|