|
Did you put the [out] attribute in the method IDL declaration?
|
|
|
|
|
Thanks for your reply.
I'm using an automation interface, created by the "MFC ClassWizard". I don't know how to add that property to the parameters. I tought that just choosing the parameters as "double*" it is enough for "ODL" to know that I'm trying to "get" the value from the function.
Best Regards,
Razvan
|
|
|
|
|
I received a VC# COM component from a customer (.dll and .tlb files only) and I would like to use it in my VC++6 application.
Method 1: What I did so far:
1) Utilize the ClassWizard to import the type library file.
2) Two wrapper classes were created IClass and IClassEvents
3) I was able to access the component methods for IClass without any problem. However the COM component (I believe) fires a notification to the client when each method has completed and data is passed back (LPCTSTR data). I looked into the IClassEvents wrapper class that was generated for me by the ClassWizard and there is a CommandCompleted(BOOL success, LPCTSTR data)interface. The question is how can I access "LPCTSR data". I know that you have to implement some kind Sink class that implements the CommandCompleted method and advise the COM component the CommandCompleted interface. But I don't know HOW. Please help...provide example if possible.
Method 2: I have also tried the #import directive "..\..\theCOM.tlb no_namespace name_guids but got as far as the Method 1. This method generates .tlh and .tli. and I am kinda lost looking at the content of these two files.
Any help would greatly appreciated!
|
|
|
|
|
Hi again....
I finished my work, and I tested its modules one by one and they worked well.
Now that I put them together, I went into a trouble: my server acts like a memory-consuming program...
Let me explain.... I open Task Manager (on Win2000 Pro) on the server machine and, as I run the client, I see the memory growing up (both Memory Usage and VM Size) and page faults incrementing in hundreds per second.
When I'm about at half of my test procedure, I see this
Memory Usage: 22,680K
Peak Memory Usage: 164,084K
Page Faults: 512,718
VM Size: 508,640K
Don't jump on your chair, these procedures work with images and send images as arrays, so it's normal to have huge structures on my wires...
So I See that VM is not released, but I don't know why. It seems that function pointer is not well-released (because actual memory usage is normal, but VM no). I tried to AddRef and Release interface pointer in every function, instead of at hte beginning and at the end of the whole program, but it did not change a bit.
What can be the problem?
Thanks in advance,
Morenz.
|
|
|
|
|
|
I got it. I was using malloc instead of CoTaskMemAlloc (and free instead of CoTaskMemFree)
Now I'll change all of my statements (some hundreds!!!) and will try.
Thanks a lot for now!!!
|
|
|
|
|
Hello, everyone!
Please help: I want to know how to convert _bstr_t to wchar_t*?
Thanks a lot!
|
|
|
|
|
er, maybe this is a trick question, but how about:
_bstr_t t(L"test");
wchar_t* p = t;
|
|
|
|
|
In fact, _bstr_t has a overloaded operator: (wchar_t*).
_bstr_t bstrTest(L"Hello, xiujie.");<br />
<br />
wchar_t* pwszTest = (wchar_t*)bstrTest;
|
|
|
|
|
Hi all,
Firstly thanks to Ramon de Klein for his nice CSerial class. I find this class to be very useful.
I have been writing multithreaded apps which require simultaneously calling on the CSerial::Read and Write functions. The problem is that the reader thread causes the write function to signal prematurely - the WaitForEvents function returns but the overlapped result is IO_INCOMPLETE (error 996).
This is due to the CSerial member variable m_hevtOverlapped (the event) being shared by Read() Write() (and also WaitEvent() ) - so when read fires a signal, the write event is signalled and returns early.
To fix this problem, I have created three member variable event, readEvent, writeEvent and waitEvent, and these are used by the corresponding function instead of the one common one. That means that multiple threads can access read and write and waitevent at the same time. This is sufficient for me.
NB: - with this particular fix, it is still not possible to call read more than once from different threads (or write or waitEvent) - ie calling different functions simultanously is ok, but multiple calls to the same function is not supported because there are still only three events.
To fix that, you could check if the user has supplied their own overlapped structure or not, and if not - create the event locally to the read write or waitEvent function.
Cheers and thanks again Ramon de Klein
James Underwood
|
|
|
|
|
I have written a BHO application. This application works on Windows XP Home, Windows 2000 Pro and Windows XP Pro without SP 2 installed. After SP 2 was installed on Windows XP Pro the GetIDsOfNames function started failing with E_ACCESSDENIED (0x80070005). The GetIDsOfNames work succesfully one time and fails after that.
What does E_ACCESSDENIED mean when returned by GetIDsOfNames?
Why did SP 2 on Windows XP Pro cause this to start happening?
|
|
|
|
|
Hello,
I've heard of troubles with XP SP2 and COM... probably they want us to migrate our projects into .NET framework... I saw that also a COM taht uses sinks to synchronize processes does not work correctly with XP SP2, while it does good with oter OSs of NT family.
If I was you, I should check on MSDN if XP SP2 modifies behavior of GetIDsOfNames (usually they say it on function description...)
Hope this helps
Best regards
Morenz.
|
|
|
|
|
|
I had read some material about SP2. SP2 has some changes for BHO (Unfortunately, I dont have the paper now ). Please check for SP2 and BHO working on msdn.
Following link might be useful for understanding BHO in XP SP2 -
http://windowsxp.mvps.org/addons.htm[^]
Have a great day ahead!
Regards,
Sohail Kadiwala
(My Blog - http://blogs.wdevs.com/sohail/[^])
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Hello Sohail,
Thank you very much for the response. I looked at the link in you message and also the links on that page.
I think there is something that I did not make clear. My BHO runs on Windows XP Pro SP 2. There is just one facility of the BHO that does not work. I have added items to the IE tools menu and buttons to the IE toolbar. These menu items and toolbar buttons do no work on Windows XP Pro SP 2. Everything else in my BHO is working. The BHO can be used without the menu items and buttons, but it is much more convenient to have them.
These items fail because they require the GetIDsOfName function. So, the links you provided did clear up some things for me, the did not help me find a resolution to my problem.
Someone must know what causes E_ACCESSDENIED to be returned from GetIDsOfNames.
Lonnie
|
|
|
|
|
Greetings,
Would you please help me with the following question?
Scenarios:
============================================================================
1. I have an XP Pro machine (A), and a Windows 2000 Standard Server (B).
2. I login both machine using the my domain account, which is administrator
of both machines.
3. I execute WBEMTest.exe running on an A to run a query against B.
. Namespace: \\B\root\cimv2
. Query: SELECT * FROM Win32_OperatingSystem
. Method: Asynchronous
4. The query runs without giving any error message, however, no result is
returned. (Operation in progress...)
5. I run the same test using Synchronous / Semisynchronous mode, they both
work fine and return me something.
============================================================================
How do I get it right? Tanks a million.
Best,
Jeff
|
|
|
|
|
Is there any good information out there on using this library. I'm trying to communicate with a printer via the COM 1 port but I can’t even open the port, so I’m kind of stuck.
|
|
|
|
|
Hi all,
First I know the handle of a window with a embeded webbrowser , in other process, how can i get IWebbrowser2 of the webbrowser? thx!
WalkSnail
-- modified at 4:34 Tuesday 1st November, 2005
|
|
|
|
|
|
Hello!
I'm developing an application, that should navigate web pages and store some wanted data... So i have decided to do it using an instance of IE.
Could you show me a simple exemple?
I need several functions:
- Create instance of IE
- Navigate browser to url
- Get source of loaded html
- Get text of loaded html (text that we see, looking at browser window)
I know, that this problem is not so difficult, by i can't slove it yet...
|
|
|
|
|
|
Thanks a lot
I use C#. May be there is some features in C# to simplify the problem? The fact is that i never used com in C#...
|
|
|
|
|
I don't know C# to greater extent. But anyways, incase there is no ready to use feature in C# for your problem, then you can obviously use the interface I mentioned. For COM in Managed code, read some articles on "COM Interoperability"
Have a great day ahead!
Regards,
Sohail Kadiwala
(My Blog - http://blogs.wdevs.com/sohail/[^])
modified 21-Apr-21 21:01pm.
|
|
|
|
|
This is really getting up my nose now.
How do you, using ATL7 in VS7.1, expose an external COM interface to your COM implementation?
If I import the type library (xxx.tlb), it complains of type definition.
This is a snippet of what's in my header file. The error code generated is listed below
Test.tlb is an external type library.
<br />
#import "Test.tlb" no_namespace<br />
<br />
[<br />
object,<br />
uuid("121574AA-841A-4FE0-871C-19A3C8C3C82F"),<br />
dual,<br />
pointer_default(unique)<br />
]<br />
__interface ITestPlugin : IDispatch<br />
{<br />
[id(1) HRESULT Process(LONG val, [out,retval] LONG* retval);<br />
[id(2) HRESULT RegisterSource(ITestSrv* source); <font color='red'>
};<br />
<br />
[<br />
coclass,<br />
threading("apartment"),<br />
vi_progid("Plug.TestPlugin"),<br />
progid("Plug.TestPlugin.1"),<br />
version(1.0),<br />
uuid("45D39585-BD2D-4F61-B0C7-A992F8CD8EF4"),<br />
helpstring("TestPlugin Class")<br />
]<br />
..<br />
..<br />
The error code is:
c:\temp\code\chincb\chinplug\testplugin.h(19) : error MIDL2025 : syntax error : expecting a type specification near "ITestSrv"
c:\temp\code\chincb\chinplug\testplugin.h(19) : error MIDL2026 : cannot recover from earlier syntax errors; aborting compilation
LINK : fatal error LNK1240: failed to compile IDL content
I'm scratching my hair out!
I Dream of Absolute Zero
|
|
|
|
|
Although I do not know what is in the imported test.tlb, the error message means that the interface ITestSrv has not been defined. I would check where ITestSrv exists and is defined, and make sure that your header file can see the definition.
|
|
|
|