Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

[solved] Get the result of SendMessage

If you have a question or need help, this is the place to be.
Post Reply
Bicou
Posts: 15
Joined: Tue Sep 12, 2006 2:51 pm

[solved] Get the result of SendMessage

Post by Bicou »

Hello again!
This time I'm trying to communicate with winamp, using windows messages: I'd like to get the shuffle status, for example.
Here's what Winamp SDK gives:

Code: Select all

#define WM_WA_IPC WM_USER
// [...]

/* (requires Winamp 2.4+)
** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_SHUFFLE);
**
** IPC_GET_SHUFFLE returns the status of the Shuffle option (1 if set)
*/
In Windows SDK I have #define WM_USER 0x0400 so I guess I should send windows message 1024 (since 0x0400h = 1024d), with 0 as wParam and 250 as lParam.

Here's my macro:
1. SendMessage( 1024, 0, 250 )
2. OSD : {eg.result}

It shows none, but I think it's normal since I did not tell EG to which window handle I want to send the message... I tried to put a Find Window: winamp.exe macro just before the Send Message macro, but it sill does not work.

What's the problem?

Thanks
Last edited by Bicou on Wed Sep 13, 2006 1:12 pm, edited 1 time in total.
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Post by Bitmonster »

The SendMessage action does not return any value. Since the message might be send to a list of windows, it wouldn't make much sense.

You can try it with a PythonScript:

Code: Select all

import win32gui

hWinamp = win32gui.FindWindow('Winamp v1.x', None)
eg.result = win32gui.SendMessage(hWinamp, 1024, 0, 250)
Bicou
Posts: 15
Joined: Tue Sep 12, 2006 2:51 pm

Post by Bicou »

This is great, thanks again for your help.
Post Reply