|
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!
|
|
|
|
|
I need to look up "real names" for GUID's (Interface name, CoClass name, TypeLib etc.)
I know that the info is available in the registry, and that VC6 debugger does it nicely.
is there anything I can reuse? Or do I have to venture on my own?
"Dor säggsische Dialeggt eechnet sich wie keeen onderor für den Ausdrugg zäärdlischor Gefiehle."
sighist | Agile Programming | doxygen
|
|
|
|
|
it's pretty easy, but don't know any API for that
you have to only open registry at the right place.
If you look to HKCR\CLSID\
you'll see a bunch of GUIDs in text form for objects, you have to open registry key
HKCR\CLSID\{GUID} and get the default value to retrieve the name of the object
for interfaces the same
HKCR\Interface\{IID}
suprisingly for Typelibs it's little different
HKCR\TypeLib\{LIBID}\1.0 (or another version number)
you can check it directly in regedit.
Hope it helps
|
|
|
|
|
When you right click an exe file you get the company's name, I'm wondering how you create this information? I would assume there's a setting in VC++ and studio.NET that compiles this information into the file but I'm not sure where to find this setting.
Obseve everything, remember more...
|
|
|
|
|
In resources tab, click Insert > Version and fill out the version info for your app. That'll get compiled in the exe and Windows will be able to associate your exe file with a company etc. when viewing properties or in small text beneath the icon in explorer
|
|
|
|