Solved

Running out of system Resources

Posted on 1997-05-30
4
510 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 learn how to clear a vector as well as how to detect empty vectors in C++.

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now