修改如下(如果没有就新建)REG_SZ值:HKEY_CURRENT_USER\Control Panel\Desktop\HungAppTimeout
内容是一个整数,表示提示之前的等待时间(毫秒),默认(不存在这个项的时候)是5000。
另外,对于编程人员,可以使用API“DisableProcessWindowsGhosting”来禁止这个提示。
最后,使用“应用程序兼容工具箱”也可以针对单个程序来禁止这个提示,不过操作较为复杂:http://blogs.technet.com/b/askperf/archive/2010/09/10/de-ghosting-your-windows.aspx。
QQ对战平台的本地好友信息储存在%QQBattleZone%\%UIN%\Friend.dat,格式比较简单,一开始是一个DWORD,看起来总是为0,后面是一堆FriendObject(参考代码中的定义)。
在平台上好象没有查找好友的功能,只能添加同一个房子的,所以就写了这么个代码来自由添加。
代码好像写的比较烂,比如说添加好友就该单独写一个函数,偷个懒,各位勉强看吧。
/*
Description
A simple tool to manage local friends in QQ game platform.
Author
NewbieCoder@0GiNr
Revision
None
*/
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <fstream>
#include <algorithm>
struct FriendObject {
int uin;
char nickName[20];
//
// Except for a DWORD at the beginning, which may be face icon?
// All the remaining bytes seem to always be zero.
//
char unknown[36];
explicit FriendObject() {
memset(this, 0, sizeof(*this));
}
};
std::vector<FriendObject> friends;
//
// Binary read.
//
template<class type> std::istream& binaryRead(std::istream &istreamObject, type &object) {
return istreamObject.read((char *)&object, sizeof(object));
}
//
// Binary write.
//
template<class type> std::ostream& binaryWrite(std::ostream &ostreamObject, type object) {
return ostreamObject.write((char *)&object, sizeof(object));
}
//
// Load friends information from 'Friend.dat'
//
// File structure:
// DWORD unknow -- Always zero.
// One or more FriendObject follows.
//
void loadFriends(std::istream &istreamObject) {
FriendObject friendObject;
int temp;
friends.clear();
//
// Always zero?
//
binaryRead(istreamObject, temp);
//
// Function binaryRead simplifies the work much.
//
while (binaryRead(istreamObject, friendObject)) {
friends.push_back(friendObject);
}
}
//
// List the friends information.
//
void dumpFriends() {
for (FriendObject friendObject : friends) {
std::cout << std::setw(10) << std::left << friendObject.uin << " " <<
std::setw(25) << std::left << friendObject.nickName << std::endl;
}
}
//
// Write friends information back.
//
void saveFriends(std::ostream &ostreamObject) {
//
// Always be zero.
//
binaryWrite(ostreamObject, (int)0);
//
// Write them back one by one.
//
for (FriendObject friendObject : friends) {
binaryWrite(ostreamObject, friendObject);
}
}
int main(int argc, char **argv) {
std::string command;
std::string fileName = "Friend.dat";
std::ifstream inputFileStream;
std::ofstream outputFileStream;
bool informationModified = false;
//
// TODO: Validate arguments.
//
command = argv[1];
inputFileStream.open(fileName, std::ios::binary);
if (!inputFileStream) {
std::cerr << "Unable to open Friend.dat." << std::endl;
return -1;
}
loadFriends(inputFileStream);
inputFileStream.close();
if (command == "-list") {
dumpFriends();
} else if (command == "-add") {
FriendObject friendObject;
std::vector<FriendObject>::iterator friendPointer;
//
// Data should be write back.
//
informationModified = true;
sscanf(argv[2], "%d", &friendObject.uin);
strncpy(friendObject.nickName, argv[3], sizeof(friendObject.nickName));;
//
// Check if we have to add a new entry.
//
friendPointer = std::find_if(friends.begin(), friends.end(),
[friendObject] (FriendObject const ¤t) -> bool {
return current.uin == friendObject.uin;
});
if (friendPointer == friends.end()) {
friends.push_back(friendObject);
} else {
*friendPointer = friendObject;
}
} else if (command == "-delete") {
int uin;
sscanf(argv[2], "%d", &uin);
informationModified = true;
//
// Find the corresponding entry and remove it if one exists.
//
friends.erase(std::remove_if(friends.begin(), friends.end(),
[uin] (FriendObject const ¤t) -> bool {
return current.uin == uin;
}), friends.end());
} else if (command == "-clear") {
informationModified = true;
friends.clear();
}
//
// Operation '-add' and '-delete' requires writting data back.
//
if (informationModified) {
outputFileStream.open(fileName, std::ios::binary | std::ios::trunc);
if (!outputFileStream) {
std::cerr << "Unable to write back to Friend.dat." << std::endl;
return -1;
}
saveFriends(outputFileStream);
outputFileStream.close();
}
}