汗,LNK的错误种类还真不少呢,刚才又来了一个LNK1168

作者在 2006-07-29 10:17:00 发布以下内容

原来是做得那个窗口的关闭按钮不好使,虽然貌似关闭了,看不见了,其实在进程里还有

以下是错误信息和外国某论坛高手给与的解答:

LINK : fatal error LNK1168: cannot open Debug/Player.exe for writing
Error executing link.exe.


//////////////////////////////
'Cos the thread message loop still running.
though , the the Window of the app is invisible.

 

把我的代码也贴上吧,明天早上再更正不能关闭的错误。第一次能执行,关闭了再执行就会出错了。

#include <stdio.h>
#include <windowsx.h>
#include <windows.h>
LRESULT CALLBACK WndShProc
(
 HWND hwnd,
 UINT uMsg,
 WPARAM wParam,
 LPARAM lParam
 );

int WINAPI WinMain(
     HINSTANCE hInstance,
     HINSTANCE hPrevInstance,
     LPSTR lpCmdLine,           //
      int nCmdShow
       )
{
 WNDCLASSEX WndClassSh;
 WndClassSh.cbSize=sizeof(WNDCLASSEX);
 WndClassSh.cbClsExtra=0;
 WndClassSh.cbWndExtra=0;
 WndClassSh.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
 WndClassSh.hCursor=LoadCursor(NULL,IDC_ARROW);
 WndClassSh.hIcon=LoadIcon(NULL,IDI_WINLOGO);
 WndClassSh.hIconSm=LoadIcon(NULL,IDI_WINLOGO);
 WndClassSh.hInstance=hInstance;
 WndClassSh.lpfnWndProc=WndShProc;
 WndClassSh.lpszClassName="I love Girls";
 WndClassSh.lpszMenuName=NULL;
 WndClassSh.style=CS_HREDRAW|CS_VREDRAW;
 RegisterClassEx(&WndClassSh);
 HWND hwnd;
 hwnd=CreateWindowEx(
  NULL,
  "I love Girls",
  "I love Girls window name",
  WS_OVERLAPPEDWINDOW,
  CW_USEDEFAULT,
  CW_USEDEFAULT,
  CW_USEDEFAULT,
  CW_USEDEFAULT,
  NULL,
  NULL,
  hInstance,
  NULL
  );
 ShowWindow(hwnd,nCmdShow);
 UpdateWindow(hwnd);
 MSG msg;
 while(GetMessage(&msg,hwnd,0,0))
 {
  TranslateMessage(&msg);
  DispatchMessage(&msg);
 }
 return 0;
}

 LRESULT CALLBACK WndShProc
  (
   HWND hwnd,
   UINT uMsg,
   WPARAM wParam,
   LPARAM lParam
  )
 {
  HDC hdc;
  PAINTSTRUCT ps;
  switch(uMsg)
  {
  case WM_PAINT:
   {
    hdc=BeginPaint(hwnd,&ps);
    TextOut(hdc,0,0,"我是个花心的人",strlen("我是个花心的人"));
    EndPaint(hwnd,&ps);
    break;
   }
  case WM_CHAR:
   {
    char szChar[20];
    sprintf(szChar,"char is %d",wParam);
    MessageBox(hwnd,szChar,"char is %d",MB_OK);
    break;
   }
  case WM_LBUTTONDOWN:
   {
    MessageBox(hwnd,"mouse click","mouse click",MB_OK);
    HDC hDC;
    hDC=GetDC(hwnd);
    TextOut(hDC,0,50,"I love Girls forever!!",strlen("I love girls forevery!!"));
    ReleaseDC(hwnd,hDC);
    break;
   }
  case WM_CLOSE:
   {
    if(IDYES==MessageBox(hwnd,"really wanna exit?","really wanna exit?",MB_YESNO))
    {
     DestroyWindow(hwnd);
    }
   }
&

VC++开拓 | 阅读 2175 次
文章评论,共0条
游客请输入验证码