I am newbe trying to make a data display application in VB6 with Flash Animation (Interface).

My question is:

When I run the application, it should opens in normal window with title bar (not maximized). But when user press a button or some thing like that, window should resize (maximize) to FullScreen without title & task bar, covering every pixel of the screen.
But how? I dont know.
Is that possible?

Your help would be much appreciated.

Recommended Answers

All 5 Replies

Try This Code

'Put this declaration on the top of the Code Window of the form
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long,          ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long

Public Const SM_CXSCREEN = 0
Public Const SM_CYSCREEN = 1
Public Const HWND_TOP = 0
Public Const SWP_SHOWWINDOW = &H40

'Put this code in the Button_Click() event
'Or whereever u want to make the 
'screen full screen.

Dim cx As Long
Dim cy As Long
Dim RetVal As Long

' Determine if screen is already maximized.
If Me.WindowState = vbMaximized Then
    ' Set window to normal size
    Me.WindowState = vbNormal
End If

' Get full screen width.
cx = GetSystemMetrics(SM_CXSCREEN)
' Get full screen height.
cy = GetSystemMetrics(SM_CYSCREEN)

' Call API to set new size of window.
RetVal = SetWindowPos(Me.hwnd, HWND_TOP, 0, 0, cx, cy, SWP_SHOWWINDOW)

Hope this solves ur problem

Regards
Shaik Akthar

Check Out the Sample Project Here for resizing the window to full screen and restore it back to its original state.

Some more code for Hide/Display the title bar is also added.

Regards
Shaik Akthar

Try this :
set form's BorderStyle=none or 0 and when you click the button set forms WindowState property =2

Code the things said by guest11

Private Sub Command1_Click()
   If WindowState = vbMaximized Then
      WindowState = vbNormal
   ElseIf WindowState = vbNormal Then
      WindowState = vbMaximized
   End If
End Sub

Shaik Akthar
Thanks alot, your sample project code almost solved the problem.
Only one thing remain, that is,
When I press FullScreen, it goes full screen hiding title bar but still showing border.
And when I press Restore, it restores the window but without title bar.
May be I am doing some thing wrong ... :-/

guest11, selvaganapathy
Thanks guys for your help, your codes are working,
But Shaik Akhtar idea is the same, what I am looking for.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.