Go Back   Winamp Forums > Developer Center > Winamp Development

Reply
Thread Tools Search this Thread Display Modes
Old 21st December 2006, 18:22   #1
Kriechi
Junior Member
 
Join Date: Dec 2006
Location: Austria
Posts: 9
Send a message via ICQ to Kriechi
find out if winamp is on top

hi
my english is not very perfect, but i try to explain my problem...


how can i find out if winamp is the top window? is there any SendMessage constante? i've searched through the sdk, but i doesn't find out any usefully information.
i programm in vb .net 2005, please help me!

Kriechi
Kriechi is offline   Reply With Quote
Old 21st December 2006, 18:30   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
A quick forum search, returned these results:
http://forums.winamp.com/search.php?...by=&sortorder=

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 22nd December 2006, 08:20   #3
Kriechi
Junior Member
 
Join Date: Dec 2006
Location: Austria
Posts: 9
Send a message via ICQ to Kriechi
ok, i searched many sites, but a didn't find a useful answer to my question.
i need a constante which gives me back the windowstate of the winamp mainframe...

nice greetings
Kriechi is offline   Reply With Quote
Old 22nd December 2006, 10:55   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,337
You could use GetForegroundWindow and compare that to the HWND you already have.

I've moved this thread to the Winamp Development forum, as it has nothing to do with NSIS.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 22nd December 2006, 15:34   #5
Kriechi
Junior Member
 
Join Date: Dec 2006
Location: Austria
Posts: 9
Send a message via ICQ to Kriechi
jeah, ok, but i get the winamp hwnd with :
WAhwnd = FindWindow("Winamp v1.x", vbNullString)


but the top window, if it is the mainframe of winamp, isn't the hwnd wich i found out with FindWindow...?
so, what can i do?
Kriechi is offline   Reply With Quote
Old 22nd December 2006, 18:06   #6
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
I haven't Winamp installed on my system so I'm not able to catch its window class name.
The following example is working with winrar, all you hava to do is to replace the "WinRarWindow" which is winrar's window class name, with winamp's window class name.
However, if you have winrar installed on your system, you may examine the code as is:

Assume that you want to do it through NSIS
code:
outfile test.exe
showinstdetails show

!include WinMessages.nsh

section
; instead of WinRarWindow add here WinAmp's window class name
FindWindow $3 "WinRarWindow"
strcmp $3 0 end

detailprint "WinRar's Window Class == $3"
System::Call 'user32::GetForegroundWindow(i, i) i (r0, r1) .r2'
detailprint "Current Foreground Window's Class == $2"
strcmp $3 $2 isforeground
detailprint "$3 is NOT foreground window"
detailprint "Setting up WinRar as foreground window"
ShowWindow $3 ${SW_NORMAL}

isforeground:
detailprint "$3 == is foreground"

end:
sectionend


Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 24th December 2006, 15:38   #7
Kriechi
Junior Member
 
Join Date: Dec 2006
Location: Austria
Posts: 9
Send a message via ICQ to Kriechi
yeah
thank you!
i've solved it like this:
FindWindow("BaseWindow_RootWnd", "Player Window")
FindWindow("BaseWindow_RootWnd", "Playlist Editor")
FindWindow("BaseWindow_RootWnd", "Media Library")

and then check with GetForegroundWindow(), if one of the 3 windows is on top.

i think this is a good solution!

thx
Kriechi is offline   Reply With Quote
Old 24th December 2006, 15:49   #8
DrO
-
 
DrO's Avatar
 
Join Date: Sep 2003
Location: UK
Posts: 22,244
it's not since it won't work for classic skins and possibly some modern style skins as well

-daz
DrO is offline   Reply With Quote
Old 25th December 2006, 09:15   #9
Kriechi
Junior Member
 
Join Date: Dec 2006
Location: Austria
Posts: 9
Send a message via ICQ to Kriechi
why not? the window names are still the same, or not?
maybe the equalizer-, video window is still in front, but this are only 2 line to write.
Kriechi is offline   Reply With Quote
Old 25th December 2006, 10:26   #10
DrO
-
 
DrO's Avatar
 
Join Date: Sep 2003
Location: UK
Posts: 22,244
those windows don't exist when running with a classic skin. you'd need to look for the following window classes.... "Winamp PE", "Winamp Eq", "Winamp Gen" with a title of "Winamp Library" (any window using the generic skinned frame like the media library, external plugins will have a 'Winamp Gen' class window), "Winamp v1.x" (assumes that the /class command line option hasn't been used).

using WinSpy++ or some similar app to that will give you all of the available window classes. it is best to use the classic skin variants and do a check for the 'BaseWindow_RootWnd' window class, where if it exists then use a GetParent(GetParent(hwnd_to_check)) call on the hwnd's from the classic skin window classes

-daz
DrO is offline   Reply With Quote
Old 26th December 2006, 17:31   #11
Kriechi
Junior Member
 
Join Date: Dec 2006
Location: Austria
Posts: 9
Send a message via ICQ to Kriechi
ok thanks, i'll try
Kriechi is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump