Hello. I'm trying to implement the DC++ URL Handler code kindly posted by sarf here and I've gotten it to work with the current version (0.24). Unfortunately, when I click on dchub link, a new instance of the program is opened. This is different from older versions, since I have compiled v0.181 and it behaves the way I would expect it (the link is sent to the current instance of the program running).
I was hoping someone a litle more familar with the code could point me in the direction of the change in the source that makes newer versions allow multiple instances to run.
Thank you very much in advance.
Preventing multiple instances
Moderator: Moderators
-
GargoyleMT
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-08 02:46
- Location: .pa.us
Re: Preventing multiple instances
If you compiled the debugging configuration, the multiple instance code has been conditionally excluded from that for a while. Look for a #ifndef _DEBUG in the windows\main.cpp file.
-
izaram
- Posts: 5
- Joined: 2003-03-19 09:02
-
smitty
- Posts: 53
- Joined: 2003-03-01 19:45
I deleted this from code and can run multiple DC++ with new version
Code: Select all
if(dcapp.IsAnotherInstanceRunning()) {
HWND hOther = NULL;
EnumWindows(searchOtherInstance, (LPARAM)&hOther);
if( hOther != NULL ) {
// pop up
::SetForegroundWindow(hOther);
if( IsIconic(hOther)) {
// restore
::ShowWindow(hOther, SW_RESTORE);
}
sendCmdLine(hOther, lpstrCmdLine);
}
return FALSE;
}Knowledge is Earned BUT Wisdom is Free
-
GargoyleMT
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-08 02:46
- Location: .pa.us
Also in main.cpp, in the function _tWinMain(), there's this line:
Why a multi-line fix when one will do?
Code: Select all
SingleInstance dcapp("{DCPLUSPLUS-AEE8350A-B49A-4753-AB4B-E55479A48351}");Why a multi-line fix when one will do?
Who is online
Users browsing this forum: Google [Bot] and 0 guests