|
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
|
|
|
|
|
If I open up an image in an MFC application, how can I get the pixel value of the picture that the mouse is pointing at?
|
|
|
|
|
get current mouse pointer position, and then call
COLORREF color = GetPixel(hdc,x,y);
the value of color is what you want.
it's easy , is it?
good luck
|
|
|
|
|
I am developing a 3D program with DirectX 7.0 SDK. When I have rendered some objects in a 3D scene, I need pick the oject accurately in the scene via my mouse position on the screen. I need your help, and in the fact, I need some source codes. Help!
stanley
|
|
|
|
|
Basically, you can compute the equation for a line between the eye and the near plane at the X,Y location that the user clicked. Then shoot the ray from the eye through the near plane and see what object it intersects.
There are many other methods around. Places like http://www.gamedev.com/ and http://www.flipcode.com should have information on how to do this. Common problem in games.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I've searched google groups but all I find is "that cant be done". Well, of course it can - and one of you know how to do it.
When you map a network share as a drive, it will be called
[sharename] on [servername] ( n: )
- by default. (n being the drive letter)
If you select properties on a mapped drive, you can change that label to anything, e.g. to "documents" in the "Label:" edit field. (only on w2k, winXP), but since I map my drives from a batch-file being run at each startup, I wan't to change that name programatically. All vb-script offers (don't laugh, please...;P) is ShareName and VolumeName, which are both read-only and respectively e.g. \\server\share and "datadrive2" (that is, the name of the harddisk-partition on the server... why the heck is that visible ???) - so I probably have to write a small exe that can do the job.
Has anybody tried this ? Or do anybody have a good idea how to find out how it's done ? Maybe I'm just searching the wrong places...
Well, any help will be much appreciated - thanks a lot in advance.
/Jan
|
|
|
|
|
I have two signals (for example two voice signals) . And i need to put them one by one, and smooth (or interpolate) possible differences between the end of first signal, and start of another one ..
How can i handle with it ?
Thanks in advance .
|
|
|
|
|
That depends on the relationship between the two signals. Are they partially overlapped, sequential with a fixed or variable delay between them, or sequential with no delay (first sample of a given stream is one sample after the last sample of the prior stream)?
|
|
|
|
|
It's most close to the "partially overlapped" signals ..
so what can you propose to me ?
thanks
|
|
|
|
|
The answer is simple, but I don't want to lead you down the wrong path. More information is needed to determine the correct solution. When you say it's "most close" to partially overlapped, what do you mean? You said this is DSP, so I assume that you're receiving chunks of buffer from an input source. If that is the case, you shouldn't need to worry about overlap or delay between the buffers, and a blunt join of the buffers would be appropriate and wouldn't cause a pop in the audio stream since the two buffers are chunks of a uniform stream. If you have two audio files from independent sources which you wish to connect, or wish to transition from one live audio source to another while receiving data streams from both, then do a linear crossfade as Tim Smith indicated. At the beginning of the fade, the audio source to be faded out is at full volume, the one to be faded in is at zero volume. At the midpoint of the fade, each audio source is at half-volume. At the end of the fade, the one fading out is at zero volume and the one fading in is at full volume. The multipliers go from 1.0 to 0.0 and from 0.0 to 1.0 linearally. Just multiple each sample across the fade by the multiplier for that buffer, and add it to the sample from the other buffer times its multiplier. At each sample, the sum of the two multipliers is 1.0 (full volume).
|
|
|
|