www.pudn.com > 嵌入式linux9应用开发祥解.rar > coolbar.c
#include#include #include #include #include #include #include #include #include #define IDC_CTRL1 100 #define IDC_CTRL2 110 #define ToolbarHeight 20 #define IDC_BAR 502 #define IDC_BARCOPY 503 #define IDC_BARCUT 504 #define IDC_BARDEL 505 #define IDC_BARPASTE 506 #define IDC_BAREXE 507 #define IDC_SLEPRO 508 #define NM_BARPIC 6 static HWND hMainWnd = HWND_INVALID; static char * barpic[]= { "res/copy.bmp", "res/cut.bmp", "res/delete.bmp", "res/paste.bmp", "res/exepro.bmp", "res/closefolder.bmp" }; static char * barhint[]= { "Copy", "Cut", "Delete", "Paste", "Execute", "Close" }; static BITMAP bmps [6]; static int ControlTestWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) { static HWND hChildWnd1, hChildWnd2; static DWORD WdHt; static COOLBARITEMINFO pData; int i; switch (message) { case MSG_CREATE: WdHt = MAKELONG (20, ToolbarHeight); hChildWnd1 = CreateWindow ("coolbar", "", WS_CHILD | WS_VISIBLE, IDC_CTRL1, 5, 2, HIWORD(WdHt)*NM_BARPIC+10, LOWORD(WdHt)+2, hWnd, WdHt); for(i=0;i dwStyle = WS_CAPTION | WS_BORDER|WS_VISIBLE; pCreateInfo->dwExStyle = WS_EX_IMECOMPOSE; pCreateInfo->spCaption = "CoolBar control"; pCreateInfo->hMenu = 0; pCreateInfo->hCursor = GetSystemCursor(0); pCreateInfo->hIcon = 0; pCreateInfo->MainWindowProc = ControlTestWinProc; pCreateInfo->lx = 0; pCreateInfo->ty = 0; pCreateInfo->rx = 320; pCreateInfo->by = 240; pCreateInfo->iBkColor = GetWindowElementColor (BKC_CONTROL_DEF); pCreateInfo->dwAddData = 0; pCreateInfo->hHosting = HWND_DESKTOP; } void coolbar_demo (HWND hwnd) { MAINWINCREATE CreateInfo; if (hMainWnd != HWND_INVALID) { ShowWindow (hMainWnd, SW_SHOWNORMAL); return; } InitCreateInfo(&CreateInfo); CreateInfo.hHosting = hwnd; hMainWnd = CreateMainWindow(&CreateInfo); }