I'm putting together code for a template that implements some special tasks that I need and I want it to use with different CWnd based classes as template argument and ancestor at the same time like this:
template < class BASE >
class CLASS : public BASE
If I want to use it with CFormView and CDialog in the same project I need template argument dependent compiling, 'cause for example if I need to implement OnInitDialog() for CDialog, I must ignore it with CFormView, otherwise I get an error that this function is not the member of the base class.
I thought of doing string comparison of the BASE argument at the right places, but I'm not too familiar with macros.
#define STR_COMP(_base, _class) \
and use it as
#if STR_COMP(BASE, "CDialog")
#else if ...
Of course it doesn't work....
Maybe you should try a "specialization" of template classes? I suppose it may look like this:
template< class BASE >
class COMMON : public BASE
// common members for CDialog and CFormView base
. . .
template< class BASE >
class CLASS : public COMMON< BASE >
// nothing yet here
// specialization for CDialog:
class CLASS< CDialog > : public COMMON< CDialog >
// members specific to CDialog
. . .
// specialization for CFormView:
class CLASS< CFormView > : public COMMON< CFormView >
// members specific to CFormView
. . .
Hi to all,
I am compiling DirectX 9.0 SDK Sample Code Filter in VC6, it is compiling successfully. (Filter is DSNetwork Filter)
But when same code I compile in VC++ 2005, it is showing errors (as follows),
1. fatal error C1083: Cannot open source file: 'c:\DXSDK\Samples\C++\DirectShow\Filters\Change': No such file or directory c1
2. command line error MIDL1003 : error returned by the C preprocessor (2) midl
3. error PRJ0019: A tool returned an error code from "Performing Custom Build Step" dsnetifc
4. error BK1506 : cannot open file '.\Debug_Unicode\dsnetifc_i.sbr': No such file or directory BSCMAKE
5. error C2146: syntax error : missing ';' before identifier 'PVOID64' C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h 222
6. error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h 222
7. error C2146: syntax error : missing ';' before identifier 'Buffer' C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h 5940
Does anyone know a few tricks to make Edit controls behave like "smart labels"? That is; I want them to be read-only, but not have a caret. It's nice being able to copy the text using Ctrl+C, something which a simple static control cannot offer.
I assume there is a simple subclassing trick you can do. If you know it, feel free to tell me.
Do your dialogs have a parent child relationship.
If affirmative you can use
you will need to pass a pointer of your class in another class and after that you can start using the variable/s / data of one class from another.
Thanks but its not fulfil my need..I have a seperate keyboard other than our system keyboard.
I have class for that as keyboard.cpp,if i press 1 in that keyboard it goes to WM_KEYDOWn in that class and it goes to OnKEyDown in that particular CView class which one is active,but the number should typed in Edit control of dialog which is invoked by clicking the view window.
The WM_KEYDOWn function only goes to avtive View CGrpView and not to that particular dialog.So,i thought to get that all values which are entered in seperate keyboard in to CString and then give this CString value to Edit control.. My Objective is : when i pressed 1 in seperate keyboard it should get entered in that edit box in the dialog..
I have problems following you, but maybe what you need is something completly different and is more along the lines of a "focus follows mouse" setting for the whole Windows-Gui?
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."