|
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.
|
|
|
|
|
Perfectly works!!!
But why appearance of the tooltip different if to create the following ways?
m_pToolTip.Create(this, TTS_BALLOON);
and
m_pToolTip.Create(this);
m_pToolTip.ModifyStyle(0, TTS_BALLOON);
Best regards,
Eugene Pustovoyt
|
|
|
|
|
I have a dialog based application that has some propertysheet.I wanted to hide Help button in it so as Shog9 said I put this statement in OnInitDialog ofmy application:
GetDlgItem(IDHELP)->ShowWindow(SW_HIDE);
But unhandled error happend and it seems that no window with this ID exist.I even put it in OnInitDialog of propertysheets but the same things happend.So how can I hide that help button?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
This line of code will only work in the OnInitDialog() of your CPropertySheet derived class. If you don't have one of these, you can place it in the OnInitDialog() of the first page that you add to your CPropertySheet.
BOOL CMyPage1::OnInitDialog()
{
CPropertyPage::OnInitDialog();
GetParent()->GetDlgItem(IDHELP)->ShowWindow(SW_HIDE);
// ...
}
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.
|
|
|
|
|
Hi,Good morning,
I have a small question .Now I want to catch the net event when the netlink breaks down,how to do......
thanks
Zbuilder
jianshez@bjxj-xjgc.com;)
DREAM FOR BRIGHT FUTURE
|
|
|
|
|
Is it possible to pause a timer created with SetTimer without actually killing it?
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Michel Prévost wrote:
Is it possible to pause a timer created with SetTimer without actually killing it?
I don't think so. You could set a flag which tells the timer function to ignore calls to it temporarilly, however killing and recreating the timer would probably be a better way to handle this.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Maybe you can use Sleep() somewhere in your code.If you use WM_TIMER you can use it to do some pausing.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Hi, I am in the process of writing a Microsoft DirectShow filter tolay back vedio from a SGI server. The Directshow environment requires the "_stdcall" calling convention while the SGI requires the "_cdecl" calling convention. How do I resolve this error. One of the errors I get when having the _stdcall convention is
asyncflt.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: static class MBMovieLib::Movie * __stdcall MBMovieLib::open(char const *,char const *,class MBMovieLib::StreamSpec *,unsigned long,class MBStreamDefs::NameValuePairs
Any help in resolving this problem will be greatly appriciated as I have been trying different things for about a month now.
Thank you.
|
|
|
|
|
Is that MBMovieLib::open class function in one of your own classes or in the third-party library? Did you declare it somehwere else as beeing _cdecl?
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
The program compiles fine. It's when it reaches the linkage stage that VC++ 6.0 linker reports the reason it cannot do the linkage is because it, "Cannot open Debug/MySampleApp.exe for writing" even though the file is not opened or being used somewhere else (or any of those things).
If I were to use Windows Explorer and go to the directory (etc.) where the file is located and delete it, then go back and recompile it, everything would go through fine. No problem!
Does anybody know why this happens? This is not the first time the compiler has done this. It seems almost something at random.
Is there something in Project->Settings->Link I should set or change to prevent this?
Thanks.
William
|
|
|
|