- This topic has 9 replies, 4 voices, and was last updated 16 years ago by String.
-
AuthorPosts
-
July 5, 2008 at 7:20 am #190758RonticMember
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?July 5, 2008 at 9:58 am #190767StringMemberYour 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 IfJuly 5, 2008 at 4:38 pm #190766RonticMemberFor some reason, my program still sees a button there, even if it’s not visible. lol
July 5, 2008 at 5:48 pm #190765ChikeMember@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.July 5, 2008 at 10:54 pm #190764RonticMemberI’m going to see if the GetMenuState command will be of any help.
July 5, 2008 at 11:45 pm #190763ChikeMember@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.July 6, 2008 at 4:26 am #190762RonticMemberOkay. 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.July 6, 2008 at 9:27 am #190761ChikeMember@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?
July 6, 2008 at 10:05 am #190760DepartureMemberWow about time we had another delphi programmer 😀
anyway the WM_Command to turn audio on is 33346 so it would look something likePostMessage(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 😆
July 6, 2008 at 4:28 pm #190759RonticMemberI really have to thank you guys for all this info.
Now I can finish up the audio checking routine. 🙂 -
AuthorPosts
Related
- You must be logged in to reply to this topic.