|
laiju wrote:
I was told to do that by deriving CEdit class and capturing the OnChar event then.Can anoyone clarify exactly how this can be dealt with.
Use ClassWizard (Ctrl+W) to derive a new class from CEdit .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I have inherited a class from CEdit as show below
class CEditValidate : public CEdit
{
DECLARE_DYNAMIC(CEditValidate)
public:
CEditValidate();
virtual ~CEditValidate();
protected:
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
};
Now can u let me know how I can use this OnChar handler for validating the characters keyed into the edit control in my property page.
laiju
|
|
|
|
|
laiju wrote:
Now can u let me know how I can use this OnChar handler for validating the characters keyed into the edit control in my property page.
Simply modify that method to allow/disallow the characters. You did not specify what characters you wanted to keep/discard.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I get what you say. But the OnChar handler is not invoked at all when I type characters into the Edit control in my property page. I dont understand how to use the newly inherited class for my edit control in the property page.
laiju
|
|
|
|
|
laiju wrote:
But the OnChar handler is not invoked at all when I type characters into the Edit control in my property page.
Probably because you are not using the newly created class. Modify the page's .h file to use it instead of CEdit .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I understood the concept now.
I changed CEdit to the class I newly inherited .
I manually changed them as below and it works.
CEditValidate m_Width;
CEditValidate m_Height;
Thanx once again.
laiju
|
|
|
|
|
Hi everybody,
I have drawn a line with LineTo.
Now, I want to perform the functionality that if I click upon the Line, it will write a TRACE saying : OK, you have clicked upon it... I mean, I want to know how to know if a point belongs or not a line. I have to do the same with several lines,distinguishing them from the others.
Thanks you very much
Javi
|
|
|
|
|
You have the line coordinates (x1 , y1 ) & (x2 , y2 ). You can store this parameters in a linked list of all the lines and traversing the list. Now you have a point say (x , y ) and you want to check that it belongs to the line or not. You can use the equation:
y2 -- y1
m = -----------
x2 -- x1
if((y - y1) == (m ( x - x1)))
Point lie on line.
http://www.priyank.in/
|
|
|
|
|
|
You could use the line function as suggested by Priyank or you could
simply use GetPixel() on the cursor coordinates and test the RGB value
returned to see if it matches the color you used to draw the line.
Steve T
|
|
|
|
|
Well I’m trying to create this small app that notifies me how long I have played a game. Now I want it to draw a short message or picture telling me that I have played game for N minutes.
Is it possible and how to display something over a fullscreen directx or opengl game, without interrupting it?
I have already tried with simple dialogs in MFC with Topmost attributes set but it doesn't seem to work on fullscreen games.
I would appreciate suggestions and samples on how to do that.
I'm not so experienced direcx programmer.
~dzenan~
|
|
|
|
|
Hi All,
I have a dialog in DLL, I wish to call this dialog of DLL from an EXE and get some data of this dialog in the EXE.
Can anyone help me.
If I use MFC Extension DLL then I am able to call the dialog but can not read the data.
If I use MFC regular DLL then I can send or read data but not been able to call the dialog of DLL.
An immediate help will be appreciated.
Please mail me at,
lipiraj@yahoo.com
Thanks in advance,
Rajesh
Rajesh
|
|
|
|
|
In an MFC regular DLL export a function that does DoModal on the dialog.
The first line of that exported function must be
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
« Superman »
|
|
|
|
|
I have a header file x.h as follows
#ifndef _x_h
#define x_h
#pragma once
#include "vv.h" //this gives a set of warning
.............
#endif
I am including this x.h in many .cpp file.
When I compile it gives warning for all the .cpp files. how do I avoid this?
|
|
|
|
|
I think you got the #define wrong
It should be
#ifndef _x_h
#define _x_h
« Superman »
|
|
|
|
|
not only the #define is wrong, but you might write longer macro to ensure that it won't be defined by another module.
i used to define mine like this (let's say, for a file named MyFile.h ) :
#if !defined(__MYFILE_HEADER_INCLUDED__)
#define __MYFILE_HEADER_INCLUDED__
#endif // __MYFILE_HEADER_INCLUDED__
in some cases, copy/paste become a very bad feature to use, but for this, i advise you highly to use it to be certain that you macros are the same everywhere in you header file
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hmm. Isn't that "#pragma once" does? Why do you have both preprocessor guards and #pragma once?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
S. Senthil Kumar wrote:
Why do you have both preprocessor guards and #pragma once?
If one get fail other will do the Work .
But here both of them are failing .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
ThatsAlok wrote:
But here both of them are failing .
sure, look at his code :
#ifndef <font color=red>_x_h</font>
#define <font color=red>x_h</font>
are these the same ?
moreover, #pragma once were not supported on previous versions of VStudio, and might be not too on another compilers...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
are these the same ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Hello Group
Can anybody in the group Try to Explain,What are Smart pointers and what are the advantages over the pointers and exactly where are they used frequently???
VC++
|
|
|
|
|
Smart pointers can be used wherever you use raw pointers. They basically make sure that every new is paired with a matching delete and that you delete allocated memory only once. Typically, they do this by reference counting.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
First of all very thanks to S.Senthil Kumar for taking time to describe this concept.
But it is bit theoretical can i have some more information on this regarding how to use this concept
VC++
|
|
|
|
|
Take a look at CComPtr class in MSDN. This is an example of smart pointers.
"I would luv to change the world, but they wont give me the source code"
My Articles
|
|
|
|
|
...or search for std::autoPtr for C++ standard
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|