Einfache Konsole zweimal starten
-
Hallo Leute,
ich will zwei Konsolen gleichzeitig starten, hab damit jedoch ein problem.
Ich habe eine einfach Definition:
Console::CConsole() { int nRet = DialogBoxParam( NULL, MAKEINTRESOURCE (IDD_CONSOLE), NULL, this->ConsoleDlgProc, (LPARAM)this ); } BOOL CALLBACK CConsole::ConsoleDlgProc(HWND hWnd, UINT uMsg, WPARAM wp, LPARAM lp) { CConsole *console = (CConsole*)lp; switch(uMsg) { case WM_INITDIALOG: { return TRUE; break; } default: return FALSE; } }Der Klasse:
class CConsole { private: public: ~CConsole(); CConsole(); static BOOL CALLBACK ConsoleDlgProc(HWND, UINT, WPARAM, LPARAM); };Wenn ich jetzt diese zweimal öffnen will, erhalte ich nur eine! Warum?
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { CConsole a; CConsole b; return 1; }Würde mich über eine Antwort freuen.

-
MSDN - DialogBoxParam schrieb:
The DialogBoxParam function creates a modal dialog box from a dialog box template resource. Before displaying the dialog box, the function passes an application-defined value to the dialog box procedure as the lParam parameter of the WM_INITDIALOG message. An application can use this value to initialize dialog box controls.
[...]
If the function succeeds, the return value is the value of the nResult parameter specified in the call to the EndDialog function used to terminate the dialog box.
Du erzeugst einen modalen Dialog - das heißt dein Hauptprogramm wird erst weiter machen, wenn du diesen Dialog geschlossen hast (dann wird auch deine zweite Konsole auftauchen). Schau dir doch mal CreateWindow(Ex) an, das könnte geeigneter sein.