Looking at Menus trough HWND
I'm trying to check the status of the "Show &Emoticons" menu item in the tools menu of the Conversation Windows.
I'm using the following code:
#define MENUID 40020
HWND hWnd; (this variable is set elsewere in the code)
// Get's Window Menu Handle
HMENU hMenu = GetMenu(hWnd);
// Check Menu state
UINT mState = GetMenuState(hMenu, MENUID, MF_BYCOMMAND);
if (!(mState & MF_CHECKED))
{
return 0;
}
else
{
return 1;
}
I know i'm checking the right menu because GetMenuString works fine but GetMenuState never seems to work properly, it returns 0 or 8, I can't make sence out of it. Can anyone help?
Thanks for your reply, I think I should try and make my
scenario clearer so that in "future planning" you'd know exactly what
I was trying to accomplish (and actually succeeded in a away trough alternative
methods).
Some users have to use the Custom Emoticons allot, some to
the point of becoming abusive, this is usually done by replacing normal letters
or small common words with custom emoticons (most of the time animated ones)
since messenger itself allows this.
You can view an example of the result here (not one of the
worst but you can get the idea):
http://madalien.com/media/microsoft/messenger-custom-emoticons-abuse.jpg
This can become very confusing for the reader and sometimes
even the writer since usually people just take others custom emoticons using
the “Add…” function and don’t know how to change the shortcuts so they send the
custom emoticon letters unwillingly. An example of this would be the "no"
in piano will triggering a "no" Custom Emoticon making it pia(custom
Emoticon).
With this in mind I developed a functionality using
Messenger Plus! Live [ http://msgpluslive.net
] Scripting abilities that allows me to disable custom emoticons from the
contacts I chose, I’ve done this by temporarily setting ShowCustomEmoticons
registry option to 0 before creating the chat window with the contact. This is a very hacky solution but the only one
that I’ve been able to work out.
So for future versions of Windows Live! Messenger I would
like if you could consider these features:
- Make all Custom Emoticons require {} (or any other
special character) around them so instead of “no” it would be “{no}”, this
would completely solve the problem with people getting custom emoticon letters
that they don’t know how to remove and spreading them around and most of the “abusing”
of custom emoticons.
- Exposing the “Show Custom Emoticons” option in
the UI like “Show Emoticons” is.
- Allow Addin Developers to access to the above options
(and others), this would be useful for more things then my case, since for
instance a person could write an agent that sends text that would be replace for
emoticons when they shouldn’t.
Hope you read this and consider it for future Windows Live!
Messenger, good luck developing.
Sincerely,
DaF