Results 1 to 3 of 3

Thread: Bunch of simple Question

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2000
    Location
    London, ON
    Posts
    40

    Post

    Here is a list of some questions, any all or any if you can please:

    How do you:

    1) find out how much mem a specifc form takes?
    2) find out how much mem you have left?
    3) send somethin to the recycle bin
    4) find out what type of connection the user is using?
    5) find out what type of drive G: is? (eg. HDD. CD-RW)
    6) make sometihng blink like ICQ does when you get a new message?
    Visual Basic 6 Professional Edition
    Captain Pinko

    also:
    Turbo Pascal, Turing, QBasic

  2. #2
    Guest
    Q3:

    http://www.vb-world.net/tips/tip48.html


    Q4:

    Check while they are online.
    http://www.vb-world.net/tips/tip467.html


    Q5:


    Add a Listbox to the form along with this code.


    Code:
    Private Declare Function GetLogicalDrives _
    Lib "kernel32" () As Long
    
    Private Declare Function GetDriveType Lib "kernel32" _
    Alias "GetDriveTypeA" (ByVal nDrive As String) As Long
    
    
    Private Function GetDrive(sDrive As String) As String
    
        On Error GoTo Error_Handler:
    
    ' This routine calls the API GetDriveType. That routine will return
    ' a long value that equates to a description as shown.
    ' Sample Call: GetDrive "C"
        
        Select Case GetDriveType(sDrive & ":\")
            Case 2
                GetDrive = "Removable"
            Case 3
                GetDrive = "Drive Fixed"
            Case 4
                GetDrive = "Remote"
            Case 5
                GetDrive = "Cd-Rom"
            Case 6
                GetDrive = "Ram disk"
            Case Else
                GetDrive = "Unrecognized"
        End Select
    
    Error_Handler:
    End Function
    
    
    Private Sub Form_Load()
    
        Dim iDrives As Integer
        For iDrives = 65 To 90
            List1.AddItem Chr$(iDrives) & Chr$(58) & Chr$(92) & Chr$(32) & Chr$(45) & Chr$(32) & GetDrive(Chr$(iDrives))
        Next iDrives
        
    End Sub

    Q6:


    Use the FlashWindow API function.


    Code:
    Private Declare Function FlashWindow _
    Lib "user32" (ByVal hwnd As Long, ByVal bInvert As _
    Long) As Long
    
    
    Usage
    
    'True = Flash
    'False = No Flash
    
    FlashWindow Me.hWnd, True

  3. #3
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    Q1 / Q2

    I imagine this works, don't really have anything to check it against...

    Code:
    Option Explicit
    
    Private Type MEMORYSTATUS
        dwLength As Long
        dwMemoryLoad As Long
        dwTotalPhys As Long
        dwAvailPhys As Long
        dwTotalPageFile As Long
        dwAvailPageFile As Long
        dwTotalVirtual As Long
        dwAvailVirtual As Long
    End Type
    
    Private Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As MEMORYSTATUS)
    
    Sub main()
     Dim s As Long, e As Long
     
     s = AvailPhysMem
     
     Load Form1
     Form1.Show
     
     DoEvents
     
     e = AvailPhysMem
     
     Debug.Print "Form1 uses " & (s - e) & " bytes of memory or " _
                        & CSng(((s - e) / TotalPhysMem) * 1) _
                         & "% of total physical memory"
     
     Debug.Print "There are " & AvailPhysMem & " bytes left of physical memory"
     
    End Sub
    
    Private Function AvailPhysMem() As Long
        Dim mem As MEMORYSTATUS
        GlobalMemoryStatus mem
        AvailPhysMem = mem.dwAvailPhys
    End Function
    
    Private Function TotalPhysMem() As Long
        Dim mem As MEMORYSTATUS
        GlobalMemoryStatus mem
        TotalPhysMem = mem.dwTotalPhys
    End Function
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

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