Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: onytoo
  Where is onytoo?
 Padang
 Indonesia
 onytoo
 To: Samir H.
  Where is Samir H.?
 Yogyakarta
 Indonesia
 Samir H.
 Tags
Subject: RE: Form with showWindow 0 and 2?
Thread ID: 310856 Message ID: 310886 # Views: 37 # Ratings: 1
Version: Visual FoxPro 9 SP2 Category: Forms
Date: Sunday, June 26, 2011 11:01:28 PM         
   


> Hi
> I have a form (a scx run with DO FORM, not createobject()) that I run as a usual form in my app, with showWindow=0 (in Screen).
>
> Now, I must also run this form as a "separate app" for guests who do not have access rights to any other function of my application. They are only allowed to run this single form.
> In this case the form must run as showWindow=2 because the screen, the menu and all other application facilities must not be accessible to the user.
>
> Since the "ShowWindow" property is readonly at runtime, I had to set it to 2 (top level) for both cases, but I would like to keep it 0 (InScreen) when the form is run from within my application, and have it set to TopLevel when a guest uses the form.
>
> Is there any trick to change ShowWindow at runtime?
>
>
> Regards
> Samir


Basically, a top level form is have no parent or the parent is windows desktop.
With a little trick, we can turn a child form into desktop form
(tested with win7, in winxp should work well)

*!* form init
LPARAMETERS tlTopLevel
this.AddProperty("lTopLevel", tlTopLevel)
IF tlTopLevel
  DECLARE LONG SetParent IN WIN32API AS API_SetParent LONG, LONG
  DECLARE LONG ShowWindow IN WIN32API AS API_ShowWindow LONG, LONG
  DECLARE LONG BringWindowToTop IN WIN32API AS API_BringWindowToTop LONG
  *!* hide screen and remove from taskbar,
  *!* do not use _SCREEN.Visible !!!
  #define SW_HIDE 0
  API_ShowWindow(_VFP.hWnd, SW_HIDE)
  *!* set form parent to desktop
  API_SetParent(this.HWnd, 0)
  *!* activate form
  API_BringWindowToTop(this.HWnd)
ENDIF

*!* form.destroy
IF this.lTopLevel
  #define SW_SHOWNORMAL    1
  #define SW_SHOWMINIMIZED 2
  #define SW_SHOWMAXIMIZED 3
  API_ShowWindow(_VFP.hWnd, SW_SHOWMAXIMIZED)
ENDIF



Regards,
Onytoo

ENTIRE THREAD

Form with showWindow 0 and 2? Posted by Samir H. @ 6/26/2011 6:18:42 AM
RE: Form with showWindow 0 and 2? Posted by Anil Sharma @ 6/26/2011 8:31:30 AM
RE: Form with showWindow 0 and 2? Posted by tushar @ 6/26/2011 9:25:22 AM
RE: Form with showWindow 0 and 2? Posted by Samir H. @ 6/26/2011 10:55:54 AM
RE: Form with showWindow 0 and 2? Posted by Yousfi Benameur @ 6/26/2011 12:50:14 PM
RE: Form with showWindow 0 and 2? Posted by Samir H. @ 6/26/2011 1:31:27 PM
RE: Form with showWindow 0 and 2? Posted by onytoo @ 6/26/2011 11:01:28 PM
RE: Form with showWindow 0 and 2? Posted by Samir H. @ 6/27/2011 5:59:20 AM