|
-
Nov 10th, 2000, 07:50 PM
#1
Thread Starter
Member
ok, i want to make my project go fullscreen, without the start menu or anything... i want it to be the ONLY thing on the screen. and in a way that hopefully nothing will go over it until the program is over...
how do i go about doing this?
-
Nov 10th, 2000, 08:31 PM
#2
Set the Form's BorderStyle to 0-None and the Form's WindowState property to 2-Maximized.
And use the SetWindowPos api function to keep the form on top of everything else.
Code:
Private Declare Function SetWindowPos Lib "user32" Alias "SetWindowPos"_
(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
Const SWP_NOMOVE = 2
Const SWP_NOSIZE = 1
Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Const HWND_TOPMOST = -1
Const HWND_NOTOPMOST = -2
Private Sub Form_Load()
SetWindowPos Me.hWnd, HWND_TOPMOST, _
0, 0, 0, 0, FLAGS
End Sub
-
Nov 10th, 2000, 08:59 PM
#3
If you want to get into it a bit more, you can hide everything, minimize all windows, showing only your program.
Code:
Declare Function findwindow Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName As String, ByVal _
lpWindowName As String) As Long
Public Declare Function FindWindowEx Lib "user32" _
Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As _
Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Declare Function showWindow Lib "user32" Alias "ShowWindow" _
(ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function SystemParametersInfo Lib "user32" _
Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal _
uParam As Long, ByVal lpvParam As Any, ByVal fuWinIni As _
Long) As Long
Private Declare Function PostMessage Lib "user32" _
Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As _
Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Const SW_HIDE = 0
Public Const SW_SHOW = 5
Private Const WM_COMMAND As Long = &H111
Private Const MIN_ALL As Long = 419
Private Const MIN_ALL_UNDO As Long = 416
Dim progman&
Dim shelldlldefview&
Dim syslistview&
Dim tray&
Sub DisableCtrlAltDelete(bDisabled As Boolean)
Dim X As Long
X = SystemParametersInfo(97, bDisabled, CStr(1), 0)
End Sub
Public Sub MinimizeAll()
On Error Resume Next
Dim lngHwnd As Long
lngHwnd = findwindow("Shell_TrayWnd", vbNullString)
Call PostMessage(lngHwnd, WM_COMMAND, MIN_ALL, 0&)
End Sub
Public Sub RestoreAll()
Dim lngHwnd As Long
lngHwnd = findwindow("Shell_TrayWnd", vbNullString)
Call PostMessage(lngHwnd, WM_COMMAND, MIN_ALL_UNDO, 0&)
End Sub
Public Sub RestoreForm(frm As Form)
'Use this after you minimize all to restore only your program
Dim lngHwnd As Long
lngHwnd = findwindow(frm.hwnd, vbNullString)
Call PostMessage(lngHwnd, WM_COMMAND, MIN_ALL_UNDO, 0&)
End Sub
Private Sub Command1_Click()
'Hide
Dim x&
Dim y&
progman& = findwindow("progman", vbNullString)
shelldlldefview& = FindWindowEx(progman&, 0&, "shelldll_defview", vbNullString)
syslistview& = FindWindowEx(shelldlldefview&, 0&, "syslistview32", vbNullString)
tray& = findwindow("Shell_TrayWnd", vbNullString)
Y = showwindow(syslistview&, SW_HIDE)
X = showwindow(tray&, SW_HIDE)
Call DisableCtrlAltDelete(True)
MinimizeAll
RestoreForm Me
End Sub
Private Sub Command2_Click()
'Show
Dim x&
Dim y&
progman& = findwindow("progman", vbNullString)
shelldlldefview& = FindWindowEx(progman&, 0&, "shelldll_defview", vbNullString)
syslistview& = FindWindowEx(shelldlldefview&, 0&, "syslistview32", vbNullString)
tray& = findwindow("Shell_TrayWnd", vbNullString)
Y = showwindow(syslistview&, SW_SHOW)
X = showwindow(tray&, SW_SHOW)
Call DisableCtrlAltDelete(False)
RestoreAll
End Sub
And if you want to lock the mouse in your program:
Code:
Declare Function ClipCursor Lib "user32" (lpRect As _
Any) As Long
Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Sub DisableTrap(CurForm As Form)
Dim erg As Long
'Declare a variable for the procedure
'to set the new coordinates
Dim NewRect As RECT
'Set the new coordinates to full screen
With NewRect
.Left = 0&
.Top = 0&
.Right = Screen.Width / Screen.TwipsPerPixelX
.Bottom = Screen.Height / Screen.TwipsPerPixelY
End With
erg& = ClipCursor(NewRect)
End Sub
Public Sub EnableTrap(CurForm As Form)
Dim X As Long, Y As Long, erg As Long
'Declare a variable for the procedure
'to set the new coordinates
Dim NewRect As RECT
'Get the TwipsperPixel
'The Form's ScaleMode must be set to Twips!!!
X& = Screen.TwipsPerPixelX
Y& = Screen.TwipsPerPixelY
'Set the Cursor-Region to the coordinates
'of the form
With NewRect
.Left = CurForm.Left / X&
.Top = CurForm.Top / Y&
.Right = .Left + CurForm.Width / X&
.Bottom = .Top + CurForm.Height / Y&
End With
erg& = ClipCursor(NewRect)
End Sub
[Edited by Matthew Gates on 11-10-2000 at 09:03 PM]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|