F
Fruber Malcome
I have two versions of my application, one (1) that is a dll that is
referenced from the document using the Wizard in VSTO, the other (2) is an
exe that creates an instance of word and loads a document and performs the
necessary tasks, this exe loads up a CustomWordForm. (which is not the same
CustomForm e.g. my help about form).
When using (1) - everything works well unless I show a custom form in word
using CustomForm.ShowDialog(). It seems that after the user clicks close on
this form, word no longer is running any of the code within the dll. (no
exceptions or errors, it just stops running my code like as it it has an
exception, therefore where my handlers used to-be, they now say cannot find
macro or the security settings are too high etc.)
When using (2) - everything works as expected, with the exception, now when
I perform a CustomForm.ShowDialog() - the user can click close on that
dialog and everything works well. (everything keeps responding).
So I'm thinking the CustomForm.ShowDialog() must be having some problems
with Word as a window (or something like that).
So my question is, if I cannot resolve this problem in the dll and I need to
move forward with the exe. How can I make word live within my
CustomWordForm window? I'm hoping that If I can do this, then when the
other custom forms get displayed via ShowDialog - they will appear ontop of
the word application, unfortunately right now they don't show up on top of
word, instead they show up on top of my CustomWordForm - which right now is
an empty form with nothing on it.
I've tried the known api:
int hwndWord = 0;
if ( (hwndWord = FindWindow( "Opusapp", null)) != 0 )
SetParent( hwndWord, this.Handle.ToInt32() );
Once I do this, I can no longer see the word window, I've even set it to
HWND_TOPMOST (the hwndWord), still no luck.
As a note, I don't like the above code because Opusapp can return any
instance of word that is already running, I'd like to use the instance of
the actuall application object I have as a member of my form.
thanks.
referenced from the document using the Wizard in VSTO, the other (2) is an
exe that creates an instance of word and loads a document and performs the
necessary tasks, this exe loads up a CustomWordForm. (which is not the same
CustomForm e.g. my help about form).
When using (1) - everything works well unless I show a custom form in word
using CustomForm.ShowDialog(). It seems that after the user clicks close on
this form, word no longer is running any of the code within the dll. (no
exceptions or errors, it just stops running my code like as it it has an
exception, therefore where my handlers used to-be, they now say cannot find
macro or the security settings are too high etc.)
When using (2) - everything works as expected, with the exception, now when
I perform a CustomForm.ShowDialog() - the user can click close on that
dialog and everything works well. (everything keeps responding).
So I'm thinking the CustomForm.ShowDialog() must be having some problems
with Word as a window (or something like that).
So my question is, if I cannot resolve this problem in the dll and I need to
move forward with the exe. How can I make word live within my
CustomWordForm window? I'm hoping that If I can do this, then when the
other custom forms get displayed via ShowDialog - they will appear ontop of
the word application, unfortunately right now they don't show up on top of
word, instead they show up on top of my CustomWordForm - which right now is
an empty form with nothing on it.
I've tried the known api:
int hwndWord = 0;
if ( (hwndWord = FindWindow( "Opusapp", null)) != 0 )
SetParent( hwndWord, this.Handle.ToInt32() );
Once I do this, I can no longer see the word window, I've even set it to
HWND_TOPMOST (the hwndWord), still no luck.
As a note, I don't like the above code because Opusapp can return any
instance of word that is already running, I'd like to use the instance of
the actuall application object I have as a member of my form.
thanks.