|
Do I need to marshal XMLDOMDocument pointer?
We yesterday got drunk with Bacchus ...
|
|
|
|
|
Do anyone have an example code on Winsock2 UDP written in C language for windows XP. Please help
Heaven's on me
|
|
|
|
|
|
<br />
CMenu menu;<br />
CMenu *sub=NULL;<br />
VERIFY(menu.LoadMenu(IDR_MENU));<br />
sub = menu.GetSubMenu(0);<br />
UINT state = sub->GetMenuState(IDC_CHOICE, MF_BYCOMMAND);<br />
ASSERT(state != 0xFFFFFFFF);<br />
if(state & MF_CHECKED)<br />
{<br />
sub->CheckMenuItem(IDC_CHOICE, MF_UNCHECKED);<br />
}<br />
else<br />
sub->CheckMenuItem(IDC_CHOICE, MF_CHECKED);<br />
Why doesn't it check or uncheck my menu item? it remains as it is initially...
|
|
|
|
|
How about:
if (state & MF_CHECKED)
sub->CheckMenuItem(IDC_CHOICE, MF_BYPOSITION | MF_UNCHECKED);
else
sub->CheckMenuItem(IDC_CHOICE, MF_BYPOSITION | MF_CHECKED);
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
nope...but here is the problem...the if works, but CheckMenuItem doesn't...so the first part is good, it sees if the item is checked, but it doesn't change this thing.
|
|
|
|
|
I think I gave you the wrong code. MSDN states that a pop-up menu item must be checked by position since it does not have a menu-item identifier associated with it. Figure out what position IDC_CHOICE is in and use that for the first parameter to CheckMenuItem() .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi!
I have an SDI application which, at a certain moment, creates a child dialog box. Therefore, when the app. is active, this dialog box (which is a popup window) is the active and it's really easy to get a CWnd* to it through GetActiveWindow().
The problem arises when the user switched to another app. (using Alt+tab for example) this function returns NULL. How can I find which window was active before my app. lose focus ?
Thanks for help
|
|
|
|
|
Y.Cohen wrote:
How can I find which window was active before my app. lose focus ?
Check out the WM_ACTIVATE and WM_ACTIVATEAPP messages.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
|
Y.Cohen wrote:
How ?
Like you would any other message or notification:
WM_ACTIVATEAPP
WM_ACTIVATE
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hey,
I have a list View which displays a tool tip on a mouse click. I want to read and save that information. Are there any messages that can be sent to retrieve such information. I have tried TTM_GETTOOLINFO and TTM_GETTEXT but then dont seem to work too well.
Abhishek
|
|
|
|
|
I want to dynamically change my dialog box. For example, if I click a check box I want text to appear or diappear, depending on the value.
Danny
|
|
|
|
|
Where is this text that you want to appear or diappear?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I might as well tell you that you are going to have to be bit more specific with your question before you will get an answer. otherwise the only thing you are going to get is: Handle the click event of the checkbox. In the handler if(checkbox.GetCheck()) show text else hide text.....
|
|
|
|
|
Sorry, I had thought I wrote it well. I meant, when I click a check box I have a static text box right next to it that I want to display either an empty string, if the check box is false, or a message, if the text box is true. I have already created member variables for the check box and the static text box.
Danny
|
|
|
|
|
In that case you could do something like:
if(checkbox.GetCheck())
textbox.SetWindowText("Some text");
else
textbox.SetWindowText("");
|
|
|
|
|
Anon E. Mouse wrote:
if(checkbox.GetCheck())
Be specific. CButton::GetCheck() is not a boolean function. If you only want to set text when the state is checked, specifically check for it:
if (checkbox.GetCheck() == BST_CHECKED)
textbox.SetWindowText("Some text");
else if (checkbox.GetCheck() == BST_UNCHECKED)
textbox.SetWindowText(""); Otherwise, the button may later get changed to a three-state check box and be in an indeterminate state.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thanks for clarifying that. That is correct.
|
|
|
|
|
DavidCrow wrote:
if (checkbox.GetCheck() == BST_CHECKED) textbox.SetWindowText("Some text");else if (checkbox.GetCheck() == BST_UNCHECKED) textbox.SetWindowText("");
Thanks, but that leaves the question, what do I use in place of 'checkbox' when I do 'checkbox.GetCheck()'? The member variable shouldn't work and I tried the ID.
Danny
|
|
|
|
|
bugDanny wrote:
what do I use in place of 'checkbox' when I do 'checkbox.GetCheck()'?
Whatever name you gave the member control variable.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
DavidCrow wrote:
bugDanny wrote:
what do I use in place of 'checkbox' when I do 'checkbox.GetCheck()'?
Whatever name you gave the member control variable.
No, using the member veriable name doesn't work. I get the error "left of '.GetCheck' must have class/struct/union type. The same when trying to change the static text box.
Danny
|
|
|
|
|
checkbox should be a CButton , and textbox should be a CStatic .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
DavidCrow wrote:
checkbox should be a CButton, and textbox should be a CStatic.
I suppose I really was too vague in the first place. The above suggestions do not work because I never hand created a CButton or CStatic for these controls. checkbox should be the name of an instantiated CButton and textbox should be name of an instantiated CStatic, but since I never instantiated these I can't do that. I only put a static text box control onto the dialog and a checkbox control and set the ID and member variable names. Shouldn't there be a simpler way, like a refresh() function (I checked help and the refresh commands were for other languages. Maybe it's named something else for C++)
Danny
|
|
|
|
|
If you don't create member variables for the controls, how do you expect to interact with them? You can't just put a control on the dialog and expect it to know what to do.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|