求绝命mod之武装帝国f-117a的代码
f-117a
Looking in dataGenerals.str for string file
Looking in datachineseGenerals.csf piled string file
ScriptEngine::setGlobalDifficulty(1)
THRUST locos may not have zero m_minSpeed; healing...
WW3D::Init hwnd = 0003039E
Init DX8Wrapper
DX8Wrapper main thread: 0x238
Reset DX8Wrapper statistics
Create Direct3D8
Enumerate devices
DX8Wrapper pleted
Allocate Debug Resources
Init Dazzles
WW3D pleted
Attempting Set_Render_Device: name: NVIDIA GeForce 9800 GTX/9800 GTX+ (nv4_disp.dll:6.14.11.9038), width: 1024, height: 768, windowed: 1
Found zbuffer mode D3DFMT_D24S8
Using Display/BackBuffer Formats: D3DFMT_X8R8G8B8/D3DFMT_A8R8G8B8
ThreadClass::Execute: Started thread Texture loader thread, thread ID is 338
Reset/Create_Device done, reset_device=0, restore_assets=1
ShaderManager ChipsetID 11
如何实现一个程序只运行一个实例
关键字:VC如何使应用程序只运行一个实例,VC 只运行一次,只给一个程序运行
在开发网络应用程序的时候,由于端口分配和占用问题,经常出现某程序只给运行一个实例的情况.下面就介绍一下,如何使程序就只运行一个实例.
方法一:在应用程序类中使用互斥量
实现步骤:
1.用GUIDGEN.EXE产生一个全局标志,#define PROC_ID "产生的全局标志"
如本实例:#define PROC_ID "0xa9a66d98, 0x18c7, 0x447b, 0x80, 0xc, 0xa3, 0x20, 0xea, 0x4f, 0xb6, 0xe8" //注:GUIDGEN.EXE为VC自带工具,如果在开始->程序的Microsoft Visual C++ 6.0 Tools里找不到该程序可以到C:Program FilesMicrosoft Visual StudioCommonTools里找到.
//注:用此方法生成的串,只为保证该进程标识的唯一性,也可以自己定一个简单的串标识
2.
BOOL CEx1App::InitInstance()
{
handle=::CreateMutex(NULL,FALSE,PROC_ID);//handle为声明的HANDLE类型的全局变量
if(GetLastError()==ERROR_ALREADY_EXISTS)
{
AfxMessageBox("应用程序已经在运行");
return FALSE;
}
......................//略
}
3.
在XXApp类里右件,添加ExitInstance虚函数:(函数里语句如下即可)
int CEx1App::ExitInstance()
{
CloseHandle(handle);
return CWinApp::ExitInstance();
}
///缺点:无法击活旧窗口
方法二:枚举进程法
#define ID_GUI "0xa9a66d98, 0x18c7, 0x447b, 0x80, 0xc, 0xa3, 0x20, 0xea, 0x4f, 0xb6, 0xe8"//Guidgen.exe生成保证唯一性
//添加的标识只运行一次的属性名
CString g_szPropName = ID_GUI;?? //全局变量
HANDLE g_hValue = (HANDLE)1; //全局变量
//添加一个枚举窗口的函数
BOOL CALLBACK EnumWndProc(HWND hwnd,LPARAM lParam)
{
HANDLE h = GetProp(hwnd,g_szPropName);
if( h == g_hValue)
{
?? *(HWND*)lParam = hwnd;
?? return false;
}
return true;
}
BOOL CRunOnceApp::InitInstance()
{
?? //查找是否有本程序的前一个实例运行
HWND oldHWnd = NULL;
EnumWindows(EnumWndProc,(LPARAM)&oldHWnd); //枚举所有运行的窗口
if(oldHWnd != NULL)
{
?? AfxMessageBox("本程序已经在运行了");
?? ::ShowWindow(oldHWnd,SW_SHOWNORMAL);??? //激活找到的前一个程序
?? ::SetForegroundWindow(oldHWnd);?? //把它设为前景窗口
?? return false;??????? //退出本次运行
}
................//略
}
在XXDlg.cpp页
//声明全局变量
extern CString g_szPropName;
extern HANDLE g_hValue;
在主窗口的 OnInitDialog()中添加属性
//设置窗口属性
SetProp(m_hWnd,g_szPropName,g_hValue);
方法二优点:可以激活旧进程窗口
用python怎么查看syslistview32的内容
j88r的回答是测试是可行了,就是代码太多不太明白,有点注释就好了
VC如何将指定的字符串复制到剪贴版里
如果是 MFC 应用程序,而且是要把编辑框内容复制到剪贴板,直接调用CEdit::Copy 即可。
如果是其他情况,MSDN 有详细说明:
Copying Information to the Clipboard
In the Label application, the application-defined EditCopy function copies the current selection to the clipboard. This function does the following:
Opens the clipboard by calling the OpenClipboard function.
调用 OpenClipboard 打开剪贴板
Empties the clipboard by calling the EmptyClipboard function.
调用 EmptyClipboard 清除剪贴板内容
Calls the SetClipboardData function once for each clipboard format the application provides.
调用 SetClipboardData 将内容放置到剪贴板上
Closes the clipboard by calling the CloseClipboard function.
调用 CloseClipboard 关闭剪贴板
Depending on the current selection, the EditCopy function either copies a range of text or copies an application-defined structure representing an entire label. The structure, called LABELBOX, is defined as follows.
BOOL WINAPI EditCopy(VOID)
{
PLABELBOX pbox;
LPTSTR lptstrCopy;
HGLOBAL hglbCopy;
int ich1, ich2,h;
if (hwndSelected == NULL)
return FALSE;
// Open the clipboard, and empty it.
if (!OpenClipboard(hwndMain))
return FALSE;
EmptyClipboard();
// Get a pointer to the structure for the selected label.
pbox = (PLABELBOX) GetWindowLong(hwndSelected, 0);
// If text is selected, copy it using the CF_TEXT format.
if (pbox->fEdit)
{
if (pbox->ichSel == pbox->ichCaret) // zero length
{
CloseClipboard(); // selection
return FALSE;
}
if (pbox->ichSel < pbox->ichCaret)
{
ich1 = pbox->ichSel;
ich2 = pbox->ichCaret;
}
else
{
ich1 = pbox->ichCaret;
ich2 = pbox->ichSel;
}
h = ich2 - ich1;
// Allocate a global memory object for the text.
hglbCopy = GlobalAlloc(GMEM_MOVEABLE,
h + 1) * sizeof(TCHAR));
if (hglbCopy == NULL)
{
CloseClipboard();
return FALSE;
}
// Lock the handle and copy the text to the buffer.
lptstrCopy = GlobalLock(hglbCopy);
memcpy(lptstrCopy, &pbox->atchLabel[ich1],
h * sizeof(TCHAR));
h] = (TCHAR) 0; // null character
GlobalUnlock(hglbCopy);
// Place the handle on the clipboard.
SetClipboardData(CF_TEXT, hglbCopy);
}
// If no text is selected, the label as a whole is copied.
else
{
// Save a copy of the selected label as a local memory
// object. This copy is used to render data on request.
// It is freed in response to the WM_DESTROYCLIPBOARD
// message.
pboxLocalClip = (PLABELBOX) LocalAlloc(
LMEM_FIXED,
sizeof(LABELBOX)
);
if (pboxLocalClip == NULL)
{
CloseClipboard();
return FALSE;
}
memcpy(pboxLocalClip, pbox, sizeof(LABELBOX));
pboxLocalClip->fSelected = FALSE;
pboxLocalClip->fEdit = FALSE;
// Place a registered clipboard format, the owner-display
// format, and the CF_TEXT format on the clipboard using
// delayed rendering.
SetClipboardData(uLabelFormat, NULL);
SetClipboardData(CF_OWNERDISPLAY, NULL);
SetClipboardData(CF_TEXT, NULL);
}
// Close the clipboard.
CloseClipboard();
return TRUE;
}