1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
| #include <windows.h>
// ---------------------------------------------------------------------------
HWND hwnd;
HWND hwndCombo;
HWND hwndEdit;
LRESULT CALLBACK WinProc(HWND, UINT, WPARAM, LPARAM);
// ---------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE Instance, HINSTANCE PrevInstance, LPSTR CmdLine, int CmdShow)
{
MSG msg;
WNDCLASSEX wc;
wc.hInstance = Instance;
wc.lpszClassName = "axile";
wc.lpfnWndProc = WinProc;
wc.style = CS_DBLCLKS;
wc.cbSize = sizeof(WNDCLASSEX);
wc.hIcon = LoadIcon(0, IDI_APPLICATION);
wc.hIconSm = LoadIcon(0, IDI_APPLICATION);
wc.hCursor = LoadCursor(0, IDC_ARROW);
wc.lpszMenuName = 0;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hbrBackground = (HBRUSH) (COLOR_WINDOW);
RegisterClassEx(&wc);
hwnd = CreateWindowEx(0, "axile", "Fenêtre principale", WS_OVERLAPPEDWINDOW,
10, 10, 300, 400, 0, 0, Instance, 0);
ShowWindow(hwnd, CmdShow);
hwndEdit = CreateWindow("EDIT", "Edit", WS_VISIBLE|WS_CHILD,
10, 10, 200, 20, hwnd, (HMENU) 101, Instance, 0);
hwndCombo = CreateWindow("COMBOBOX", "ComboBox", CBS_DROPDOWNLIST|WS_VISIBLE|WS_CHILD|CBS_DISABLENOSCROLL,
10, 40, 200, 300, hwnd, (HMENU) 201, Instance, 0);
DlgDirListComboBox(hwnd, "*.c??", 201, 0, 0);
while (GetMessage(&msg, 0, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (msg.wParam);
}
// ---------------------------------------------------------------------------
LRESULT CALLBACK WinProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_CTLCOLOREDIT:
{
HDC hdc = (HDC)wParam;
COLORREF couleur = RGB(255, 0, 0);
SetTextColor(hdc, couleur);
return ((LRESULT) GetStockObject(WHITE_BRUSH));
}
}
return (DefWindowProc(hwnd, msg, wParam, lParam));
}
// --------------------------------------------------------------------------- |
Partager