|
No, the ActiveX isn't written by me.
I have already tried to disable the WM_ERASEBKGND message for the dialog and the only thing changed is indeed that the dialog looks horrible. The ActiveX control has the same problem. Adding the disabling WM_PAINT makes the dialog fully transparent - and still no proper redraw in the video control. (I've let only the control at this moment on the dialog, which is a modeless one launched from the main application dialog)
My mistake, sorry, I wrote the first post in a hurry, the Clip Children was the property I set and doesn't make much difference, not the Clip Siblings.
Finally, yes, the control is using DirectX overlay, is the problem there ?
Thank you for your interest
|
|
|
|
|
Have you tried to see if other applications using DirectX overlay have a similar problem? Could be a graphics card / driver / driver settings problem.
I could try the ActiveX control if you send me a copy and if it doesn't have some licensing issue. For now, I can't think of a specific reason for your problem. It would be much easier to try it myself.
Best wishes,
|
|
|
|
|
The control is open source, so I don't see any licensing problems. I know almost nothing about COM/ActiveX development like I said in the first post. If I did I would have taken a look myself inside it's code.
I'll mail it to you on the address specified in the link in your signature if it is ok (please let me know). As far as I know, I think there are video players that use DirectX overlay. I don't know one exactly but I don't remember seeing any player to "behave" in this way.
Again, many thanks for the answer.
|
|
|
|
|
Yes, you can use that email address. If you'd like you can simply send the location where I can find the open-source code for the control. I'll create a sample test project and try to reproduce the behaviour you've been describing.
Regards,
|
|
|
|
|
Can someone provide links to Windbg apart from microsoft documentation?
|
|
|
|
|
|
Thanks for telling me that. But i'm looking for links which provide more info on it in terms of hand on.
|
|
|
|
|
|
That link was provided to him several days ago here. He's apparently not interested in help.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
"Debugging Applications for .NET and Windows" by John Robbins, published by Microsoft Press.
|
|
|
|
|
MSDN states that sending a message is done directly to a message windows procedure rather than message queue. If that is true then is it true that GetMessage/PeekMessage is valid only for messages that are placed into message queue by postmessage.
Also if we want to direct a message to another process will both PostMessage/SendMessage work. What is the difference?
|
|
|
|
|
from MSDN:
The SendMessage function sends the specified message to a window or windows. It calls the window procedure for the specified window and does not return until the window procedure has processed the message.
The PostMessage function places (posts) a message in the message queue associated with the thread that created the specified window and returns without waiting for the thread to process the message.
The WindowProc function is an application-defined function that processes messages sent to a window. The WNDPROC type defines a pointer to this callback function. WindowProc is a placeholder for the application-defined function name.
The DispatchMessage function dispatches a message to a window procedure. It is typically used to dispatch a message retrieved by the GetMessage function.
|
|
|
|
|
In addition to what Michael posted, both APIs are adding messages to the thread's message queue, thus can be retrieved using GetMessage() and PeekMessage(). As MSDN says, on Vista there's a small exception for this behaviour:
"Microsoft Windows Vista and later.
...
If the specified window was created by the calling thread, the window procedure is called immediately as a subroutine.
..."
Best regards,
|
|
|
|
|
What about the other part of the question
Also if we want to direct a message to another process will both PostMessage/SendMessage work. What is the difference?
|
|
|
|
|
Do you understand English? PostMessage() returns without waiting for the thread to process the message. SendMessage() does not return until the window procedure has processed the message. PostMessage() is a non-blocking call. SendMessage() is a blocking call. Regardless of Microsoft's implementation details, both calls go to the same place -- the window procedure of the window to which you are sending (or posting) the message.
|
|
|
|
|
hi Tom,
did u get the answer for your question,
"if we want to direct a message to another process will both PostMessage/SendMessage work?"
If so, can you reply that to me?
I dont think postmessage/sendmessage works across processes.
it that right?
Thanks in advance.
cheers....!
Balaji
|
|
|
|
|
tom groezer wrote: MSDN states that sending a message is done directly to a message windows procedure rather than message queue.
Hi again,
It seems others tend to paste MSDN snippets, however I'll try to explain it as I understand it. Lets just hope that I understand it correctly
Its quite complicated... and this is only a summary.
SendMessage() ... It will completely bypass the message que and ultimately call the window Proc directly. The message is never placed into the message que. Instead it is placed into a seperate FIFO stack of "nonqueued messages" which is technically not the normal message que.
The following functions generate nonqueued messages:
SendMessage, SendMessageCallback, SendMessageTimeout, SendNotifyMessage, BroadcastSystemMessage, BroadcastSystemMessageEx... maybe more I dunno.
PostMessage()... always places the message into the standard windows message que and returns immediately.
tom groezer wrote: If that is true then is it true that GetMessage/PeekMessage is valid only for messages that are placed into message queue by postmessage.
GetMessage() and PeekMessage() checks for both queued and nonqueued messages. Meaning regardless of whether they are sent by SendMessage() or PostMessage() you can filter them.
tom groezer wrote: Also if we want to direct a message to another process will both PostMessage/SendMessage work. What is the difference?
You should use PostMessage(). If you use SendMessage() and the other application is blocked... your SendMessage() will never return. But there are alternatives... SendMessageTimeout() and such.
Best Wishes,
-Randor (David Delaune)
|
|
|
|
|
David, in my opinion, your interpretation does not make any sense. Why? Because when SendMessage is used across thread boundaries, it cannot be processed in the sender's thread, thus... must be queued, and processed by the receiving window's thread, whenever it is reached. That's why SendMessage may hang if the receiver thread (other than sending one) is busy... not processing queued messages. If fact, I can tell you from experience that it happen once to redraw a window, but to return the wrong value from the window procedure, thus the paint message was not removed from the queue. In that case, any other thread using SendMessage to communicate with this window was blocked, not only the thread that created the window.
Your explaination with a secondary FIFO doesn't hold, because a thread's context can't change "suddenly". If there is a message queue (also FIFO) which GetMessage() and PeekMessage() are using, when and how a secondary FIFO can be processed? No OS would suspend a thread's execution while processing a message from the queue, or even while waiting for a new message, and "suddenly" call a window procedure with a message sent through SendMessage! Remember, I'm not talking here about sending a message to a window belonging to the same thread where the call is made.
Indeed, when the window belongs to the same thread, it makes perfect sense to call the window procedure immediatelly, because the developer would expect that SendMessage() returns only after the message is processed, so... the thread execution depends on the processing of that message, before any other message already existing in the queue at that point in time. I don't even understand why MSDN says that such behaviour is for "Vista or later", because, when I think about it,... it cannot be otherwise.
Regards,
|
|
|
|
|
|
Thanks David for the links... especially the second one!
It is interesting to see different opinions about an "old new subject" such as message queueing. We might fight over nothing here, since I kinda agree with one of the conclusions mentioned in that discussion thread: it seems to be an implementation detail. Point taken regarding the non-queueing messages! Indeed, sent messages are different since are not stored as messages posted, and also not returned by GetMessage. My logic still says that they are "somehow" queued... and how is indeed "an implementation" detail. All this confusion is set by MSDN, which is not comprehensive on the subject, and also contradicting itself in the documentation of GetQueueStatus()[^], when describing QS_SENDMESSAGE. As you well described, sent messages are different then posted ones, having higher priority, and still being queued (maybe separately, or could be inserted ahead of the posted ones) because they can't be processed by receiving thread "immediately" (as MSDN is misleading us).
Please have a look at "The Algorithm for Extracting Messages from a Thread's Queue" section at "Waking a Thread[^]" sub-chapter from a book called "Programming Applications for MS Windows, 4th edition" by Jeffrey Richter, and tell me if you agreed with what says there... at least partially. It was published by Microsoft Press[^]!
Thanks,
|
|
|
|
|
Hi All,
I am debugging my application by printing the Working Set at the specific point with the function provided in psapi.h
My purpose is to check which part of my application used up the memory.
However, just look at the Working Set is not very conclusive. I found if allocated 1k memory in the app but the Working Set may not grow up 1k accordingly. It will grow eventually(say allocated 10 times 1k, Working Set will grow up around 10k.)
In the psapi.h, there are several values such PageFault, PagedPool, Pagefile... i can see those values will change each time when allocating memory. I guess the result of memory allocation action has reflected in those values.
What i want to ask is any formula to calculate the exact memory usage of the application? say, i do "new char[128]" the memory usage result will grow up 128byte immediately.
Any reply will be appreciated!
Thanks!
Jim
|
|
|
|
|
When you allocate 128 bytes through "new char[128]", you may not commit any new page of memory!!!
My point is that memory allocation is done by the heap manager used by your module. For example, if CRT is the heap manager (msvcrt.dll) you're linking with, all "malloc / new" kind of instructions will be handled by that library, which may reuse previously released memory, or return an address of already commited memory. The heap manager keeps track of your allocations, and commits pages of memory only when needed. For example, on first allocation, a number of pages are commited to support the request. On those pages there's still room for more allocations. Thus, next allocation, if small enough, will not commit more pages, but use the existing commited pages.
There're plenty of online resources explaining how a "heap manager" implementation works:
http://blogs.technet.com/askperf/archive/2007/06/26/what-a-heap-of-part-one.aspx[^]
http://en.wikipedia.org/wiki/Chunking_(computing)[^]
http://www.blackhat.com/presentations/bh-usa-06/BH-US-06-Marinescu.pdf[^]
http://www.freshpatents.com/Methods-systems-and-computer-program-products-for-managing-a-memory-by-storing-external-objects-in-a-dynamic-heap-dt20051215ptan20050278496.php[^]
Best regards,
|
|
|
|
|
Does WM_COPYDATA use some kind of shared memory concept when it uses the structure COPYDATASTRUCT?
|
|
|
|
|
When sending WM_COPYDATA message to another application, lParam must point to a COPYDATASTRUCT, and the passed data must not contain any addresses (pointers or references) that would not be available in the other process. Until the thread sending the message returns from the call, the data structure should be either locked or not modified by other threads of the calling process. The data received by the other process cannot modify / return any of the structure's content. The reason behind all these is that the OS is copying the given structure as a block, from the calling process to the receiving process. It is like calling WriteProcessMemory, on some temp variable (thread stack address) in the target process. The communication is one way!
Regards,
|
|
|
|
|
While using the structure could we say that the OS implements one as a shared memory?
|
|
|
|
|