Solved

Running out of system Resources

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

895 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

14 Experts available now in Live!

Get 1:1 Help Now