We need you!

We're working hard on the next version of Developer Fusion. Let us know what you think we should be up to!

Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Rated
Read 35,820 times

Contents

Related Categories

API Programming Series #5 - Analysis

sreejath

Analysis

Here we first declare a variable of the type MEMORYSTATUS. Then we pass this variable as argument to the GlobalMemoryStatus function which we declared in the General Declaration section of the form.

This function "populates" this MEMORYSTATUS structure with the values of the various parameters at that instant. From these we access two parameters and display them using a message box. Note that the MEMORYSTATUS type has many more members, which can be used to obtain detailed info about the current memory status of the system.

The dwTotalVirtual member gives the total virtual memory of the system. It'd be a waste of time to explain all of them here as any decent API guide will contain this info. Be sure to explore them and do mail me (or post a comment here) if you need any help.

With a little work (and a few progress bars and a timer) you can design a memory status indicator that is all yours.

A tentative Plan of Action is as follows:

  • Set the Timer's interval property to a suitable value. (So that it will refresh the status at a suitable interval)
  • Set each progress bar's maximum value property to the Total value for that particular quantity (say dwTotalPhys or dwTotalVirtual).
  • In the Timer's OnTimer event handler, call the GlobalMemoryStatus function passing it a variable of the type MEMORYSTATUS as the argument.
  • Now set the Value property of the various status bars to the Available values of the various parameters (dwAvailPhys or dwAvailVirtual) or Total - Available if you want to display the used portion.

That's it! YVO Memstat is ready to run. (YVO = Your Very Own, just in case you are wondering)

Do keep one thing in mind however; progress bars are somewhat heavy in terms of memory. So your resource meter itself could end up consuming considerable resources on its own. Fear not, this too can be overcome to a certain extent if we use the API to create the progress bars. We'll discuss how to accomplish this in a future article.

Comments

  • questions..

    Posted by mistkron on 04 Nov 2004

    this is really nice article, but im wondering is there a way to display the memory status in a textbox ? well im rather new to vb.

  • MSFlexGrid to Excel

    Posted by wayp on 20 Jan 2004

    I always do this for my "print to file" checkbox in the print dialog

    **Needed Reference** : Microsoft Excel x.y Object Library

    [code]
    Public Sub ExportFlexGrid(ByRef objGrid As MSFlexGrid)
    ...

  • vb and excel

    Posted by marz on 24 Aug 2003

    HI!

    Is there a way to transfer the database to excel rather usingt the datareport?
    If you have any suggestions or ideas pls feel free to mail me.

    thanks.
    marz!
    marz03@yahoo.com

  • Thanks

    Posted by sreejath on 05 Jun 2003

    Thank you for expressing your appreciation.

  • Thanks..

    Posted by troygates on 02 Jun 2003

    Thank you for spending your time to write these great articles. They are very helpful and clearly written.