Hi all, I have found a MAJOR crash glitch when the program window is clicked out of. When you click anywhere out of the program window, DBPro crashes it. So I came up with a way around that. I would like to disable the Minimize and Maximize button on my windowed mode program.
I looked online and discovered a VB.Net code that allows for this, and I tried to convert it, but it won't work right.
Here's the code:
sync on : sync rate 60
#Constant GWL_STYLE -16
Global hWnd
hWnd = get dbpro window()
set display mode screen width(), screen height(), screen depth(), 1
autocam off
set ambient light 100
make matrix 1000, 1000, 1000, 20, 20
`RemoveControlBoxes(hWnd, GWL_STYLE)
do
move camera (keystate(17)-keystate(31) or upkey()-downkey())*1
turn camera left (keystate(30)-keystate(32) or leftkey()-rightkey())*1
sync
loop
Function SetWindowLong(hWnd, nIndex, dwNewLong)
load dll "user32.dll", 1
func$ = "SetWindowLong"
call1=call dll(1, func$, hWnd, nIndex, dwNewLong)
EndFunction call1
Function GetWindowLong(hWnd, GW_STYLE)
load dll "user32.dll", 1
func$ = "GetWindowLong"
call1=call dll(1, func$, hWnd, GW_STYLE)
EndFunction call1
Function RemoveControlBoxes(hWnd, GW_STYLE)
windowLong = GetWindowLong(hWnd, GW_STYLE)
windowLong = -131073 And -65537
SetWindowLong(hWnd, GWL_STYLE, windowLong)
EndFunction
Here's the VB.Net script:
<DllImport("user32.dll")> _
Private Shared Function SetWindowLong(ByVal hWnd As IntPtr, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
End Function
<DllImport("user32.dll")> _
Private Shared Function GetWindowLong(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As Integer
End Function
Private Const GWL_STYLE As Integer = (-16)
Private Sub RemoveControlBoxes()
'
Dim hwnd As IntPtr = New Interop.WindowInteropHelper(Me).Handle
Dim windowLong As Long = GetWindowLong(hwnd, GWL_STYLE)
windowLong = windowLong And -131073 And -65537
SetWindowLong(hwnd, GWL_STYLE, CInt(windowLong))
'
End Sub
//The above VB.NET code should remove the Minimize and Max. //control buttons within the Window frame. Also, pinvoke.net is a //handy resource for future reference.
CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!