J
jan.loucka
Hi,
I looked around for this specific problem but could not find any
answer - there's few things in VB but still nothing exactly like this
so I'd appreciate any help.
We're writing C# WinForm application that need to "silently" use
another app (called MapInfo) within itself - the intention is to use
this app (which is quite sophisticated mapping application) and add
some other extra functionality to it. We have a dll so we can run the
application using InteropServices.
We created a main form that is MDI container and has multiple other
forms as children. One of these children is MapInfo form which has got
nothing in itself. It only creates MapInfo executable which is again
another MDI container (C# just doesn't know about it obviously -
MapInfo is written in C++). Inside this MapInfo form we're using this
WIN API methods (after the MapInfo object has been created and we have
a pointer to it):
SetParent(MapInfo handle, parentForm handle);
SetWindowLong(miWin, GWL_STYLE, WS_VISIBLE) - to get rid of the border
etc.
I have certain simple mechanisms how to communicate with this object
but I'm facing one problem. Since my Main parent form is MDI container
- when I click on any child of this form (not the MapInfo ones) the
main parent form keeps focus (I have a menu, toolbar etc there).
However when I click on the MapInfo form (the one that encapsulates
the Interop object in itself) the main Form looses focus. As a result
of that - when the user does something in MapInfo application and
decides to click on one of our controls (toolbar or menu in the main
MDI container form) then he has to click twice. Ones to get the focus
back to the main form. And second time to actually activate the
control. The problem is that when users are within MapInfo - they're
within MapInfo form (the fake empty one that we've written in C#) but
the MapInfo form never gets focus.
I'm open to any ideas hot to solve this problem - I'm sure there must
be some solution to this problem
Thanks
Jan
I looked around for this specific problem but could not find any
answer - there's few things in VB but still nothing exactly like this
so I'd appreciate any help.
We're writing C# WinForm application that need to "silently" use
another app (called MapInfo) within itself - the intention is to use
this app (which is quite sophisticated mapping application) and add
some other extra functionality to it. We have a dll so we can run the
application using InteropServices.
We created a main form that is MDI container and has multiple other
forms as children. One of these children is MapInfo form which has got
nothing in itself. It only creates MapInfo executable which is again
another MDI container (C# just doesn't know about it obviously -
MapInfo is written in C++). Inside this MapInfo form we're using this
WIN API methods (after the MapInfo object has been created and we have
a pointer to it):
SetParent(MapInfo handle, parentForm handle);
SetWindowLong(miWin, GWL_STYLE, WS_VISIBLE) - to get rid of the border
etc.
I have certain simple mechanisms how to communicate with this object
but I'm facing one problem. Since my Main parent form is MDI container
- when I click on any child of this form (not the MapInfo ones) the
main parent form keeps focus (I have a menu, toolbar etc there).
However when I click on the MapInfo form (the one that encapsulates
the Interop object in itself) the main Form looses focus. As a result
of that - when the user does something in MapInfo application and
decides to click on one of our controls (toolbar or menu in the main
MDI container form) then he has to click twice. Ones to get the focus
back to the main form. And second time to actually activate the
control. The problem is that when users are within MapInfo - they're
within MapInfo form (the fake empty one that we've written in C#) but
the MapInfo form never gets focus.
I'm open to any ideas hot to solve this problem - I'm sure there must
be some solution to this problem
Thanks
Jan