|
Yes, I know this message, but how do I implement that message handler in the message_map and in the code of the parent dialog of each CWnd?
Thank you in advance...
|
|
|
|
|
After your post i cqn imagine you're writing plain Win32 and not MFC ... and i'm not that familiar with Win32 without MFC's. (if you are using MFC, post your code).
But :
The message (WM_LBUTTONCLICK) can surely be intercepted within the message pump of the parent window. Do check if your CWnds notifies something to their parents. When not, you can intercept the click in your CWnd, and then send a user msg to the parent one.
Repost your question if you don't find the answer, people will help you.
~RaGE();
|
|
|
|
|
How can I prevent user to choose date/time less than NOW in DateTImePicker control?
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
handle the notify message DTN_USERSTRING,get the time user selected
compare it with now time, do your business.
|
|
|
|
|
Thanks for reply,but it seems that this notification is never called.Is there any trick for it?
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
hi,
Use dateTimePicker1.MinDate = new DateTime(1985, 6, 20);
The minimum date and time that can be selected in the control. The default is 1/1/1753 00:00:00.I haven't used it, but i guess it works..
cheers
Himanshu
|
|
|
|
|
xxhimanshu wrote:
dateTimePicker1.MinDate
Thats .NET way.It does not exist in MFC.Does it?
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
:-Osorry!!! i guess that doesn't exist in MFC. What my guess is you just write into onclick or mouseover event some code that invalidates when user wants to change the date ec. to some previous date.That should do what you want to.
cheers..
Himanshu
|
|
|
|
|
Hi all,
I want to insert a tabbed dialog on my menu's option but can't find anything good. Don't know how to use property sheets either.Can anyone please help..
thanks in advance..
Himanshu
|
|
|
|
|
How to use property sheets:
NOTE:
the previous message is a llitle weird (at the beggining because it is pasted from a question that I've answered some time ago...) here's the normal one...
-> First of all excuse my English
You must create the property sheet class:
1. Menu insert -> new class.
2. Type the new class name.
3. Select the CPropertySheet base class.
Now you have the property sheet created, but this won't have any tab (property page).
To create pages (PropertyPages) you will have to:
1. Create a dialog resource (a normal dialog)
2. in the dialog properties select:
2.1. (Tab styles) Style = child
2.2. (Tab styles) Border = thin
2.3. (Tab styles) checked Title Bar (the other options in this tab must be unchecked)
3. Doubleclick the dialog (in order to create a new class for it)
3.1. Write the new name of the class.
3.2. Select the CPropertyPage base class.
Now you have created a property page and a property sheet, you can create all the property pages you want. (Surely there will be a limit of property pages, I don’t know it…)
Now you have to insert the property pages to the property sheet.
In order to do that:
Make sure that you have included the header files of the PropertyPages in the header file of the Property Sheet:
<br />
#if !defined(AFX_PSPARAMETRITZACIONS_H__8CB4FA88_5A89_4479_A479_4734680B1775__INCLUDED_)<br />
#define AFX_PSPARAMETRITZACIONS_H__8CB4FA88_5A89_4479_A479_4734680B1775__INCLUDED_<br />
<br />
#if _MSC_VER > 1000<br />
#pragma once<br />
#endif // _MSC_VER > 1000<br />
<br />
#include "PPDlgParametritzacions.h" <br />
…<br />
And you should add a PropertyPage variable for each PropertyPage that you want to add:
CPropertyPageClassThatYouWillHaveAdded m_CPPCTYHA;
In the constructor of the Property sheet class you should add the PropertyPages:
this->AddPage(&m_CPPCTYHA);
And that’s all…
(Just kidding…)
You will need to call the Property sheet:
In order to do that:
You should include the CMyPropertySheet class (header file) to the header file of from where you want to include the property sheet call.
Add a variable of the type CMyPropertySheet in the same class (dialog or xxx) from where you want to call the property sheet:
CMyPropertySheet m_MyPropertySheet;
(In order to try it you can create a CButton in a dialog) and in its click event you can call
m_MyPropertySheet.DoModal();
Hope this helps...
Its possible that I have done a typing error or that I have missed something, if this don't works, email me (or try it by yourself...).
|
|
|
|
|
Have a look in the MSDN, it is _really_ easy to use PropertyPage and PropertySheet, but _long_ to explain in a post
~RaGE();
|
|
|
|
|
I have get a Torica TSK-U CMOS fingerprint reader.
And I would like to capture fingerprint image from the reader.
Any method to get thw image?
I just have the .inf and .sys for the driver only.
What do I need do??
Million Thanks!!!!!!
|
|
|
|
|
How do I convert a CString to a float without losing any precision? When I do the following I lose precision.
CString strFloat = _T("0.5");<br />
char buf[20];<br />
for(int i=0; i<20; i++)<br />
buf[i] = NULL;<br />
<br />
sprintf(buf, "%s", strFloat);<br />
float nResult = atof(buf);<br />
Thanks,
-Eric
|
|
|
|
|
you can do it like this
CString str(_T("0.5"));
float fResult = atof(str);
|
|
|
|
|
ashxly wrote:
you can do it like this
CString str(_T("0.5"));
float fResult = atof(str);
Nope, get a compile error i I try that. I have also tried _wtoi and _wtol but they lose precision also.
-Eric
|
|
|
|
|
Consider atof(theString.GetBuffer(0)).
Kuphryn
|
|
|
|
|
kuphryn wrote:
Consider atof(theString.GetBuffer(0)).
Nope, I get the same error with this. Can't convert CString to const char *.
There has to be a way to convert a CString to a float without losing the precision. It shouldn't be this hard I wouldn't have thought.
-Eric
|
|
|
|
|
Consider const_cast.
Kuphryn
|
|
|
|
|
What error are you getting? The code provided by ashxly should work. You should get a compiler warning that says
warning C4244: 'initializing' : conversion from 'double' to 'float', possible loss of data
That is because atof returns a double...the warning will go away if you change float fResult to double fResult. OR cast the return value from atof to float.
_wtoi and _wtol are no good for your purpose...they will both truncate to an integer.
Gary Kirkham
A working Program is one that has only unobserved bugs
|
|
|
|
|
CString str(_T("0.5"));
float fResult = atof(str);
the code work well.
certainly , if you use UNICODE,
you'd better use wtof(str) instead
can you tell me the error info?
|
|
|
|
|
What about
float fResult=atof((LPCTSTR)str);
~RaGE();
|
|
|
|
|
;)Rage is right This should dp the work work.
cheers
Himanshu
|
|
|
|
|
Rage wrote:
float fResult=atof((LPCTSTR)str);
This gives the following error:
error C2664: 'atof' : cannot convert parameter 1 from 'const unsigned short *' to 'const char *'
I apologize ahead of time if this makes a difference, but I am compiling this under PocketPC 2002 SDK.
After working somemore lastnight I figured out part of the issue. In my orginal code the call to sprintf() is always returning zero into buf. It works just fine if the user has an whole number in strFloat, but once they enter a decimal number it blowsup, only returning zero into buf.
Thanks for all the help folks. I honestly didn't think this would be that difficult.
-Eric
|
|
|
|
|
The problem is you are working with UNICODE strings and trying to use the ANSI conversion routine. That is just silly. As people have already said, use the UNICODE conversion routine "wtof".
float fResult = wtof (str);
That will work just fine.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Tim Smith wrote:
The problem is you are working with UNICODE strings and trying to use the ANSI conversion routine. That is just silly. As people have already said, use the UNICODE conversion routine "wtof".
float fResult = wtof (str);
That will work just fine.
Tim Smith
Tim,
Thanks for the suggestion. The wtof function works fine, but it truncates the value to a whole number. I lose the precision after the decimal if I use this function. I need a value going out only to the tenths, but I do need to keep the one decimal place.
-Eric
|
|
|
|