fb:porticula NoPaste
Windows: Programm beenden mit X-Button
Uploader: | St_W |
Datum/Zeit: | 26.08.2012 23:47:00 |
#Include "windows.bi"
#Include "fbgfx.bi"
Declare Function gfxWndProc(hWnd As HWND, uMsg As UINT, wParam As WPARAM, lparam As LPARAM) As LRESULT
Screen 13
Dim Shared hWnd As HWND
Dim Shared OldWndProc As WNDPROC
ScreenControl(FB.GET_WINDOW_HANDLE, Cast(UInteger, hWnd))
OldWndProc = Cast(WNDPROC, SetWindowLongPtr (hWnd, GWLP_WNDPROC, cast(LONG_PTR, @gfxWndProc)))
Sub closeThread(p as any ptr)
If MessageBox(hWnd, @"Soll das Programm wirklich beendet werden?", @"Ende", MB_YESNOCANCEL Or MB_ICONQUESTION) = IDYES Then
ExitProcess(0)
EndIf
End Sub
Function gfxWndProc(hWnd As HWND, uMsg As UINT, wParam As WPARAM, lParam As LPARAM) As LRESULT
'Dim ending As Integer = FALSE
If uMsg = WM_CLOSE Then
'ending = TRUE
'ExitProcess(0)
'CreateThread(0, 0, @closeThread, 0, 0, 0)
ThreadCreate(@closeThread)
Return 0
EndIf
'If ending Then Return DefWindowProc(hWnd, uMsg, wParam, lParam)
Return OldWndProc(hWnd, uMsg, wParam, lParam)
End Function
Do
Dim keys As String
keys = InKey()
If keys <> "" Then
Print "Gedrueckt: "; Hex(Asc(keys, 1))
EndIf
Sleep 1
Loop