Wieso in beiden Fenstern ?
-
Hier der Code :
#include <windows.h> /* Declare Windows procedure */ LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK ChildProc(HWND, UINT, WPARAM, LPARAM); void neues_Fenster(void); /* Make the class name into a global variable */ char szClassName[ ] = "WindowsApp"; char szNeuName[] = "Neue Sammlung erstellen"; int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil) { 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 Hauptfenster */ WNDCLASSEX neucl; //Neue Sammlung Fenster //Haupt Fenster /* The Window structure */ wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS; /* 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)GetStockObject (WHITE_BRUSH); /* Register the window class, and if it fails quit the program */ if (!RegisterClassEx (&wincl)) return 0; //Ende Main Fenster //Start Neue Sammlung Fenster neucl.hInstance = hThisInstance; neucl.lpszClassName = szNeuName; neucl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ neucl.style = CS_DBLCLKS; /* Catch double-clicks */ neucl.cbSize = sizeof (WNDCLASSEX); /* Use default icon and mouse-pointer */ neucl.hIcon = LoadIcon (NULL, IDI_APPLICATION); neucl.hIconSm = LoadIcon (NULL, IDI_APPLICATION); neucl.hCursor = LoadCursor (NULL, IDC_ARROW); neucl.lpszMenuName = NULL; /* No menu */ neucl.cbClsExtra = 0; /* No extra bytes after the window class */ neucl.cbWndExtra = 0; /* structure or the window instance */ /* Use Windows's default color as the background of the window */ neucl.hbrBackground = (HBRUSH)GetStockObject (WHITE_BRUSH); /* Register the window class, and if it fails quit the program */ if (!RegisterClassEx (&neucl)) return 0; /* The class is registered, let's create the program*/ hwnd = CreateWindowEx ( 0, /* Extended possibilites for variation */ szClassName, /* Classname */ "Magic Organisations Software", /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ 800, /* The programs width */ 600, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); /* Make the window visible on the screen */ ShowWindow (hwnd, nFunsterStil); HWND hwnd2 = CreateWindowEx ( 0, /* Extended possibilites for variation */ szNeuName, /* Classname */ "Neue Sammlung Anlegen", /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ 800, /* The programs width */ 600, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); ShowWindow (hwnd2, SW_SHOWNORMAL); UpdateWindow (hwnd2); /* 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; } /* This function is called by the Windows function DispatchMessage() */ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; PAINTSTRUCT ps; static HWND hChild; static RECT rect; static int iColor = RGB(255, 255, 255); switch (message) /* handle the messages */ { case WM_PAINT: { hdc = BeginPaint(hwnd,&ps); TextOut(hdc,75,5,"Willkommen bei der Magic Organisations Software.",48); EndPaint(hwnd, &ps); return 0 ; }break; case WM_KEYDOWN: switch(wParam) { case VK_F1: case VK_F12: MessageBox(NULL,"","Copyright",MB_OK); return 0; } return 0; case WM_DESTROY: PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; default: /* for messages that we don't deal with */ return DefWindowProc (hwnd, message, wParam, lParam); } return 0; }
waren schreibt der "Willkommen bei der Magic Organisations Software" in beide Fenster , die haben doch eigentlich nicht mehr miteinander zu tuhen ? Es müssten doch eigenständige Fenster seien .
-
Beide Fenster verwenden dieselbe WindowProcedure und verhalten sich dementsprechend gleich!
Du müsstest eine zweite WindowProcedure erstellen, und jedem Fenster eine andere zuweisen.
-
jo , hab ich gerade auch rausgefunden ... aber Danke für die Antwort.
-
Ok , kann geschlossen werden ...
-
wieso denn schließen ;)? stell dir ma vor er hat noch ne frage ^^ dann muss er net gleich nen neuen thread aufmachen
cya
-
MagiC Creator schrieb:
wieso denn schließen ;)? stell dir ma vor er hat noch ne frage ^^ dann muss er net gleich nen neuen thread aufmachen
Häh - die Frage stammte doch auch von ihm
-
lol sorry ^^ mann ich sollte echt ma wieda ausschlafen
ma gucken ob ich morgen blau machen darf *gähn*...
cya
-
hmm.. das automatisch einloggn funzt wohl noch net so ganz oda ^^?
cya