MessageBox
-
abend , habe mal ne einfache frage.
wie bekomm ich hin das die messagebox direkt in der mitte der anwendung erscheint und nicht in der mitte des monitores ?
mfg, reiner
-
Musst du Hooken und dann verschieben. Ist aber ziemlich kompliziert. Mach dir lieber kurz nen eigenen Dialog.
-
Ich würds wenigstens nochmal mit MessageBoxIndirect() versuchen. Da gibts dann ne Callback für.
-
jo, gibt's ne callback funktion für, aber ich seh nur eine für die hilfe-events:
lpfnMsgBoxCallback
Pointer to the callback function that processes help events for the message box.
-
Probieren geht über Studieren, oder?
-
Was heisst das jetzt? Hast du da noch eine andere Callback Funktion entdeckt?
-
Das heißt, DU SOLLST ES MAL VERSUCHEN!!!
*kapiernix - probiernix*
-
Ne, also da seh ich den Sinn nicht. Sag mir doch mal bitte wo das mit der Callback Funktion hinsoll? Meinst du das Member lpfnMsgBoxCallback von MSGBOXPARAMS? Wenn ja, dann brauch man es nicht auszuprobieren, das funktioniert nicht!
-
Hallo,
das mit 'nem Hook ist doch ganz easy:
HHOOK FCBTHook = NULL; FCBTHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTProc,(HINSTANCE)0,GetCurrentThreadId()); MessageBox(0,"Test","Test",0); UnhookWindowsHookEx(FCBTHook); LRESULT CALLBACK CBTProc(int code, WPARAM wParam, LPARAM lParam) { static HWND hAktivWnd = NULL; if(code < 0) return(CallNextHookEx(FCBTHook,code,wParam,lParam)); else if(code == HCBT_ACTIVATE){ if(((CBTACTIVATESTRUCT*)lParam)->hWndActive == hAktivWnd){ hAktivWnd = NULL; } else if(!hAktivWnd){ // eventuell noch abfragen ob das Fenster wirklich eine MessageBox ist int x = 0; // musst Du selber berechnen int y = 0; // musst Du selber berechnen HWND hWnd = (HWND)wParam; hAktivWnd = hWnd; SetWindowPos(hAktivWnd,NULL,x,y,0,0,SWP_NOZORDER | SWP_NOSIZE); } } return(0); }
So oder so ähnlich könnte so etwas aussehen.
Gruß
ube