|
VC++6 , W2k(sp2)
I created an MFC( Dynamic link ) DLL ,and I have put an ActiveX control on it.
When I Load the DLL and call the ActiveX's method i.e
"Play", then I am not able to access the window at all
( i.e cannot press any button ), because the window freezes.
Can someone please give me the solution
Thanks
Sanjay
|
|
|
|
|
Which classes of MFC are you using?
|
|
|
|
|
Hai Everyone!I have added a CommandBarButton and MenuBar in the Word2000 and Excel2000,using ATL and COM as well.My problem is I want to add a bitmap or icon to both the CommandBarButton and MenuItems .I want to do it using ATL and COM.Can anyone please suggest how can I do it.My emailid is ramachandrulasreeram@rediffmail.com.Please do reply me back as I need it urgently.
Regards
SreeRam
|
|
|
|
|
::OpenClipboard
::LoadImage
::SetClipboardData
::DeleteObject
::CloseClipboard
Office::_CommandBarButtonPtr::PasteFace
::EmptyClipboard
These are the methods in the order that you will need to call to get a custom bitmap onto a command bar button.
Cheers,
-Erik
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My thoughts are my own and reflect on no other.
|
|
|
|
|
Hi Erik!
Thankz for u r timely help.
Regards
Sree Ram
|
|
|
|
|
Hi All,
I'm interested in your thoughts about the following:
I have created an ATL COM object with an interface that
consists of the methods Run and Stop. From a
client application I would like to be able to call the Run
method which causes my COM object to start a long
operation. However, the Run method should return immediately
because i don't want any multithreading code in my client.
The long operation can be stopped by calling the Stop method.
Currently, I create a worker thread in my objects Run method
and set a stop flag when the Stop method is called. The worker
thread periodically checks this flag and exits if it is set. For
this to work, my object is created in the MTA.
However, I have the feeling this can be done much simpler. (Also,
there are warnings everywhere about creating threads in COM objects)
I have looked into Asynchronous method calls but this limits my application
to Win2000 and does not work with IDispatch derived interfaces.
Any other idea's, pointers, samples ?
Thank you,
Alwin!
Alwin Beukers
|
|
|
|
|
I use that exact method, and it seems to work fine for me. The worker thread in the Run() method I mean.
If there is a classier way of doing it, I'd like to know.
J
|
|
|
|
|
I have an out of proc server, and a buggy beta-ish client. There is always only a single instance of both client and server. Quite frequently, the client crashes before releasing its server reference.
The one solution I've come up with for this problem, is to have the server keep track of when the client connects and disconnects (implement my own IConnectionPoints) so that if I get an Advise() call before the required Unadvise() call, I (the server) will decrement my own reference count.
Is this as evil as it sounds? I get the feeling this is a kludge solution, and I'm hoping y'all can help me out.
J
|
|
|
|
|
Hi,
Can you give some snapshots of the code?
The out-of-process server - is it a DLL or an EXE?
With best regards,
Sayan Mukherjee
|
|
|
|
|
Ok, actually, it's not a problem that the client crashes. The client code is just one of our applications. The problem is that WHEN it crashes, it never gets around to Release()ing the interface on the OOP server object. It can't, because it crashes.
My question is more about style. Is it OK for the OOP server object to Release() itself if I know that the client will never get around to it?
J
|
|
|
|
|
hello all,
How do I dynamically add script elements through HTML DOM interfaces? I know I can add body element,options etc through DOM but what about scripts?
I'd like to add a simple script at runtime?
TIA.
I'm an alien, I'm an alien
it's a beautiful life....
Bush
|
|
|
|
|
Hi All!
I have been using Smart Pointers to access an active access control's functionality. But I have no idea how to get its events.
Let me tell you one thing that I was using Class Wizard before and i was getting events properly, but there is some problem in the control and I cannot instantiate right at start of application. SO to have good control I am instantiating that control using Smart pointers but I have no way to get its events.
Any help would be appriciated.
Thanks.
Sohail.
"liahoS@hotmail.com"
|
|
|
|
|
Hey,
I've got a tough problem I can't seem to nail down at all. I'm dealing with a series of COM components. One of the components loads another. The outer component loads fine and in turn loads several other components. One of the components it loads is a progress bar dialog written in ATL (everything is ATL). The main COM DLL uses a smart pointer and CreateInstance(__uuidof(blahblahblah)) to instantiate it. When this happens the DLL freezes hard. After a little looking I discovered that the smart pointer was NULL which would certainly explain the freeze. I guess I'm wondering if anyone could shed some light on why my smart pointer is dumb? (heh)
I use: #import "component.tlb" no_namespace
and instantiate the normal way... nothing new. It's the same as all the other components which work fine. The component itself works fine in a dummy application I wrote to verify it. The TLB is solid and I've rebuilt it several times to make sure.
I'm getting pretty agitated. Any gotcha's anyone know of?
Thanks
|
|
|
|
|
Smart pointer is actually a object wraper around interface pointer
whend u declare smartpointer as
IMyClassPtr Mysmartobj; it declare a wraper class around interface ptr.
HRESULT hr
hr = Mysmartobj.CreateInstance(__uuidof(Myclass))
when u check the value of smart pointer just befor this call it is just NULL ,nothing wrong in it but it must contains some valid value after this call.
if it is empty after this call check for Hresult retruned. it may give u some indication of this call failure.
|
|
|
|
|
The basic rule of COM says, In COM, once you "publish" an interface contract by shipping a component, the contract is immutable—it cannot be changed in any way. You can not add. You can not delete. You can not modify.
But, when you open Microsoft Word 97/98 and Microsoft Word 2000 's .OLB files, you will see that for extending the interfaces, they have added methods to the old interfaces. For example, in MS Word 2000 they have added methods in Application interface, and all the other interfaces. Why So? I feel the right approach is to add new interface if you want to extend an interface. Can somebody tell me its' reason??
|
|
|
|
|
Hi,
There are two ways to access a COM interface, accessing using virtual table (IUknown interface), and accessing using Dispinterface (IDispatch interface). If you are using the first approach, the fact that the interface is imutable is true, and you will have trouble in accessing changed interfaces. But if you are using the other approach, you are safe, becuase always you are accessing the same interface (IDispatch) which direct your call to the required interface.
MS Office tools are using Automation (IDispatch interface), so they don't have problems in changing interfaces' methods.
Regards,
ShadiK.
Shadi Al-Kahwaji
|
|
|
|
|
Hi,
Thanks a lot for your information.
In the application which I am writing, I support both dual and dispatch interface. Now, I want to publish a new version of my COM Server. How should I extend my existing interfaces?
Thanks and Regards.
|
|
|
|
|
The most important thing that you don't change the current interfaces, in this way you have many options:
1. If your old interface name is IMyInterface, you might create a new one called IMyInterfaceEx which include the new functionality (within the same COM object) that you need to distribute. (This might be applicable if you have small added features)
2. You might create totaly new COM object on the same component (.DLL) which provide the new functionality plus the new interfaces, this new COM object can use the old COM object functionality in two ways, either by Containment or Aggregation, so the new clients for your component will deal with one COM object to access new and old functionality.
3. You might create totaly new COM component (.DLL) if you are providing very huage change to the old COM component.
You have to read more about Containment and Aggregation, these are advanced topics in COM technology.
Regards,
ShadiK.
Shadi Al-Kahwaji
|
|
|
|
|
We have implemented COM automation server using MFC. MFC Use Nested Class approach to implement COM interface.
What We have done is that for each component we have two interface IMyInterface and IDualMyInterface(for VB client) and both interface expose same set of function. IMyDualInterface is implemented in Nested class and IMyInterface is implemented in parent class.
All the Call to IMyDualInterface Methods are routed to corrosponding IMyInterface implementation by using METHOD_PROLOGUE_EX Macro (This macro return the parent class pointer i.e.pThis).
Now I have to Enhance my com server for this I have to make some changes in my both interface but according to COM rule I can not modify the interface once it is published, as it break the contract with my existing client that are using my previous COM server.
I want to Know How I can Enhance my COM server that is using MFC support.
regards.
|
|
|
|
|
Create another two interfaces IMyInterfaceEx, IDualMyInterfaceEx which will expose the new fuctionality that you want to develop. IMyInterfaceEx implemenattion might be located on the same class which implements IMyInterface interface. And IDualMyInterfaceEx implemenattion might be located on the same class which implements IDualMyInterface interface.
Regards,
ShadiK.
Shadi Al-Kahwaji
|
|
|
|
|
I want to implement the QueryStatus and Exec functions from IOleCommandTarget in my class (so my app can be notified when the user clicks on a custom menu item under IE's Tools menu), but I'm a bit miffed as how to do that . I've tried a wide range of combinations, and have spent awhile searching the internet, but I have yet to find out.
|
|
|
|
|
What is the correct method to stop an OLE server?
I have a service (A.exe)that creates 3 objects in an OLE full server (B.exe). This causes the server application to be launched. As the various objects are instantiated, they come into existence just fine. When the service stops, it releases the three objects, but the server application doesn't go away.
One of the objects in B.exe does have a Stop method that is called by the service as it stops. This is used to stop a bunch of worker threads that live in one of the COM objects. I can cause the program to quit when I A invokes the Stop method in B, but this jerks the objects out from under the service (A) that created them, causing all sorts of ugly things to happen when it tries to release them.
Does any one know what the "right way" to do this is? My first thought was that the server .exe would stop when all of its objects were released. This does not appear to be the case (or is something wrong with their destructors, causing them to not release).
Should I post a message to the main app's thread? If I do, I still need it to live until the objects have been released (or do I?).
Please help, I'm beginning to confuse myself.
Thanks, Bill
Thanks for the help,
Bill
|
|
|
|
|
The server .exe will exit when all instances of all objects are released.
Thanks for the help,
Bill
|
|
|
|
|
Augh! I've created a new ATL COM workspace, and added a ATL Internet Explorer object. But, when I compile it, I get the following link error:
LINK : fatal error LNK1104: cannot open file "nafxcwd.lib"
I've also noticed that now it's happening on a couple other COM server projects, but on some it works just fine. I've tried changing the link libraries, and the included headers around a bunch, but it still keeps happening. I've also searched my hd, and it can't find a file called "nafxcwd.lib".
|
|
|
|
|
nafx*.lib are MFC static libraries, and not all those LIBs are installed by default. Pop in your VC CD and it should look on the CD. If not, find the LIB on the CD and copy it to <msdevdir>\vc98\mfc\lib
--Mike--
http://home.inreach.com/mdunn/
This posting is provided "as was" with no warranties, guarantees, lotteries, or any of those little bags of peanuts you get on planes. You assume all risk for crossing the street without holding mommy's hand. © 2001 Mike's Classy Software. Member FDIC. If rash develops, discontinue use.
your with and
|
|
|
|