|
I use:
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
at the top of my application, and:
_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
at the start of my application (first function).
More information about the object that caused the memory leak will appear in the debug information.
|
|
|
|
|
Yes, I notice that the VC6 dump tells you which object caused the leak and VC7 doesn't
_CrtSetDbgFlag doesn't make any difference.
|
|
|
|
|
Hi,
I set bitmap in default button. When button enable, button is display with bitmap. But when button disable then bitmap doesn’t show in button and button is shown with another color.
Here is my code:
HBITMAP hbmp =::LoadBitmap(AfxGetInstanceHandle), MAKEINTRESOURCE(IDB_BITMAP_OK));
::SendMessage(GetDlgItem(IDC_OK)->GetSafeHwnd(), BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,(LPARAM) hbmp);
hbmp = NULL;
I also checked Bitmap option from button properties.
My problem is that, I want to show button with bitmap when it is disable (same as when button is enable).
Anybody can tall me, how can I solve this problem?
|
|
|
|
|
Make sure the style of your button does not require more than one picture (the common "three states" requires a picture for normal state, a picture for "pushed" state and a picture for disabled state).
If not, then invert the problem, make a button with three states, and provide the same picture for the normal and grayed state.
~RaGE();
|
|
|
|
|
HBITMAP hbmp =::LoadBitmap(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_BITMAP_OK));
GetDlgItem(IDC_OK)->GetSafeHwnd()->SetBitmap(hbmp);
This code give me a error. that is : 'SetBitmap' : is not a member of 'HWND__'
|
|
|
|
|
Hi,
Thank you for reply.
yes, this code is ok. but it didn't solved my problem.
when button is disable, it doesn't show bitmap.
i want to show bitmap in button when button is disable.
|
|
|
|
|
Hi all,
I have a small problem..I have an MFC application..and I want to enable screensaver or disable screensaver on meeting some condition...can I do it..I tried searching for it in google, codeproject etc..but hard luck...nothing is there..can anyone out there help me out...any help or pointers are highly appreciated..
Thanks a lot in advance..
Himanshu
|
|
|
|
|
Do you want to disable it permanently or just while your program is running?
To disable it permanently, you might have to write to the registry or use SystemParametersInfo() , although unless your program is specifically to change the screensaver, then most users won't like you doing this.
To disable it temporarily, look at SetThreadExecutionState(ES_DISPLAYREQUIRED) . This function is supported on Win98 or later.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi,
Thanks..i tried using systemparametersinfo() but seems as if it is not enabling the screensaver..i want to enable screensaver like on event when I press OK button..but it is not happening...and disabling i dont require..sorry..I think it will automatically disable if we press any key or move mouse..Please help...
Thanks in advance..
Himanshu
|
|
|
|
|
Oh, you want to start the screensaver running whenever you like? A screensaver is just an exe file on your hard-drive. The name of the screensaver file the user has selected is in the registry, at "HKEY_CURRENT_USER\Control Panel\Desktop\SCRNSAVE.EXE" . Read this value and pass it to ShellExecute() and that will run the user's screensaver.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote:
A screensaver is just an exe file on your hard-drive
Almost, it is actually a .scr, which is, as you pointed it out, a .exe renamed in .scr.
~RaGE();
|
|
|
|
|
Rage wrote:
Almost, it is actually a .scr, which is, as you pointed it out, a .exe renamed in .scr.
Picky, picky, picky . I know that!
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote:
Picky, picky, picky
Hey, we are on CP here, the most *precise* web site about code stuff ...
~RaGE();
|
|
|
|
|
|
Ryan Binns wrote:
beat that!!
[ouch!] MMhhh ... well well well ... how is the weather in Australia today ?
~RaGE();
|
|
|
|
|
Rage wrote:
[ouch!]
I hope you saw the ";P". If not... ;P;P
Rage wrote:
how is the weather in Australia today
The temperature is about 10 degrees, it's raining, and I'm hungry. I have no idea what colour the sky is because I can't see it - all I see is more clouds than there are people in New York, and I'm hungry.
PS. Did I mention I was hungry?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
If you want to start the currently configured screensaver, try this:
PostMessage(GetForegroundWindow(), WM_SYSCOMMAND, SC_SCREENSAVE, 0);
--------
There are 10 types of people in this world. Those who know binary and those who don't.
|
|
|
|
|
hi all,
i need to check if a file is in use/locked.
(then i have to delete the file if i want.)
how can i do it using win32 api?
regards
Hari Krishnan
|
|
|
|
|
If the file exists but you can't open it for exclusive read access, you can safely assume it's locked by another process. Assuming you're using MFC, see CFile for more information.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi,
thanks, but i don't want to use CFile.
After checking i want to delete the file.
Is there any win32 way ? I've read now that CreateFile can check this. But is not sure about the arguments.
Hari Krishnan
|
|
|
|
|
HFILE hFile = OpenFile(..., OF_SHARE_EXCLUSIVE);
if (HFILE_ERROR != hFile)
{
DeleteFile(...);
}
|
|
|
|
|
I have followed the instructions for C. Lung's VERY helpful article from 1999 on calling a VB ActiveX Dll from c++. I have built my VB dll that I have (which has 24 classes and 1 .bas file), and I used the midl compiler to compile the .idl file that I made by copying the code crom OLE View, as the article instructs. Now that I have the .idl files and the .c files which correspond to my VB DLL loaded into my C++ project, I get the following error when I try to build (F7) my c++ project.
"fatal error C1010: unexpected end of file while looking for precompiled header directive". I cannot figure out the cause of this error.
The only thing I have done that was not mentioned in Lung's article is change some data type specifications in the idl file which were causing error messages from the midl compiler. I changed "Single" to "float" and, I replaced the name of a VB enum I had created with a "Long" data type.
Please advise, or ask more questions, if I have not provided enough info.
Thank you VERY much, in advance, for any help you can provide!
rajdawg - a.k.a. Roger
|
|
|
|
|
|
The product I'm working on is still in the stage where I'm releasing debug builds. I have asserts in place for things that I want to see, but aren't actual application failures. What I'd like to do is augment assert so that places where I want to see an assert, I'll get an assert, but not when a debug build leaves my desk. I could just add a define and have not only a debug build configuration, but also a private debug build configuration. But ideally, I'd like to detect at runtime whether the app is running in the debugger or not, and key this behavior (and a few others I won't go into) off of that information. Does anyone know a way to do this?
|
|
|
|
|