VC++:一个简单的WINDOWS程序

来源:百度知道 编辑:UC知道 时间:2024/05/16 03:55:53
我想编一个简单的WINDOWS程序,打开以后会显示“Welcome!",
给一下代码。
最好说明一下一些设置,比如说选win32 Application还是win32 console Application等。
我用的是VC++6.0。

选Win32 Application。

代码可以这样写:
#include <windows.h>

/* Declare Windows procedure */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

/* Make the class name into a global variable */
TCHAR szClassName[ ] = TEXT("WindowsApp");
TCHAR szAppName[] = TEXT("Welcome");

int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)

{
HWND hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are saved */
WNDCLASSEX wincl; /* Data structure for the windowclass */

/* The Window structure */
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure; /* This function is ca