|
my project is on database in c++ and ado .
i wanna add gui features using MFC/SDK.
plz help its urgent
|
|
|
|
|
Having a strage time with a custom CWnd derived control in MFC. My OnPaint method never gets entered. I've got a message map:
BEGIN_MESSAGE_MAP(CGMeterCtrl, CWnd)<br />
ON_WM_PAINT()<br />
ON_WM_ERASEBKGND()<br />
END_MESSAGE_MAP()
And a handler:
void CGMeterCtrl::OnPaint()<br />
{<br />
...
And according to Spy++ when my control's in a dialog test app it recieves WM_PAINT messages in the right places. I can't figure out why OnPaint is never called.
Any tips?
|
|
|
|
|
Does anything show up at all?
This might be silly, but make sure your control has the WS_VISIBLE style set.
Maybe windows thinks it is not 'on' the screen? So you don't get any paint messages.
Also, make sure its coordinates are also visible, it is not offscreen or outside the coordinates of the window/dialog.
|
|
|
|
|
The control shows on the dialog, I changed the background colour & gave it a 3D border to make sure. It's stuck in the middle of my dialog and the borders don't go outside the dialog edges. Like I say, Spy++ shows WM_PAINT being sent to the control, my message handler just doesn't get called.
|
|
|
|
|
Did you also declare the paint handler in the header file?
// Generated message map functions
//{{AFX_MSG(CYourDialogClassNameHere)
...
afx_msg void OnPaint();
...
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
|
|
|
|
|
Sure did
|
|
|
|
|
I am baffled.
Just some ideas off top of my head here:
Does the erase background message get called? This at least lets you know the parent-child relationship is set up okay.
Can you call Invalidate() and UpdateWindow() on your control to FORCE a paint message to it? Just to be sure the 'regular' paint messages are not masked out by something else, like maybe child rectangle clipping or some other wierdness in the parent window?
|
|
|
|
|
Seems OnEraseBkgnd isn't being called either!
Calling Invalidate() and UpdateWindow() cause WM_PAINT messages to be show up in Spy++ they always have an hdc 00000000.
|
|
|
|
|
Do you have a static control or some other control on the resource dialog template that this 'custom control' will override?
If that is the case, then you need to also make sure you have 'subclassed' the instance of your MFC custom control so that it is 'attached' to the 'real window' of the control from the dialog template. If not, then in the OnInitDialog function you must 'create' the 'real' window for the custom control to use.
For example, suppose you already place a static frame control onto the dialog template with control identifier IDC_MYCSTMCTRL, and in the header file you have declared an instance of your custom control:
CMyCustomControl m_MyCustomControl1;
Then in the OnInitDialog you can call
m_MyCustomControl1.SubclassDlgItem(IDC_MYCSTMCTRL, this);
Which should attach the CWnd control instance to the 'real' window created from the dialog template.
If this were done by the ClassWizard, and placed into the DoDataExchange, it might look something like this:
DDX_Control(pDX, IDC_MYCSTMCTRL, m_MyCustomControl1);
|
|
|
|
|
That's it! There was a typo in my DDX_Control line, i.e. it was accessing a wrongly numbered IDC_CUSTOMx control, one which existed in resource.h but wasn't in my main dialog.
I'm now getting WM_PAINT etc. messages and I'm getting called at the right place.
Cheers!
|
|
|
|
|
phaderunner wrote:
My OnPaint method never gets entered.
How are you verifying this?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
TRACE at the entry point to the function and Spy++ looking at the control. Seeing if WM_PAINT messages in Spy++ correspond with TRACE outputs in the debugger.
|
|
|
|
|
Hi,
I have an activeX control which is displayed in the Internet Explorer via the object tag. Now, as you probably know, you can pass parameters to the activeX control by using the param tag.
My question now is, how do I get these parameters in my activeX control.
I read about IPropertyBag, but didn't find a good example on how to implement that. I even don't know whether this is the right way to get the parameters.
Does anyone know how to realize that?
I hope so.
Thx in advance,
mimmi511
|
|
|
|
|
hiho@ll
is it possible to make a MFC bho which could use MFC controls?
|
|
|
|
|
Hi,
I'd like to create a popup menu with a titlebar to move the menu. For that I thought to create a toolbar in vertical order and with horizontal popup menus. Does anybody know how to create it with MFC?
thanks a lot
|
|
|
|
|
Does anyone know what the code is to generate LM hashes?
|
|
|
|
|
I'm having trouble opening a 3 GB file. I've never had to open a file so large before and I'm nost sure what to do. I've tried fopen and open functions but the program fails to open the file. Any suggestions?
|
|
|
|
|
How are you attempting to open it? The fopen() and open() functions should be limited to older C programs. For newer Windows programs, use CreateFile() instead.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
To use CreateFile() I must have the Coredll.lib. Where do I find this lib?
|
|
|
|
|
Oops..nevermind I was in the WindowsCE part of MSDN..
|
|
|
|
|
|
Thanks so much for your help...CreateFile worked..
|
|
|
|
|
hiho@ll
i try to do something like a newsticker on a browser helper object
the problem is that the helper object is made using ATL and i want to use CStatic (because there are some classes, which scroll text using a CStatic)
my problem is that CStatic is a MFC class and i need it for my ATL browser object!?
are there alternatives or other controls i could use for my problem?
btw, is it possible to convert my BHO to a MFC BHO?
or is MFC BHO not supported by IE?
if it's possible, how can i do it (easily, without troubles?)
I'm using Visual Studio .NET
thx
|
|
|
|
|
ThinkingPrometheus wrote:
my problem is that CStatic is a MFC class and i need it for my ATL browser object!?
You can not directly add a mfc class to ATL.
John
|
|
|
|
|
and how can i make just a simple static text control in ATL?
|
|
|
|