|
Richard MacCutchan wrote: New?
New as in "MFC Feature Pack 2008" (4 years!)
The compiler does not report ID conflicts, it all builds nicely.
Anyway, I will clean up my hundreds of resources in the offending range.
Watched code never compiles.
|
|
|
|
|
This is a callback function definition used in capAVI frame callback.
The LPVIDEOHDR structure supplies useful data and one of the members ( dwUser) can be user defined. Is there a way to set this before the system executes this callback?
Could someone point me to a sample code which actually uses this member in any capAVI callbacks.
LRESULT CALLBACK capVideoStreamCallback(
HWND hWnd,
LPVIDEOHDR lpVHdr
);
typedef struct videohdr_tag {
LPBYTE lpData;
DWORD dwBufferLength;
DWORD dwBytesUsed;
DWORD dwTimeCaptured;
DWORD_PTR dwUser;
DWORD dwFlags;
DWORD_PTR dwReserved[4];
} VIDEOHDR, *PVIDEOHDR, *LPVIDEOHDR;
Thanks for your help.
Vaclav
|
|
|
|
|
does capSetUserData do it ?
|
|
|
|
|
There is a MFC-Based Application,his window tree structure as below:
Root Parent Window
Sub-Parent Window1:Edit、ComboBox
Sub-Parent Window2:Edit、ComboBox、Static
Sub-Parent Window3:ListCtrl、Progress Bar
Sub-Parent Window4:Check Box
Child Window4-1:Edit、ComboBox
Child Window4-2:Edit、ComboBox
****
I want to know if user click any window(including controls) or Get Focus,which message can Root parent window receive.
|
|
|
|
|
Try the NM_SETFOCUS[^] and NM_CLICK notification messages.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Since you are using nonstandard nomenclature, please define Root Window, Sub window and Child window. What is relationship between all windows?
In general message about gaining focus (by any means including mouse click) is sent to a window that is gaining focus and loosing focus.
If this window is a child window, the parent does not know about what child gained focus.
You have two choices: write code in the child window to notify parent window about gaining focus using custom defined message, or write windows hook that will receive messages before any window does and post a message from the hook procedure to a parent window.
In both cases you would pass a handle to a window that gains focus.
JohnCz
|
|
|
|
|
Hi
Is it possible to read hardware information from another computer in a network with Active Directory and WMI?
www.logicsims.ir
|
|
|
|
|
The documentation says <b>A pointer to the single CWinApp object for the application</b>
However that is not really true is it CWinthread::m_pMainWnd
If whitin a CDialog I create a Thread and populate the data area with that (CWnd *) CDialog then AfxGetApp will return that window
|
|
|
|
|
ForNow wrote: The documentation says
Which documentation; please provide links?
ForNow wrote: However that is not really true is it CWinthread::m_pMainWnd
Again, no idea what you are looking at, but the actual documentation is here[^].
|
|
|
|
|
<a href="http://msdn.microsoft.com/en-us/library/5k9f064x(v=vs.80).aspx">http://msdn.microsoft.com/en-us/library/5k9f064x(v=vs.80).aspx</a>[<a href="http://msdn.microsoft.com/en-us/library/5k9f064x(v=vs.80).aspx" target="_blank" title="New Window">^</a>]
|
|
|
|
|
For some reason my pre tags aren't working sorry for thr giberich
I just googled AfXGetApp and the doc say the Thread pointed to My CWinApp
|
|
|
|
|
Exactly so, but I still don't know what your question is. Aside from the fact that you still seem to be having trouble understanding the Windows model, the use of threads and MFC.
|
|
|
|
|
How many more days do you want to spend trying to bend windows to do what you want?
Rather than try to make a worker thread a UI thread in order to get a message handler in it just add your own messaging. It is easy:
MyThread()
{
WaitForEvent();
WhileNotMessageQueueEmpty()
{
ReadMessageOffQueue();
ProcessMessage();
}
}
somewhere in your code.....
PutMessageOnQueue();
SignalQueueEvent();
and at shut down....
SignalQueueEvent();
And domnt forget your queue needs to be protected with a lock so it it thread safe.
==============================
Nothing to say.
|
|
|
|
|
|
Because you want to use windows messaging.
OK, keep struggling, keep wasting time, it is your choice.
==============================
Nothing to say.
|
|
|
|
|
There is only 1 object of a class derived from CWinApp in an MFC application. Any program with more than one object of a CWinApp derived class won't even compile. As CWinApp is derived from CWinThread that means the app object is a thread as well.
AfxGetApp (as generated by the code generator) always returns that one object. Always, no exceptions.
Now... Windows has two types of threads. We've been over that in other questions. If you want to use them in MFC you do one of the following:
- Worker threads are kicked off by AfxBeginThread. Call that with a pointer to the function you want it execute, it gives you a CWinThread, and off you go, woo hoo! CAVEAT if you call a USER function in your worker thread it gets a message queue BUT you won't be able to do anything with it as MFC doesn't know that it's changed. It's still just scheduling that single function (which could include a message loop but please don't try it...).
- UI threads are slightly harder - you have to derive your own class from CWinThread. Override InitInstance to create the window for your UI thread. Don't try and be clever and use an existing window - if you do messages for that window will be processed by whatever thread created the window, not what you want. Then call AfxBeginThread passing it a pointer to your derived class's RUNTIME_CLASS. You can't just assign an arbitary window pointer to m_pMainWnd and expect it to work - it won't.
|
|
|
|
|
I need some hint how to do this.
Most capAVI examples of callback let the callback function process the data.
I have static splitter with four views of the document and one of them does the callback stuff – semi real time video capture.
I need to “send” the video data from the callback function to the document so I can do processing and updating of the remaining views accordingly.
I though that I could just instantiate another view, but it would have to be in the initial templates to have access to the document. Little kludgy, but doable.
Ideally I would like to let view which runs the callback to send the data to the document, but I do not know how to do it.
I also do not have a clue how to access the callback return value.
Maybe that would work if I can return the data.
I am pretty much stuck.
Any help would be as always appreciated.
Thanks Vaclav
PS This is plain MFC doc/view in VC++ 6.0 ancient stuff, peppered with OpenCV and capAVI.
Addendum
I found this here and I think it will get me started
Callbacks, Threads, and MFC
-- modified 10-Jun-12 12:38pm.
|
|
|
|
|
hey guys....i need you all to help me to get an example of CONSTRUCTOR and DESTRUCTOR in derived class....and before helping me make sure your answer is correct and can help me,...Thanks
SuNiL
|
|
|
|
|
likescr7 wrote: make sure your answer is correct
Well, just in case I'm not up to the job, you could always read the documentation[^].
|
|
|
|
|
They're the same as for a base class, with one difference in the constructor - which is how it chains to the base class constructor to initialise it. Give it a go and post what you have here and we'll take it from there.
|
|
|
|
|
|
likescr7 wrote: and before helping me make sure your answer is correct
Where would be the fun, then?
Veni, vidi, vici.
|
|
|
|
|
lol
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
Help yourself![^]
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
likescr7 wrote: i need you all to help me to get an example of CONSTRUCTOR and DESTRUCTOR in
derived class
Certainly sounds like homework.
likescr7 wrote: before helping me make sure your answer is correct and can help me
Since it sounds like homework the only correct answer is one that says to do it yourself.
|
|
|
|