我用vc写一个sdk的小程序,源码如下
#include <windows.h>
#include "mouse.h"int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,
 PSTR lpCmdLine,int nShowCmd)
{
MSG msg; if(!InitApplication(hInstance))
return FALSE; if(!InitInstance(hInstance,nShowCmd))
return FALSE;
while(GetMessage(&msg,hwnd,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}BOOL InitApplication(HINSTANCE hInstance)
{
WNDCLASS wc;

wc.style=CS_HREDRAW|CS_VREDRAW;
wc.lpfnWndProc=WndProc;
wc.cbClsExtra=0;
wc.cbWndExtra=0;
wc.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wc.hCursor=LoadCursor(NULL,IDC_CROSS);
wc.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);
wc.lpszMenuName=NULL;
wc.lpszClassName=szAppName;

return RegisterClass(&wc);
}BOOL InitInstance(HINSTANCE hInstance,int nShowCmd)
{
hwnd=CreateWindow(szAppName,szAppName,
  WS_OVERLAPPEDWINDOW,
  CW_USEDEFAULT,CW_USEDEFAULT,
  CW_USEDEFAULT,CW_USEDEFAULT,
  NULL,NULL,hInstance,NULL);
if(!hwnd)
return FALSE;
ShowWindow(hwnd,nShowCmd);
UpdateWindow(hwnd);
return TRUE;
}LRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
{
int x,y;
HDC hdc; switch(message)
{
case WM_LBUTTONDOWN:
hdc=GetDC(hwnd);
x=LOWORD(lParam);
y=HIWORD(lParam);
TextOut(hdc,x,y,TEXT("您点击了鼠标左键"),lstrlen(TEXT("您点击了鼠左键")));
ReleaseDC(hwnd,hdc);
break; case WM_DESTROY:
PostQuitMessage(0);
break;
}
return DefWindowProc(hwnd,message,wParam,lParam);
}PSTR IntToStr(int i)
{
TCHAR szBuffer[20];
wsprintf(szBuffer,TEXT("%10d"),i);
return szBuffer;
}头文件mouse.h如下
TCHAR szAppName[]=TEXT("Mouse");
HWND hwnd;PSTR IntToStr(int);LRESULT CALLBACK WndProc(HWND,UINT,WPARAM,LPARAM);BOOL InitApplication(HINSTANCE);BOOL InitInstance(HINSTANCE,int);编译、连接都没报错,但执行就会出现以下提示:
Loaded 'D:\WINNT\System32\ntdll.dll', no matching symbolic information found.
Loaded 'D:\WINNT\system32\user32.dll', no matching symbolic information found.
Loaded 'D:\WINNT\system32\kernel32.dll', no matching symbolic information found.
Loaded 'D:\WINNT\system32\gdi32.dll', no matching symbolic information found.
Loaded 'D:\WINNT\system32\imm32.dll', no matching symbolic information found.
Loaded 'D:\WINNT\system32\advapi32.dll', no matching symbolic information found.
Loaded 'D:\WINNT\system32\rpcrt4.dll', no matching symbolic information found.
The thread 0x6E8 has exited with code 0 (0x0).
The program 'D:\xiaofeng源码\VC练习\mouse\Debug\mouse.exe' has exited with code 0 (0x0).请问各位大侠是何原因???

解决方案 »

  1.   

    This happens even though you installed the .dbg files from the Vc98\Debug directory of the Visual Studio 6.0 CD-ROM. 
      The error message is due to the symbol (.dbg) files for the indicated DLLs not being installed or being out-of-date with respect to the DLLs. Installing a version of Internet Explorer may have updated the DLLs with later versions. You can ignore this error message because you should be able to debug your application successfully without these files anyway.
      

  2.   

    应该不是楼上所说的,出现那些没找到符号信息并不影响程序的调试。从出错信息“The thread 0x6E8 has exited with code 0 (0x0).”来看应该是进程提前中止了。可能是在创建窗口的时个出了错。
      

  3.   

    我刚才跟了一下,发现createwindow返回的是0,这就是说确实是创建窗口失败,找一找为什么吧。
      

  4.   

    加上:
    wc.hInstance = hInstance;在WndProc中加:
    case WM_DESTROY:
    case WM_CLOSE:
    case WM_QUIT:
    PostQuitMessage(0);
    return 0;
    提示也没问题,程序也没错误,只不过窗口没有创建成功。
      

  5.   

    哈哈!
    找到原因了!原来是wc.hInstance没有赋值!!!
    哈哈!!
    不好意思,就不给分了!