Results 1 to 2 of 2

Thread: Stopping code?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    May 2006
    Posts
    2,295

    Stopping code?

    Hey guys I have this code that I have no idea what it does, I think it gives me the information on avlaible and total physical and virtual memory.

    VB Code:
    1. While Not blnQuit
    2.        DoEvents
    3. Dim memstat As MEMORYSTATUS
    4. Call GlobalMemoryStatus(memstat)
    5.  
    6. Text30000000.Text = Format(memstat.dwAvailPhys) / 1024 / 1024 / 1024
    7. Text50000000.Text = Format(memstat.dwAvailVirtual) / 1024 / 1024 / 1024
    8. Text60000000.Text = Format(memstat.dwTotalPhys) / 1024 / 1024 / 1024
    9. Text70000000.Text = Format(memstat.dwTotalVirtual) / 1024 / 1024 / 1024
    10. Wend

    The prob is it appears to be a tad cpu intnsive, is there a way to stop this code by pressing a button, so that the users have a choice to run it or not.

    thanks!

  2. #2
    Frenzied Member
    Join Date
    Dec 2007
    Posts
    1,072

    Re: Stopping code?

    Code:
    While blnQuit = False
           DoEvents
    Dim memstat As MEMORYSTATUS
    Call GlobalMemoryStatus(memstat)
    
    Text30000000.Text = Format(memstat.dwAvailPhys) / 1024 / 1024 / 1024
    Text50000000.Text = Format(memstat.dwAvailVirtual) / 1024 / 1024 / 1024
    Text60000000.Text = Format(memstat.dwTotalPhys) / 1024 / 1024 / 1024
    Text70000000.Text = Format(memstat.dwTotalVirtual) / 1024 / 1024 / 1024
    Wend
    In a command button's sub, insert this:

    blnQuit = True

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width