资源简介

http://blog.csdn.net/magictong/archive/2008/12/25/3603015.aspx 综述:让一个程序只运行一个实例的方法有多种,但是原理都类似,也就是在程序创建前,有窗口的程序在窗口创建前,检查系统中是否已经设置了某些特定标志了,如果有说明已经有一个实例在运行了,则当前程序通知用户怎样怎样,然后程序退出,当然方法有这么多,各自也就有自己的优缺点了。资源是四个例子的源代码。可以参考:http://blog.csdn.net/magictong/archive/2008/12/25/3603015.aspx

资源截图

代码片段和文件信息

// SingleInstanceFW.cpp : Defines the class behaviors for the application.
//

#include “stdafx.h“
#include “SingleInstanceFW.h“
#include “SingleInstanceFWDlg.h“

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSingleInstanceFWApp

BEGIN_MESSAGE_MAP(CSingleInstanceFWApp CWinApp)
//{{AFX_MSG_MAP(CSingleInstanceFWApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
//    DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
ON_COMMAND(ID_HELP CWinApp::onhelp)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSingleInstanceFWApp construction


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2008-12-25 13:11  SingleInstance\
     目录           0  2008-12-25 13:11  SingleInstance\SingleInstanceFW\
     文件        3759  2008-12-25 09:28  SingleInstance\SingleInstanceFW\ReadMe.txt
     目录           0  2008-12-25 09:28  SingleInstance\SingleInstanceFW\res\
     文件         554  2008-12-25 09:28  SingleInstance\SingleInstanceFW\Resource.h
     文件        1078  2008-12-25 09:28  SingleInstance\SingleInstanceFW\res\SingleInstanceFW.ico
     文件         408  2008-12-25 09:28  SingleInstance\SingleInstanceFW\res\SingleInstanceFW.rc2
     文件       35776  2008-12-25 09:29  SingleInstance\SingleInstanceFW\SingleInstanceFW.aps
     文件        1197  2008-12-25 12:55  SingleInstance\SingleInstanceFW\SingleInstanceFW.clw
     文件        2533  2008-12-25 09:39  SingleInstance\SingleInstanceFW\SingleInstanceFW.cpp
     文件        4339  2008-12-25 09:28  SingleInstance\SingleInstanceFW\SingleInstanceFW.dsp
     文件         555  2008-12-25 09:28  SingleInstance\SingleInstanceFW\SingleInstanceFW.dsw
     文件        1434  2008-12-25 09:28  SingleInstance\SingleInstanceFW\SingleInstanceFW.h
     文件       41984  2008-12-25 13:11  SingleInstance\SingleInstanceFW\SingleInstanceFW.ncb
     文件       48640  2008-12-25 13:11  SingleInstance\SingleInstanceFW\SingleInstanceFW.opt
     文件        1176  2008-12-25 09:39  SingleInstance\SingleInstanceFW\SingleInstanceFW.plg
     文件        5415  2008-12-25 09:29  SingleInstance\SingleInstanceFW\SingleInstanceFW.rc
     文件        4280  2008-12-25 09:28  SingleInstance\SingleInstanceFW\SingleInstanceFWDlg.cpp
     文件        1452  2008-12-25 09:28  SingleInstance\SingleInstanceFW\SingleInstanceFWDlg.h
     文件         218  2008-12-25 09:28  SingleInstance\SingleInstanceFW\StdAfx.cpp
     文件        1054  2008-12-25 09:28  SingleInstance\SingleInstanceFW\StdAfx.h
     目录           0  2008-12-25 13:11  SingleInstance\SingleInstanceMutex\
     文件        3813  2008-12-25 09:41  SingleInstance\SingleInstanceMutex\ReadMe.txt
     目录           0  2008-12-25 09:41  SingleInstance\SingleInstanceMutex\res\
     文件         560  2008-12-25 09:41  SingleInstance\SingleInstanceMutex\Resource.h
     文件        1078  2008-12-25 09:41  SingleInstance\SingleInstanceMutex\res\SingleInstanceMutex.ico
     文件         411  2008-12-25 09:41  SingleInstance\SingleInstanceMutex\res\SingleInstanceMutex.rc2
     文件       35868  2008-12-25 09:42  SingleInstance\SingleInstanceMutex\SingleInstanceMutex.aps
     文件        1242  2008-12-25 13:11  SingleInstance\SingleInstanceMutex\SingleInstanceMutex.clw
     文件        3340  2008-12-25 10:46  SingleInstance\SingleInstanceMutex\SingleInstanceMutex.cpp
     文件        4393  2008-12-25 09:41  SingleInstance\SingleInstanceMutex\SingleInstanceMutex.dsp
............此处省略50个文件信息

评论

共有 条评论