Dawidsoni Temat założony przez niniejszego użytkownika |
» 2011-03-29 19:50:15 Sorry, ale pisałem na komórce i nie miałem kodu.
Main.cpp:
#include<windows.h> #include<commctrl.h> #define Ikona 123
HWND hButton, hButton2, hButton3, hButton4, hButton5, hWnd; CHAR szClassName[] = "OknoRodzica"; HINSTANCE * hInst; int x = 250;
LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM ); INT WINAPI WinMain( HINSTANCE hInstance, HINSTANCE, LPSTR lStart, INT nShow ) { hInst = & hInstance; WNDCLASSEX wc; wc.hInstance = * hInst; wc.lpszClassName = szClassName; wc.lpfnWndProc = WndProc; wc.style = 0; wc.cbSize = sizeof( WNDCLASSEX ); wc.hIcon = LoadIcon( 0, IDI_ERROR ); wc.hIconSm = LoadIcon( 0, IDI_ERROR ); wc.hCursor = LoadCursor( 0, IDC_ARROW ); wc.lpszMenuName = 0; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hbrBackground =( HBRUSH ) COLOR_BACKGROUND; if( !RegisterClassEx( & wc ) ) return 0; hWnd = CreateWindowEx( 0, szClassName, "Tworzenie buttona", WS_OVERLAPPEDWINDOW | WS_VSCROLL, 0, 0, 1280, 640, 0, 0, * hInst, 0 ); ShowWindow( hWnd, nShow ); MSG msgs; while( GetMessage( & msgs, 0, 0, 0 ) ) { TranslateMessage( & msgs ); DispatchMessage( & msgs ); } return msgs.wParam; }
LRESULT CALLBACK WndProc( HWND hwnd, UINT msg, WPARAM wpar, LPARAM lpar ) { switch( msg ) { case WM_CREATE: hButton = CreateWindowEx( 0, WC_BUTTON, "Przycisk", WS_CHILD | WS_VISIBLE, 30, 30, 100, 100, hwnd,( HMENU ) 1, * hInst, 0 ); hButton2 = CreateWindowEx( 0, WC_BUTTON, "Tworzenie przycisku", WS_CHILD | WS_VISIBLE, 150, 150, 200, 100, hwnd,( HMENU ) 2, * hInst, 0 ); hButton4 = CreateWindowEx( 0, WC_EDIT, "Tworzenie pola tekstowego", WS_CHILD | WS_VISIBLE | ES_MULTILINE | WS_BORDER | ES_AUTOVSCROLL, 1000, 150, 200, 100, hwnd,( HMENU ) 2, * hInst, 0 ); hButton5 = CreateWindowEx( 0, szClassName, "Tworzenie buttona", WS_OVERLAPPEDWINDOW, 0, 0, 300, 640, 0, 0, * hInst, 0 ); break; case WM_COMMAND: if( wpar == 1 ) MessageBox( hwnd, "Przycisk wcisniety", "Komunikat", MB_OK ); if( wpar == 2 ) { int i; i = MessageBox( hwnd, "Chcesz nowy przycisk?", "Komunikat", MB_YESNO | MB_ICONQUESTION ); if( i == 6 ) { hButton3 = CreateWindowEx( 0, WC_BUTTON, "Przycisk", WS_CHILD | WS_VISIBLE, x, x, 100, 100, hwnd,( HMENU ) 1, * hInst, 0 ); x += 100; } } break; case WM_DESTROY: DestroyWindow( hButton ); DestroyWindow( hButton2 ); PostQuitMessage( 0 ); break; default: return DefWindowProc( hwnd, msg, wpar, lpar ); } return 0; }
Kod zasoby.rc:
Błąd:
||invalid option -- J|
||supported targets: pe-i386 pei-i386 elf32-i386 elf32-little elf32-big srec symbolsrec tekhex binary ihex|
||=== Build finished: 2 errors, 0 warnings ===|
|