Код:
int WINAPI WinMain (HINSTANCE hInstance,HINSTANCE hPrevInstance,
LPSTR lpCmdLine,int nShowCmd)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
MSG Msg;
// настройка темы
tema.sz_window.w=500;
tema.sz_window.h=300;
tema.cl_window.fon=0x484848;
tema.cl_window.border=0x000000;
tema.cl_top.fon=0x4a4a4a;
tema.cl_top.border=0x4e4e4e;
tema.top_height=13+14;
tema.cl_topfont=0xffffff;
tema.cl_button.fon=tema.cl_button.border=0x484848;
tema.cl_buttonA.fon=0x5b5b5b;
tema.cl_buttonA.border=0x737373;
tema.cl_buttonP.fon=0x6d6d6d;
tema.cl_buttonP.border=0xa0a0a0;
tema.cl_buttonfont=0xffffff;
tema.buttonfont=(HFONT)GetStockObject(ANSI_VAR_FONT);
tema.cl_splitline=0x242424;
CreateMainWindow(hInstance,nShowCmd);
while(GetMessage(&Msg,NULL,0,0))
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return (int)Msg.wParam;
}
...
при обработке
//----------------------------------------------
case WM_CREATE:
close=CreateWindow(_TEXT("button"),NULL,WS_VISIBLE|WS_CHILD|BS_OWNERDRAW,
tema.sz_window.w-15-7,7,
15,13,
hWnd,(HMENU)BT_CLOSE,NULL,NULL);
oldfunc=SetWindowLong(close, GWL_WNDPROC, (LONG)&GarikBtnProc);
mini=CreateWindow(_TEXT("button"),NULL,WS_VISIBLE|WS_CHILD|BS_OWNERDRAW,
tema.sz_window.w-38,7,
15,13,
hWnd,(HMENU)BT_MINI,NULL,NULL);
SetWindowLong(mini, GWL_WNDPROC, (LONG)&GarikBtnProc);
bit_openfile=CreateWindow(_TEXT("button"),_TEXT("+ История"),WS_VISIBLE|WS_CHILD|BS_OWNERDRAW,
6,33,
70,20,
hWnd,(HMENU)IDB_OPF,NULL,NULL);
SetWindowLong(bit_openfile, GWL_WNDPROC, (LONG)&GarikBtnProc);
bit_opendir=CreateWindow(_TEXT("button"),_TEXT("+ Папка"),WS_VISIBLE|WS_CHILD|BS_OWNERDRAW,
78,33,
60,20,
hWnd,(HMENU)IDB_OPD,NULL,NULL);
SetWindowLong(bit_opendir, GWL_WNDPROC, (LONG)&GarikBtnProc);
..........
// в общем сабклассинг
//----------------------------------------------
case WM_DRAWITEM:
LPDRAWITEMSTRUCT bs;
bs=(LPDRAWITEMSTRUCT)lParam;
// если рисуем кнопачку
if(bs->CtlType==ODT_BUTTON)
{
DrawButton(wParam,bs);
// закончили кнопочку рисовать
}
break;
//----------------------------------------------
//----------------------------------------------
case WM_PAINT:
hDC=BeginPaint(hWnd,&PaintStruct);
//рисуем рамку окна
DrawPryam(hDC,tema.cl_window,0,0,tema.sz_window.w,tema.sz_window.h);
//рисуем заголовок
DrawTop(hDC,NULL);
//типа меню
RAMKA color;
color.fon=0x494949;
color.border=0x5d5d5d;
int height,y2,y1,x1,x2;
height=30;
x1=1;
x2=tema.sz_window.w-1;
y1=tema.top_height+1;
y2=tema.top_height+height;
DrawPryam(hDC,color,x1,y1,x2,y2);y1=y2;
DrawLine(hDC,tema.cl_splitline,x1,y1,x2,y2,1);y1=y2+1;
height=206;
y2+=height+1;
color.fon=color.border;
DrawPryam(hDC,color,x1,y1,x2,y2);y1=y2;
DrawLine(hDC,tema.cl_splitline,x1,y1,x2,y2,1);
EndPaint(hWnd,&PaintStruct);
return 0;
//----------------------------------------------