|
Yes, these are wrapper classes. If you don't want to use them, I recommend you look at their source code to get some ideas for how to accomplish what you need.
Regards,
Alvaro
All you need in this life is ignorance and confidence, and then success is sure. -- Mark Twain
|
|
|
|
|
I have (hopefully) set up the menu for NOTIFYBYPOS.
In the cpp file, I want to add a message map entry for a menu item thats got no ID.
I have put in
afx_msg void OnMenuCommand( WPARAM wParam, LPARAM lParam);
in the h file
When the dynamic non-ID bearing menu items are clicked, I want to trap the WM_MENUCOMMAND issued.
I'm thinking
ON_COMMAND(<code>WHat_Goes_Here</code>, OnMenuCommand) ...
In the usual ON_COMMAND they have an ID_SOMETHING as the first parameter to this map statement...
Appreciate your help,
ns
|
|
|
|
|
I put in a dummy ID_DUMMY1 for all my dynamic menu items created on the fly and used that in the ON_COMMAND. But its not bringing in the right index - its a huge positive integer. BTW, if I name another actual physical menu item ID_DUMMY1 created before I even do the notifyposition stuff, it still responds to the OnMenuCommand!!!! SO something isnt right with my message map....I may be totally off the mark here. I am thinking if I make the submenu under the toplevel "mapdyn" NOTIFYBYPOS, every one under it will trigger the index handler. But maybe I cant make it NOTIFYBYPOS since its already created in the resorrce editor?
In my menu "mapdyn" I already have one existing physical submenu item since i wasnt able to get GetSUbMEnu(pos) without it being present.
CMenu* mmenu = ((CMainFrame*)AfxGetMainWnd())->GetMenu();
int pos = ((CMainFrame*)AfxGetMainWnd())->FindMenuItem(mmenu, "mapdyn");
if (pos == -1)
return;
CMenu* submenu = mmenu->GetSubMenu(pos);
HMENU m_hMenu = submenu->GetSafeHmenu();
MENUINFO mi;
mi.cbSize=sizeof(MENUINFO);
mi.dwStyle = MNS_NOTIFYBYPOS;
SetMenuInfo(m_hMenu, &mi);
submenu->AppendMenu(MF_STRING, ID_DUMMY1, "From M1");
submenu->AppendMenu(MF_STRING, ID_DUMMY1, "From M2");
submenu->AppendMenu(MF_STRING, ID_DUMMY1, "From M3");
void CBKView::OnMenuCommand(WPARAM wParam, LPARAM lParam)
{
CString a;
a.Format("index is %d", wParam);
AfxMessageBox(a);
}
Appreciate your help,
ns
|
|
|
|
|
I have implemented a Property Sheet with multiple property pages. I have set a few buttons on one of my pages and can't seem to get a handle to allow me to disable (grey) the button. I know I am doing something wrong and can't figure it out so please point me in the right direction. Sample code or correcting mine would help the most.
<br />
CWnd *pWnd = AfxGetMainWnd();<br />
CButton* pButton = (CButton*) pWnd->GetDlgItem(IDC_ENGINE_LIGHT_DELETE);<br />
pButton->EnableWindow(FALSE);<br />
Thanks!
John Hagen
|
|
|
|
|
This worked for me with list controls
from within your propertysheet class:
CMyPropertyPage m_myPage;
CButton* pButton = (CButton*) m_myPage.GetDlgItem(IDC_ENGINE_LIGHT_DELETE);
pButton->EnableWindow(FALSE);
|
|
|
|
|
That works for me, too, though I normally handle the button management local to the propertypage, so don't have the m_myPage indirection, e.g.
CButton* m_rbFile = (CButton*) GetDlgItem(IDC_BUTTON);
m_rbFile->EnableWindow(FALSE);
Debbie
|
|
|
|
|
Hi Debbie,
Thanks for the code. It worked perfectly. I appreciate youtaking the time to post help to my question.
John
|
|
|
|
|
Thanks for the sample code. It is what I needed to get over this minor hurdle. I appreciate your time and effort.
John
|
|
|
|
|
Hiya, I have a very old C Compiler( the usual NMAKE stuff!! ) that compiles very old dos based programs. The programs are very old but very good..so I like messing around with them and changing them..Sad I know but it helps me practice my programming...
Does anyone know a way of using Microsoft Visual C++ 6.0 to compile up such programs, instead of using the old C Compiler??
If anyone knew this it would be a great help to me..
Thanks,
grahamoj
|
|
|
|
|
depends how old they are, some dos staff might not be supported anymore. What is wrong with the old compiler? If all you want to do is to use VC, in VC 7 you can specify custom compiler (non MS), in VC 6 you can check "Always use custom build step"
|
|
|
|
|
Hiya using the old C Compiler is ok but abit crap because I would like to use 6.0 to be able to compile the old dos programs and my new stuff, instead of continually changing between the two ...
I know Visual 6.0 is a Windows based compiler, but surely it can do this.
Were is the "Always use custom build step" and what exactly I am checking it for??
thanks,
grahamoj.
|
|
|
|
|
1. The steps I mentioned are to use 3rd party compiler from VS 6 and 7. Project settings is the place to configure it.
2. If talking about 16-bit dos, it most probably would not compile with 32-bit MS compiler. If your code is 32-bits - just create a project and add your files there. There could be some dependencies missing (include directories, libraries etc.) but it is easy to configure in project settings.
I guess I do not understand what exactly is the problem with converting(adapting) the code.
|
|
|
|
|
Hi, can I get the height in point size (not logical size) from a font ?
LOGFONT lf;
GetFont()->GetObject(sizeof(lf),&lf);
return lf.lfHeight;
From MSDN:
lfHeight - Specifies the height, in logical units
Thx for help, Moak
|
|
|
|
|
PointSize = lfHeight * 72 / GetDeviceCaps(hDC, LOGPIXELSYS);
Kuphryn
|
|
|
|
|
thx, could you give a reference where you have this information from + how does this work?
|
|
|
|
|
Here is the source on MSDN.
lfHeight = -MulDiv(PointSize, GetDeviceCaps(hDC, LOGPIXELSY), 72);
Solution:
PointSize = lfHeight * 72 / GetDeviceCaps(hDC, LOGPIXELSY);
Kuphryn
|
|
|
|
|
Thanks
|
|
|
|
|
Hello,
Do you have any idea how to create shadow run time? I would like to generate shadow thumbnails in my application.
Thanks,
H.S.Ngai
|
|
|
|
|
draw a black rectangle, blur it, draw the image on top of the blurred rectangle.
Image processing
|
|
|
|
|
Cut off your thumbnail and hold it under a light. Look underneath the thumbnail, and you'll see a shadow...
Sometimes, I have all the right answers...
------- signature starts
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
Please review the Legal Disclaimer in my bio.
------- signature ends
|
|
|
|
|
I'm building an application that will use a XML file as a document. The application will simply load the document and allow the user to edit it - adding nodes here and there. The editing will be done in custom controls, so I'm not looking for a generic XML editor...
My question is this: would it be wise to use the DOM as my document? That is, would my CDocument-derived class simply maintain and update an IXMLDOCDocument? Or would it be better to load the XML then convert to an internal format (converting on save as well)?
J
May the bear never have cause to eat you.
|
|
|
|
|
Use the DOM, much less work. Its generaly wise to only have a single model of your data, and the DOM is about the best way to represent an XML document. It would probably be good to have your controls directly editing nodes too.
Ryan
They read good books, and quote, but never learn
a language other than the scream of rocket-burn.
Our straighter talk is drowned but ironclad;
elections, money, empire, oil and Dad.
|
|
|
|
|
Ryan S Roberts wrote:
Use the DOM, much less work. Its generaly wise to only have a single model of your data, and the DOM is about the best way to represent an XML document. It would probably be good to have your controls directly editing nodes too.
This is what I figured. Thanks for the input!
Ryan S Roberts wrote:
They read good books, and quote, but never learn
a language other than the scream of rocket-burn.
Our straighter talk is drowned but ironclad;
elections, money, empire, oil and Dad.
Hmmmm... Where is this from?
J
May the bear never have cause to eat you.
|
|
|
|
|
I need to take an input string of something like "one thousand, 2 hundred and 54" and turn that into 1254 as an integer. I know how to write an algorithm to do this, but I am hoping someone can point me to one that already exists.
Ideally, it would be C++ and non-MFC.
Thanks,
Matt Gullett
|
|
|
|
|
If you know a solution, then implement it. Originality has its advantages including experience.
Kuphryn
|
|
|
|