|
All items are grayed out, why?
void CMyFrameWnd::OnRButtonUp(UINT nFlags, CPoint p)
{
CMenu menu;
menu.CreatePopupMenu();
menu.AppendMenu( MF_STRING | MF_ENABLED , 700 , "Zoom All" );
menu.AppendMenu( MF_STRING | MF_ENABLED , 701 , "Properties" );
ClientToScreen(&p);
menu.TrackPopupMenu(TPM_CENTERALIGN,p.x,p.y,this,NULL);
CFrameWnd::OnRButtonUp(nFlags, point);
}
|
|
|
|
|
Do you have a handler function for menu items 700 and 701?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
No I am overriding OnCommand()
For CWnd's this seems to be enough - maybe for CFrameWnd's it's not enough?
|
|
|
|
|
MFC's framework will disable menu items for which a handler has not been provided. There is no way for it to know that you are handling menu item requests from within OnCommand() .
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
So I shouldn't override OnCommand(), instead I should create a handler?
ON_COMMAND_RANGE( 700 , 701 , OnMenuCommand )
afx_msg void OnMenuCommand ( UINT nID )
I just wonder - why is OnCommand() virtual then?
|
|
|
|
|
You can add onupdatecmdui handlers for each id and then use oncmommand, I do this a lot.
John
|
|
|
|
|
Jesper Knudsen wrote: So I shouldn't override OnCommand(), instead I should create a handler?
That's how I would proceed.
Jesper Knudsen wrote: I just wonder - why is OnCommand() virtual then?
It has its purpose. My most recent use of it was on a property sheet. I needed to handle the clicking of the OK button.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
Thank you for your help, it works with the handler - still I wonder, still I wonder..
|
|
|
|
|
|
I'm using a class derived from CHtmlView as listview in an internal Folder
Browser of my application.
Exist a facility to hide the left blue task pane (if user have activate this
feature in Folder Options)?
Another fine feature will be, to set the "list" as active default view in my
application (may be the user has set "icon" as default). Any idea?
Thx for help
|
|
|
|
|
Check out this article[^]
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
I dont want integrate html in my view and i dont want use a own written class derived from CView. I use the CHtmlView. This is the starting point. And i use this class for File browsing (Navigate2(pidl)).
Thx, for you comment, but this artikel was not what im locking for (or did i have some overlooked??)
|
|
|
|
|
Hi,
I've created a dll (C++) containing several functions, which are used inside an Excel-VBA-Project via dll-calls.
What I want: when the dll is loaded into memory (i.e. when one of the functions is executed first time), a general function should be executed (purpose: check licence information etc.).
Is there an event, which is triggered when the dll is loaded ?
TIA M.
|
|
|
|
|
BOOL WINAPI DllMain(
HINSTANCE hinstDLL,
DWORD fdwReason,
LPVOID lpvReserved
);
fdwReason -> DLL_PROCESS_ATTACH -> The DLL is being loaded into the virtual address space of the current process as a result of the process starting up or as a result of a call to LoadLibrary. DLLs can use this opportunity to initialize any instance data or to use the TlsAlloc function to allocate a thread local storage (TLS) index.
|
|
|
|
|
I would like to know how to pass CStatic as normal variable to member function?
When I try to do it, I will get a message
"cannot convert parameter 1 from 'class CStatic' to 'class CStatic'"!
Please help!
|
|
|
|
|
Post the code.
Why do you want to pass a CStatic variable to a member function ??
|
|
|
|
|
I have some repeatly process which will use serveral CStatic variable.
How can I make a member function to do it?
Please help!
|
|
|
|
|
Either use a pointer or a reference.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
You beat me. :P
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
(Off the top of my head guess)
CStatic might not have a copy constructor.
Try declaring the function as
void FuncX (CStatic &MyStatic);
- or -
void FuncX (const CStatic &MyStatic);
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
It's working now!
Thank you very much!
|
|
|
|
|
hi can anyone tell me
how can i get & send data to
a USB port from a VC++ application
thank you
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
You do not send data to the USB port, you send data to the device attached to the USB port.
The tigress is here
|
|
|
|
|
Logically true
I have an embeded device attached to the USB my
work is to ensure the data reach to the port rest
is the firmware developers work.
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Communication on the USB port is made through a device driver. So, you need to get a handle to this driver (with CreateFile) and then use some IO commands (with DeviceIOControl). Normally you should have a driver with your device and the doc that goes with it.
-- modified at 8:13 Wednesday 9th November, 2005
|
|
|
|