|
Hi,
any idea on how to disable a menu button. What I mean is, consider internet explorer browser the menu consists of 'File', if you click on it a drop down menu appears, what api could I use to disable the close button.
Kind Regards
Caoimh
|
|
|
|
|
If you are using the MFC in your application, you can handle the ON_UPDATE_COMMAND_UI handler for your menu item (you can do this via Class wizard). Then its a matter of setting the state of your item pCmdUI->Enable(isEnabled?TRUE:FALSE);
I Dream of Absolute Zero
|
|
|
|
|
If you aren't using MFC, then you can get the menu handle for the window (normally the top level window), and then get a handle for the sub-menu from there (they start at zero, of course!), and finally modify the state of a given item.
APIs to check out are:
HMENU GetMenu( HWND hWnd );
HMENU GetSubMenu( HMENU hMenu, int nSub );
BOOL SetMenuItemInfo( HMENU hMenu, UINT uItem,
BOOL fByPos, LPMENUITEMINFO lpmii);
That should take care of most things.
Steve S
|
|
|
|
|
|
Hi,everybody,I want to know how to create chm format files?I know that the Microsoft compiler must be used,but I really don't know how to use it.Can you tell me what I should to do ?Help me,Please!
|
|
|
|
|
You can use the HTML Help Workshop[^] from the Microsoft website to create these.
I Dream of Absolute Zero
|
|
|
|
|
Oh,I think I didn't represented it clearly,sorry!
I want to create chm files by my program,I want to know how to use the Microsoft's compiler in my program.Thanks!
|
|
|
|
|
Dear All,
I just created a combo box in VC++ 6.0 enviroment. but dont know how to get the selected item. I am using MFC to create this combo box
Regards,
Anson Tong
|
|
|
|
|
Sorry, i am NOT using MFC to create this combo box
Regards,
Anson Tong
|
|
|
|
|
Without MFC
int nCurSel = (int)SendMessage(hWndComboBox, CB_GETCURSEL, 0, 0);
will give the Currently Selected Item.
or
char szText[255];
GetWindowText(hWndComboBox,szText,255);
Hope it helps
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
It is better to use SendMessage(hWndComboBox, CB_GETLBTEXT, nCurSel, (LPARAM) (LPCSTR) szText) instead GetWindowText.
|
|
|
|
|
Why?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
If i rememeber good, GetWindowText won't returns text oly if you're using editable combo box,
it won;t return you selection in droplist combobox
rrrado
|
|
|
|
|
I use GetWindowText() for all three styles.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
This windows message is used for a combo box. If you have multiple choice what you expected to get, and GetWindowText copies the text specified window's title bar, but if you have a window control, the text of the control is copied but you never be sure which text will be copied.
|
|
|
|
|
Branislav wrote:
This windows message is used for a combo box.
Which is what the OP was inquiring about.
Branislav wrote:
If you have multiple choice...
You can't have multiple choices with a combobox.
Branislav wrote:
...but if you have a window control, the text of the control is copied but you never be sure which text will be copied.
This makes no sense. How could you not be sure what text will be retrieved?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Yes, you are right I am thinking about list box but in MSDN about potential message-map:
ON_CBN_SELCHANGE The selection in the list box of a combo box is about to be changed as a result of the user either clicking in the list box or changing the selection by using the arrow keys. When processing this message, the text in the edit control of the combo box can only be retrieved via GetLBText or another similar function. GetWindowText cannot be used.
|
|
|
|
|
Branislav wrote:
ON_CBN_SELCHANGE The selection in the list box of a combo box is about to be changed
Wrong. The CBN_SELCHANGE message is sent after the selection has changed.
Branislav wrote:
When processing this message, the text in the edit control of the combo box can only be retrieved via GetLBText or another similar function. GetWindowText cannot be used.
Wrong again. GetWindowText() can most certainly be used at this point, as the combobox has already been updated to reflect the new selection.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_ccombobox.3a3a.ccombobox.asp
says this :
ON_CBN_SELCHANGE The selection in the list box of a combo box is about to be changed as a result of the user either clicking in the list box or changing the selection by using the arrow keys. When processing this message, the text in the edit control of the combo box can only be retrieved via GetLBText or another similar function. GetWindowText cannot be used.
rrrado
|
|
|
|
|
That's all well and good, but MSDN is not always correct. Reality dictates that GetWindowText() can be used, and is what I always use in response to the CBN_SELCHANGE message. Go ahead, give it a try.
BTW, the link you meant to specify is here.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Are you wanting the index of the selected item, or the value of the selected item? In other words, if your listbox contained the following items:
Apple
Orange <<-- selected item
Kiwi The index of the selected item would be 1, while the value of the selected item would be Orange.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi,
hi i need some info abt using of autocad objects in VC++ application..
Basically its manipulation of autocad files via VC++ application...
So any links, books , any material will be useful..
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
Hi all,
How should I show up a splashscreen while my application init ?
I am using MFC application wizard to create it(dialog based)
Thanks
|
|
|
|
|
|
Search MSDN for an October 1999 article by Paul DiLascia. It has a good splash screen implementation.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|