求助sdk高手!!!

xiaofeng_cxy 2002-06-12 08:47:13
我用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).

请问各位大侠是何原因???

...全文
34 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
xjl1980_81 2002-06-12
  • 打赏
  • 举报
回复
gz
xiaofeng_cxy 2002-06-12
  • 打赏
  • 举报
回复
哈哈!
找到原因了!原来是wc.hInstance没有赋值!!!
哈哈!!
不好意思,就不给分了!
verybigbug 2002-06-12
  • 打赏
  • 举报
回复
加上:
wc.hInstance = hInstance;

在WndProc中加:
case WM_DESTROY:
case WM_CLOSE:
case WM_QUIT:
PostQuitMessage(0);
return 0;
提示也没问题,程序也没错误,只不过窗口没有创建成功。
alien75 2002-06-12
  • 打赏
  • 举报
回复
我刚才跟了一下,发现createwindow返回的是0,这就是说确实是创建窗口失败,找一找为什么吧。
alien75 2002-06-12
  • 打赏
  • 举报
回复
应该不是楼上所说的,出现那些没找到符号信息并不影响程序的调试。从出错信息“The thread 0x6E8 has exited with code 0 (0x0).”来看应该是进程提前中止了。可能是在创建窗口的时个出了错。
lanzhengpeng2 2002-06-12
  • 打赏
  • 举报
回复
正常提示
xiaofeng_cxy 2002-06-12
  • 打赏
  • 举报
回复
可是现在我的程序没有这样的提示,执行还是看不见啊???
这们大侠能不能不用英文啊?
wistaria 2002-06-12
  • 打赏
  • 举报
回复
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.

16,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧