来看看这段VC++的代码!!各位大虾请指教啊!

来源:百度知道 编辑:UC知道 时间:2024/06/24 08:13:50
请各位大虾不吝赐教啊!!在下感激不尽!

#include<windows.h>

LRESULT CALLBACK DEAL_MSG ( HWND , UINT , WPARAM , LPARAM ) ;

int PASCAL WinMain ( HINSTANCE hInstance , HINSTANCE hPrevInstance , LPSTR lpCmdLine , int nShow )
{
char string[] = " 大家好!" ;
HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;

wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = DEAL_MSG ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = string ;

if( !RegisterClass ( &wndclass ) )
{
return false ;
}

hwnd = CreateWindow( string , " 第一个窗口 " , WS_OVERLAPPE

是不是工程建错了,别建成Console Application。

提示说unresolved external symbol _main

Linker告诉你你的工程在某处调用了_main但没有_main的定义,实际在你这个代码里也是。我想大概是你建的工程在配置时出了什么问题吧,我用vc2005建了个空项目编译通过了,没什么问题。

你这个程序用的是直接的API,确定你没有建ATL,MFC或者CLR。

有空我再来看一下