Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using the ShowWindow API to display a form
Message
From
17/11/2005 01:54:45
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
Using the ShowWindow API to display a form
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01069604
Message ID:
01069604
Views:
78
Iam having a problem using the ShowWindow API routine to show a form. I run into this trying to overcome problems with the setting of the visible property Bug ID: 152

When using the code below as a test, the form shows, but all its non client area is not shown. If you move the mouse over to where the close button should be, you will see a pre-themes close button and you will be able to close this form.

Any comments or suggestions? Maybe i have to send the window more messages with SendMessage so it will update itself? I tried a few messages, with no luck.

Carlos
***** BEGIN ShowWindow API Test *****

#Define SW_HIDE 0
#Define SW_MAXIMIZE 3
#Define SW_MINIMIZE 6
#Define SW_RESTORE 9
#Define SW_SHOW 5
#Define SW_SHOWDEFAULT 10
#Define SW_SHOWMAXIMIZED 3
#Define SW_SHOWMINIMIZED 2
#Define SW_SHOWMINNOACTIVE 7
#Define SW_SHOWNA 8
#Define SW_SHOWNOACTIVATE 4
#Define SW_SHOWNORMAL 1

*#beautify keyword_nochange
Declare Integer ShowWindow In user32 As ShowWindowA;
  INTEGER nHWnd,;
  INTEGER nCmdShow
*#beautify

Public oForm1,oForm2
oForm1 = Createobject("MyForm1")
oForm1.AddObject("Command1","Mycmd1")
oForm1.AddObject("Command2","Mycmd2")
oForm1.AddObject("Command3","Mycmd3")

oForm1.Show

oForm2 = Createobject("MyForm2")
Read Events

Define Class Mycmd1 As CommandButton
  Caption = 'ShowWindow'
  Left = 60
  Top = 150
  Height = 25
  Width = 100
  Procedure Click
  oForm2 = Createobject("MyForm2")
  oForm2.AddObject("Command4","Mycmd4")

   ShowWindowA(oForm2.HWnd, SW_SHOWNORMAL)
Enddefine

Define Class Mycmd2 As CommandButton
  Caption = 'Form.Show'
  Left = 180
  Top = 150
  Height = 25
  Width = 100
  Procedure Click
  oForm2 = Createobject("MyForm2")
  oForm2.AddObject("Command4","Mycmd4")

  * Mostrar formulario "normalmente"
  oForm2.Show
Enddefine

Define Class Mycmd3 As CommandButton
  Caption = 'Exit'
  Left = 300
  Top = 150
  Height = 25
  Width = 100
  Procedure Click
  Clear Events
  RELEASE oForm1, oForm2
Enddefine

Define Class Mycmd4 As CommandButton
  Caption = 'Close'
  Left = 300
  Top = 150
  Height = 25
  Width = 100
  Procedure Click
  ThisForm.Release
Enddefine

Define Class MyForm1 As Form
  Caption = "Test of ShowWindow API"
  Left = 10
  Top = 10
  Height = 200
  Width = 420
  Procedure QueryUnload
  Clear Events
  PROCEDURE Activate
  ThisForm.SetAll("Visible",.T.)
Enddefine

Define Class MyForm2 As Form
  Caption = "MyForm"
  AutoCenter = .T.
  Height = 200
  Width = 420
  Procedure QueryUnload
  Clear Events
    PROCEDURE Activate
  ThisForm.SetAll("Visible",.T.)
Enddefine

***** END ShowWindow API Test *****
Next
Reply
Map
View

Click here to load this message in the networking platform