|
But.... Why do you use DDX_Control ?? You cannot use both DDX_Control and Create together.
Can't you simply override the Create function (and so you will be able to send your own parameters also) and then inside that function call Create of the base class ?
I always work like that...
|
|
|
|
|
If you want to handle the WM_CREATE message for the static control then you need to define your own CStatic-derived control, specify that class instead of CStatic associated with your control id and then handle the desired messages and overrides in your CStatic-derived class.
|
|
|
|
|
that's what I'm doing.
I have derived my own class from CStatic; inserted a CStatic in my dialog resource
used DDX_Control to do the automatic subclassing.
some code...
my CStatic derived class :
IMPLEMENT_DYNAMIC(CMyStatic, CStatic)
CMyStatic::CMyStatic()
{
}
CMyStatic::~CMyStatic()
{
}
BEGIN_MESSAGE_MAP(CMyStatic, CStatic)
ON_WM_CREATE()
END_MESSAGE_MAP()
int CMyStatic::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CStatic::OnCreate(lpCreateStruct) == -1)
return -1;
return 0;
}
class CMyStatic : public CStatic
{
DECLARE_DYNAMIC(CMyStatic)
public:
CMyStatic();
virtual ~CMyStatic();
protected:
DECLARE_MESSAGE_MAP()
public:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
};
in my dialog class I have
DDX_Control(pDX, IDC_MY_STATIC, m_MyStatic);
and in the header :
CMyStatic m_MyStatic;
did I miss something obvious ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
that's what I'm doing.
I have derived my own class from CStatic; inserted a CStatic in my dialog resource
used DDX_Control to do the automatic subclassing.
some code...
my CStatic derived class :
IMPLEMENT_DYNAMIC(CMyStatic, CStatic)
CMyStatic::CMyStatic()
{
}
CMyStatic::~CMyStatic()
{
}
BEGIN_MESSAGE_MAP(CMyStatic, CStatic)
ON_WM_CREATE()
END_MESSAGE_MAP()
int CMyStatic::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CStatic::OnCreate(lpCreateStruct) == -1)
return -1;
return 0;
}
class CMyStatic : public CStatic
{
DECLARE_DYNAMIC(CMyStatic)
public:
CMyStatic();
virtual ~CMyStatic();
protected:
DECLARE_MESSAGE_MAP()
public:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
};
in my dialog class I have
DDX_Control(pDX, IDC_MY_STATIC, m_MyStatic);
and in the header :
CMyStatic m_MyStatic;
did I miss something obvious ?
Thanks again.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Sorry. I didn't see that in the original post.
What exactly is not happening that you want to happen then?
|
|
|
|
|
should the OnCreate handler ( of ON_WM_CREATE ) be called when doing this ?
let's say that when I design my dialogs with the resource editor, I type in the text in the resource editor; now, in the code, when the CStatic ( my own derive class ) gets created, I want to get the text of the control and modify it ( and storing it in my derived class ).
I wanted to do that in the OnCreate, but it does not get called.
for example :
int CMyStatic::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CStatic::OnCreate(lpCreateStruct) == -1)
return -1;
GetWindowText( m_String );
DoSomething( m_String );
return 0;
}
thanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
It's been a long time since I've seen this issue, but I don't think you can override create functionality the way you're trying to do it
In other words, when you place a control on a dialog template then the window for that control is created when the dialog is created and displayed. Then, you're having DDX subclass that window after it's already been created so the overridden creation functions (such as the WM_CREATE handler, OnPreCreateWindow, etc.) will never be called in yoru derived class.
You need to manually create the control (instead of placing it on the dialog template) via the Create or CreateEx function and then subclass it if you need to.
Let me know if you need any help doing this.
|
|
|
|
|
I know to do all of this, but my "users" don't want to have to do it manually.
I will continue looking for other options.
( thanks for the link in your other answer. )
max.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
|
Is it possible to grab audio data from sound car?
For instance, if I open a game emulator, the music in the game would be played through the sound card. ( Does it? Actually I'm not very sure! )
What should I do to grab the audio data that played by my sound card?
I'll appreciate your help, thanks!
|
|
|
|
|
I have a project which I want to build as a dll in one project workspace and as a static lib for another project workspace. can you somebody suggest ways to do this if it is possible? If I need to have two different project files, how do I create the second one in the same directory as the first one. and if it is possible to do with just a single .dsp file, what should I do in this .dsp file? Thanks in advance.
|
|
|
|
|
I would recommend having separate .dsp files. You can put them both in the same workspace (.dsw ).
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
You can use with VC6 'Configurations' under 'Build' menu.
|
|
|
|
|
Hello everyone, I have created an activex control using VC.net, the control works fine if i use the activex test container, or a small vc program i wrote to test the control. But if i use it in vb it doesnt, the problem is when i try to call the SetTimer funtion. from what i can see, the hwnd value is Null when called from vb, i think it is something to do with vb been the container ?? but i am not sure... does anyone have any ideas, as the rest of the control works a treat, its just this one point...
Thanks in advance
LJ
|
|
|
|
|
I have a problem. I want to capture the character which is deleted in the application. Please let me know how capture the character.
Thanking you,
E.Veera Raghavendra
|
|
|
|
|
|
Actually i am developing screen reader software. In this application if user presses baca space in the msword or any application i want to catch that charcter and to be supplied to speech engine. Ex:
if following is the text in the application.
hello good morning every body.
i started deleting letter by letter g,n,i,n,r,o,m. now i want to know which character is deleted. Please let me know.
Thanking you,
E.Veera Raghavendra.
|
|
|
|
|
I'm not sure I understand your question...
So, you say you have Word (or another application) open and your application that is also open. The user write something in Word and then delete it. You want to retrieve in your application what the user has deleted ? Is that correct ?
It looks really strange to me... But ok there could be option like using hooks on Word inside your application (that will allow you to retrive all keys that are pressed in Word). But I don't have a lot of knowledge in that field. Take a look on this site, I think there are a lot of articles that cover this subject.
If it is not what you were asking for, then try to reformulate your question a little bit clearer
|
|
|
|
|
Actually i am using hooking technology. ya, i want what the user deleted. U r assumption is correct.
e.veera raghavendra
|
|
|
|
|
You can write a keyboard hook to do that. Look for SetWindowsHookEx Win32 API function.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I am trying to handle drawing a header control so that I can support
multi-line items. It tried both owner and custom draw but neither will tell
me the control is 'hot' when the mouse is over it. Everything is ok if I
revert back to standard drawing so the window styles must be right. Can
anyone suggest what is wrong?
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
This may be a simple thing but I,m stuck. In the last function of this class I am trying to show m_image_new. This is not for a serious project I am just learning, but the project will not compile. The class is:-
// dlg_new.cpp : implementation file
//
#include "stdafx.h"
#include "EditTest.h"
#include "dlg_new.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// dlg_new dialog
dlg_new::dlg_new(CWnd* pParent /*=NULL*/)
: CDialog(dlg_new::IDD, pParent)
{
//{{AFX_DATA_INIT(dlg_new)
m_image_new = _T("");
//}}AFX_DATA_INIT
}
void dlg_new::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(dlg_new)
DDX_Control(pDX, IDC_BUTTON_IMAGE, m_image_button);
DDX_Text(pDX, IDC_STATIC_IMAGE, m_image_new);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(dlg_new, CDialog)
//{{AFX_MSG_MAP(dlg_new)
ON_COMMAND(ID_VIEW_NEW, OnViewNew)
ON_BN_CLICKED(IDC_BUTTON_IMAGE, OnButtonImage)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// dlg_new message handlers
void dlg_new::OnViewNew()
{
// TODO: Add your command handler code here
}
void dlg_new::OnButtonImage()
{
//using ::CWnd;
m_image_new.CWnd::ShowWindow( SW_SHOW );
// TODO: Add your control notification handler code here
}
The error I get is that CWnd is not a member of CString.
Please help
regards
Paul
|
|
|
|
|
Try
GetDlgItem(IDC_STATIC_IMAGE)->ShowWindow(SW_SHOW);
instead of
m_image_new.CWnd::ShowWindow( SW_SHOW );
|
|
|
|
|
Thanks, this worked.
Regards
Paul
|
|
|
|
|
Stirfie wrote:
I am trying to show m_image_new
what do you mean ???
i think m_image_new is a CString variable and i completely don't understand
what you're trying to do with this :
m_image_new.CWnd::ShowWindow( SW_SHOW );
"Go as far as you can see,and when you get there you’ll see further" - Unknown
|
|
|
|