Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 544
  • Last Modified:

Running out of system Resources

*/ from my .cpp file
#pragma argsused
BOOL Wintodo_OnCreate(HWND hwnd, CREATESTRUCT FAR*  lpCreateStruct)
{
      
      CreateWindow("BorBtn",NULL,
      WS_CHILD|WS_VISIBLE|WS_BORDER,
      1,0,24,20,hwnd,HMENU(801),
      hInstance,NULL);
}

 */ Segment from my resource file /*
1801 BITMAP "1801.bmp"
3801 BITMAP "3801.bmp"


My program does not call "LoadBitmap" to use these
bitmaps, they seem to have been loaded automatically
by the program the only problem is that i am running out
of system resources because my program does not seem to be freeing the resources it loaded when i comment out the bitmaps in my resource file every thing seem to be OK.
My question is Must i use LoadBitmap?? and where should i use it i tried using it before the call to CreateWindow
but it did'nt make a diffenence.
Should i call DeleteObject()?? and if so how can i if i
don't have a handle to this bitmap any where in my program which does'nt seem to need it anyway and also i cannot use an integer in the call to LoadBitmap, am i doing something wrong (I got the documentation for placing a bitmap on my buttons from Borland TechFax Document #1534).
 Thanx in aDvanCe.
0
mwebster
Asked:
mwebster
  • 3
1 Solution
 
mwebsterAuthor Commented:
Edited text of question
0
 
mwebsterAuthor Commented:
Adjusted points to 100
0
 
ramshankCommented:
If you are trying to load a bitmap on to a window it is always advisable  to use LoadBitmap function. Aftre completeting your operation DeleteObject should be used for deleteting the bitmap object. the advantage of usinfg LoadBitmap is that it gives you a  handle  to the open bitmap which can be used anywhere. For the LoadBitmap include the bitmap into your resource and use use  MAKEINTRESOURCE  in your LoadBitmap function.
0
 
mwebsterAuthor Commented:
iin reply to  ramshank's answer these buttons are being used
as a short cut to my program's main menu and  not in a dialogbox
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now