|
Thanx for yor reply. I can modify the OCX code, however my OCX is a composite control and it seems that the OnDraw is never called, instead the CAXWindowHost::OnPaint. Overloading this call seems tricky, do you know how I can trigger the OnDraw of the composite control?
|
|
|
|
|
Hi,
I have written a small application using DirectShow that plays an MPEG or AVI movie in full screen mode. My code is based on the "playit" sample code that comes with the DirectX SDK (or at least it came with 6.1), and it uses WinAPI. All I want to do is have it so that the movie finishes (exits) as soon as you press any key on the keyboard (or one of the mouse keys, though that's not as vital). This is probably a very dumb question (I am very new to DirectX and not a very experienced programmer in general), but how can I do this? I *think* that I somehow need to send the message EC_USERABORT to the movie window as soon as the user presses a key. I have tried using put_MessageDrain() and so on, but it doesn't seem to recognise my window - or at least, it doesn't work.
This is the main loop of the PlayMovie() function:
long evCode, param1, param2;
bool bcomplete=false;
while (hr = pME->GetEvent(&evCode, ¶m1, ¶m2, INFINITE), SUCCEEDED(hr))
{
switch(evCode)
{
case EC_USERABORT:
bcomplete=true;
break;
case EC_COMPLETE:
bcomplete=true;
break;
}
hr = pME->FreeEventParams(evCode, param1, param2);
if(bcomplete==true){break;}
}
If anybody could tell me how to get my movie to close as soon as the user hits any key, I would be very grateful.
Many thanks for any help,
KB
P.S. Apologies - I posted a similar message a few days ago; however, I am still stuck and my old post seems to have been lost pages back...
|
|
|
|
|
Hi, is it possible to get the information of the display card through C++? Any sample code? Thanks.
|
|
|
|
|
EnumDisplayDevices to get the video cards
EnumDisplayMonitors for the monitors
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!
|
|
|
|
|
How do I set the mouse position (in absolute coordinates) in Win32?
Thanks.
Isaac Sasson,
Lean, mean posting machine!
Sonork ID 100.13704
|
|
|
|
|
Use this function:
BOOL SetCursorPos(
int X,
int Y
);
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!
|
|
|
|
|
Thanks! I forgot the function name and I'd hate to look through MSDN.
Isaac Sasson,
Lean, mean posting machine!
Sonork ID 100.13704
|
|
|
|
|
I think that looking through MSDN is a skill that you become good at only after years of practice and experience.
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!
|
|
|
|
|
The good thing though is that it will take years to complete your first search, so by the second one you'd be an expert...
Isaac Sasson,
Lean, mean posting machine!
Sonork ID 100.13704
|
|
|
|
|
SetCursorPos(x, y) where x and y are screen coordinates.
If you have client coordinates or coordinates relatives to another window, then you can uses function like MapWindowPoints or ClientToScreen to do the proper conversion.
Philippe Mori
|
|
|
|
|
Hi, could anyone give me an answer to this.
We have a long operation involving that we have wrapped with a CWaitCursor. However, during the processing, the cursor flickers back and forward to the pointer.
Any ideas what we can do to keep the hourglass visible?
Cheers,
Steve.
if(E_NOINTERFACE == pThat->QueryInterface(IID_IUnknown,(void**)&pUnk))
{
// I aint no pUnk bitch!
}
|
|
|
|
|
Whenever you window need redraw, the cursor is updated. If you want to stick to your CWaitCursor, you need to overwrite SetCursor().
|
|
|
|
|
Ahhhh,
documentation.
Maybe I should have read it in the first place.
Thanx for your help.
Steve.
if(E_NOINTERFACE == pThat->QueryInterface(IID_IUnknown,(void**)&pUnk))
{
// I aint no pUnk bitch!
}
|
|
|
|
|
I think it's simpler to just do:
AfxGetApp()->DoWaitCursor(1);
doSomething();
AfxGetApp()->DoWaitCursor(-1); /ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
If fact, temporary cursor are restored as soon as the mouse is moved (see SetCursor doc) and in pratice, it means that the cursor will be restored if windows messages are processed which may be the case if something with a message loop is called (COM apartment switching, message box,...).
The only way to ensure that the wait cursor stay displayed is by calling something that will do a permanent change of the cursor (or also by processing WM_SETCURSOR) or by associating a NULL cursor with your window.
In MSDN documentation, it is said that the cursor must be restored if an operation cause the cursor to be changed (see CWaitCursor::Restore).
Philippe Mori
|
|
|
|
|
Hi guys n gals, how do i disable a push button at runtime?? Is there a function in CButton class to disable a button? I couldnt find one.
thx
bye
|
|
|
|
|
Use EnableWindow(FALSE) for the buttons you want to disable.
for example, you have a push button with a control member variable m_ctlButton associated with it. So
m_ctlButton.EnableWindow(FALSE);
|
|
|
|
|
All CWnd derived class's have the EnableWindow(true/false) function
Also take a look at the CWnd class member functions to see what may also be applicable to your button or other window types.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Question: What is the maximum # of variables you like to pass into a function before you decide it needs redesigning to use a struct or some other method?
I have an old math library, some functions take 10 parameters.
Just curious if there was any "common-sense" standard.
(I have no common-sense, so I have to ask....)
- Codin' Carlos
|
|
|
|
|
The number that I have grown accustomed to is 7. But that is more because I used to program for Sun machines, and that is the number of variables that would be placed in registers before they were passed on the stack.
This is not really an issue with the VC++ compiler because it always passes the paraemters on the stack. Therefore a sensible number between 4 and 7 is good, but it will not hurt you to have a number of parameters like 10. It just becomes more cumbersome.
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 did a little more research and found that if you only use between 1-3 input parameters, depending on what you do inside of your function, then compiler is able to use the registers as input parameters. x86 does not have that many free registers, so if you use them up on input parameters, there will be no registers to perform operations with.
Hope this extra information will make a difference.
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!
|
|
|
|
|
kilowatt wrote:
x86 does not have that many free registers
Actually, it doesn't have that many registers at all, free or not.
But you seem to be right in your assessment of how MSVC handles the case, only that I've never seen it reduce it to one single fre GPR. Two, possibly, but never one. Also worth to keep in mind is that MSVC hardwires ECX to the 'this' pointer for member functions, reducing the number of free GPR's to 3 (only two more than it's Z80 relative - no wonder since they both are created at about the same time :-> ).
|
|
|
|
|
IMHO, if this struct isn't getting passed around multiple times between the main subroutine and internal subroutines, there is little point in using structures.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Right-o ol' bean.
In this case, the main routine will be calling the same few routines every time the user updates a numerical edit box or two.
So putting into struct would be 'faster' and more efficient;
Putting as individual parameters is more 'programmer friendly' and self documenting (only need function declaration, not function and structure declaration)???
hmmmmm....
- Codin' Carlos
|
|
|
|
|
It might also be more efficient to pass the struct by reference.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|