Board index » cppbuilder » Forms in a DLL & Alt+Tab

Forms in a DLL & Alt+Tab


2006-03-30 07:34:34 AM
cppbuilder57
Hi all, got a quick question to ask, not sure what I'm doing wrong. I have
a DLL in which I have several forms embedded. At run-time I create theses
forms in response to calls made to exported functions. The first form is
created non-modal, from there I can create another form modal or non-modal.
For some reason, each form is appearing as another 'application' when I
press Alt+Tab to switch through running applications.
Can anyone point me in the right direction here - does it have anything to
do with the parent object that the form's belong to? I've been
experimenting with using different value during the construction i.e.
new TSomeForm(Application);
new TSomeForm(NULL);
new TSomeForm(SomeOtherForm);
Any pointers would be excellent...
Mike C
 
 

Re:Forms in a DLL & Alt+Tab

"Mike Collins" < XXXX@XXXXX.COM >wrote in message
Quote
For some reason, each form is appearing as another 'application'
when I press Alt+Tab to switch through running applications.
As they should be. A DLL has its own TApplication object that is separate
from the main application. Your TForm objects are children of the DLL's
TApplication object, not the main application's.
Quote
Can anyone point me in the right direction here
You have to assign the DLL's TApplication::Handle property to be the same
HWND as the TApplication::Handle of the main application. Which means that
the main application will have to pass its HWND to the DLL in an exported
function.
The alternative is to change your DLL project into a Package instead. A
Packaage is a special type of DLL that has built-in VCL support, which
includes automatic sharing of the main application's TApplication object.
Gambit
 

Re:Forms in a DLL & Alt+Tab

Thanks for the reply Remy,
I'm doing a bit of a bodge (is that a word in the US?) with respects to
this - I'm coding a Gina stub so I'll have to stick to a DLL instead of a
package. The initialisation calls to the DLL receive a handle to winlogon,
so I should be able to use this - do you know of any issues that might occur
here since it's not a BCB / TApplication that is calling the DLL.
The reason why I'm doing this is that the only way to produce 'windows' from
within a standard ginastub is to use the wrapper functions WlxDialogBox.
I've spend ages trying to produce a screen that confirms to out requirements
using the dialog related api()'s and in the end I gave up. Instead I do a
bit of 'bodge' and create a blank dialog and then (within the Callback
function) when I receive the WM_INITDIALOG, I create my BCB form, and in
turn destroy it when I get the WM_DESTROY.
Doesn't sound good but it works really well. Any feed back though, would be
greatly appreciates...
Thanks again...
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"Mike Collins" < XXXX@XXXXX.COM >wrote in message
news:442b198b$ XXXX@XXXXX.COM ...

>For some reason, each form is appearing as another 'application'
 

{smallsort}

Re:Forms in a DLL & Alt+Tab

Actually - I was talking rubbish there (it's late in the UK) - I get passed
a HANDLE to winlogon, not a HWND so I probably won't be able to use it :-(
"Mike Collins" < XXXX@XXXXX.COM >wrote in message
Quote
Thanks for the reply Remy,

I'm doing a bit of a bodge (is that a word in the US?) with respects to
this - I'm coding a Gina stub so I'll have to stick to a DLL instead of a
package. The initialisation calls to the DLL receive a handle to
winlogon, so I should be able to use this - do you know of any issues that
might occur here since it's not a BCB / TApplication that is calling the
DLL.