?
Solved

VB6 Minimize Memory Usage Shown in Task Manager

Posted on 2010-01-02
7
Medium Priority
?
665 Views
Last Modified: 2012-05-08
Dear Experts,

I am aware that the memory use shown in Windows Task Manager can be misleading and lowering this number is partially "cosmetic", but I am trying to use the old trick of minimizing and then normal-sizing my app to reduce the number. This works great when done manually, but not very well when I perform it programmatically, which is my goal.

How can I do this correctly, or is there a better way?

Thanks!
0
Comment
Question by:ttobin333
7 Comments
 
LVL 8

Expert Comment

by:Jon500
ID: 26164045
I have no idea what you're talking about and I am a Microsoft Certified Professional in VB6, in particular.

What do you mean "the old trick"? What exactly are you doing to lower memory usage and then "normal-size" (do you mean "normalize")?

Thank you,
Jon500
0
 
LVL 10

Accepted Solution

by:
LMiller7 earned 2000 total points
ID: 26164141
I think you may be looking for the SetProcessWorkingSetSize() API function. This function can reduce memory consumption the same way  that minimizing an app will. It is largely cosmetic but may be useful in some cases. I don't know that much about VB6 so can't help with how to use it. Do note that the parameters passed to the function are 64 bit integers.
http://msdn.microsoft.com/en-us/library/ms686234%28VS.85%29.aspx

0
 

Author Comment

by:ttobin333
ID: 26164146
Jon500, that's not a very nice tone, but let me explain.

When my app (like most) launches, it uses more memory than when it is idle, but the task manager processes tab shows the high initial memory usage (even though I realize that this can be freed up when needed by other apps). When you minimize the app then restore it, the memory usage number in task manager goes way down. Try it, it works with most VB apps

I am trying to achieve this programmatically.

Thanks.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 8

Expert Comment

by:Jon500
ID: 26164163
I do apologize for what appeared to be a bad tone. It wasn't my intention. I honestly did not know "the old trick". Thank you for explaining. Your question is far clearer now, in my opinion, and I think it will enable other experts to chime in with some helpful advice.

Regards,
Jon500
0
 

Author Comment

by:ttobin333
ID: 26164204
No problem, Jon. Thanks for your response.
0
 

Author Closing Comment

by:ttobin333
ID: 31672049
That's it, thanks!
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 26164526
Don't have VB6 on my machine anymore...you could also try:
    Private Const SW_MINIMIZE As Long = 6
    Private Declare Function ShowWindow Lib "user32" Alias "ShowWindow" (ByVal hWnd As Long, ByVal nCmdShow As Long) As Long
 
    ...
        ShowWindow Me.hWnd, SW_MINIMIZE

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

850 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