第一节 MessageBox程序
窗口恶搞程序:
【编译器】C-Free 5.0
#include <windows.h>
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
/* TODO: Place code here.*/
int a,b = 4;
while(IDRETRY == b)
{
a = MessageBox(NULL,TEXT("你是好人吗"),TEXT("窗口"),MB_YESNO);
if(IDNO == a)
{
b = MessageBox(NULL,TEXT("看你就不像好人,点击确定开始格式化C盘!"),TEXT("窗口"),MB_OK|MB_ICONINFORMATION);
}
else
{
b = MessageBox(NULL,TEXT(""),TEXT("窗口"),MB_RETRYCANCEL);
}
if(IDOK == b)
{
MessageBox(NULL,TEXT("C盘格式化完毕!"),TEXT("窗口"),MB_OK);
}
}
return 0;
}
第二节 对话框程序
【编译器】Visual Studio 2010
#include "stdafx.h"
#include "test2.h"
#include "Resource.h"
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
DialogBox(hInstance,MAKEINTRESOURCE(IDD_ABOUTBOX),NULL,NULL);
return 0;
}
第三节 简易加法计算器