程序代码如下:#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
long WINAPI WndProc(HWND hWnd,UINT iMessage,UINT wParam,LONG lParam);
BOOL InitWindowsClass(HINSTANCE hInstance);
BOOL InitWindows(HINSTANCE hInstance,int nCmdShow);
HWND hWndMain;//主函数
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,
int nCmdShow)
{
MSG Message;
if(!InitWindowsClass(hInstance))
return FALSE;
if(!InitWindows(hInstance,nCmdShow))
return FALSE;
while(GetMessage(&Message,0,0,0))
{
TranslateMessage(&Message);
DispatchMessage(&Message);
}
return Message.wParam;
}
//消息处理函数
long WINAPI WndProc(HWND hWnd,UINT Message,UINT wParam,LONG lParam)
{
static long nXChar,nCaps,nYChar;
HDC hDC;
short x;
TEXTMETRIC tm;
short LnCount=6;
PAINTSTRUCT PtStr;
static char *textbuf[]=
{
"This is the first line",
"This is the second line",
"This is the third line",
"This is the fourth line",
"This is the fifth line",
"This is the sixth line",
};
switch(Message) //处理消息
{
case WM_CREATE: //处理窗口创建消息
hDC=GetDC(hWnd);
GetTextMetrics(hDC,&tm);
nXChar=tm.tmAveCharWidth;
nYChar=tm.tmHeight+tm.tmExternalLeading;
nCaps=(tm.tmPitchAndFamily&1? 3:2)*nXChar/2;
ReleaseDC(hWnd,hDC);
return 0;
case WM_PAINT:
hDC=BeginPaint(hWnd,&PtStr);
for(x=0;x<=LnCount;x=x+1)
{
TextOut(hDC,nXChar,nYChar*(1+x),
textbuf[x],lstrlen(textbuf[x]));
}
EndPaint(hWnd,&PtStr);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return(DefWindowProc(hWnd,Message,wParam,lParam));
}
}BOOL InitWindows(HINSTANCE hInstance, int nCmdShow) //初始化窗口
{
HWND hWnd;
hWnd=CreateWindow("WinTex", //生成窗口
"文本显示示例程序",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
0,
CW_USEDEFAULT,
0,
NULL,
NULL,
hInstance,
NULL);
if(!hWnd)
return FALSE;
hWndMain=hWnd;
ShowWindow(hWnd,nCmdShow); //显示窗口
UpdateWindow(hWnd);
return TRUE;
}BOOL InitWindowsClass(HINSTANCE hInstance)
{
WNDCLASS WndClass;
WndClass.cbClsExtra=0;
WndClass.cbWndExtra=0;
WndClass.hbrBackground=(HBRUSH)(GetStockObject(WHITE_BRUSH));
WndClass.hCursor=LoadCursor(NULL,IDC_ARROW);
WndClass.hIcon=LoadIcon(NULL,"END");
WndClass.hInstance=hInstance;
WndClass.lpfnWndProc=WndProc;
WndClass.lpszClassName="WinText";
WndClass.lpszMenuName=NULL;
WndClass.style=CS_HREDRAW|CS_VREDRAW;
return RegisterClass(&WndClass);
}
编译的时候全部通过了
,但是执行的时候就退出了
错误代码如下,请问一下是什么问题呢?出错代码:Loaded 'C:\WINDOWS\SYSTEM\ADVAPI32.DLL', no matching symbolic information found.
Loaded 'C:\WINDOWS\SYSTEM\GDI32.DLL', no matching symbolic information found.
Loaded 'C:\WINDOWS\SYSTEM\USER32.DLL', no matching symbolic information found.
Loaded 'C:\WINDOWS\SYSTEM\KERNEL32.DLL', no matching symbolic information found.
The thread 0xFFF9C27D has exited with code 0 (0x0).
The program 'D:\练习的例子\文本显示示例程序\Debug\文本显示示例程序.exe' has exited with code 0 (0x0).谢谢先。
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
long WINAPI WndProc(HWND hWnd,UINT iMessage,UINT wParam,LONG lParam);
BOOL InitWindowsClass(HINSTANCE hInstance);
BOOL InitWindows(HINSTANCE hInstance,int nCmdShow);
HWND hWndMain;//主函数
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,
int nCmdShow)
{
MSG Message;
if(!InitWindowsClass(hInstance))
return FALSE;
if(!InitWindows(hInstance,nCmdShow))
return FALSE;
while(GetMessage(&Message,0,0,0))
{
TranslateMessage(&Message);
DispatchMessage(&Message);
}
return Message.wParam;
}
//消息处理函数
long WINAPI WndProc(HWND hWnd,UINT Message,UINT wParam,LONG lParam)
{
static long nXChar,nCaps,nYChar;
HDC hDC;
short x;
TEXTMETRIC tm;
short LnCount=6;
PAINTSTRUCT PtStr;
static char *textbuf[]=
{
"This is the first line",
"This is the second line",
"This is the third line",
"This is the fourth line",
"This is the fifth line",
"This is the sixth line",
};
switch(Message) //处理消息
{
case WM_CREATE: //处理窗口创建消息
hDC=GetDC(hWnd);
GetTextMetrics(hDC,&tm);
nXChar=tm.tmAveCharWidth;
nYChar=tm.tmHeight+tm.tmExternalLeading;
nCaps=(tm.tmPitchAndFamily&1? 3:2)*nXChar/2;
ReleaseDC(hWnd,hDC);
return 0;
case WM_PAINT:
hDC=BeginPaint(hWnd,&PtStr);
for(x=0;x<=LnCount;x=x+1)
{
TextOut(hDC,nXChar,nYChar*(1+x),
textbuf[x],lstrlen(textbuf[x]));
}
EndPaint(hWnd,&PtStr);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return(DefWindowProc(hWnd,Message,wParam,lParam));
}
}BOOL InitWindows(HINSTANCE hInstance, int nCmdShow) //初始化窗口
{
HWND hWnd;
hWnd=CreateWindow("WinTex", //生成窗口
"文本显示示例程序",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
0,
CW_USEDEFAULT,
0,
NULL,
NULL,
hInstance,
NULL);
if(!hWnd)
return FALSE;
hWndMain=hWnd;
ShowWindow(hWnd,nCmdShow); //显示窗口
UpdateWindow(hWnd);
return TRUE;
}BOOL InitWindowsClass(HINSTANCE hInstance)
{
WNDCLASS WndClass;
WndClass.cbClsExtra=0;
WndClass.cbWndExtra=0;
WndClass.hbrBackground=(HBRUSH)(GetStockObject(WHITE_BRUSH));
WndClass.hCursor=LoadCursor(NULL,IDC_ARROW);
WndClass.hIcon=LoadIcon(NULL,"END");
WndClass.hInstance=hInstance;
WndClass.lpfnWndProc=WndProc;
WndClass.lpszClassName="WinText";
WndClass.lpszMenuName=NULL;
WndClass.style=CS_HREDRAW|CS_VREDRAW;
return RegisterClass(&WndClass);
}
编译的时候全部通过了
,但是执行的时候就退出了
错误代码如下,请问一下是什么问题呢?出错代码:Loaded 'C:\WINDOWS\SYSTEM\ADVAPI32.DLL', no matching symbolic information found.
Loaded 'C:\WINDOWS\SYSTEM\GDI32.DLL', no matching symbolic information found.
Loaded 'C:\WINDOWS\SYSTEM\USER32.DLL', no matching symbolic information found.
Loaded 'C:\WINDOWS\SYSTEM\KERNEL32.DLL', no matching symbolic information found.
The thread 0xFFF9C27D has exited with code 0 (0x0).
The program 'D:\练习的例子\文本显示示例程序\Debug\文本显示示例程序.exe' has exited with code 0 (0x0).谢谢先。
解决方案 »
- VC 对话框程序的问题
- 软件的注册部分如何设计,给点思路?
- 单选按钮的简单问题
- 今天的面试题(自学C果然够呛,望大家多多提示)
- 菜鸟级问题,datetimepicker控件上面显示的时间,如何转化为字符串??
- 【求助】访问需要用户名密码的http站点时,有时会返回401错误,或者用户名密码是正确的,怎样编代码检验?
- 端口选择问题?高分求救!
- 小CASE请教:.pdg是个什么文件?
- 求助~我需要高手帮我用VC++来做个三维图像重建的程序 报酬商议
- VC6.0能去掉Web Browser控件的滚动条吗
- 我怎么接管不到ComboBox的keyDown事件?
- 如何将MDI中的一个Child Window置为TopMost
PAINTSTRUCT PtStr;
static char *textbuf[]=
{
"This is the first line",
"This is the second line",
"This is the third line",
"This is the fourth line",
"This is the fifth line",
"This is the sixth line",
};
>>for(x=0;x<=LnCount;x=x+1)
>>{
>>TextOut(hDC,nXChar,nYChar*(1+x),
>>textbuf[x],lstrlen(textbuf[x]));
>>} ??for(x=0;x<LnCount;x=x+1)
{
TextOut(hDC,nXChar,nYChar*(1+x),
textbuf[x],lstrlen(textbuf[x]));
}