读书人

小弟我被下面的进程启动晕糊涂了!求真

发布时间: 2012-01-30 21:15:58 作者: rapoo

我被下面的进程启动晕糊涂了!求真心的你,谢谢
我的某程序安装后有4个exe:其中funambol.exe是主界面;另外有startsync.exe,ClientPush.exe
主界面有下面这个函数

我发现个很奇怪的问题:正常情况下:打开和关闭主界面或者点上面的某些无关紧要功能比如about(厂家说明),不会启动ClientPush.exe
但是 把startsync.exe移除后,我随便点主界面任何一个功能键如about,都会启动ClientPush.exe
ClientPush.exe的启动貌似和下面函数有关系

void CuiDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized) {

CDialog::OnActivate(nState, pWndOther, bMinimized);
if(isDialogOpened() && !isSyncStarted()){
lstSources.refreshSourcePanes();
// check if the CP is activated or not. If not it can be restored
// it is checked only when the flag openUp has true, so when the oninit
checkCPWorking();
}
}

bool checkCPWorking() {

ClientSettings* cs = getRegConfig();
int pushType = 0;
int smsType = 0;

if (cs->getPush().size() > 0) {
pushType = atoi(cs->getPush().c_str());
}
if (cs->getSms().size() > 0) {
smsType = atoi(cs->getPush().c_str());
}

if (pushType > 0 || smsType > 0) {
LOG.debug("Util::checkCPWorking: push or sms registry are > 0. Try to register CP");
return registerCP();
} else {
deregisterCP();
LOG.debug("Util::checkCPWorking: CP is not activated");
}
return true;

bool registerCP() {

// Check if process is not running.
DWORD pid = isClientPushRunning();

if (!pid) {
LOG.info("Util: Starting the process 'ClientPush.exe'.");
pid = startProgram(TEXT("ClientPush.exe"), TEXT(""));

if (pid == 0) {
LOG.error("Util: Not possible to start client push");
return false;
}
// Save the pid into registry.
LOG.debug("Util: Saving the CP PID to registry: %d", pid);
DMTree* dmt = DMTreeFactory::getDMTree(APPLICATION_URI);
ManagementNode* node = dmt->readManagementNode(APPLICATION_URI);
if (!node) {
LOG.error("Util: Cannot store CP PID, error reading management node '%s'", APPLICATION_URI);
return false;
}
StringBuffer value;
value.sprintf("%d", pid);
node->setPropertyValue(CP_PID, value.c_str());

delete node;
delete dmt;
}
else {
LOG.debug("Util: CP already running: current PID = %d", pid);
}
return true;
}
更多说明http://topic.csdn.net/u/20100412/16/1500aa0a-5d30-4625-b264-13790dfe2b2c.html

[解决办法]
你自己debug调试一下啊。。。。

读书人网 >VC/MFC

热点推荐