|
Hi
If I remember correctly, this is what happens:
- If there is no function linked to a menu item (using the ON_COMMAND macro) the item will be grayed. This is normal because no function could be executed anyway.
- If there is a function linked the item will appear enabled and the linked function would be called upon a click.
!! If you want the menu items to dynamicaly change the state from enabled to disabled (and vice versa) depending on the state the whole program is in, you need to implement the ON_UPDATE_COMMAND_UI macro and create a handler in the object that will handle the update.
class CFoo
{
...
afx_msg void OnUpdateMyMenuCommand(CCmdUI* pCmdUI);
};
// in the message map you must include
ON_UPDATE_COMMAND_UI(IDS_PROJECT_ID+IDS_NOUVEAU, OnUpdateMyMenuCommand)
CFoo::OnUpdateMyMenuCommand(CCmdUI* pCmdUI)
{
pCmdUI->Enable(ToolAvailable());
}
Hope this is helpfull
Regards,
Kurt Pattyn
codito ergo sum
|
|
|
|
|
this[^] will probably help you on your way...
and if you'd like to have more infos on menus (ans especially CMenu s, read Roger Allen's Menus for beginners[^].
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Tx guys !!!
I miss the line about ON_UPDATE_COMMAND_UI...
Tx for all, it works !!!
<br />
UINT state = m_cMenu.GetMenuState( pCmdUI->m_nID, MF_BYCOMMAND );<br />
state = (state & MF_DISABLED) | ( state & MF_GRAYED );<br />
pCmdUI->Enable( ! ( state > 0 ) );<br />
|
|
|
|
|
Does anybody have any idea or sample code for grabbing text from a window with class AfxWnd42s(shown by Spy++). This seems to be a customised window and the text seems to have been painted in the window screen. Normal methods of text grabbing like WM_GETTEXT, WM_COPY etc do not seem to work.
Any help will be much appreciated.
Thanks
|
|
|
|
|
Hi
Does anyone know how to get on of the buttons on a toolbar to flash ?
or the best way to go about it
Thanks
Si
|
|
|
|
|
You need to display bitmaps for a button alternately.
The following code changes the bitmap of one button.
TBBUTTONINFO bi;
memset(&bi,0,sizeof(TBBUTTONINFO));
bi.cbSize = sizeof TBBUTTONINFO;
bi.dwMask = TBIF_IMAGE;
bi.idCommand = ID_FILE_OPEN; // Command ID of the button.
bi.iImage = 4; // The index of the bitmap to display.
m_wndToolBar.GetToolBarCtrl().SetButtonInfo(ID_FILE_OPEN,&bi);
Handle the OnTimer() for CMainFrame. In it, display the new bitmap, and the old one alternately. This will give flashing effect.
You can add more images to the toolbar using:
m_wndToolBar.GetToolBarCtrl().AddBitmap();
Of course this code is not perfect.
this is this.
|
|
|
|
|
i want a text in this format...
CString cstr;
cstr= "Value of X =";
int i=10;
cstr +=i \\ how do u add int here?
so the output should be "value of x=10"
regards,
Rookie
|
|
|
|
|
Hi,
You can use itoa function for that
CString s = "Value of x= ";
int val = 10;
char cVal[2];
itoa(val,cVal,10); //Third parameter in this is the base for the conversion, for decimal it is 10.
s += CString(cVal);
Hope it will work.
Ritu Kwatra
|
|
|
|
|
Hi,
the best way to do this is to use the Format member function of the CString object.
This function has the same formating param as the 'C' sprintf function.
code:
CString cstr;
int i = 10;
cstr.Format("Value of X=%d", i);
Hope this is what you want.
Regards,
Kurt Pattyn
codito ergo sum
|
|
|
|
|
i tired both the other ways it worked... but i actually wanted in this way.
cstr.Format("Value of X=%d", i);
and it worked .. thanks guys..GoodKarma
regards,
Rookie
|
|
|
|
|
CString cstr;
cstr= "Value of X =";
int i=10;
CString csIVal;
csIVal.Format("%d",i);
cstr += csIVal;
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
oooops, marc.. atlast i'm going by ur way.. no other go...
thanx , thanx
can we do like this any way?
CString msg;
msg="value of x=";
int num;
num=5;
Msg.Format(Msg,"%d", num);
output should be --> "value of x:5"
but its printing only --> "value of x"
regards,
Rookie
|
|
|
|
|
That's because you are not doing anything with msg.
Format takes the first parameter (format-control string) and replace each % formatte part with the other parameters. So if you write:
Msg.Format(Msg,"%d", num);
It'll write the Msg as it was before the call, because there isn't any format-control string as Msg doesn'thave any %. If it'd had any, it'd had replaced by "%d" and "num" values.
void Format( LPCTSTR lpszFormat, ... );[^]
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
hi
i want to write an application for the desktop sharing, any body can help me or any link or article will be appreciated
ddd
|
|
|
|
|
What do you mean between users, remote computers ???
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
yes
its bw remote computer through the clinet server architacture.
ddd
|
|
|
|
|
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
what so funny!
ddd
|
|
|
|
|
Well you obviously have to capture the screen, the keyboard and mouse, so for the keyboard and mouse i would use some kind of windows hook
If you want it to run as in the remote desktop connection then it would simply been a couple of hooks, but if you want the local user to still have control then it gets a tad more complex
|
|
|
|
|
any article or the link that can guide me toward this. i mean api's to capture the screen and how to hook the key board and mouse.tt
ddd
|
|
|
|
|
Hi
I have the following code:
int x=100;
CString s;
s=x;
I need to put the number 100 in s how?
/\|-||\/|/\|)
|
|
|
|
|
itoa(number,char*,10);
CString cs;
cs=char;
V
|
|
|
|
|
Halawlaws wrote:
I need to put the number 100 in s how?
s.Format("%d",x);
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
u can use the CString function Format
CString s;
s.Format("%d",x);
"Don't forget to rate the solutions, if they help you.
|
|
|
|
|
This theoretical snippet of code would be within the PreHandleEvent function of my MSHTML EditDesigner object (IHTMLEventObj* pIEventObj is one of the parameters).
IHTMLDocument2* pDoc;<br />
IHTMLElement* pElem;<br />
IDispatch* pDisp;<br />
pIEventObj->get_srcElement(&pElem);
pElem->get_document(&pDisp);
OK, so I supposedly have a pointer to the Document. But what I don't understand is how do I then use that IDispatch pointer to invoke the methods available through the IHTMLDocument2 object?
Specifically, I'm trying to use the IHTMLDocument2 object's "elementFromPoint" method to retrieve IHTMLElement objects from specific points within the client area.
I'm clearly missing some cast that I need to do.
|
|
|
|