I tested a little bit around and wrote a function to Get
eDonkey out of the tray and which returns the current window
handle of the eDonkey window - Maybe this code is
interesting for you:
// Kill quote-marks:if\(DonkeyPath\[0\]=='"'\)\{dk\_path=&DonkeyPath\[1\];i=strlen\(dk\_path\);dk\_path\[i-1\]='\0';\}else\{dk\_path=DonkeyPath;\}// try to get write acces to gdonkey.exe// if you can write, eDonkey is running:fHandle=CreateFile
(dk_path,GENERIC_WRITE|GENERIC_READ,NULL,NULL,OP
EN_EXISTING,NULL,NULL);
if (fHandle!=INVALID_HANDLE_VALUE)
{
// eDonkey is not running!
CloseHandle(fHandle);
return (HWND)-2;
}
// Now just run gdonkey.exe and the currently
running
// eDonkey-app will come out of his little icon ;-)
ShellExecute
(NULL,"open",dk_path,NULL,NULL,SW_SHOWNORMAL);
// Try to find the window now:DonkeyWindow=GetForegroundWindow
Yes that will probably work. I haven't thought about running
gdonkey.exe in order to get it out of tray.
I don't really understand why checking for write access to gdonkey.exe
should ensure a running instance of Edonkey. Could you enlighten me
on this? :)
The only problem is that I would consider it a little rude for an app to
pull another app out of the tray without putting it back, but I could of
course include the feature as yet another option until a better solution is
found.
Anyway thanks a lot for your idea.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I check for write access, because i did not want to run
eDonkey if it is not running, and i don't know another method
how to detect if eDonkey is running, if it is trayed ;-)
If you know, eDonkey was in Tray before you opened it, it is
easy to send eDonkey back to tray:
SendMessage(donkeyWnd,WM_CLOSE,0,0);
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=544193
I already added the fix to this as an upcoming feature. :)
Logged In: YES
user_id=173654
I tested a little bit around and wrote a function to Get
eDonkey out of the tray and which returns the current window
handle of the eDonkey window - Maybe this code is
interesting for you:
HWND GetDonkeyOutOfTray()
{
HANDLE fHandle;
HKEY aKey;
char DonkeyPath[MAX_PATH];
char *dk_path;
DWORD DataSize;
int i;
HWND DonkeyWindow;
char wintitle[500];
(HKEY_CLASSES_ROOT,"ed2k\\DefaultIcon",NULL,KEY_RE
AD,&aKey)!=ERROR_SUCCESS)
{
return (HWND)-1;
}
DataSize=MAX_PATH;
if (RegQueryValueEx
(aKey,NULL,NULL,NULL,(LPBYTE)DonkeyPath,&DataSize)!
=ERROR_SUCCESS)
{
RegCloseKey(aKey);
return (HWND)-1;
}
RegCloseKey(aKey);
(dk_path,GENERIC_WRITE|GENERIC_READ,NULL,NULL,OP
EN_EXISTING,NULL,NULL);
if (fHandle!=INVALID_HANDLE_VALUE)
{
// eDonkey is not running!
CloseHandle(fHandle);
return (HWND)-2;
}
running
// eDonkey-app will come out of his little icon ;-)
ShellExecute
(NULL,"open",dk_path,NULL,NULL,SW_SHOWNORMAL);
();
SendMessage
(DonkeyWindow,WM_GETTEXT,(WPARAM)450,(LPARAM)
wintitle);
wintitle[12]='\0';
=0)
{
DonkeyWindow=GetWindow
(DonkeyWindow,GW_HWNDNEXT);
if (DonkeyWindow==NULL)
{
(DonkeyWindow,WM_GETTEXT,(WPARAM)450,(LPARAM)
wintitle);
wintitle[12]='\0';
}
}
Logged In: YES
user_id=544193
Yes that will probably work. I haven't thought about running
gdonkey.exe in order to get it out of tray.
I don't really understand why checking for write access to gdonkey.exe
should ensure a running instance of Edonkey. Could you enlighten me
on this? :)
The only problem is that I would consider it a little rude for an app to
pull another app out of the tray without putting it back, but I could of
course include the feature as yet another option until a better solution is
found.
Anyway thanks a lot for your idea.
Logged In: YES
user_id=173654
I check for write access, because i did not want to run
eDonkey if it is not running, and i don't know another method
how to detect if eDonkey is running, if it is trayed ;-)
If you know, eDonkey was in Tray before you opened it, it is
easy to send eDonkey back to tray:
SendMessage(donkeyWnd,WM_CLOSE,0,0);
Logged In: YES
user_id=544193
>If you know, eDonkey was in Tray before you opened it, it is
>easy to send eDonkey back to tray:
>SendMessage(donkeyWnd,WM_CLOSE,0,0);
Of course - if edonkey was in tray, closing the window should be safe,
because the 'send to tray' option must have ben set.
Now it does look like a working solution. I'll probably implement this.
Thanks a lot for your input. :)