003
09.04.2004, 13:17 Uhr
RedEagle
|
In der int WINAPI WinMain( HINSTANCE hThisInstance, HINSTANCE, PSTR, int nFunsterStil) Funktion
C++: |
//Hauptfenster HWND hwnd = CreateWindow (szName, "Hauptmenue", WS_SYSMENU | WS_MINIMIZEBOX, 10, 10, 150, 360, NULL, NULL, hThisInstance, NULL);
//2. Fenster HWND hwnd2 = CreateWindow (szName, "Office" , WS_SYSMENU | WS_MINIMIZEBOX, 20, 20, 150, 360, NULL, NULL, hThisInstance, NULL);
|
Meine Nachrichten Prozedur:
C++: |
case WM_COMMAND : switch(LOWORD(wParam)) { case 1 : ShowWindow (hwnd2, nFunsterStil); break;
|
Jetzt kommen ncih fehler über die Variablen-Deklaration: wo, wie und mit welchem type muss ich folgende Variablen Deklarieren:
szName nFunsterStil
Hir mal der komplette code:
C++: |
/* name.c_str() */
#include <windows.h> #include <stdio.h> #include <fstream> #include <string> #include <sstream> using namespace std; ///Globale Variablen stringstream ss;
string schaltfl_01 = "Office", schaltfl_02 = "Bilder", schaltfl_03 = "Brennen", schaltfl_04 = "Editor", schaltfl_05 = "Spiele", schaltfl_06 = "Internet", schaltfl_07 = "Laufwerke", schaltfl_08 = "Musik", schaltfl_09 = "System", schaltfl_10 = "Ordner", schaltfl_11 = "Links", schaltfl_12 = "Tools", schaltfl_13 = "Beenden";
string office[13]; string bilder[13]; string brennen[13]; string editor[13]; string spiele[13]; string internet[13]; string laufwerke[13]; string musik[13]; string system_[13]; string ordner[13]; string links[13]; string tools[13];
///Prototypen LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM); //Deklaration der Windows-Nachrichten-Prozedur
///Funktionen int WINAPI WinMain( HINSTANCE hThisInstance, HINSTANCE, PSTR, int nFunsterStil) {
char szName[] = "Fensterklasse"; HBRUSH MyBrush = CreateSolidBrush(RGB(0,150,255)); //Eigene BG-Color WNDCLASS wc; wc.style = CS_HREDRAW | CS_VREDRAW; //CS = Class Style wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hThisInstance; wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = MyBrush;//(HBRUSH) COLOR_BACKGROUND; wc.lpszMenuName = NULL; wc.lpszClassName = szName; RegisterClass (&wc); HWND hwnd = CreateWindow (szName, "Hauptmenue", WS_SYSMENU | WS_MINIMIZEBOX, 10, 10, 150, 360, NULL, NULL, hThisInstance, NULL);
HWND hwnd2 = CreateWindow (szName, "Office" , WS_SYSMENU | WS_MINIMIZEBOX, 20, 20, 150, 360, NULL, NULL, hThisInstance, NULL); ShowWindow (hwnd, nFunsterStil); UpdateWindow (hwnd); //Nachrichtenschleife MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage (&msg); } return msg.wParam; }
//Windows-Nachrichten-Prozedur LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC hdc; PAINTSTRUCT ps; static HWND hwndButton1, hwndButton2, hwndButton3, hwndButton4, hwndButton5, hwndButton6, hwndButton7, hwndButton8, hwndButton9, hwndButton10, hwndButton11, hwndButton12, hwndButton13; switch(message) { case WM_PAINT : hdc = BeginPaint (hwnd, &ps); SetTextColor(hdc, RGB(25 , 25 , 200)); SetBkColor (hdc, RGB(0 , 150, 255)); TextOut(hdc, 30, 20, "Hauptmenue", 10); //device context, x, y, string, string-Länge EndPaint (hwnd, &ps); return 0; case WM_CREATE : hwndButton1 = CreateWindow("button", schaltfl_01.c_str(), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 19, 50, 110, 20, hwnd, (HMENU)1, (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL); hwndButton2 = CreateWindow("button", schaltfl_02.c_str(), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 19, 70, 110, 20, hwnd, (HMENU)2, (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
hwndButton3 = CreateWindow("button", schaltfl_03.c_str(), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 19, 90, 110, 20, hwnd, (HMENU)3, (HINSTANCE) GetWindowLong (hwnd, GWL_HINSTANCE), NULL);
//usw. bis zum 13. Button
return 0; case WM_COMMAND : switch(LOWORD(wParam)) { case 1 : ShowWindow (hwnd2, nFunsterStil); break; case 13 : PostQuitMessage(0); return 0; } break; case WM_DESTROY : PostQuitMessage(0); return 0; } return DefWindowProc (hwnd, message, wParam, lParam); }
|
Insgesammt Brauche ich 13 neue Fenster, währe nett, wenn ihr mir mal eins einbauen würdet !!Mit erklärung Bitte, das ich den Rest selber machen kann
im vorraus -- MFG RedEagle Dieser Post wurde am 09.04.2004 um 13:22 Uhr von RedEagle editiert. |