53 lines
1.7 KiB
C
53 lines
1.7 KiB
C
// 19 october 2014
|
|
#include "../wininclude_windows.h"
|
|
|
|
// #qo LIBS: user32 kernel32 gdi32 comctl32 uxtheme ole32 oleaut32 oleacc uuid
|
|
|
|
#include "main.h"
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
HWND mainwin;
|
|
MSG msg;
|
|
INITCOMMONCONTROLSEX icc;
|
|
|
|
ZeroMemory(&icc, sizeof (INITCOMMONCONTROLSEX));
|
|
icc.dwSize = sizeof (INITCOMMONCONTROLSEX);
|
|
icc.dwICC = ICC_LISTVIEW_CLASSES;
|
|
if (InitCommonControlsEx(&icc) == 0)
|
|
panic("(test program) error initializing comctl32.dll");
|
|
initTable(NULL, _TrackMouseEvent);
|
|
mainwin = CreateWindowExW(0,
|
|
tableWindowClass, L"Main Window",
|
|
WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL,
|
|
CW_USEDEFAULT, CW_USEDEFAULT,
|
|
400, 400,
|
|
NULL, NULL, GetModuleHandle(NULL), NULL);
|
|
if (mainwin == NULL)
|
|
panic("(test program) error creating Table");
|
|
SendMessageW(mainwin, tableAddColumn, tableColumnText, (LPARAM) L"Column");
|
|
SendMessageW(mainwin, tableAddColumn, tableColumnImage, (LPARAM) L"Column 2");
|
|
SendMessageW(mainwin, tableAddColumn, tableColumnCheckbox, (LPARAM) L"Column 3");
|
|
if (argc > 1) {
|
|
NONCLIENTMETRICSW ncm;
|
|
HFONT font;
|
|
|
|
ZeroMemory(&ncm, sizeof (NONCLIENTMETRICSW));
|
|
ncm.cbSize = sizeof (NONCLIENTMETRICSW);
|
|
if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof (NONCLIENTMETRICSW), &ncm, sizeof (NONCLIENTMETRICSW)) == 0)
|
|
panic("(test program) error getting non-client metrics");
|
|
font = CreateFontIndirectW(&ncm.lfMessageFont);
|
|
if (font == NULL)
|
|
panic("(test program) error creating lfMessageFont HFONT");
|
|
SendMessageW(mainwin, WM_SETFONT, (WPARAM) font, TRUE);
|
|
}
|
|
ShowWindow(mainwin, SW_SHOWDEFAULT);
|
|
if (UpdateWindow(mainwin) == 0)
|
|
panic("(test program) error updating window");
|
|
while (GetMessageW(&msg, NULL, 0, 0) > 0) {
|
|
TranslateMessage(&msg);
|
|
DispatchMessageW(&msg);
|
|
}
|
|
return 0;
|
|
}
|