|
Win32_MotherboardDevice WMI class which is under the "Computer System Hardware Classes". For BIOS check Win32_BIOS class.
Atul
100.13714 netdiva
|
|
|
|
|
|
is there anyway to call RegisterClass() and CreateWindow() "dynamically"? i need to make a message pump for a worker thread in an ATL control. Everyone says "make a message pump", so show me how. i dont want to know "what to do" i want to know "how to do it". Thanks, people. Let's see some CODE since this is called "CodeProject" haha Thanks if anyone can help me.
~Timothy T. Rymer
www.digipen.edu
tim.xpertz.com
|
|
|
|
|
Hey, behold the authentic message pump:
MSG msg;
while(GetMessage(&msg,NULL,0,0)!=0){
TranslateMessage(&msg);
DispatchMessage(&msg);
} Jokes aside, every window created within a particular thread can only work if that thread, after window creation, gracefully decays into this message loop. GetMessage returns 0 upon calling PostQuitMessage (usually issued from the WM_DESTROY handler of the thread main window), signalling the thread to exit from the message pump (because no further message processing is required).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
The real message pump.
TradeMark...?
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hi all,
I would like to know about making COM objects ?
How can i make a simple COM objects ?
Can you write example for me ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
|
Hi!
I'm working on a CAD project and I can't seem to get the lighting right. My light source is coming from a fixed direction and so when a shaded part is rotated and is directly facing that light source, it is really shiny. I've tried reducing the light intensity and the shininess but this means that, at certain angles, some parts appear too dark.
Is there any way to reduce the shininess while at the same time avoiding these dark areas? Any help would be greatly appreciated...
Thanks!
Mandy
|
|
|
|
|
I have an mdi applicaiton that has some of the same features as an existing project. I really do not want to redesign everything. So can i import a dialog box from one project into another?
if so how?
Thank you.
|
|
|
|
|
It doesn't seem like you can get VC to save or export dialog resources alone, so you have 2 options:
1) Open the resource.rc file as text and copy the dialog resource info into clipboard. Open the new resource file as text and paste clipboard contents into new file.
2) Make a copy of the resource.rc open it as text and remove all un-nessecary contents.
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Copy the .rc file from the source project to a safe dir (working copy) then, with the dest project open, open this .rc file - you should find you can drag and drop what you want into your new project, and it shouldn't be to hard to reuse any existing CDialog based class as well.
|
|
|
|
|
I didn't even think of doing it that way!
Sweet...theres a time saver!
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Yep - but make a copy of the original .rc, because VC seems to treat it as a 'move' operation rather than a 'copy' - by default anyway.
|
|
|
|
|
I've been inserting the reference project into the new project, then dragging and dropping the resources into the new project. (and then break the link)
One cool thing is that it seems to copy whatever bitmaps, etc that you need as well. I'm not even sure why it works, but it's slick. You have to join projects, though. You can break them apart later.
---------------------------------------------------------------------------------
I wish I had a way to have multiple *.rc files for a project - when we are using Visual Source Safe, one guy wants to change his dialog somewhere, but he has to check out the main rc file, and it locks us all out of it. (and he leaves it checked out and we are stuck for a while)
I started playing around with doing #include's into the resource file to let us split it up, but didn't get too far.
|
|
|
|
|
In VS you can open up multiple *.rc files at once and copy/paste between them. This is easier than dealing with them as text files, as you don't have to worry about assigning resource IDs, copying bitmap or icon files, etc.
farewell goodnight last one out turn out the lights Smashing Pumpkins, Tales of a Scorched Earth
|
|
|
|
|
What are the differences between OnErase and OnPaint.
Although I haven't actually tested or noticed, I assume OnPaint is called after. OnErase would be used for...drawing the background and OnPaint would be used for...drawing the forground, this is why i assume OnPaint is called second. Are there any other deifferences between them that i'm missing here...?
Also...double buffering doesn't seem to work in OnErase so I always get flicker.
CMemDC class works AWESOME!!! Kudos to the author, small simple...i one include file...I Like it!
However this class requires you to override onErase and return FALSE..?(i think) I guess this means all drawing should be done in OnPaint...???
I'm curious to know the purpose of OnErase...???
The reason I ask is i'm creating a control from scratch (CWnd) and do all the drawing etc...OnErase causes flicker and OnPaint don't...whats the deal...?
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Seems to me that WM_ERASEBKGND is some kind of legacy message that has been maintained for compatibility reasons, but that lacks any real usefulness. The standard sequece of calls and messages is this:- When the window needs to be repainted,
WM_PAINT is sent. OnPaint typically calls BeginPaint , which prepares the window DC, sends WM_ERASEBKGND and returns the DC ready for painting. So, by the time BeginPaint returns, WM_ERASEBKGND has been already processed.- All drawing stuff takes place with the DC returned by
BeginPaint . - Once the drawing is finished,
EndPaint releases the DC and the handler for OnPaint exits. I've got two questions regarding this issue that surely Christian Grauss will be able to anwser (are you reading this, Chris ? ):
- What are the origins and purpose of the
WM_ERASEBKGND ? Is there more to this message than I said above?
- What is the difference between returning
TRUE or FALSE in OnEraseBkGnd ?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Michael Dunn is the person who made me realise how useful WM_ERASEBKGND is, so he's probably a better person to answer this.
1. WM_ERASEBKGND seems to be used to redraw the background of a window, and any invalidate call that passes the default TRUE parameter calls it first. In this sense, I find that WM_PAINT is the redundant call, in that WM_ERASEBKGND is usually a better place to try and get flicker free drawing happening. The alternative is to prepare a buffer image, create a CPaintDC and immediately Blt the image over it, which makes for minimum flicker, but doing it in WM_ERASEBKGND is really what you're trying to get as close to simulating as possible, so why not do it there ? I actually tend to use OnPrepareDC, which is the prior call to OnDraw, and I have no idea why some app types can process both pairs of messages.
The one downside to all this is you must never call Invalidate(FALSE) if you are drawing in WM_ERASEBKGND.
Joaquín M López Muñoz wrote:
What is the difference between returning TRUE or FALSE in OnEraseBkGnd?
This is a question I'd like to look at myself. In theory it is telling the framework you did or didn't handle the call, but returning either instead of calling the base method appears to have the same effect, or at least that's how it seems based on my limited testing. I've always returned TRUE until someone posted an example returning FALSE and I noticed it did the same thing.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
|
|
|
|
|
What is the difference between returning TRUE or FALSE in OnEraseBkGnd?
This is a question I'd like to look at myself. In theory it is telling the framework you did or didn't handle the call, but returning either instead of calling the base method appears to have the same effect, or at least that's how it seems based on my limited testing. I've always returned TRUE until someone posted an example returning FALSE and I noticed it did the same thing.
Hmm, between what you and Killowatt says, I will have to pull this up in the debugger and see what is going on. I really geek out over this stuff.
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?
|
|
|
|
|
Christian Graus wrote:
WM_ERASEBKGND is usually a better place to try and get flicker free drawing happening
I don't know if your familiar with the CMemDC class found here Flick Free
but when I use it in OnDraw or OnPaint it works perfect, but in OnErase it still flickers...any idea as to why this might be..???
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I'd say at a guess because you're trying to do something it handles itself, and that it uses the last minute creation of CPaintDC method I described.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
|
|
|
|
|
Is hockeydude maybe calling the baseclass implementation, and then re-erasing background again afterwards?
I'd used this message handler, and done some really sloppy DC coding and still not had flickering. Hence I wonder if it's being done twice
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
WM_ERASEBKGND is still a very important message.
WM_ERASEBKGND reinitialized the display surface before you paint it. When you drag a window over the window that needs to be repainted, the WM_ERASEBKGND message is needed to remove the image of the window that obscurred your view of the target window.
If you override and return FALSE for WM_ERASEBKGND , and you do not provide a WM_PAINT handler, you will see that your display window will just get written on by any other window that is placed on top if your window.
If you return false in WM_ERASEBKGND , then you are telling the WM_PAINT handler that it is responsible for erasing the background of your window. The fErase field of the PAINTSTRUCT returned from BeginPaint will be true if you return FALSE in WM_ERASEBKGND .
|
|
|
|
|
Ok...so i'm not the only one that found OnErase un-nessecary. What bothers me is that my control (while painted in OnPaint to avoid flicker) will be painted over possibly by the derived versions OnDraw (It's actually a view not a CWnd). Unless the derived class does
void CNewView::OnDraw(CDC* pDC)
{
pDC->LineTo(100, 100);
COldView::OnDraw(pDC);
}
Would the above implementation avoid the problem..??
Hope you don't mind me asking...I realize i'm only one step away from trying it and figuring it out myself, but I always like to hear a second opinion on the subject before I ever try anything.
Cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Are you worried about other people deriving from your class and changing the way it looks, or even you deriving from your class? Is that the problem that you are trying to avoid?
If some one derives from your class there is very little that you can do to prevent them from doing anything that they want.
Let me know if you are trying to derive from someone else's class adding paint enhancements to what they have already done and avoid flicker by adding in your own new code.
|
|
|
|