Can some one tell me, How do I pass Typdef name which is stored in string variable to be passed to as a functions parameter.
For eg: LOOKUP_CODE (which is a typedef for struct)
I use to call my function, which takes the first parameter of LOOKUP_CODE
MyFunction(MYCODE,....) This works like charm.
Now I'm storing that name MYCODE into string variable strCode
LOOKUP_DEF Class = reinterpret_cast<lookup_def &="">(strCode);
and calling the function like this:
MyFunction(&Class,...) but it does not work correctly. Any input from any one is greatly appreciated.
This is called run-time type information (RTTI) and C++ generally isn't designed for it. The main reason was IMHO that well-designed program can do without RTTI, and accomplish this features by polymorphism etc. But, especially when you read objects from stream, RTTI is necessary.
VC provides the typeid operator and type_info class, but this is a nonstandard C++ extension. And it can be used only for opposite direction (convert typename to string).
So you probably have to write your own class, which manages a mapping from strings to typenames. Various libraries uses various techniques for RTTI. MFC does it through a massive macro gymnastic; a month ago I made RTTI for a particular purpose via templatized class factories...
These techniques are quite complicated to describe it here, so I could send you some tips by email. I don't know about any standard technique, but I'm quite interested about it. If there's anybody, who knows more, let me please know, we can discuss
"Friends come and leave, but teddybears stay in forever."
I did the same way as the above article said. I want to use the CTreeCtrl instead of CListCtrl. but I got the following errors and don't really know why i got those errors
An unhandled exception of type 'System.TypeLoadException' occurred in proj1.exe<br />
Additional information: Could not load type _TREEITEM fromassembly proj1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.<br />
I am using Visual C++ 6 on Windows XP Professional.
I am busy writing an Application Wizard. On two of the dialogs I have an edit control that must initially must be displayed as disabled. After the user makes a certain selection then the edit control is enabled.
I have tried using GetDlgItem() and a cast to CEdit followed by called ModifyStyle on the CEdit control with WS_DISABLED as the first parameter and NULL as the second. However when it comes time to enable the control, it doesn't appear to be enabled even though one can enter text into it.
I have an MFC application that has several buttons on it that correlate to a counter being increment on a standard left click. I was wondering if there was a way to differentiate between a left click and right click. If so the left click would incremente the counter while the right click would decrement the counter. I know how to do this in C# but sadly not in MFC.
There are 10 kinds of people in those world. Those who understand binary and those who don't.
How I can make a win32 Callback function as a data member of my class?
I tried it making a static function but then i can't acess the data memeber of my class.The callback function is keyboard hook proc function?
thanks for reply. The link which you have send primarly talks about making the callback function as a static member function of class but what if I want to access the class data members. any pointer to that will be a valuable inputs.
the reason it is a static member is obvious if u think about it a little bit ... a callback that u register with the system cannot be duplicated everytime u instantiate a new object of the type ... if it were then which actual function would the system call as the callback?
I make a programme based on IWebbrowser, and I want to insert a script to the htmlpage loaded by my programme.（the script maybe looks like:
）How could I do?
I find a article "http://www.codeguru.com/ieprogram/HtmlMemory.html" .It tells us how to modify the content of the SCRIPT,but didn't tell how to add to "SCRIPT" tag to the htmlpage.