|
|
Hi,
I draw a rectangle in my ownerdraw control. I need to fill it with the current background, a brush I guess (it's for resizing or ungly paint artifacts can stay on my dialog). How would I clear area with current background? ....I already have my DC and and the client rectangle.
CBrush brBackground(??????);
dc.FillRect(pRect, &brBackground);
Thx
|
|
|
|
|
Use the WS_EX_TRANSPARENT style for your control. It will make sure that all of the controls below yours gets painted first.
Then you will need to override your WM_ERASEBKGND message to not do anything. Simply return TRUE in the handler for this function. Then in your paint routine, do what you wanted to do on the control.
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 have written a program that works great with Windows XP. A friend of mine tried it on Windows ME and nothing worked, from static controls, list box scroll bars, etc. Should I be concerned that I will have the same problems on Windows 95/98/2000 or should I put my confidence in that Windows ME is the worst windows ever and is to blame for everything.
|
|
|
|
|
I think your program has huge bugs. Test it on at least some 9x platform and w2k/NT4.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Are you saying that it has huge bugs due to the above mentioned, or you have actually tried it and are basing your conclusions as such? I am on my way to test it, see ya later!
|
|
|
|
|
There is no reason to believe that the problem is being caused by ME. That is just wishful thinking. In general, there is no reason to ever believe a problem is caused by the operating system. It does no good to start a debugging process with that attitude. It is always best to assume it is your software. Only after you have proof that it is an operating system problem, should you even venture down that path.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I guess you're right, can't know unless I have tested it. But I remember throwing ME out the window because it would always hang, crash, destroy my cd's when I was burning, the list goes on and on. I especially remember when I first started programming this app and the scroll bar of the list box was so jerky as if it was using up all of my resources. As soon as I installed XP, my problems disappeared!
|
|
|
|
|
Heheh, ME sucks. No argument about that. But that is "the user" side of me talking. "The developer" side of me says "life sucks, you have to support it".
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
|
Yeah, ME has its problems but you still can run regular apps on it, like Word, Excel, etc. If your app is acting weird then there's probably something wrong with it. The fact that it's OK in XP is likely because XP has a much greater tolerance for resource leaks. Remember, XP is based on 2000, which is based on NT, and NT is not nearly as limited when it comes to resource use (and abuse) as 95/98/ME are.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
Hi!
I've got a template class which basically implements the functionality in a dialog. Now I must use a callback function which requires a pointer to the class.
The callback function is a global function outside the template. How do I cast in this function from a LPARAM to my CTemplateWhatever<cdlgwhatever> pointer? I dont have the template specifiers because its outside my template class.
Any ideas?
template<class _Ty> void CTemplateWhatever<_Ty>::UsesCallback()
{ DoSomething(Mycallbackfunction, this); }
void Mycallbackfunction(LPARAM a)
{
}
|
|
|
|
|
You have two options here (to the best of my knowledge):- Derive
CTemplateWhatever from an abstract class with all the virtual methods Mycallbackfunction is interested in and cast to that base.
- If you can afford it, templatize
Mycallbackfunction like this:
template void CTemplateWhatever<_Ty>::UsesCallback()
{
DoSomething(Mycallbackfunctionwrapper<_Ty>::f, this);
}
template <_Ty> struct Mycallbackfunctionwrapper
{
static void f(LPARAM a)
{
CTemplateWhatever<_Ty> *p=
reinterpret_cast<CTemplateWhatever<_Ty> >(a);
...
}
}; A template class wrapper is preferred to directly templatizing the function because of a VC++ bug that makes it impossible to explicitly indicate template parameters for a function.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks. I solved it similar, just a bit simpler with a function template for the callback. Works fine for me.
Error 4711: Signature expired
|
|
|
|
|
|
No, thats fine. I've got parameters and that specific function is instantiated just once (per app).
Thanks a lot.
I don't think this is a serious possesion, and the evil most likely comes from your hand. Colin J Davies, The Lounge
|
|
|
|
|
how can we get the Id of the computer processor ?
|
|
|
|
|
|
Can someone give me a simple(just the skeleton) Windows Messenger addin source code (IMessengerHeadlines or something else) please?
Thanks...
|
|
|
|
|
hi!
I needed to implement a schema wherein one Property Sheet is displayed over the other, although with a slight offset. (Please note that both sheets are modal).
Any help will be highly appreciated.
Regards
Richard
|
|
|
|
|
Hi All,
How can I check for timer id whether its already running or not...I m using SetTimer() more than once to start the same timer so I want to chk it before invoking SetTimer()...Please help me.
Thanks in advance
Prateeti
|
|
|
|
|
You can use a flag to set to TRUE when you call SetTimer() and when you call StopTimer (or what function it is) you set the flag to FALSE.
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Hello all,
I need to know when the user stops my app. from the "task administrator" using "Stop process" (Ctrl+shift+esc makes that window appear (I don't know if I have translated the window name properly )).
Thank you in advance...
|
|
|
|
|
You can't do it. Hmmm, maybe with help of debugging APIs, but it's still too much trouble.
If you need a fast solution: a workaround for this would be creating a second application that monitors the first one. The first opens a file and locks it for exclusive user and the monitor keeps trying to open the file for exclusive use too. When it succeeds, the first application has been shutdown.
If you think the user can shutdown the monitor application, you can have both applications monitoring for each one.
The file locking is only a sample and can be substituted for any Windows object that can be created on a global context, like mutexes.
My latest article:
SQL Server DO's and DONT's[^]
|
|
|
|
|
- what about finding a window caption?
FindWindow(NULL, "Caption of the window to look for");
- I will pause the machine, wait for a complete pause, delete all the program files (my program files) and shutdown the PC if I discovers that a wrong code has been entered, one of the two apps has disappeared, the expiration date has been reached, or the date has been changed to a littler one.
Do you think that it could work? I've tested all the other stuff and it's fine for me, now I'm trying to find the window caption...
|
|
|
|