#include <commctrl.h>
#pragma comment(lib, "comctl32")
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
PAINTSTRUCT ps;
HDC hdc;
TCHAR szHello[MAX_LOADSTRING];
LoadString(g_hInst, IDS_HELLO, szHello, MAX_LOADSTRING);
// {
static HIMAGELIST IL;
// }
switch (message)
{
// {
case WM_CREATE:
IL=ImageList_LoadImage(g_hInst, "Fruit.bmp",
32, 1, RGB(0,0,255),IMAGE_BITMAP,LR_LOADFROMFILE);
/* IL=ImageList_LoadBitmap(g_hInst, MAKEINTRESOURCE(IDB_FRUIT),
32, 1, RGB(0,0,255));
*/
/* IL=ImageList_LoadImage(g_hInst, MAKEINTRESOURCE(IDB_FRUIT),
32, 1, RGB(0,0,255),IMAGE_BITMAP,0);
*/
return 0;
// }
case WM_DESTROY:
// {
ImageList_Destroy(IL);
// }
PostQuitMessage(0);
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
// TODO: Add any drawing code here...
// {
ImageList_Draw(IL,0,hdc,50,50,ILD_NORMAL);
// }
EndPaint(hWnd, &ps);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam);
}
return 0;
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
MSG msg;
HACCEL hAccelTable;
// Initialize global strings
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_IMAGELIST, szWindowClass, MAX_LOADSTRING);
// {
InitCommonControls();
// }
MyRegisterClass(hInstance);
...
}