-------------------Configuration: 03 - Win32 Debug--------------------
Linking...
LINK : fatal error LNK1168: cannot open Debug/03.exe for writing
Error executing link.exe.03.exe - 1 error(s), 0 warning(s)以是是程序的源代码(winAPI);
#include <windows.h>
#include <stdio.h>LRESULT CALLBACK lilight(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // pointer to command line
int nCmdShow // show state of window
){
WNDCLASS win;
win.cbClsExtra=0;
win.cbWndExtra=0;
win.hbrBackground=(HBRUSH)GetStockObject(DKGRAY_BRUSH);
win.hCursor=LoadCursor(NULL,IDC_APPSTARTING);
win.hIcon=LoadIcon(NULL,IDI_EXCLAMATION);
win.hInstance=hInstance;
win.lpfnWndProc=lilight;
win.lpszClassName="bright";
win.lpszMenuName=NULL;
win.style=CS_HREDRAW | CS_VREDRAW;
RegisterClass(&win);
HWND hwnd;
hwnd=CreateWindow("Weixin2003","输入法",WS_OVERLAPPEDWINDOW,
0,0,600,400,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd); MSG msg;
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;}
LRESULT CALLBACK lilight(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
){
switch(uMsg)
{
case WM_CHAR:
char szChar[20];
sprintf(szChar,"char is %d",wParam);
MessageBox(hwnd,szChar,"weixin",0);
break;
case WM_LBUTTONDOWN:
MessageBox(hwnd,"www.baidu.com","www.sian.com.cn",0);
HDC hdc;
hdc=GetDC(hwnd);
TextOut(hdc,0,50,"计算机",strlen("计算机"));
ReleaseDC(hwnd,hdc);
break;
case WM_PAINT:
HDC hDC;
PAINTSTRUCT ps;
hDC=BeginPaint(hwnd,&ps);
TextOut(hDC,0,0,"学校",strlen("学校"));
EndPaint(hwnd,&ps);
break;
case WM_CLOSE:
if(IDYES==MessageBox(hwnd,"你真的要退出吗?","lilight",MB_YESNO))
{
DestroyWindow(hwnd);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}
Linking...
LINK : fatal error LNK1168: cannot open Debug/03.exe for writing
Error executing link.exe.03.exe - 1 error(s), 0 warning(s)以是是程序的源代码(winAPI);
#include <windows.h>
#include <stdio.h>LRESULT CALLBACK lilight(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
int WINAPI WinMain(
HINSTANCE hInstance, // handle to current instance
HINSTANCE hPrevInstance, // handle to previous instance
LPSTR lpCmdLine, // pointer to command line
int nCmdShow // show state of window
){
WNDCLASS win;
win.cbClsExtra=0;
win.cbWndExtra=0;
win.hbrBackground=(HBRUSH)GetStockObject(DKGRAY_BRUSH);
win.hCursor=LoadCursor(NULL,IDC_APPSTARTING);
win.hIcon=LoadIcon(NULL,IDI_EXCLAMATION);
win.hInstance=hInstance;
win.lpfnWndProc=lilight;
win.lpszClassName="bright";
win.lpszMenuName=NULL;
win.style=CS_HREDRAW | CS_VREDRAW;
RegisterClass(&win);
HWND hwnd;
hwnd=CreateWindow("Weixin2003","输入法",WS_OVERLAPPEDWINDOW,
0,0,600,400,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd); MSG msg;
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;}
LRESULT CALLBACK lilight(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
){
switch(uMsg)
{
case WM_CHAR:
char szChar[20];
sprintf(szChar,"char is %d",wParam);
MessageBox(hwnd,szChar,"weixin",0);
break;
case WM_LBUTTONDOWN:
MessageBox(hwnd,"www.baidu.com","www.sian.com.cn",0);
HDC hdc;
hdc=GetDC(hwnd);
TextOut(hdc,0,50,"计算机",strlen("计算机"));
ReleaseDC(hwnd,hdc);
break;
case WM_PAINT:
HDC hDC;
PAINTSTRUCT ps;
hDC=BeginPaint(hwnd,&ps);
TextOut(hDC,0,0,"学校",strlen("学校"));
EndPaint(hwnd,&ps);
break;
case WM_CLOSE:
if(IDYES==MessageBox(hwnd,"你真的要退出吗?","lilight",MB_YESNO))
{
DestroyWindow(hwnd);
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}
解决方案 »
- 如何删除菜单条?
- CArray GetSize 或者 GetCount 返回值为 -1
- socket 实现了连接代理服务器成功后,代理服务器与目标服务器之间还要不要进行数据交换处理?
- 有关如何获取word文档的文件名的问题
- 想前辈请教一个自绘的问题
- CString能够分配的最大内存空间是多少?64k还是640k?!
- 求教高手!用CBrush画圆形或者矩形并且要填充内部区域,怎样擦除以前留下的路径??
- 100分求解!怎样用VC6.0访问ACCESS数据库!由于问题简单,分全给第一个解决问题的高手
- 关于 Sokect通讯问题
- 请问在哪里可免费下载VC++ 我是初学者
- 我在一个DOC类里声明一个静态类对象怎么不可以?
- 关于钩子!
-------------------Configuration: 03 - Win32 Debug--------------------
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/03.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.03.exe - 2 error(s), 0 warning(s)
不过还有一个问题:
hwnd=CreateWindow("bright" //这里的应该是bright
,TEXT("输入法"),WS_OVERLAPPEDWINDOW,
0,0,600,400,NULL,NULL,hInstance,NULL);
类名应该和win的win.lpszClassName="bright"一样
它的object/library 是以下内容
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
没有LIBCD.lib
另外project options 中的/subsystem应为windows
改为/subsystem:windows