// only.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <windows.h> #pragma data_seg("Shared")//创建自定义段,编译器解释 volatile long Run=0; #pragma data_seg()//自定义段创建至此 #pragma comment(linker,"/Section:Shared,RWS")//读(R)写(W)共享(S)自定义段 int main(int argc, char* argv[]) { if(!Run) { Run=1; } else { MessageBox(0,0,0,0); return -1; } Sleep(INFINITE); return 0; }