Solved

Running out of system Resources

Posted on 1997-05-30
4
526 Views
Last Modified: 2008-02-26
*/ 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
Comment
Question by:mwebster
  • 3
4 Comments
 

Author Comment

by:mwebster
ID: 1163766
Edited text of question
0
 

Author Comment

by:mwebster
ID: 1163767
Adjusted points to 100
0
 
LVL 1

Accepted Solution

by:
ramshank earned 100 total points
ID: 1163768
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
 

Author Comment

by:mwebster
ID: 1163769
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
maze travler 6 62
ASP.net build a IF/Then Walkthrough Guide 1 240
FMX TCameraComponent Problem 2 89
Embarcadero C++ builder XE10.1 Berlin TRegistry declaration 1 41
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question