Konsole immer offen -> nicht gut
-
Hallöchen.
Ich habe grad wieder eines meiner ersten WinAPI-Programme geschrieben und stehe schon wieder vor einem Problem.
Alles lässt sich wunderbar compilieren, aber wenn ich das Programm ausführe, ist die Konsole noch im HIntergrund zu sehen.Das möchte ich eigentlich nicht.
Hier mal zu meiner WinMain-Funktion:int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { HWND hwnd; /* This is the handle for our window */ MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ /* The Window structure */ wincl.hInstance = hInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW; /* Catch double-clicks */ wincl.cbSize = sizeof (WNDCLASSEX); /* Use default icon and mouse-pointer */ wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION); wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION); wincl.hCursor = LoadCursor (NULL, IDC_ARROW); wincl.lpszMenuName = NULL; /* No menu */ wincl.cbClsExtra = 0; /* No extra bytes after the window class */ wincl.cbWndExtra = 0; /* structure or the window instance */ /* Use Windows's default color as the background of the window */ wincl.hbrBackground = (HBRUSH) (COLOR_BACKGROUND); /* Register the window class, and if it fails quit the program */ if (!RegisterClassEx (&wincl)){ MessageBox (NULL, "Fehler beim öffnen des Fensters", "Fehler", MB_OK | MB_ICONINFORMATION); return 0; } /* The class is registered, let's create the program*/ hwnd = CreateWindowEx ( WS_EX_CLIENTEDGE | WS_EX_CONTROLPARENT, /* Extended possibilites for variation */ szClassName, /* Classname */ "Testfenster", /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ 200, /* Windows decides the position */ 100, /* where the window ends up on the screen */ 400, /* The programs width */ 300, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); /* Make the window visible on the screen */ ShowWindow (hwnd, iCmdShow); UpdateWindow (hwnd); /* Run the message loop. It will run until GetMessage() returns 0 */ while (GetMessage (&messages, NULL, 0, 0)) { /* Translate virtual-key messages into character messages */ TranslateMessage(&messages); /* Send message to WindowProcedure */ DispatchMessage(&messages); } /* The program return-value is 0 - The value that PostQuitMessage() gave */ return messages.wParam; };Erkennt hier jemand einen Fehler?
Ich glaub ja es hat was mit der ShowWindow-Funktion zu tun, aber hab damit auch schon alles ausprobiert.Vielen Dank schon mal jetzt!
-
Erezueg doch eine "Windows" Anwendung und keine "Consolen" Anwendung!
Was für eine IDE? Das kannst Du bei den Compiler-Settings einstellen (Subsystem:WINDOWS)
-
Ich benutze den Devcpp.
Aber so eine einstellung hab ich dort noch nicht gefunden.
-
Soll ich Dich ins Compiler-Forum verschieben? Mit WinAPI hat das nix zu tun...
-
Danke, ist nicht mehr notwendig.
Wenn ich ein Projekt öffne, dann geht das jetzt, nur als einzelne cpp-datei nicht.