#include <windows.h> #include <gl/gl.h> #define ID_COMBO 1 // combobox id si #define ID_EDITBOX1 2 // editbox id si #define ID_LISTBOX 3 // listbox id si #define ID_STATIC1 4 // birinci label id si #define ID_STATIC2 5 //ikinci label id si #define ID_STATIC3 6 // ucuncu label id si #define ID_GROUPBOX1 7 // groupbox id si LRESULT CALLBACK WndProc (HWND hWnd, UINT message,WPARAM wParam, LPARAM lParam); int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iCmdShow) { WNDCLASS wc; HWND hWnd,combo,EditBox1,listbox1,label1,label2,label3,groupbox1; // bileşenler tanımlanıyor HDC hDC; HGLRC hRC; MSG msg; BOOL bQuit = FALSE; float theta = 0.0f; wc.style = CS_OWNDC; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon (NULL, IDI_APPLICATION); wc.hCursor = LoadCursor (NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH) GetStockObject (GRAY_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName ="OpenGLTurk"; RegisterClass (&wc); hWnd = CreateWindow ("OpenGLTurk","Yasin Demirci",WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE | WS_OVERLAPPEDWINDOW ,30, 30, 500,200,NULL, NULL, hInstance, NULL); groupbox1= CreateWindow( "BUTTON","OBJE",WS_VISIBLE | WS_CHILD | BS_GROUPBOX,5,15,400,95,hWnd,(HMENU)ID_GROUPBOX1,hInstance,NULL); label1=CreateWindow( "static","editbox",WS_VISIBLE | WS_CHILD ,10,40,80,18,hWnd,(HMENU)ID_STATIC1,hInstance,NULL); label2=CreateWindow( "static","Combobox",WS_VISIBLE | WS_CHILD ,120,40,80,18,hWnd,(HMENU)ID_STATIC2,hInstance,NULL); label3=CreateWindow( "static","Listbox",WS_VISIBLE | WS_CHILD ,240,40,80,18,hWnd,(HMENU)ID_STATIC3,hInstance,NULL); // editbox oluşturuluyor----------------------------------------------------------------------------------------------------------------------------- EditBox1 = CreateWindow ("edit",NULL,WS_CHILD | WS_VISIBLE |ES_LEFT | ES_AUTOHSCROLL |ES_AUTOVSCROLL | WS_BORDER ,10,70,100,20, hWnd, (HMENU) ID_EDITBOX1, hInstance, NULL) ; // editbox a yazdırma SetWindowText(EditBox1,"deneme"); //edit box ----------------------------------------------------------------------------------------------------------------------------------------- //combo box oluşturuluyor ---------------------------------------------------------------------------------------------------------------------------- combo=CreateWindow( "COMBOBOX", "Combo1", WS_VISIBLE | WS_CHILD | CBS_DROPDOWN|WS_TABSTOP, 120, 70, 81, 210, hWnd, (HMENU) ID_COMBO, NULL, NULL); // combo box a veriler yukleniyor char *combotext[]={"bir","iki","uc"}; SendMessage(combo, CB_ADDSTRING, 0, (LPARAM)combotext[0]); SendMessage(combo, CB_ADDSTRING, 0, (LPARAM)combotext[1]); SendMessage(combo, CB_ADDSTRING, 0, (LPARAM)combotext[2]); SendMessage(combo, CB_SETCURSEL, 0, 0); //combo box ------------------------------------------------------------------------------------------------------------------------------------------ //listbox box ------------------------------------------------------------------------------------------------------------------------------------------ listbox1=CreateWindow( "LISTBOX", "listbox",WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_AUTOVSCROLL, 240, 70, 150, 40, hWnd, (HMENU)ID_LISTBOX, NULL, NULL); // listbox a veri yukleniyor char *listboxtext[]={"Kırmızı","mavi","yeşil","siyah"}; SendMessage(listbox1, LB_ADDSTRING, 0, (LPARAM)listboxtext[0]); SendMessage(listbox1, LB_ADDSTRING, 0, (LPARAM)listboxtext[1]); SendMessage(listbox1, LB_ADDSTRING, 0, (LPARAM)listboxtext[2]); SendMessage(listbox1, LB_ADDSTRING, 0, (LPARAM)listboxtext[3]); //listbox box ------------------------------------------------------------------------------------------------------------------------------------------ while (!bQuit) { if (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) { /* mesaj dağıtma*/ if (msg.message == WM_QUIT) { bQuit = TRUE; } else { TranslateMessage (&msg); DispatchMessage (&msg); } } else { } } DestroyWindow (hWnd); return msg.wParam; } LRESULT CALLBACK WndProc (HWND hWnd, UINT message,WPARAM wParam, LPARAM lParam) { switch (message) { case WM_CREATE: return 0; case WM_CLOSE: PostQuitMessage (0); return 0; case WM_DESTROY: return 0; case WM_KEYDOWN: switch (wParam) { case VK_ESCAPE: PostQuitMessage(0); return 0; } return 0; default: return DefWindowProc (hWnd, message, wParam, lParam); } }
11 Nisan 2014 Cuma
Winapi (Groupbox,label,editbox,combobox,listbox)
Kaydol:
Kayıt Yorumları (Atom)
Hiç yorum yok:
Yorum Gönder