maximising a form (completely)

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,530
Location
Lansing, MI; USA
Programming Experience
10+
how would one go about maximising a form the cover the entire screen?

i need it to cover the taskbar, regardless if the taskbar is set to 'Keep the taskbar on top of other windows' or not

and i say maximised because i dont want the user to be able to move the window at all either
 
also how does one go about making their application start on startup (right after the user logs into windows xp that is) in the registry?
 
JuggaloBrotha said:
also how does one go about making their application start on startup (right after the user logs into windows xp that is) in the registry?
All applications referenced in the HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run key (and the corresponding HKEY_CURRENT_USER subkey) are run at startup. Is that what you want, or are you talking about the way anit-virus software gets loaded even earlier than that?
 
jmcilhinney said:
All applications referenced in the HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run key (and the corresponding HKEY_CURRENT_USER subkey) are run at startup. Is that what you want, or are you talking about the way anit-virus software gets loaded even earlier than that?

yes actually that is what i was looking for i just figured putting both questions into the same topic would be as good as looking up the old posts (sorry, i'm on dialup here)
 
Cool. It sounds like you want to restrict access to the OS through your app so I thought you might want to load it even sooner (although I couldn't tell you how to do that). As for your first question, the only way to run full-screen properly is to use DirectX. There are a few hacks you can use that involve APIs, though. You can use the SetWindowPos API to put a window on top of the Taskbar but you can't stop the user Alt+Tabbing to bring the Taskbar back to the foreground without a bit more work. I believe there is an API to hide the Taskbar and also to disable key combinations like Alt+Tab and even Ctrl+Alt+Del. Let me know how much restriction you want and I'll put an example together if you like. It's not stuff I've used myself before but I've read bits and pieces in various places.
 
Even i don't see the purpose to restrict user to close the application here is the simplest example:
Just set up FormBorderStyle to "none" and WindowState to Maximized and it will cover up entire screen including taskBar. Also you can preserve key combinations as Alt + F4 in this manner:

VB.NET:
[size=2][color=#0000ff]Protected [/color][/size][size=2][color=#0000ff]Overrides [/color][/size][size=2][color=#0000ff]Function[/color][/size][size=2] ProcessCmdKey([/size][size=2][color=#0000ff]ByRef[/color][/size][size=2] msg [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Windows.Forms.Message, [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] keyData [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Windows.Forms.Keys) [/size][size=2][color=#0000ff]As [/color][/size][size=2][color=#0000ff]Boolean
[/color][/size][size=2][color=#0000ff]If[/color][/size][size=2] (keyData = Keys.Alt + Keys.F4) [/size][size=2][color=#0000ff]Then
 
[/color][/size][size=2]MessageBox.Show("Sorry, you can't close current window")
 
[/size][size=2][color=#0000ff]Return [/color][/size][size=2][color=#0000ff]True
 
[/color][/size][size=2][color=#0000ff]End [/color][/size][size=2][color=#0000ff]If
 
[/color][/size][size=2][color=#0000ff]End [/color][/size][size=2][color=#0000ff]Function
[/color][/size]
the "Return True" indicates you've processed that key and don't want the base class (the form) to process it and note that this way you can block virtually any type of key stroke (well, atleast those that are defined in the 'Keys' enum). For instance Esc + Ctrl can also pop up the start menu and taskbar so, take care about this key combiantion as well.


Cheers ;)
 
thanx guys, i'll actually be playing around with that tonight (after work)

and yes this is like a (very) low level addition to security

though (if you can remember) i wouldnt mind reading those directx articles if ya still have the link(s)
 
Back
Top