前辈们好
我用vc++2008 api编写一个windows窗口程序 不是MFC等
想导入一个自己资源 做为图标
我是这样的坐的 添加 资源 ICON 导入 导入成功
然后VC++ 自动生成了 resource.h 和 。RC文件结果出现这样的错误
错误 1 fatal error C1083: 无法打开包括文件:“resource.h”: No such file or directory //麻烦前辈们看下那里错了
//------------------全部的简单.cPP -------------
#include <windows.h>
#include <resource.h>LRESULT CALLBACK WindowProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
WNDCLASSEX WindowClass;
static LPCTSTR szAppName = L"enwico";
HWND hWnd;
MSG msg; WindowClass.cbSize = sizeof(WNDCLASSEX);
WindowClass.style = CS_HREDRAW | CS_VREDRAW;
WindowClass.lpfnWndProc = WindowProc;
WindowClass.cbClsExtra = 0;
WindowClass.cbWndExtra = 0;
WindowClass.hInstance = hInstance;
WindowClass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
WindowClass.hCursor = LoadCursor(0, IDC_ARROW);
WindowClass.hbrBackground = static_cast<HBRUSH>(GetStockObject(GRAY_BRUSH));
WindowClass.lpszMenuName = 0;
WindowClass.lpszClassName = szAppName;
WindowClass.hIconSm = 0; RegisterClassEx(&WindowClass); hWnd = CreateWindow(
szAppName,
L"enwico",
WS_OVERLAPPEDWINDOW,
0,
0,
800,
600,
NULL,
NULL,
hInstance,
NULL
);
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
while(GetMessage(&msg, 0, 0, 0) == TRUE)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return static_cast<int>(msg.wParam);
}
LRESULT CALLBACK WindowProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
HDC hDC;
PAINTSTRUCT PaintSt;
RECT aRect; switch(uMsg)
{
case WM_RBUTTONUP:
MessageBox(hwnd,L"按下右键抬起",L"enwico",0);
return 0; case WM_LBUTTONUP:
MessageBox(hwnd,L"按下左键抬起",L"enwico",0);
return 0; case WM_PAINT:
hDC = BeginPaint(hwnd, &PaintSt);
GetClientRect(hwnd, &aRect);
SetBkMode(hDC, TRANSPARENT);
DrawText(
hDC,
L"enwico",
-1,
&aRect,
DT_SINGLELINE|
DT_CENTER | DT_VCENTER);
EndPaint(hwnd, &PaintSt);
return 0; case WM_CLOSE:
if(IDYES==MessageBox(hwnd,L"真的要退出吗?",L"enwico",MB_YESNO))
{
DestroyWindow(hwnd);
}
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
}
我用vc++2008 api编写一个windows窗口程序 不是MFC等
想导入一个自己资源 做为图标
我是这样的坐的 添加 资源 ICON 导入 导入成功
然后VC++ 自动生成了 resource.h 和 。RC文件结果出现这样的错误
错误 1 fatal error C1083: 无法打开包括文件:“resource.h”: No such file or directory //麻烦前辈们看下那里错了
//------------------全部的简单.cPP -------------
#include <windows.h>
#include <resource.h>LRESULT CALLBACK WindowProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow
)
{
WNDCLASSEX WindowClass;
static LPCTSTR szAppName = L"enwico";
HWND hWnd;
MSG msg; WindowClass.cbSize = sizeof(WNDCLASSEX);
WindowClass.style = CS_HREDRAW | CS_VREDRAW;
WindowClass.lpfnWndProc = WindowProc;
WindowClass.cbClsExtra = 0;
WindowClass.cbWndExtra = 0;
WindowClass.hInstance = hInstance;
WindowClass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1));
WindowClass.hCursor = LoadCursor(0, IDC_ARROW);
WindowClass.hbrBackground = static_cast<HBRUSH>(GetStockObject(GRAY_BRUSH));
WindowClass.lpszMenuName = 0;
WindowClass.lpszClassName = szAppName;
WindowClass.hIconSm = 0; RegisterClassEx(&WindowClass); hWnd = CreateWindow(
szAppName,
L"enwico",
WS_OVERLAPPEDWINDOW,
0,
0,
800,
600,
NULL,
NULL,
hInstance,
NULL
);
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
while(GetMessage(&msg, 0, 0, 0) == TRUE)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return static_cast<int>(msg.wParam);
}
LRESULT CALLBACK WindowProc(
HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
HDC hDC;
PAINTSTRUCT PaintSt;
RECT aRect; switch(uMsg)
{
case WM_RBUTTONUP:
MessageBox(hwnd,L"按下右键抬起",L"enwico",0);
return 0; case WM_LBUTTONUP:
MessageBox(hwnd,L"按下左键抬起",L"enwico",0);
return 0; case WM_PAINT:
hDC = BeginPaint(hwnd, &PaintSt);
GetClientRect(hwnd, &aRect);
SetBkMode(hDC, TRANSPARENT);
DrawText(
hDC,
L"enwico",
-1,
&aRect,
DT_SINGLELINE|
DT_CENTER | DT_VCENTER);
EndPaint(hwnd, &PaintSt);
return 0; case WM_CLOSE:
if(IDYES==MessageBox(hwnd,L"真的要退出吗?",L"enwico",MB_YESNO))
{
DestroyWindow(hwnd);
}
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
}
解决方案 »
- GetDlgItemIn为什么在视图类中获取不到值?
- 一个字符串的拆分,用VC可以这样写吗?
- 我想读取一个应用程序某个界面的值 应该怎么做啊?
- 在线等待,很急的问题,也很初级的问题---搜索条
- 我从弹出菜单或者其他界面上,安装钩子都能够成功,为什么从UDP接收到消息的时候安装就不成功呢
- 请问如果一个 做成了 .lib 的静态库怎么调试阿?
- 求解在WIN2003 或者IE6SP1下,OnBeforeNavigate2 失效问题
- ScrollWindow
- 由于本人总是懒得看书,有问题喜欢问各位大虾,大家给我面子哟
- ǎ。。?????————怎么样改变EDIT控件的字体或颜色??用SDK 急
- Win7下安装VS2005之后用不了Visual Assist X?
- 我支持的球队赢了,散300分祝贺!~
这个文件在工程目录下吗
应该是
#include "resource.h"
#include "resource.h"zhoujianhei大哥 能告告诉我#include "resource.h" 与 #include <resource.h>
有什么区别吗?
“”是在当前路径下查找
<>是在系统路径下查找