Skip to content

Audio Enabled in IM windows

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #190758
    Rontic
    Member

    Okay. I am currently working on a program that uses the SAPI voice interface to send out text to speech over chatrooms, and IM windows for a friend who is mute.
    I need to be able to have my program know when the audio in an IM window is enabled.
    If the audio in an IM window is not enabled, then there is no mic button.
    When my program tries to lock down a mic button that isn’t there, it causes Paltalk to crash.
    I need a way to prevent this from happening accidently.
    Can anybody tell me how to deal with this problem?

    #190767
    String
    Member

    Your answer is in your question.

    …..need to be able to have my program know when the audio in an IM window is enabled.

    ….If the audio in an IM window is not enabled, then there is no mic button.

    If ThereIsNoButton Then
    IM_AudioNotEnabled
    End If
    #190766
    Rontic
    Member

    For some reason, my program still sees a button there, even if it’s not visible. lol

    #190765
    Chike
    Member

    @Rontic wrote:

    For some reason, my program still sees a button there, even if it’s not visible. lol

    Where is this “there: or if it is the button is sees or something else, is a key to the mystery.
    Maybe you can rely on the menues instead, you can see what’s in them and what it is always.

    #190764
    Rontic
    Member

    I’m going to see if the GetMenuState command will be of any help.

    #190763
    Chike
    Member

    @Rontic wrote:

    I’m going to see if the GetMenuState command will be of any help.

    It sure does. You can see if audio is active by the check state of “Audio On” and send the IM window the commands you need that are the menu ID of the submenu items of “Talk Mode”.
    Much easier than finding buttons.

    #190762
    Rontic
    Member

    Okay. This is what I have so far. It’s written in Delphi…

    Function AudioEnabled:Boolean;
    Var dlggroupchatwindowclass: Longint;
    itemcount:longint;
    menuitemid:longint;
    submenu:longint;
    TheMenu:hmenu;
    isamenu:longint;
    itemstate:longint;
    Begin
    result:=false;
    dlggroupchatwindowclass := FindWindowA(‘dlggroupchat window class’, pchar(Roomname));
    themenu:=GetMenu(dlggroupchatwindowclass);
    submenu:=GetSubMenu(themenu,3);
    if IsMenu(submenu) then
    begin
    itemcount:=GetMenuItemCount(submenu);
    if (itemcount = 15) or (itemcount = 16) then
    begin
    itemstate:=GetMenuState(submenu,1,MF_BYPOSITION);
    if (itemstate and 8 )=8 then
    begin
    result:=true;
    end
    else
    begin
    result:=false;
    //menu might not be loaded
    end;
    end else
    begin
    result:=false;
    //menu not loaded
    end;
    end else begin
    result:=false;
    end;
    End;

    The trouble now is, I have to open up and close the menu in order to refresh the information after the audio is added.

    I hope somebody can give me the code numkber for the menu command.
    I know it’s simillar to how to open up the admin console, but I don’t know what number to substute for the actions menu.
    Then I have to close it after it’s been opened. lol
    Unless there’s a better way.

    #190761
    Chike
    Member

    @Rontic wrote:

    if (itemcount = 15) or (itemcount = 16) then

    Personally I would have check if the item name is “Action” rather depend on the count.
    BTW put code in “Code”

    @Rontic wrote:

    The trouble now is, I have to open up and close the menu in order to refresh the information after the audio is added.

    Not realy. You can trick paltalk to think you have 😉


    SendMessage(hwnd, WM_INITMENUPOPUP, hmenu, nItem);
    SendMessage(hwnd, WM_UNINITMENUPOPUP, hmenu, 0);

    If it’s the Action menu that need to be open then hmenu is themenu and nitem 3.

    @Rontic wrote:

    I hope somebody can give me the code numkber for the menu command.

    Those you can find on the fly with GetMenuItemID

    Didn’t I tell you it is much easier than messin with the button? :mrgreen:

    #190760
    Departure
    Member

    Wow about time we had another delphi programmer 😀
    anyway the WM_Command to turn audio on is 33346 so it would look something like

    PostMessage(PalPMHandle,WM_COMMAND,33346,0);

    P.s all you need is the PM window handle, once you have that just use the above line and it will be turned on 😆

    #190759
    Rontic
    Member

    I really have to thank you guys for all this info.
    Now I can finish up the audio checking routine. 🙂

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.