|
In my tests it works fine with the file: protocol. Thats the beauty of it, since an app can locate the resources it needs in a consistent way no matter where they are stored. Unfortunately the protocol handler for res: doesn't seem to work exactly like the others but it must be possible since you can create a IMoniker to a res: file and hand that to IE for it to load with no problems!
I know that i could create my own pluggable protocol handler and that would then allow me to get at my files in resources but that seems like a lot of work when there must be slight change that i can make to the way i deal with the IMoniker interface to take advantage of Microsofts res: implementation.
|
|
|
|
|
Alrighty, here's the setup.
Machine A has a local object server (.exe) called AFIT. Another application creates the AFIT object and registers it using RegisterActiveObject(). Another server is available to local and remote clients called AFITFinder, which provides one method that returns the results of GetActiveObject().
Machine B has a client that creates an AFITFinder on Machine A, and uses it to get an interface to the AFIT object from Machine A's ROT.
This all works fine.
Machine B can create an AFITFinder on Machine A no problem for the first 5 minutes (very repeatable) after AFIT has been created. If, on the other hand, I wait for 5 minutes or more, then the GetActiveObject() call fails on Machine A. That is, Machine B creates the AFITFinder on Machine A (successfully), calls GetAFIT() (marshalled successfully), but in GetAFIT(), the call to GetActiveObject() fails with 0x800401E3 (Operation Unavailable).
I've tried changing every security setting I can find. It just doesn't make sense that the same call becomes unavailable after leaving the connection idle for 5 minutes.
Have any of you ever heard of a timeout like this? Is there some security setting that time's itself out in a DCOM connection?
Is there some reason the ROT should drop my object after a certain period of time? It's registered as "strong" and definitely NOT being revoked in the meantime.
Any help would be greatly appreciated.
[edit]
I just tested it with a local client and it failed with the same problem. That is, Machine A created a local AFITFinder object and failed in the same spot.
[/edit]
J
|
|
|
|
|
What is your client written in? I know some languages (PowerBuilder for one) have a default timeout of 5 minutes on all ole objects.
Jason Henderson start page articles "If you are going through hell, keep going." - Sir Winston Churchill
|
|
|
|
|
Client(s) and server are all written in C++ (ATL).
What would enforce that timeout? Some boilerplate framework code? Or is it something in the underlying COM libraries?
J
|
|
|
|
|
I want to create event handler in WebBrowser (using MSHTML).
But I don't know how to set VARIANT.pdispVal to point to my event handler function.
/*************************************/
IHTMLElement::put_onclick(VARIANT v)
/*************************************/
/************** My code ***************/
IHTMLElement* pElement;
......
VARIANT var;
VariantInit(&var);
var.vt = VT_DISPATCH;
var.pdispVal = ????? <==== what I have to do ?
pElement->put_onclick(&var);
/*************************************/
What I have to do to make my handler function becomes IDispatch interface ?
|
|
|
|
|
You've got to pass an object interface supporting the following DISPID_HTMLELEMENTEVENTS_ONCLICK dispatch method id. Search MSDN with this keyword.
You've got to implement Invoke in this object, and especially provide implementation for the case dispid==DISPID_HTMLELEMENTEVENTS_ONCLICK.
She's so dirty, she threw a boomerang and it wouldn't even come back.
|
|
|
|
|
Is there a way to enumerate all client connections to a DCOM server? I'd like to be able to call a method on all instances of my class object.
Is it possible and if so, how??
Thanks
Jason Henderson start page articles "If you are going through hell, keep going." - Sir Winston Churchill
|
|
|
|
|
I think the only way to do this is to register the clients at the server object, i.e. store a reference to the clients (observer pattern).
|
|
|
|
|
Hi, I am having some problems with a pair of COM controls i have written. Each control starts up threads to deal with a serial port and fires events back to the container app on certain data recieved.
I want to be able to deal with the situation where the container is shut down with out calling my clean up methods.
If I have only one control running every thing seems fine and the code cleans up
if i run both controls (seperate serial ports no common variables or code) then I can get in a situation where i signal my threads to stop and they never do. I call the "Emergency shut down" on a c++ deconstructor of the com control. The emergency shut down sets a flag that will cause the thread to abort and not fire the controls events but the thread gets NO runtime even with stupid sleeps() while i am waiting for it to return before destroying my com object (from a c++ sense).
I can only assume I have deadlocked the com control. If i let the deconstructor complete I either get a page fault due to my variables being now nonsense or I find I was in the middle of firing the com event and now the rest of that events code no longer exists either way page fault and the container goes down with any recorded data.
How can I
1) avoid this dead lock
2) detect the container/control is going down and have time to stop my threads close ports etc.
and why does having both controls running on a single container matter?
Thanks in advance
Robin,
|
|
|
|
|
The most common overlooked problem in STA COM components is that the thread that CREATES the components must be running a message loop or else no method call will be processed, even the release. If you have a thread 1 that's waiting for a thread 2 to Release(), and thread 2 created the COM STA component, you are in serious trouble (deadlock).
Without looking at the code, it seems to me that this is the problem.
My latest articles:
Desktop Bob - Instant CP notifications
XOR tricks for RAID data protection
|
|
|
|
|
Thanks for the reply,
My main thread in each control is based on an ATL wizard anyway so that should be sound and have a message loop etc. Its a worker thread that is locking up. The worker thread can send events (via a global interface table) it does no other COM and it just watches for a c++ flag to drop to quit. The kill method is in the main ATL bit so/and the flag is getting set but then while I sleep waiting for clean up the worker thread seems to stall.
But and this is where it is werid. If i run one control it cleans up, if i use two controls it locks up!. The two controls are very similar. a main ATL wizard body and a worker thread that can dispatch events with a GIT. but apart from a common container (VB6 form) they are independent!
My assumption is that if the event gets fired in the worker thread and a method is invoked in the "main" thread the event is locked until the method returns meaning i can never clean up.
Based on your reply will a message loop in the worker thread help? I'm confused!
|
|
|
|
|
I'm working on a rather large and useful library (with some implementations of it, like shell extensions and ActiveX controls) that I'd like to sell as shareware, but I'm new to the COM licensing model. I've been researching it quite a bit, but I'm curious if anyone here in this forum has any experience with it.
Say I'd like to offer a 30-day/15-uses trial period. Is the COM licensing model a good thing to use for this, or would a home-brewed solution work best (perhaps even a commercial library that does this, although the price I'm selling it for doesn't really warrant such a commercial library)? Any experience out there on this? TIA
"Well, I wouldn't say I've been missing it, Bob." - Peter Gibbons
|
|
|
|
|
Hi,
I'm creating a directshow application with visualc++ 6.
I need to make a selection tool (similar to Paint) that can select rectangular, elliptical and free-hand regions.
Is there a tool already availible for this? If not, what is the best way of retrieving the coordinates of mouse down and up events if they occur within a certain area of the dialog box?
[... still new to this]
|
|
|
|
|
I worked before. Then I did something stupid and my program crash. Then I change it back. Now when I execute the program, it hangs. I trace through the source and find it stops at ::CoCreateInstance (called by CComPtr.CoCreateInstance()). Any idea?
|
|
|
|
|
register the COM component again.
She's so dirty, she threw a boomerang and it wouldn't even come back.
|
|
|
|
|
Hello There,
Can somebody advise me where I can download the sample codes(i.e.control object(CO) and service object(SO) and its testing application) ? I need to know the skeleton and the methods/properties relation for each CO,SO and AP.
Meanwhile, some opos related link to Microsoft is gone !
(i.e.http://www.microsoft.com/business/industry/ret/retoposoverview.asp). If anyone of you knows where to link to Microsoft for OPOS documents, please let me know.
THANKS IN ADVANCE !!!
BEST REGARDS FROM,
Julio
|
|
|
|
|
Hi all,
I'm having trouble getting information on how to enumerate a folder that I created. My folder is under the "System" directory, and I want to display the contents in a menu (much like the "Send To" menu). I found the "Navigating the Namespace" article on MSDN, but but that just finds the "first" folder to enumerate.
I have a an IShellFolder interface pointed to the system folder:
hr = SHGetMalloc(&pMalloc);<br />
hr = SHGetFolderLocation(NULL, CSIDL_SYSTEM, NULL, NULL, &pidlSystem);<br />
hr = SHGetDesktopFolder(&psfDesktop);<br />
<br />
hr = psfDesktop->BindToObject(pidlSystem, NULL, IID_IShellFolder, (LPVOID *) &psfSystem);<br />
<br />
if (SUCCEEDED(hr))<br />
{<br />
hr = psfDesktop->QueryInterface(IID_IShellFolder, (LPVOID *) &psfSystem);<br />
psfDesktop->Release();<br />
}<br />
<br />
hr = psfSystem->EnumObjects(NULL, SHCONTF_FOLDERS, &ppenum);<br />
Now how can I get an this pointed to my folder? I'm familiar with IShellFolder::ParseDisplayName , but I just don't know how to implement this (if this is in fact what I need).
Could someone point me in the right direction?
Thanks,
Matt
|
|
|
|
|
In ATL, a .tlb file is generated automaticly for the component. But in a MFC-based component project, how can I create a .tlb file for it?
I want to become a great programmer just like most of you. But I still have a long way to go, can you help me? Of course, I will be very glad to help some of you, if I can.
|
|
|
|
|
How was your component created? Did you use one of the wizard options?
I have test both an MFC ActiveX control and MFC Application with COM Server support and both generated the expected tlb file in the debug folder?
Michael
"I've died for a living in the movies and tv.
But the hardest thing I'll ever do is watch my leading ladies,
Kiss some other guy while I'm bandaging my knee."
-- The Unknown Stuntman
|
|
|
|
|
The IDispatch interface is useful sometime. But I can't find a sample that use more than one IDispatch-derived interface in one MFC-based component. Can't we use more than one in MFC? How can I use more than one IDispatch-derived interface in one component just like in ATL?
I want to become a great programmer just like most of you. But I still have a long way to go, can you help me? Of course, I will be very glad to help some of you, if I can.
|
|
|
|
|
Hi
I issued this problem recenty but now I know a bit more about its nature.
I'm trying to store some data in MsOffice files and the problem is that MsWord 2000/XP removes my data after I save document from the Word (I tried also MsWord 97,MsExcel 97/2000/XP and here my data remains untouched). Now some explanation how I store my data in doc file:
1. Using StgOpenStorage I open office file as a compound file
2. I create new storage with IStorage::CreateStorage
3. Within newly created storage I create new stream using IStorage::CreateStream
4. I store my data within newly created stream using IStream::Write
5. I release all opened streams and storages
I discovered that when in doc file Word adds stream 0Table (1Table is probably always present) my data doesn't dissapear (I don't know why). I don't know how to prevent Word from deleting my data but I suppose that forcing Word to add 0Table stream could solve my problem (but how can I do this). I would appreciate any hints.
Mariusz Popiolek
|
|
|
|
|
Using Access 2000 and ADO VC++6.0
I am executing the following statement..
VARIANT Params[2];
Params[0].vt = VT_I2; Params[0].iVal = 1;
Params[1].vt = VT_R4; Params[1].fltVal = 8.99;
m_pCommand->adCmdText = "Query4";
m_pCommand->ActiveConnection = m_pConnection;
m_pCommand->Execute(0, Params, adCmdStoredProc);
Generates an exception {DB_E_PARAMNOTOPTIONAL}
Query4 in Access is as follows:
PARAMETERS vID Short, Rad IEEESingle;
INSERT INTO TABLE1 ( ODID, MeasRadius )
VALUES (vID, Rad);
Thanks for your help in advance.
|
|
|
|
|
I have around 500 records to insert into a table in Access 2000. I am using ADO.
Is it possible to pass all of the 500 records to a query using some kind of SafeArray parameters and Insert them all at once?
Any tips how this can be accomplished ?
Thanks
|
|
|
|
|
I need to open MSWord, retrieve information from it, change some information, and then save it. All these will be done using VC++/MFC. Does anybody have some existing code which I can take a look at it?
|
|
|
|
|
hello,
I need your input/advice on a practical (and urgent) problem!
I am currently developping a time critical app on a Windows NT/2000 platform involving pseudo real-time image acquisition.
The app should be flexible, fast and implement some fault-tolerant features. For example, I want to handle 12 cameras "simultaneously" (multitasks) for an acquisition. One channel acquition task may crash. But the whole application (the remaining working channels) should NOT crash! So I thought of using different processes for each channels.
The next question was then: how do I handle (share?) huge chunk of data (512*512 RGB images), among a pool of processes under Windows NT?
Of course, an obvious solution would be to use either PIPES or SHARED MEMORY (using FileMapping). But lots of coding is necessary and I will end up with a LOT of bugs (and I must have NO MEMORY LEAKS at all, it's imperative!!).
I discovered COM, a standard way of doing what I want, but I was wondering how you transfer BIG CHUNKS of data between COM servers???
What should I use to have something efficient, but also flexible in terms of development?
Please just give me some clues!
Thanks!
Bertrand Boichon
Research Assistant
Electrical & Computer Engr
Oregon State University
|
|
|
|