|
|
This is how i have inserted an menu and it works fine
// tried for a dialog
// ID_MYMENU NEWMLY ADDED MENU ID
CMenu *Menu =this->GetSystemMenu(FALSE); <br />
Menu->InsertMenu( 3 , MF_BYPOSITION, ID_MYMENU, "&Insert in 3 Place");<br />
map this <br />
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra,AFX_CMDHANDLERINFO* pHandlerInfo <br />
);<br />
nCode check for <br />
if(nID ==ID_MYMENU) &&( nCode == CN_UPDATE_COMMAND_UI)<br />
{<br />
( ( CCmdUI* ) pExtra)->Enable( TRUE );<br />
}<br />
Regards,
FarPointer
-- modified at 12:28 Sunday 2nd April, 2006
|
|
|
|
|
|
oh yes i forgot ,so in such case if i want to handle the OnCmdMsg(...)
wat ami supposed to do .
Regards,
FarPointer
|
|
|
|
|
Hi FlyWithYou,
maybe it is some helpful to you
#define IDC_TEST 1000
HMENU hmenu,hMenu2;
hmenu=GetMenu(hWnd);
hMenu2=GetSubMenu(hmenu,0);
AppendMenu(hMenu2, MF_STRING|MF_ENABLED, IDC_TEST, "111");
case WM_COMMAND:
switch (wmId)
{
case IDC_TEST:
MessageBox(hWnd,"test",NULL,MB_OK);
break;
...
...
|
|
|
|
|
But the menu item not enabled, how to click.
|
|
|
|
|
FlyWithYou
I tested for your question(why the menu item is gray and disabled, cannot click)
I write this code then test it and it's not gray
do you use this code?
|
|
|
|
|
Hello,
In addition to catching the WM_CLOSE event, I would like to disable the close icon on the dialog title bar when some critical section is being parsed in my application.
Is this possible?,
For those that use Nero Burning Room, when you are burning a CD/DVD, the close icon on the dialog title bar is dissabled.. How can be this done under MFC?
http://img82.imageshack.us/img82/1588/disableclose7uy.gif[^]
I guess that the style of the window is changed with SetWindowLong() , but I don't manage to find how.
Thanks in advance.
-- Ricky Marek (AKA: rbid)
-- "Things are only impossible until they are not" --- Jean-Luc Picard
My articles
|
|
|
|
|
disable the related menuitem in the system menu and the button will be disabled at the same time...
|
|
|
|
|
|
GetSystemMenu(FALSE)->RemoveMenu(SC_CLOSE, MF_BYCOMMAND);
|
|
|
|
|
RemoveMenu or ModifyMenu.
Regards,
FarPointer
|
|
|
|
|
of course Fisrt Hi FarPointer
whats the problem?
|
|
|
|
|
he doesnt wants to remove it all he wants is to disable it .
Regards,
FarPointer
|
|
|
|
|
yes (he wants only disable)
|
|
|
|
|
It is so simple when you know it
-- Ricky Marek (AKA: rbid)
-- "Things are only impossible until they are not" --- Jean-Luc Picard
My articles
|
|
|
|
|
--------------------------------------------------------------------------------
hello ,
can u tell me one this ,
is there any point in MDI application u newly created with CrichEditView base class and execute it and then write something on editor and it will find left to right . how i can find right to left .
????
in my application reverse happen , it is finding right to left but i want to find left to right
thanks in advance
sachin gupta
|
|
|
|
|
I am a novice c programmer. My programs are very floating point intensive - some can take days to run. Most of the CPU time is spent in long loops doing various tasks. I would like to know what the best way of optimising this sort of program for dual cpu processors is. It would be possible to break the loop into 2 bits. I'm guessing it has something to do with multithreading.
Do dual cpu machines automatically distribute the load without specific coding?
|
|
|
|
|
Windows does distribute threads of execution between multiple processors. You need to be careful, however. If your algorithm requires that you use thread synchronization primitives like critical sections, mutexes, or other types to synchronize the two threads, your application can end up running slower.
Software Zen: delete this;
|
|
|
|
|
m_581 wrote: I would like to know what the best way of optimising this sort of program for dual cpu processors is.
Multithreading is an advanced topic.
Without seeing the code, and understanding the problem the app is trying to solve, nobody is going to be able to you an answer.
Start reading up on multithreading topics.
VS2005 has also added support for OpenMP:
http://msdn.microsoft.com/msdnmag/issues/05/10/OpenMP/[^]
m_581 wrote: Do dual cpu machines automatically distribute the load without specific coding?
Not the way you want.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
i can't understand that how sscanf() take any number of param we want. When i see it definition, i see that it prototype is something like this:
sscanf(char *xx,char *yy,...);
I wonder: can we write a function that can take any param like sscanf();
Thank you very much!
|
|
|
|
|
following is one function I coded before, I simplify it now, please have a look:
sz is definded as char sz[1000] bellow:
in real code, sizeof sz should be dynamically alloced.
in C++, params of a function are ordered in memory.
//---------- function
BOOL MyFormat(const char*pszFmt,...)
{
//align to sizeof(int) for args after pszFmt
const char*pszArg=(char*)&pszFmt+((sizeof(pszFmt)+sizeof(int)-1)&~(sizeof(int)-1));
int iBuf=_vsnprintf(sz,999,pszFmt,(char*)pszArg);
if((iBuf>=0)&&(iBuf<1000)) return 1;
sz[0]=0;
return 0;
}
//-----------------
I deleted too many lines, if it doesn't work, i will test again for u, above is an idea only - but I guess it works.
A special image tool for Windows C++ programmers, don't miss it!
The world unique Software Label Maker is waiting for you and me ...
A nice hyper tool for optimizing your Microsoft html-help contents.
-- modified at 4:05 Sunday 2nd April, 2006
|
|
|
|
|
Hey, I guess the address of the params in function are placed together,it's right? So I write this code and it works:
int fun(int x,...){
int *next = (int*)(&x+1);
cout<<*next<
|
|
|
|
|
Yes you can , the three ... after the second comma stands for elippse notation which means the function can take any number of params ,
fun(int ,int ,...);
This means the fun function will take a minimum of two args and if wanted can take any number of other types of args also .
Regards,
FarPointer
|
|
|
|
|
Look at the va_start() , va_arg() and va_end() macros.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|