|
I have try this method, but this doesn't work!!!thanks you for your help
|
|
|
|
|
What kind of child window it is?
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
It is CView window, THX!!!
|
|
|
|
|
You could try with GetParentFrame()->SetWindowText(...), but your title will be changed by MFC. To get this right, you need to override the following CMDIChildWnd method:
void OnUpdateFrameTitle(BOOL bAddToTitle);
In your implementation, call 'GetMDIFrame()->OnUpdateFrameTitle(bAddToTitle);' first, then set the caption with a call to AfxSetWindowText (reduces flicker).
Tomasz Sowinski -- http://www.shooltz.com
"Yields falsehood when preceded by its quotation" yields falsehood when preceded by its quotation.
|
|
|
|
|
Sorry, I am not very understand, could you mind further explain on it? Thx
|
|
|
|
|
I have include "winuser.h",why compiler report error"undeclared identifier"?
my operation system is Win98 and use vc6.0.
Hi
|
|
|
|
|
SendInput is located between the following preprocessor directives:
#if (_WIN32_WINNT > 0x0400)
...
#endif
Define _WIN32_WINNT with value greater than 0x0400 before including winuser.h and you'll be OK.
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
Thank you for your reply.
I write the code according to you:
...
#define _WIN32_WINNT 0x0500
#include "winuser.h"
...
but it report the same error "undeclared identifier".
is there other reason?
Thanks again!
Hi
|
|
|
|
|
Place the #define in stdafx.h, before any #includes.
Tomasz Sowinski -- http://www.shooltz.com
"Yields falsehood when preceded by its quotation" yields falsehood when preceded by its quotation.
|
|
|
|
|
Hi GUI coders,
I try to create a ownerdraw listbox which has a fixed button in the upper right corner. Fixed button means here, it always is at the same local position (drawn over listbox entries). Basically, it should look like this (o = button).
_______________
| o ||
| ||
| ||
| ||
| ||
|______________||
I already have an ownerdraw CListbox class and an ownedraw CButton class (MFC). Now, how would I integrate my ownerdraw button? Can I use my existing button class (1. somehow one button dynamically created over the listbox)... or do I need to handle everything on my own (2. somehow inside my listbox class)??? At the end I'd like to have a new control. Thanks for any hint or ideas. Currently I have no idea how to start.
Thanks, Moak
PS: What's the idea of this control? When a user hits the new button I'll create a popupmenu showing some icons and the user can choose one. The icon will then be shown in the listbox (it's a output of a chat program).
|
|
|
|
|
This is easy. I'm assuming your app is dialog based, or CFormView based.
1. Create a class derived from CListBox ... eg CMyListBox. Does not need to be owner draw for this.
2. Add a member variable to CMyListBox "CButton *m_pButton"
3. Add an implmentation of CMyListBox::PreSubclassWindow :-
void CMyListBox::PreSubclassWindow()
{
CListBox::PreSubclassWindow();
m_pButton = new CButton;
m_pButton->Create(":o)",WS_CHILD | WS_VISIBLE,CRect(0,0,20,20),(CWnd *) this, 1);
}
4. Use Classwizard to map your dialogs List box control to an instance of CMyListBox.
5. Bob's your uncle.
Jon
STL is a religeon. Enquiries to Reverend Christian Graus
|
|
|
|
|
wow. sounds easy, lucky luck joy joy thanks Jon!
PS: who is Bob?
|
|
|
|
|
Can I just ask why your using new to allocate the object? Just declare it as CButton m_Button, call create as normal, and you have reduced the risk of a memory leak. Its also faster.
BTW, you also need to call DestroyWindow() on the button in the OnDestroy of the ListBox override class.
Roger Allen
Sonork 100.10016
I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.
|
|
|
|
|
Roger Allen wrote:
BTW, you also need to call DestroyWindow() on the button in the OnDestroy of the ListBox override class
Really? AFAIR, child windows are destroyed with parent.
Tomasz Sowinski -- http://www.shooltz.com
"Yields falsehood when preceded by its quotation" yields falsehood when preceded by its quotation.
|
|
|
|
|
yes an answer would be interesting. perhaps I'll do some message tracing and see it the buuton receives a WM_DESTROY or not.
|
|
|
|
|
You can do some tracing, but I can tell you right now that child window will be destroyed correctly - will receive WM_DESTROY and WM_NCDESTROY.
Tomasz Sowinski -- http://www.shooltz.com
"Yields falsehood when preceded by its quotation" yields falsehood when preceded by its quotation.
|
|
|
|
|
1. How to create the balloon tooltip?
2. Why I can't change the size of the tooltip font on WinXP (on Win98SE - OK)
CToolTipCtrl m_Tooltip;
CFont font;
font.CreateFont(<code>12</code>, 0, 0, 0, FW_NORMAL, 0, 0, 0, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
FIXED_PITCH, "Courier");
m_Tooltip.SetFont(&font);
Best regards,
Eugene Pustovoyt
|
|
|
|
|
Regarding (2): 'font' - what kind of variable it is? Local, global, member?
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
Of cause, font is a global member, declared in the header file.
I'm glad to hear you, Tomasz. Thank you for your help with tooltip.
Best regards,
Eugene Pustovoyt
|
|
|
|
|
Changing font works for me. The code you've posted caused the tooltip to switch to ugly, monospaced Courier font.
You may check if you don't have both global and local variables with the same name.
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|
|
Yes it turns in ugly Courier, but not this main thing. A problem that at various height of a font on WinXP the font tooltip remains constant though on Win98SE his size varies. Any ideas?!
Best regards,
Eugene Pustovoyt
|
|
|
|
|
I'm not sure what do you mean exactly. I've tested this on XP with few different font sizes, and everything works OK - the tooltip font changes.
Tomasz Sowinski -- http://www.shooltz.com
"Yields falsehood when preceded by its quotation" yields falsehood when preceded by its quotation.
|
|
|
|
|
I have once again rechecked and have noticed, that the font does not vary at the size from 1 up to 16. After 16 size increases.
Best regards,
Eugene Pustovoyt
|
|
|
|
|
This problem with "Courier" font only. When the font is "Verdana" or other, then size changed is right.
Thank you.
Best regards,
Eugene Pustovoyt
|
|
|
|
|
Question (1): you need to use TTS_BALLOON style. If you don't have most recent Platform SDK installed, just add this define somewhere:
#ifndef TTS_BALLOON
#define TTS_BALLOON 64
#endif
Tomasz Sowinski -- http://www.shooltz.com
Never argue with an idiot, he'll bring you to his level and beat you with experience.
|
|
|
|