//用过MFC的朋友都知道RC资源文件的功能。
//
//小弟今天遇到了问题以下代码编译成功。但是我希望执行文件用自定义的ICO图标。
//
//附源码
#include <windows.h>
LRESULT CALLBACK WindowProc(HWND hwnd,UINT msg,WPARAM wparam, LPARAM lparam);
int WINAPI WinMain(HINSTANCE hinstance,
HINSTANCE hprevinstance,LPSTR lpcmdline,int ncmdshow)
{
WNDCLASSEX winclass = {0};
HWND hwnd;
MSG msg;
winclass.cbSize = sizeof(WNDCLASSEX);
winclass.style = CS_HREDRAW | CS_VREDRAW;
winclass.lpfnWndProc = WindowProc;
winclass.hInstance = hinstance;
winclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
winclass.lpszClassName = "WinInit";
winclass.hCursor=LoadCursor(NULL,IDC_CROSS);
winclass.hIcon = LoadIcon(NULL,MAKEINTRESOURCE(32651));
RegisterClassEx(&winclass);
hwnd = CreateWindowEx(NULL, "WinInit", "First Window",
WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0,
200, 200, NULL, NULL, hinstance, NULL);
ShowWindow (hwnd,SW_SHOWMAXIMIZED);
UpdateWindow (hwnd);
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WindowProc(HWND hwnd,UINT msg,WPARAM wparam, LPARAM lparam)
{
switch (msg) /* handle the messages */
{
case WM_CLOSE:
DestroyWindow( hwnd );
return 0;
case WM_DESTROY:
PostQuitMessage (0);
return 0;
break;
default: /* for messages that we don't deal with */
return DefWindowProc(hwnd,msg,wparam,lparam);
}
return 0;
}
[课程]FART 脱壳王!加量不加价!FART作者讲授!