Help and Support
 

powered byLive Search

BUG: Setting WindowState = 0 Doesn't Set Window State to Normal

Article ID:180527
Last Review:March 11, 2005
Revision:3.1
This article was previously published under Q180527
On This Page

SYMPTOMS

Setting the WindowState property of a form to '0 - Normal' has no effect.

Back to the top

RESOLUTION

Save the form's height and width before changing the WindowState property (such as Maximizing), and then restore the height and width when desired as follows:
   Option Explicit
   Dim FormHeight
   Dim FormWidth

   Private Sub Form_Load()
      'initialize form size, could be set at design-time also.
      Form1.height = 2000
      Form1.width = 3000
      'Save the form's height and width.
      FormHeight = Form1.Height
      FormWidth = Form1.Width
      Command1.Caption = "Maximized"
      Command2.Caption = "Normal"
   End Sub

   Private Sub Command1_Click()
      Form1.WindowState = 2 'Maximized
   End Sub

   Private Sub Command2_Click()
      'Restore the form's original height and width.
      Form1.Height = FormHeight
      Form1.Width = FormWidth
   End Sub
				

Back to the top

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

Back to the top

MORE INFORMATION

Steps to Reproduce Behavior

1.Start a new Windows CE HPC Pro Project in either eMbedded Visual Basic or Visual Basic 6.0. Form1 is created by default.
2.Add two command buttons to Form1, placing them in the upper-left-hand corner of the form so they will be visible when the form is resized by the Load event of the form.
3.Paste the following code into Form1:
      Private Sub Form_Load()
           Command1.Caption = "Maximized"
           Command2.Caption = "Normal"
           'initialize form size, could be set at design-time also.
           Form1.height = 2000
           Form1.width = 3000
      End Sub

      Private Sub Command1_Click()
           Form1.WindowState = 2 'Maximized
      End Sub

      Private Sub Command2_Click()
           Form1.WindowState = 0 'Normal
      End Sub
						
4.Press F5 to run the project.
5.Click on Command1 and note that the form is maximized.
6.Click on Command2 and note that the window does not return to its normal state.

Back to the top


APPLIES TO
Microsoft eMbedded Visual Basic 3.0
Microsoft Windows CE Toolkit for Visual Basic 6.0

Back to the top

Keywords: 
kbbug kbtoolkit kbpending KB180527

Back to the top

Article Translations

 

Other Support Options

  • Need More Help?
    Contact a Support professional by Email, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.