Link to home
Start Free TrialLog in
Avatar of mokule
mokuleFlag for Poland

asked on

MDI service application

Hi,
Can somebody give me an example of service application which consist of MDIForm and one MDIChild.
Both should be created when service is started.
They may be visible or hidden while created.
But afterwards they should be hidden not destroyed all the time service is running.
TIA
Avatar of 2266180
2266180
Flag of United States of America image

if they will be hidden, why do you need them anyway? if you just want to drop compnents, you can use a datamodule.
and you will have to make the service be interactive otehrwise you won't be able to use the forms.
plus that services are designed to not interact with the user: it is the most important quality of them: they don't need user intervention and hence can run even if no user is logged on. but a form needs to be displayed and hance requires a "desktop" and thus a logged in user.

so all this is kind of not compatible. can you explain why and what you need this for? maybe there are better soultions.
Avatar of mokule

ASKER

ciuly
I know all this.
> can you explain why and what you need this for ?
To make a long story short. It is rewritten application to service.
It'll be most convinient for me.
I can create normal forms with no problem, but not MDI.

Does anybody know if this is possible at all ?
can you tell me what errors do you get? )if any) also, what is your delphi version? I'll get home in about 2 hours and investigate this on a delphi 7 environment.
I don't see any reason for why a normal form would work for you and a MDI one not. but then again, I don't have much experience with mdi's.
Avatar of mokule

ASKER

This program is written under D7
I've got exception:
Cannot create form. No MDI forms are currently active.
It is thrown when I'm trying to create child window.
The main window is visible and it is MDI, but in fact it's Active property is False.
I've tried SetFocus and Activate with no success.
ASKER CERTIFIED SOLUTION
Avatar of 2266180
2266180
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mokule

ASKER

ciuly,
do you know what to do to avoid button on the taskbar when window is hidden.
The service shouldn't have button on taskbar.
yes, this should fix it: http://www.scalabium.com/faq/dct0096.htm
I am at work right now and cannot test. if the above does not work (though in a normal application does) then let me know and I will investigate tonight
Avatar of TheRealLoki
another way of keeping the service running when you close the mdi form is to add a dummyform.
set it as the "main form" in the project options but put
application.showmainform := false;
in the .dpr