Verfasst: 18.03.2007 17:55
> ich glaub ihr versteht nicht ganz was ich meine.Ich möchte auf den Buttons meine Antworten stehen haben,geht das?Und zuvor mit MessageRequester... ne Frage stellen
Hab ich doch gepostet. Führ den Code doch mal aus.
Mal konkret:
EDIT: Hab den Fehler beim Requester mit 2 Antwortmöglichkeiten ausgebessert.
Hab ich doch gepostet. Führ den Code doch mal aus.
Mal konkret:
Code: Alles auswählen
;//Antworten
#Antwort1 = #PB_MessageRequester_Yes
#Antwort2 = #PB_MessageRequester_No
#Antwort3 = #PB_MessageRequester_Cancel
;// Definitionen. Kannste überlesen ;)
#IDOK = 1
#IDCANCEL = 2
#IDABORT = 3
#IDRETRY = 4
#IDIGNORE = 5
#IDYES = 6
#IDNO = 7
#IDPROMPT = $FFFF
Global hHook
Global mbtitle$, mbmsg$, mbopt1$, mbopt2$, mbopt3$
#StringSpace = 80
Procedure MsgBoxHookProc2 (uMsg, wParam, lParam)
If uMsg = #HCBT_ACTIVATE
SetWindowText_ (wParam, mbtitle$)
SetDlgItemText_ (wParam, #IDYES, mbopt1$)
SetDlgItemText_ (wParam, #IDNO, mbopt2$)
;SetDlgItemText_ (wParam, #IDIGNORE, mbopt3$)
SetDlgItemText_ (wParam, #IDPROMPT, mbmsg$)
UnhookWindowsHookEx_ (hHook)
EndIf
ProcedureReturn #False
EndProcedure
Procedure MsgBoxHookProc3 (uMsg, wParam, lParam)
If uMsg = #HCBT_ACTIVATE
SetWindowText_ (wParam, mbtitle$)
SetDlgItemText_ (wParam, #IDYES, mbopt1$)
SetDlgItemText_ (wParam, #IDNO, mbopt2$)
SetDlgItemText_ (wParam, #IDCANCEL, mbopt3$)
SetDlgItemText_ (wParam, #IDPROMPT, mbmsg$)
UnhookWindowsHookEx_ (hHook)
EndIf
ProcedureReturn #False
EndProcedure
Procedure Frage2 (parentWindow, title$, message$, button1$, button2$)
mbtitle$ = title$
mbmsg$ = message$
mbopt1$ = button1$
mbopt2$ = button2$
mbopt3$ = button3$
hInstance = GetModuleHandle_ (0)
hThreadId = GetCurrentThreadId_ ()
hHook = SetWindowsHookEx_ (#WH_CBT, @MsgBoxHookProc2 (), hInstance, hThreadId)
ProcedureReturn MessageBox_ (parentWindow, Space (#StringSpace), Space (#StringSpace), #MB_YESNO)
EndProcedure
Procedure Frage3 (parentWindow, title$, message$, button1$, button2$, button3$)
mbtitle$ = title$
mbmsg$ = message$
mbopt1$ = button1$
mbopt2$ = button2$
mbopt3$ = button3$
hInstance = GetModuleHandle_ (0)
hThreadId = GetCurrentThreadId_ ()
hHook = SetWindowsHookEx_ (#WH_CBT, @MsgBoxHookProc3 (), hInstance, hThreadId)
ProcedureReturn MessageBox_ (parentWindow, Space (#StringSpace), Space (#StringSpace), #MB_YESNOCANCEL )
EndProcedure
;//Ende von dem obligatorischen Code
;//
;//Jetzt geht dein Programm los
If Frage2(0, "Quiz Frage 1", "Die Hauptstadt von Deutschland?", "Berlin", "Bonn") = #Antwort1
;richtig
Else
;falsch
EndIf
If Frage3(0, "Quiz Frage 2", "In welchem Bundesland liegt München?", "Hessen", "Berlin","Bayern") = #Antwort3
;richtig
Else
;falsch
EndIf
If Frage2(0, "Quiz Frage 3", "Hat euch dieses Quiz gefallen?", "Ja", "Nein") = #Antwort1
;richtig
Else
;falsch
EndIf