|
I think you need to handle this using the OnCommand message if you have created a dynamic control.
Sara
|
|
|
|
|
|
I'm using MFC's and MDI`s,I can change the window style after the creation of the window?
|
|
|
|
|
Yes, some of the styles can be changed ( dependent on the Cwnd ( derived Cnwd ).
look at CWnd::ModifyStyle and CWnd::ModifyStyleEx
Max.
|
|
|
|
|
Thanks
|
|
|
|
|
Good morning,
I'm trying to have a small window to hover over my view (opengl ), following the mouse; a bit like a toolip, but needs to stay, not hide after a small delay.
so, I created a CWnd derived class with the text and all the trimmings, added _TrackMouseEvent to the view to be able to receive the WM_MOUSELEAVE and WM_MOUSEHOVER so that the window is shown only if the mouse is over the view's client.
It's working, but the display is bad, I have bad refresh.
I move the windows on the MouseMove of the view, it works ok, but it will, I think, trigger a redraw, so I get too much flicking ( even with double buffer ).
The question, is there way to make the hover window behave more like it was a overlay thing ?
Oh Bugger!, I'm just answering the question when writing this ... the parent window of the my Cwnd was bad ... much better ...
move on... just crazy programmer ... nothing to see ... move on ...
Max.
|
|
|
|
|
help me please, I am stucked here.
It's a very simple SDI application. I got it from MFC appWizard.
In the view class, I started a worker thread, which will be running until a flag is cleared. I made sure that the worker thread is ended before the program terminate, because I put a TRACE line before its return statement, and the line is outputed. But still, I got such info:
Detected memory leaks!
Dumping objects ->
thrdcore.cpp(166) : {97} client block at 0x00305BB0, subtype 0, 112 bytes long.
a CWinThread object at $00305BB0, 112 bytes long
Object dump complete.
To make it more annoying, this doesn't happen all the time. What can go wrong?
Any clue is appreciated!
|
|
|
|
|
As its a CWinThread object thats been leaked, you can either store the pointer when you create the thread or set the m_bAutoDelete member var to true so it deletes itself when the thread ends.
Roger Allen
Sonork 100.10016
In case you're worried about what's going to become of the younger generation, it's going to grow up and start worrying about the younger generation. - Roger Allen, but not me!
|
|
|
|
|
Thank you for your quick help.
I set it, but it didn't solve the problem. anything else?
|
|
|
|
|
I noticed that after I rebuild the project then run it for the first time, this memory leak will occur for sure. The subsequent running doesn't have this problem. Why this inconsistence?
|
|
|
|
|
It seemed that after I add #include "StdAfx.h" to my generic cpp file, this problem is solved.
But in my generic cpp file, all I did is some mathematical computation. No input or output involved, except for the argument passing to the function.
What does StdAfx.h do here? Why I have to include it? It makes no sense to me.
|
|
|
|
|
Hi.
I read an interesting thread at a MSDN newgroup on MFC and thread safety. Its author asks about why a thread causes the process to hang when you pass to the thread points to MFC control objects (CListrCtrl, CEdit, CTreeCtrl, etc).
I remember something similar to what the author of thread asks from a application I just finished. I found that you can make changes to MFC controls from threads via pointers to the controls. Everything works well until you call WaitForSingleObject(), or WaitForMultipleObject(), etc. In other words, the process hangs if you call WaitForSingleObject() when the thread is updating an MFC control.
Ivan Lalis posted an interesting solution involving MFC controls handles. He writes that one solution is to pass in the worker threads handles to MFC controls instead of pointers.
-----
UINT theWorkerThread(LPVOID pParam)
{
CListCtrl theList;
theList.attach(handleToRealListbox);
...
theList.detach();
return 0;
}
-----
I would like to know what is the safest solution to this problem? Secondly, in terms of Lalis' solution, do you create and attach, for example, one CListCtrland for the entire life-time of the thread?
Thanks,
Kuphryn
|
|
|
|
|
Does anyone know how to print the German characters öäü to a line printer (Epson LX-300). I suppose I need to select a character set to do this, but somehow I can not manage to get it workin.
Thanks,
Richard
|
|
|
|
|
:-DI want to get the data from video card and store them as Bmp.Please tell me how to do? Thanks a lot!
thanks to every one!
|
|
|
|
|
Do you have the data from the video card?
How did you get it?
How you got the information and the format that it is currently stored in determines how you will save it.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
no, i have't the data ,i want to know how to get the data in it.which function in Visual c++ can get the data?
thanks!
|
|
|
|
|
The next question is do you want to save an image that is on the screen or in a window?
You will need to create a device context for either the desktop window or the window that you want to save.
AFter you have the DC look at this article:
http://www.codeproject.com/bitmap/dibsection.asp[^]
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
i want to screen capture to Bmp format.
|
|
|
|
|
Use avphone3 control:
'connect to driver
vidcap1.device = -1;
Sub Timer1_Timer()
SavePicture vidcap1.Picture, filename
End Sub
|
|
|
|
|
I get past one problem, and bump into another... Steep learning curve
I created a dialog with among other controls, a static control expanded to a size I can use to draw small plots in. I created my own plotting class derived from CStatic, and attached it to the static control in the dialog with ClassWizard. I built the functionality in my derived class to draw the plots, and now I'd like to handle some mouse move and click messages. For some reason, my CStatic derived class won't handle any of these messages. If I add a handler in the dialog, it does handle them. I've looked through the articles on subclassing controls, and I don't see where I'm missing anything. Can you give me some suggestions on where to look?
Thanks.
|
|
|
|
|
In your OnDialogInit handler have you attached your derived CStatic control to the actual window? Do you get any sort of notification or response in your special class?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
You have to set the NOTIFY style of the CStatic in the resource editor for your class to pick up the mouse messages.
Roger Allen
Sonork 100.10016
In case you're worried about what's going to become of the younger generation, it's going to grow up and start worrying about the younger generation. - Roger Allen, but not me!
|
|
|
|
|
That did the trick! mumble...mumble...
Thanks
|
|
|
|
|
Maybe there's a simple answer for this too...
I can handle mouse messages now, but not popup menu messages!
I created a popup menu, and display it when I right click my derived CStatic object. I added message handlers for the menu items in my derived class, but for some reason, none of the menu items are enabled. The menu is displayed, but all items are greyed out.
I'll poke around for the cause of this, but if you have a suggestion, I'd appreciate it.
Thanks.
|
|
|
|
|
Never mind, simple mistake on my part...
|
|
|
|