Hello,a question about handle and windows memory

This is a multi-part message in MIME format.

------=_NextPart_000_005A_01C36CB0.61900C20
Content-Type: text/plain;
	charset="windows-1258"
Content-Transfer-Encoding: 7bit

Hello,I meet a question in the programe,
In the programe,I use many loadimage() function,and put the image to some
handle,
when the image is more,windows give me a error that the memory error,but i
have more than 300 M memory left(my machine have 512 M memory),how this
happend? and how to do ?

------=_NextPart_000_005A_01C36CB0.61900C20
Content-Type: text/html;
	charset="windows-1258"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1258">
<META content=3D"MSHTML 6.00.2800.1226" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D4>Hello,I meet a question in the =
programe,</FONT></DIV>
<DIV><FONT size=3D4>In the programe,I use many loadimage() function,and =
put the=20
image to some handle,</FONT></DIV>
<DIV><FONT face=3D"MS UI Gothic" size=3D2><FONT face=3D"Times New Roman" =
size=3D4>when=20
the image is more,windows give me a error that the memory error,but i =
have more=20
than 300 M memory left(my machine have 512 M memory),how this happend? =
and how=20
to do</FONT> <FONT face=3D"Times New Roman"=20
size=3D4>?</FONT></FONT></DIV></BODY></HTML>

------=_NextPart_000_005A_01C36CB0.61900C20--

0
lixingang (11)
8/27/2003 6:32:10 AM
vc.mfc 33608 articles. 0 followers. Follow

6 Replies
575 Views

Similar Articles

[PageSpeed] 44

> lxg wrote:
> 
> Hello,I meet a question in the programe,
> In the programe,I use many loadimage() function,and put the image to
> some handle,
> when the image is more,windows give me a error that the memory
> error,but i have more than 300 M memory left(my machine have 512 M
> memory),how this happend? and how to do ?

300 M memory is not a lot of memory if you load many images.

--
Scott McPhillips [VC++ MVP]
0
scottmcp (342)
8/27/2003 12:11:49 PM
lxg,

You might want to use the appropriate function to delete the handle when you
are finished with the image, DeleteObject would seem to be the prime
candidate here :-)))

Johan Rosengren
Abstrakt Mekanik AB

"lxg" <lixingang@hotmail.com> a �crit dans le message de
news:%23SCA30GbDHA.2620@TK2MSFTNGP09.phx.gbl...
> Hello,I meet a question in the programe,
> In the programe,I use many loadimage() function,and put the image to some
> handle,
> when the image is more,windows give me a error that the memory error,but i
> have more than 300 M memory left(my machine have 512 M memory),how this
> happend? and how to do ?
>


0
8/27/2003 12:41:35 PM
 en,but i want to use the handle in the programe.
so i can't use deleteobject.
before the programe run ,my computer memory is 200M
when i run the programe, the memory is 442M.
then,I run many difficult soft,now my computer is 270M
when i run the programe ,the memory is 512M.
It seemd is not error about the memory,but i don't know why!

the code like this
    for (int i = 0;i < 9999;i++)
    {
        handle = ::LoadImage(...);
    }
every time the i is 50- 70,it give me a error.

"Johan Rosengren" <johan.rosengren@telia.com> wrote in message
news:%23bGYdjJbDHA.1740@TK2MSFTNGP10.phx.gbl...
> lxg,
>
> You might want to use the appropriate function to delete the handle when
you
> are finished with the image, DeleteObject would seem to be the prime
> candidate here :-)))
>
> Johan Rosengren
> Abstrakt Mekanik AB
>

0
lixingang (11)
8/28/2003 12:27:47 AM
en,if I need all handle at once ,i means if.,,then,there are no way to
resolve it?
there are only 200M memory in the heap.
can you tell me more about windows programe?isn't the windows programe can
use 4G memory?
"Johan Rosengren" <johan.rosengren@telia.com> wrote in message
news:%23AQ9GPRbDHA.1832@TK2MSFTNGP10.phx.gbl...
> lxg,
>
> "lxg" <lixingang@hotmail.com> a $BqD(Brit dans le message de
> news:ubNJ7NQbDHA.2328@TK2MSFTNGP09.phx.gbl...
> > en,but i want to use the handle in the programe.
> > so i can't use deleteobject.
>
> Well, of course. But you might want to check your usage, perhaps you don't
> need all the handles at once?
>
> > before the programe run ,my computer memory is 200M
> > when i run the programe, the memory is 442M.
> > then,I run many difficult soft,now my computer is 270M
> > when i run the programe ,the memory is 512M.
>
> You might very well run out of handles before physical memory. It sounds
> like you have GDI-leaks or something. You must make sure that all
> GDI-objects selected are unselected from a CDC before deleting the CDC.
You
> can have tons of memory on a machine running Win98, for example, but
quickly
> run out of GDI-handles if you don't manage them correctly. So, don't get
> hanged up on the physical memory of the machine!
>
> Johan Rosengren
> Abstrakt Mekanik AB
>
> > It seemd is not error about the memory,but i don't know why!
> >
> > the code like this
> >     for (int i = 0;i < 9999;i++)
> >     {
> >         handle = ::LoadImage(...);
> >     }
> > every time the i is 50- 70,it give me a error.
> >
> > "Johan Rosengren" <johan.rosengren@telia.com> wrote in message
> > news:%23bGYdjJbDHA.1740@TK2MSFTNGP10.phx.gbl...
> > > lxg,
> > >
> > > You might want to use the appropriate function to delete the handle
when
> > you
> > > are finished with the image, DeleteObject would seem to be the prime
> > > candidate here :-)))
> > >
> > > Johan Rosengren
> > > Abstrakt Mekanik AB
> > >
> >
>
>

0
lixingang (11)
8/28/2003 2:39:19 AM
lxg,

"lxg" <lixingang@hotmail.com> a �crit dans le message de
news:ubNJ7NQbDHA.2328@TK2MSFTNGP09.phx.gbl...
> en,but i want to use the handle in the programe.
> so i can't use deleteobject.

Well, of course. But you might want to check your usage, perhaps you don't
need all the handles at once?

> before the programe run ,my computer memory is 200M
> when i run the programe, the memory is 442M.
> then,I run many difficult soft,now my computer is 270M
> when i run the programe ,the memory is 512M.

You might very well run out of handles before physical memory. It sounds
like you have GDI-leaks or something. You must make sure that all
GDI-objects selected are unselected from a CDC before deleting the CDC. You
can have tons of memory on a machine running Win98, for example, but quickly
run out of GDI-handles if you don't manage them correctly. So, don't get
hanged up on the physical memory of the machine!

Johan Rosengren
Abstrakt Mekanik AB

> It seemd is not error about the memory,but i don't know why!
>
> the code like this
>     for (int i = 0;i < 9999;i++)
>     {
>         handle = ::LoadImage(...);
>     }
> every time the i is 50- 70,it give me a error.
>
> "Johan Rosengren" <johan.rosengren@telia.com> wrote in message
> news:%23bGYdjJbDHA.1740@TK2MSFTNGP10.phx.gbl...
> > lxg,
> >
> > You might want to use the appropriate function to delete the handle when
> you
> > are finished with the image, DeleteObject would seem to be the prime
> > candidate here :-)))
> >
> > Johan Rosengren
> > Abstrakt Mekanik AB
> >
>


0
8/28/2003 3:22:32 AM
lxg,

An overview of GDI-objects:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dngdi/html/msdn_objects.asp

You'll be able to calculate the memory your bitmaps actually use :-) Here is
an article on leaking resources, if this is your problem:

http://msdn.microsoft.com/msdnmag/issues/01/03/leaks/default.aspx

Johan Rosengren
Abstrakt Mekanik AB

"lxg" <lixingang@hotmail.com> a �crit dans le message de
news:%23fg6aXRbDHA.1640@TK2MSFTNGP10.phx.gbl...
> en,if I need all handle at once ,i means if.,,then,there are no way to
> resolve it?
> there are only 200M memory in the heap.
> can you tell me more about windows programe?isn't the windows programe can
> use 4G memory?
> "Johan Rosengren" <johan.rosengren@telia.com> wrote in message
> news:%23AQ9GPRbDHA.1832@TK2MSFTNGP10.phx.gbl...
> > lxg,
> >
> > "lxg" <lixingang@hotmail.com> a $BqD(Brit dans le message de
> > news:ubNJ7NQbDHA.2328@TK2MSFTNGP09.phx.gbl...
> > > en,but i want to use the handle in the programe.
> > > so i can't use deleteobject.
> >
> > Well, of course. But you might want to check your usage, perhaps you
don't
> > need all the handles at once?
> >
> > > before the programe run ,my computer memory is 200M
> > > when i run the programe, the memory is 442M.
> > > then,I run many difficult soft,now my computer is 270M
> > > when i run the programe ,the memory is 512M.
> >
> > You might very well run out of handles before physical memory. It sounds
> > like you have GDI-leaks or something. You must make sure that all
> > GDI-objects selected are unselected from a CDC before deleting the CDC.
> You
> > can have tons of memory on a machine running Win98, for example, but
> quickly
> > run out of GDI-handles if you don't manage them correctly. So, don't get
> > hanged up on the physical memory of the machine!
> >
> > Johan Rosengren
> > Abstrakt Mekanik AB
> >
> > > It seemd is not error about the memory,but i don't know why!
> > >
> > > the code like this
> > >     for (int i = 0;i < 9999;i++)
> > >     {
> > >         handle = ::LoadImage(...);
> > >     }
> > > every time the i is 50- 70,it give me a error.
> > >
> > > "Johan Rosengren" <johan.rosengren@telia.com> wrote in message
> > > news:%23bGYdjJbDHA.1740@TK2MSFTNGP10.phx.gbl...
> > > > lxg,
> > > >
> > > > You might want to use the appropriate function to delete the handle
> when
> > > you
> > > > are finished with the image, DeleteObject would seem to be the prime
> > > > candidate here :-)))
> > > >
> > > > Johan Rosengren
> > > > Abstrakt Mekanik AB
> > > >
> > >
> >
> >
>


0
8/28/2003 6:18:35 PM
Reply:

Similar Artilces:

Hello again!
I attempted to add the SW_HIDE and SW_SHOW to the app accordingly, however it did not hide the form/window.I am using Visual C++ .NET 2003 right now, and can someone email a project that uses the ShowWindow(SW_HIDE) and ShowWindow(SW_SHOW), to my email address which is straightwaytek at homail dot com What are you trying to hide? Is it MDI or SDI? For MDI, if you want to hide the view, you will need to hide the parent frame. -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com "James Simpson" <straightwaytek@hotmail.com> wrote in message news:0d8001c39201$e5462d30$a101280a@p...

Log File Question
Scenario: Three mail stores in a single storage group and one store is lost. The log files for the entire storage group are on a separate drive letter. What I'd like to do: I dismount the bad store, remove the .edb and .stm files and remount (dial tone). I restore my last backup set to an RSG. Now, here's where my question comes in... Can I just take all the log files since that backup (the one I just restored) and put them in the RSG location folder and mount the database? I'm hesitant because the logs in question are for the entire storage group. From there I plan ...

Detect & Repair question please
Two related but separate questions actually: I have had occasion to use the "Detect & Repair" feature (from Word) to fix a problem where Outlook 2000 refuses to start after trying from either an icon or command line start. (The last time it happened was after I changed the resolution setting in Control Panel/Display. 1. When I run Detect & Repair it asks my to put in my Office 2000 Small Business CD, why do I have to do this? Can't that info be installed onto my hard drive? 2. This process must be done every couple of months (for various reasons) to "revive"...

showing key board on window panel
How can i show keyboard on my dialog. There is exe in windows osk.exe which is on screen keyboard. but i am not aware how to use and display that keyboard at exact position Regards, Ravi ...

Report and subreport question
I have a report with one subreport. If the subreport has no data, it still shows the subreport label in the main report. How can I show the subreport only for those customers where as well data is in the subreport - and - if the subreport has no data, nothing should be seen (as well not the label). Thanks Klaus You don't need the label - cut it. Set the subreport to can shrink:yes and can grow:yes "Amateur" wrote: > I have a report with one subreport. > > If the subreport has no data, it still shows the subreport label in the main > report. > How can I s...

Newby Question #4
I am sure that you will tell me that this is not recommended, but I'm going to ask anyway... I have a single domain controller here that is running Win2k with Dual 2.4G processors and a Gig of memory. This server does not do hardly anything all day. It used as a file server only. It is supporting about 60 users. Can I install E2k3 on this server? What are the impacts? If I install a low end server to act as the front end off my DMZ, can I do OWA securely? OWA will only have to support about 5-6 people (which will most likely not all be at the same time). Thanks for any input. Jef...

Which browsers handle "Add to Favorites" sensibly?
As far as I know, all versions of IE, for some inexplicable reason, open -every- -single- -subfolder- of the favorites folder every time you add a link to favorites. It's hard to imagine why, since novices with 10 entries probably won't bother using subfolders. Veteran users, or researchers who have hundreds or thousands of links that were nicely organized under IE6 are now, well, screwed. So of course I'm looking for a browser that will function in place of IE7/8, and will do the following (in order of priority): 1: Read current format IE favorites. 2: NOT open every ...

Sending e-mail with Windows Mail
I have created an e-mail newsletter in Publisher 2007 and want to send it to my customers using my default e-mail program - Windows Mail. However when I try to send it, Publisher tells me that Microsoft Outlook is not my default mail client, do I want to change it. The answer is NO, I do not. But once I choose the NO option it will not send at all. Everywhere I look says this will work with Windows Mail, so why is Publisher so set on Outlook being my default e-mail program? Is there a setting somewhere in Publisher that I need to change? Thanks!! Leslie scratch that- the error I get ...

hello
hello, this is my first post. I have the dmeo of Microsoft retail management sofwtare and so far I like it. I run a retail store which sells all items under $2.00. we use around 40 to 50 suppliers. Basically all i want to do is be able to select a supplier from a list. see all the items they supply to we buy from that supplier. pick the items id like. place a purchase order. and when we recieve delivery recieve that purchase order and record my payment method. So far Microsft Retail Management POS has provided that for me. but the problem is for everythinbg to work i actually need to ...

Window Hook for Open File Dialog
Hi all: Using VC6, and after updating the SDK and setting _WIN32_WINNT to 0x0500, I encountered the OPENFILENAME size problem, and tried replacing CFileDialog with the CFileDialogST that I found on CodeProject. After slight modification, it works fine (shows the Places bar), but it always puts the file dialog top left on the screen. So I added a Window Hook procedure so I could center the file dialog on my application: static UINT __stdcall OfnHookProc(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam); implemented as UINT CFileDialogST::OfnHookProc(HWND hdlg, UINT uiMsg, WPARAM wP...

Exchange 2003 (SP2) Mailbox Manager Exclusion Question...
I am the admin for a Exchange Server 2003 (SP2) Enviroment and an running into a problem with the Mailbox Manager.. We currently purchased a 3rd party product to archive e-mail outside of the exchange server. Basically a user creates a folder called "Archive" under the root of their folder list in Outlook and then they can create whatever folder structure they like under the folder called "Archive". Any e-mail a user wants to keep over 120 days (the limit we have mail saved on the exchange server) they drag and drop into this archive folder and then the 3rd party pro...

ADO connection string question
Hello, I need help getting the ADO connection string syntax right for my Access 2007 Db application. Below is my code. My backend database file is located at "f:\data\mydb.accdb". I basically need to replace the "Data Source" argument with the hard path to my database in the strConnection setup. Thanks for your help. Corta Sub RecordCount() Dim cnCh5 As ADODB.Connection Dim rsContacts As ADODB.Recordset Dim strConnection As String strConnection = "Provider=Microsoft.ACE.OLEDB.12.0;" & _ "Data Source=" & CurrentProject.Pa...

Copying a formula question
I am a novice Excel user and have a formula I would like to copy to more than 100 cells in a column. I am hoping there is an easy way to do this without entering it many times. The pattern of the formulas are outlined below: =B6-(B6*B2-A2)/500 =B7-(B7*B2-A2)/500 =B8-(B8*B2-A2)/500 =B9-(B9*B2-A2)/500 =B10-(B10*B2-A2)/500 Thanks. -- Zilbandy - Tucson, Arizona USA <zil@zilbandyREMOVETHIS.com> Dead Suburban's Home Page: http://zilbandy.com/suburb/ PGP Public Key: http://zilbandy.com/pgpkey.htm ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Zilbandy, Use...

CTreeCtrl ASSERT question?
1) Why do I get a "Debug Assertion Failed!" when I insert an item in the CTreeCtrl as shown below? BOOL CDeviceProp::OnInitDialog() { // TODO: Add extra initialization here mDeviceTreeCtrl.InsertItem( "TEST" ); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CDeviceProp::OnTvnSelchangedTree1(NMHDR *pNMHDR, LRESULT *pResult) { LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR); // TODO: Add your control notification handler code here *pResult = 0; } 2) Is it poss...

Question about ho to insert data in SQL
Hello I have a adodb recordset which always have 2000 records The code is like this 'fisrt i'm opening the database in which i will insert the data conn.ConnectionString = "Data Source=.\SQLEXPRESS;Initial Catalog=MyDate;Integrated Security=True" cmd = New SqlCommand("select * from table", conn) conn.Open() 'Then i'm opening a ADODB recordset rst.Open("http://www.domain.gr/data.asp") 'the rst filled with 2000 records 'now i want to insert them to the sql database 'i'm using While Not rst.EOF dim Ins as...

Function question
I know I'm not going to ask this correctly. I have a column of numbers. I wish to have a count at the bottom of the column of the number of numbers that fall below a certain number. What function is this? Or, is there a website that would tell me how to do this? Second question: Same column of numbers. Is there a way to have those same numbers that fall below a given number become bold? Thanks so much. Dale Use this to "hard code" the number (450) in the formula: =COUNTIF(A1:A100,"<450") OR Place the number in a cell (B1), so that it can be easily revised, wit...

Best way to handle mail
Hi, just wanting people comments and suggestions on the way we run mail. We have a website with a hosting company and the MX record on that points to a NO-IP free DNS service which points to our server in the office (which has a dynamic IP). Is that they best way to do it? P.S If that server in our office dies, no email will get through, is there a way to have it divert somewhere else? again, I'm asking cause im not sure on what to do!, but the email works ok atm? Thanks, Trent. :) In news:1157913078.052256.52660@i3g2000cwc.googlegroups.com, trent.queen@gmail.com <trent.queen@gma...

Excel Question #5
All, I need your help: Please see below: line1: 1 line2: 1 line3: 1 line4: 2 result: 2 I want the result to show if the any lines (cells) of the above cells contain 2, if not nothing. Thanks in advance. Hi, You could use COUTNIF Assume your numbers (1 & 2) are in range B2:B10 in B11 enter =COUNTIF(B2:B10,"2") Hope this helps, Gav. "alish" wrote: > All, > > I need your help: Please see below: > line1: 1 > line2: 1 > line3: 1 > line4: 2 > > result: 2 > > I want the result to show if the any lines (cells) of the above ce...

OnSize() question
Hello, I have a resizing dialog window with some controls on it. I use the OnSize() message to change the size of the controls when the user resizes the dialog. But when I start my application, the OnSize() function is directly called and an error is given. It seems that he controls don't have a valid window handle or something?? I have another dialog application where the resizing doesn't work (although enabled). The mouse icon changes when I try to resize. This dialog application has several modeless child dialogs. I can't say more about this problem, needs some further investi...

Restore question #2
I try to restore a full backup of a PF database, follow the "hard recovery option" of a single db, and i have a problem: when i mount the restored DB the situation is the same (all message missing after a pf replication problem, between servers)!!! I have read the following and i try by "eseutil /cc" option instead of normal "last backup set". http://www.microsoft.com/technet/prodtechnol/exchange/guides/DROpsGuide/5c993545-011e-4fcd-80ee-36d6d5db84f4.mspx Any other suggestion?! ...

Question Re: Startup Switches
I am using Excel 2000. Is there a way to startup a workbook with a startup switch that not only starts a specific workbook: but, also starts it up at a specific tab within the workbook ? Not through a startup switch. But you could have a macro that selects the desired worksheet when you open the workbook. option explicit sub auto_open() worksheets("my startup sheet").select end sub (don't forget to change the worksheet name to what you want.) If you're new to macros, you may want to read David McRitchie's intro at: http://www.mvps.org/dmcritchie/excel/getstarted...

transparent window problem
Hi! I'm implementing a transparent view in an MDI application. I cannot use region or layer because the view has to be draggable by its content (using region or layer will cause mouse messages in the transparent region to fall through to the underlying window). What I did was: 1. make the child frame transparent (WS_EX_TRANSPARENT). 2. override view's OnEraseBkgnd to simply return TRUE. 3. draw something transparent in view. 4. do this in child frame's OnMove: void CChildFrame::OnMove(int x, int y) { CMDIChildWnd::OnMove(x, y); CView* view = GetActiveView(); if (view &...

hello
hello! ...

Search Folder Question Please
I use search folders quite a bit but I have one question please. When I set it up and tell it to search for a particular phrase in email it does not include emails that may be in the Sent Items folder. Is there a way to get it to include Sent Items also? Thanks in advance... Bob ...

Regular Expression Question (Using CAtlRegExp Class)
Can anyone tell me why, using the CAtlRegExp class, "^ *# *include" matches "#include" but not " # include"? Wondering if it might have something to do with the "^" (start of line) character, I also tried "# include" and that didn't match either. Thanks. -- Jonathan Wood SoftCircuits Programming http://www.softcircuits.com Jonathan Wood wrote: > Can anyone tell me why, using the CAtlRegExp class, "^ *# *include" matches > "#include" but not " # include"? > > Wondering if it might have som...