|
Okay, i have this problem with a screensaver i'm writing. Basically i want to write a screensaver that plays a video.
Then when the mouse is moved (or a key pressed) the program quits.
Everything works fine, except when the mouse is moved over the area of the video playing.
the following function doesnt get any "WM_MOUSEMOVE" callback while the mouse is over the video area
LRESULT WINAPI ScreenSaverProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
///////////////
my guess is that it might be a problem with the following
MCI_DGV_WINDOW_PARMS mciWindow;
mciWindow.dwCallback = 0L; //Here
mciWindow.hWnd = hWnd;
mciWindow.nCmdShow = SW_SHOW;
anyways, the
mciSendCommand(gwMCIDeviceID, MCI_PLAY, dwFlags, (DWORD)(LPMCI_DGV_PLAY_PARMS)&mciPlay);
function doesnt return any "WM_NOTIFY" call back or anything to the ScreenSaverProc
Any help with this would be greatly appriciated
|
|
|
|
|
I'm having problems with the CMemDC inside a CStatic derived class.
void MyStatic::OnPaint()<br />
{<br />
CPaintDC dc(this);<br />
CMemDC memDC(&dc);
<br />
CBrush brush(RGB(255,0,0));<br />
CPen pen(PS_SOLID,1,RGB(0,0,0));<br />
<br />
HBRUSH oldbrush=(HBRUSH)memDC->SelectObject(brush);<br />
HPEN oldpen=(HPEN)memDC->SelectObject(pen);<br />
<br />
memDC->Rectangle(&r);<br />
<br />
memDC->SelectObject(oldbrush);<br />
memDC->SelectObject(oldpen);<br />
}<br />
<br />
BOOL MyStatic::OnEraseBkgnd(CDC* pDC)<br />
{<br />
return TRUE;<br />
}
If I use this inside a derived CSliderCtrl, for example, a nice red box will be drawn with a black outline on a gray dialog. Top!
But inside a derived CStatic, the dialog is entirely white, nothing else. I've 2 different versions of CMemDC (both currently on codeproject), there's one that returns a white dialog, the other gives some random colors, like a corrupt bitmap.
What am I doing wrong here?
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
hi,
why do you use CMemDC, and not directly dc ?
HBRUSH oldbrush=(HBRUSH)dc->SelectObject(brush);
HPEN oldpen=(HPEN)dc->SelectObject(pen);
dc->Rectangle(&r);
|
|
|
|
|
Double Buffering...
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
Try this in OnDraw( CDC* dc ) like this
CMemDC pDC(dc);
if( !pDC->IsPrinting() )
{
}
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
I've changed it to a custom control derived from CWnd. Works fine now.
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
* If you want to set the background color, you should have a look to this article: http://www.codeproject.com/miscctrl/colorcontols.asp?target=ccolorstatic[^]
On the use of MemDC:
* To avoid flickering, OnEraseBkgnd should return FALSE.
* you should use pointers with CDC::SelectObject
CBrush *pOldBrush = memDC->SelectObject(&brush);<br />
CPen *pOldPen = memDC->SelectObject(&pen);
...
memDC->SelectObject(pOldBrush);<br />
memDC->SelectObject(pOldPen);
Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Dwight D. Eisenhower
|
|
|
|
|
Hi all,
I am developing a dialog based application using VC 6.0
I have placed a RichText control on dialog template. Right clicking on it opens a control's properties window, in the Style's tab there is a combobox option Align Text. It has three values
- Right
- Centered
- Left
I have selected default value at design time, but I want to change this selection at runtime.
How can I accomplish this.
Thanks
The Phantom.
|
|
|
|
|
Have you looked at CRichEditCtrl::SetParaFormat() ?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
How can we spy[hook] Registry Actions? such as RegSetValueEx that called in other running process.
thanks
|
|
|
|
|
|
If am searching for a way to exit a MFC MDI application if I discover an error in CMyView::OnInitialUpdate().
If I use SendMessage(WM_CLOSE) to the main window, I get some crashes in MFC classes.
Using exit(0) seems to be not very good, because of memeory leaks.
So what's the best way to end a MFC application during CMyView::OnInitialUpdate()?
Thanks in advance.
|
|
|
|
|
Use PostMessage instead of SendMessage. SendMessage is a synchronous do it now kind of thing, which will rip the floor from underneath you, while PostMessage will defer it until OnInitialUpdate returns.
Steve S
|
|
|
|
|
First iterate through all the open documents, and close them one by one. Then instead of using SendMessage to send WM_CLOSE, use PostMessage. It should work.
Acutually the program crashes, When OnActivateFrame( ... ) is invoked with WA_INACTIVE parameter and the 'this' pointer( which has an invalid value ). So use PostMessage.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Why not use PostQuitMessage() ?
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
PostQuitMessage is another option. But it uses WM_QUIT instead of WM_CLOSE. I thought, since the guy was using WM_CLOSE, lets us point out, where he has went wrong. Actualy the problem was with using SendMessage, and not with WM_CLOSE.
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
I wonder what MFC is capable of?
Can it create full-screen 3D games?
Have anyone ever played games on
RealOne Arcade? Are they made from
MFC? Anyone knows what technology do
they use?
Thanks
|
|
|
|
|
Use Direct3D.
You can combine DX with MFC without any problems.
You can also use some 2D/3D library, but remember that it will run slower (software rendering).
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
So, you mean the DirectX can combine with
MFC? Is DirectX a language or a platform?
How do you combine them together? Do you
just add DirectX code into the MFC project?
Thanks.
|
|
|
|
|
Direct-X is a free MS API. Almost every commercial game today is created using DX.
To develop in DX, you need C++ and an understanding of COM objects. There's a DX for visual basic also, but it's very limited and you should not use that one.
If you want to develop into DX, you need to download the DX SDK from the microsoft site.
There's an example, that comes with the SDK, on how to combine D3D into an MFC app. It's pretty straightforward.
To be complete, I should mention OpenGL too. That's another API with 3D inside, but I've never used that.
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
Yes I know every commercial game is using DirectX today.
But I don't know how it is used. So you are saying that
I can download the SDK and combine it with MFC. So, do
I need Visual Studio to do that. Well, yes, I have
VS.Net 2003 installed, but what if other people who do
not have VS, can they benefit from the DX SDK?
I am currently a freshman CS student, so most of the
programmings are done in console-based C++. So could
you tell me how do they develop game's engine? Do they
used MFC combine with DX technique? Have you ever played
Half-life, or Unreal? They comes with an Editor that allows
you to create a mod, have you used that? That looks like
a normal window-based program. Is it developed in MFC +
DX techniqe?
Could you explain that what's the difference between
Win 32 program, and MFC?
Thanks.
|
|
|
|
|
MFC isn't best suited for games. Games don't make the best use of the MFC capabilites. MFC is an overhead that most games don't require.
Most games have their own window handling framework, although I do know people who use WTL to handle the processing of Windows messages.
Personally I rolled my own mini-framework to use along side DirectX.
I used some of the techniques described in the Windows++[^] book for building the framework for handling message processing. I then used DirectX to handle the drawing.
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
I want to create ActiveX self,
but in CDialog where it defined, instead of them
(due to lack of memory happens if Cdialog creates ActiveX
- they do many uncontrolled loads with IPictureDisp interface )
I need to get position and tab-oreder information for
each control in CDialog resource.
Here is not shown position info, and enumeration:
http://www.codeproject.com/useritems/UpdateResource.asp
and Do not allow to create control by CDialog.
Can some one help me?
thanks.
|
|
|
|
|
How to detect ICMP echo request under windows2000 ?
Any source available ???
|
|
|
|
|
you'll need a packet sniffer!
Don't try it, just do it!
|
|
|
|