Re: Calling CreateDispatch to create Word Instance
- From: Pranav <Pranav@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 29 May 2009 00:05:01 -0700
Thanks SvenC. So is there any way of Launching a word application when the
DLL is loaded in the memory, other than making the function call from the
application which loads this DLL? If there is no other way, then I have to
change the application which loads my DLL to invoke the word launching
function before invoking any other function of my DLL. I thought of avoiding
this step. But it seems..couldn't be done. I have read about the restrictions
of calling some functions from InitInstance of DLL. If I invoke the word
launching function in the DLL from the application which loads this DLL, the
user of the application will feel the latency of word application being
launched. This DLL is written in such a way, it will maintain the same
instance until the application which loads this DLL is closed. So for the
first time, when user invokes this word launching function, there will be
latency...So inorder to hide this latency when the user invokes the specific
functionality, I thought of launching the word application at the DLL load
time...Any suggestions are welcomed...
Pranav
"SvenC" wrote:
Hi Pranav,.
for the typo. This code is inside DLL Constructor and this DLL is loaded
by
another application. I have checked the process list, once the
CreateDispatch
Statement gets hung. I couldn't see Winword.exe in the list. But when the
same set of code is put in a separate DLL function and call it from other
member function (except the constructor or InitInstance.), word could be
launched. When I try to call the same function from the
constructor/initInstance it gets hung. My sample code looks like this
My guess is that your code running in the constructor of InitInstance of
your CWinApp derived class will make it run in the context of DllMain.
You are quite restricted in what you can do in DllMain. See remarks:
http://msdn.microsoft.com/en-us/library/ms682583(VS.85).aspx
So you have to change your design that you use COM only at later
times, e.g. when a function of your dll gets called.
--
SvenC
- Follow-Ups:
- References:
- Calling CreateDispatch to create Word Instance
- From: Pranav
- Re: Calling CreateDispatch to create Word Instance
- From: SvenC
- Re: Calling CreateDispatch to create Word Instance
- From: Pranav
- Re: Calling CreateDispatch to create Word Instance
- From: SvenC
- Calling CreateDispatch to create Word Instance
- Prev by Date: Re: Calling CreateDispatch to create Word Instance
- Next by Date: Re: Too much spam in microsoft.public.vc.mfc
- Previous by thread: Re: Calling CreateDispatch to create Word Instance
- Next by thread: Re: Calling CreateDispatch to create Word Instance
- Index(es):
Relevant Pages
|