⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 conpgm.cpp

📁 讲mfc的书
💻 CPP
字号:
#include <stdio.h>
#include <windows.h>

extern "C" {
	BOOL AbortBox(char *string,char *eventname); // DLL function
	}

void main()
	{
	HANDLE event;
	unsigned int ct=0;
	event=CreateEvent(NULL,TRUE,FALSE,"CONABORTEVENT");
	AbortBox("Press the Abort button to terminate the console application","CONABORTEVENT");
	while (WaitForSingleObject(event,0)==WAIT_TIMEOUT&&ct<100000)
		{
		printf("%d\n",ct);
		ct+=2;
		}
	if (WaitForSingleObject(event,0)==WAIT_TIMEOUT)
		{
		SetEvent(event); // make sure Abort box gets the message
		::MessageBox(NULL,"Done","Operation Complete",MB_OK|MB_SETFOREGROUND);
		}
	// No message if aborted by abort box
	CloseHandle(event);
	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -