I have a CDateTimeCtrl on my dialog. Through this I can choose any date in given range from drop down. But currently user is also allowed to press numeric keys to set the date. Is there any way to stop user from typing in it. I want, he should only be able to select the date from drop-down and I don't want to disable the control.
I have checked the "AllowEdit" property but that is different thing. Currently it is set to false.
Thanks Jochen, you are right. That way it will work. But for such a small requirement, I don't want to do big changes and also I don't want to go for pretranslate message. Is there any way to handle WM_CHAR/OnChar events for the date control on the same dialog class?
You are using MFC, so you don't need to handle PreTranslateMessage(). Just use the wizard to derive a class, use the message properties to add the WM_CHAR handler, and comment the line calling CDateTimeCtrl::OnChar(). Done with a few mouse clicks. All you need to type in using the keyboard is the name of the drived class, the comment chars, and replacing the CDateTimeCtrl by your class name in your code.
The edit control of CDateTimeCtrl is not accessible. So it can't be done in the dialog. Even when it would be possible: It is always better to perform such things in the control rather than in the dialog. So it must be done only once and not within every dialog that uses such a control.
After this statement,m_pImage = new Image(szFile, FALSE)
the m_pImage is NULL, I do not know why create Image failed, after debug that I find that the szFile is a right PNG image file path.
The last code used in a CDialog form, I use the CDialog::DoModel() to show this dialog in the
I do not know whether I use this class Image too early, or I need use some code to initialize the GDI+ library?
I have a console application, that create a dialog box to show a progress bar. This has worked fine for years (it started as a Visual Studio 6 project, then I migrated it to Studio 2005) Now, I have migrated it to Studio 2010. It still works fine under Windows 7, but under XP, the dialog box returns -1, with a GetLastError() of 0. When I look at the messages sent to the dialog box, then I see WM_SETFONT, followed by WM_DESTROY and WM_NCDESTROY. I call it as
DialogBox (hInstance, MAKEINTRESOURCE (IDD_MAPPER), HWND_DESKTOP, DialogProc), where DialogProc is defined as
Also, please check if you still using the manifest loaded via RT_MANIFEST resource. You need to delete this from resource and use the project settings. VS2010 has a habit of assigning RT_MANIFEST to 2, making the program unusable under XP.
And of cause you need to check this linker option: MinimumRequiredVersion. It should be 5.00.
There is no RT_MANIFEST mentioned in the resource Also, the MinimumRequiredVersion is left blank, so I don't expect any difficulties there!
In any case: the program itself runs and it does everything up untill the point that I start the dialog box. (and everything after that dialogbox crashes) There are a number of log statements before and after and I see everyone of them. Only everything that occurs from within the dialogbox doe not appear in XP.
I did code to draw curves using PolyBezier function. now I want to allow user to draw it using the mouse but I do not know how I can do it how I specify the control points for the curve while user draw the curves using mouse??
can you help me in doing this did lots of search without any result
It depends on what you want. You could, for instance, let the user draw the curve, extrapolate control points from the drawn curve (aka x,y positions that the mouse went through), and then use them to calculate a smooth curve. Or you could have the user draw a line, then click a point on that line to create a control point and allow them to move that point. I've seen both.
Last Visit: 31-Dec-99 18:00 Last Update: 29-Jul-16 1:24