void CreateGrphicMenuWin()
{
WNDCLASS wc;
RECT rect;
ZeroMemory(&wc, sizeof(wc));
...
wc.lpfnWndProc = (WNDPROC)MenuWinProc;
...
//RegisterClass(&wc)
//CreateWindow
//ShowWindow
//UpdateWindow
}
BOOL CALLBACK MenuWinProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
LRESULT lResult = 0;
PAINTSTRUCT ps;
switch(msg)
{
...
case WM_PAINT:
{
HDC hDC = BeginPaint(hwnd,&ps);
DrawGraphicMenuBar(hwnd,hDC);
EndPaint (hwnd, &ps);
}
return 0;
...
}
return (DefWindowProc(hwnd, msg, wParam, lParam));
}
void DrawGraphicMenuBar(HWND hwnd, HDC hDC)
{
HDC hMemDC = CreateCompatibleDC(hDC);
HDC hDrawDC = CreateCompatibleDC(hDC);
HBITMAP hBitmap, hOldbmp;
HBITMAP hBgTitle, hPlay, hStop;
HBITMAP hOldBgTitle, hOldPlay, hOldStop;
hBitmap = CreateCompatibleBitmap(hDC, PHONEWIDTH, MENUHEIGHT);
hOldbmp = (HBITMAP)SelectObject(hMemDC, hBitmap);
hBgTitle = LoadBitmap(context->hInst, MAKEINTRESOURCE(IDB_SBGTITLE));
hOldBgTitle = (HBITMAP) SelectObject(hDrawDC, hBgTitle);
BitBlt(hMemDC, 0, 0, PHONEWIDTH, MENUHEIGHT, hDrawDC, 0, 0, SRCCOPY);
SelectObject(hDrawDC, hOldBgTitle);
DeleteObject(hBgTitle);
hPlay = LoadBitmap(context->hInst, MAKEINTRESOURCE(IDB_SPLAY));
hOldPlay = (HBITMAP) SelectObject(hDrawDC, hPlay);
BitBlt(hMemDC, LEFTSPACE, TOPSPACE, PLAYPAUSEWIDTH, ICONHEIGHT, hDrawDC, 0, 0, SRCCOPY);
SelectObject(hDrawDC, hOldPlay);
DeleteObject(hPlay);
hStop = LoadBitmap(context->hInst, MAKEINTRESOURCE(IDB_SSTOP));
hOldStop = (HBITMAP) SelectObject(hDrawDC, hStop);
BitBlt(hMemDC, PLAYPAUSEWIDTH+LEFTSPACE, TOPSPACE, STOPWIDTH, ICONHEIGHT, hDrawDC, 0, 0, SRCCOPY);
SelectObject(hDrawDC, hOldStop);
DeleteObject(hStop);
BitBlt(hDC, 0, 0, PHONEWIDTH, MENUHEIGHT, hMemDC, 0, 0, SRCCOPY);////
SelectObject(hMemDC, hOldbmp);
DeleteObject(hBitmap);
DeleteDC(hMemDC);
DeleteDC(hDrawDC);
}