none
API Programming and functions. RRS feed

  • Question

  • Here is the list and if possible examples of the API's for windows.
    Monday, March 26, 2007 12:12 PM

Answers

  • ActivateKeyboardLayout

    The ActivateKeyboardLayout function sets the input locale identifier (formerly called the keyboard layout handle) for the calling thread or the current process. The input locale identifier specifies a locale as well as the physical layout of the keyboard.

    VB4-32,5,6
    Declare Function ActivateKeyboardLayout Lib "user32" (ByVal HKL As Long, ByVal Flags As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hkl
    [in] Input locale identifier to be activated.
    Windows 95/98/Me: This parameter can be obtained using LoadKeyboardLayout or GetKeyboardLayoutList, or it can be one of the values in the table that follows.
    Windows NT/2000/XP: The input locale identifier must have been loaded by a previous call to the LoadKeyboardLayout function. This parameter must be either the handle to a keyboard layout or one of the following values.
    HKL_NEXT
    Selects the next locale identifier in the circular list of loaded locale identifiers maintained by the system.
    HKL_PREV
    Selects the previous locale identifier in the circular list of loaded locale identifiers maintained by the system.

    · Flags
    [in] Specifies how the input locale identifier is to be activated. This parameter can be one of the following values.

    KLF_REORDER
    If this bit is set, the system's circular list of loaded locale identifiers is reordered by moving the locale identifier to the head of the list. If this bit is not set, the list is rotated without a change of order.
    For example, if a user had an English locale identifier active, as well as having French, German, and Spanish locale identifiers loaded (in that order), then activating the German locale identifier with the KLF_REORDER bit set would produce the following order: German, English, French, Spanish. Activating the German locale identifier without the KLF_REORDER bit set would produce the following order: German, Spanish, English, French.
    If less than three locale identifiers are loaded, the value of this flag is irrelevant.

    KLF_RESET
    Windows 2000/XP: If set but KLF_SHIFTLOCK is not set, the Caps Lock state is turned off by pressing the Caps Lock key again. If set and KLF_SHIFTLOCK is also set, the Caps Lock state is turned off by pressing either SHIFT key.
    These two methods are mutually exclusive, and the setting persists as part of the User's profile in the registry.

    KLF_SETFORPROCESS
    Windows 2000/XP: Activates the specified locale identifier for the entire process and sends the WM_INPUTLANGCHANGE message to the current thread's Focus or Active window.

    KLF_SHIFTLOCK
    Windows 2000/XP: This is used with KLF_RESET. See KLF_RESET for an explanation.

    KLF_UNLOADPREVIOUS
    This flag is unsupported. Use the UnloadKeyboardLayout function instead.

    Return Values
    Windows NT 3.51 and earlier: The return value is of type BOOL. If the function succeeds, it is nonzero. If the function fails, it is zero.

    Windows 95/98, Windows NT 4.0 and later: The return value is of type HKL. If the function succeeds, the return value is the previous input locale identifier. Otherwise, it is zero.

    To get extended error information, use the GetLastError function.





    Monday, March 26, 2007 12:13 PM
  • AddAccessAllowedAce

    The AddAccessAllowedAce function adds an access-allowed ACE to an ACL. The access is granted to a specified SID. To control whether the new ACE can be inherited by child objects, use the AddAccessAllowedAceEx function.

    VB4-32,5,6
    Declare Function AddAccessAllowedAce Lib "advapi32.dll" (pAcl As Byte, ByVal dwAceRevision As Long, ByVal AccessMask As Long, pSid As Byte) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Win9x/ME: Not supported

    Library
    Advapi32

    Parameter Information
    · pAcl
    [in/out] Pointer to an ACL structure. This function adds an access-allowed ACE to the end of this ACL. The ACE is in the form of an ACCESS_ALLOWED_ACE structure.

    · dwAceRevision
    [in] Specifies the revision level of the ACL being modified.
    Windows NT 4.0 and earlier: This value must be ACL_REVISION.
    Windows 2000: This value can be ACL_REVISION or ACL_REVISION_DS. Use ACL_REVISION_DS if the ACL contains object-specific ACEs.

    · AccessMask
    [in] Specifies the mask of access rights to be granted to the specified SID.

    · pSid
    [in] Pointer to the SID structure representing a user, group, or logon account being granted access.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Monday, March 26, 2007 12:15 PM
  • AddAce

    The AddAce function adds one or more ACEs to a specified ACL. An ACE is an access-control entry. An ACL is an access-control list.

    VB4-32,5,6
    Declare Function AddAce Lib "advapi32.dll" (ByVal pAcl As Long, ByVal dwAceRevision As Long, ByVal dwStartingAceIndex As Long, ByVal pAceList As Long, ByVal nAceListLength As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Win9x/ME: Not supported

    Library
    Advapi32

    Parameter Information
    · pAcl
    [in/out] Pointer to an ACL structure. This function adds an ACE to this ACL.

    · dwAceRevision
    [in] Specifies the revision level of the ACL being modified.
    Windows NT 4.0 and earlier: This value must be ACL_REVISION.
    Windows 2000: This value can be ACL_REVISION or ACL_REVISION_DS. Use ACL_REVISION_DS if the ACL contains object-specific ACEs.

    · dwStartingAceIndex
    [in] Specifies the position in the ACL's list of ACEs at which to add new ACEs. A value of zero inserts the ACEs at the beginning of the list. A value of MAXDWORD appends the ACEs to the end of the list.

    · pAceList
    [in] Pointer to a list of one or more ACEs to be added to the specified ACL. The ACEs in the list must be stored contiguously.

    · nAceListLength
    [in] Specifies the size, in bytes, of the input buffer pointed to by the pAceList parameter.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Monday, March 26, 2007 12:15 PM
  • AddFontResource

    The AddFontResource function adds the font resource from the specified file to the system font table. The font can subsequently be used for text output by any Win32-based application.

    VB4-32,5,6
    Declare Function AddFontResource Lib "gdi32" Alias "AddFontResourceA" (ByVal lpFileName As String) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Gdi32

    Parameter Information
    · lpszFilename
    [in] Pointer to a null-terminated character string that contains a valid font file name. This parameter can specify any of the following files.
    .fon
    Font resource file.
    .fnt
    Raw bitmap font file.
    .ttf
    Raw TrueType file.
    .ttc
    Windows 95/98 East Asian and Windows NT: TrueType font collection.
    .fot
    TrueType resource file.
    .otf
    PostScript OpenType font.
    .mmm
    multiple master Type1 font resource file. It must be used with .pfm and .pfb files.
    .pfb
    Type 1 font bits file. It is used with a .pfm file.
    .pfm
    Type 1 font metrics file. It is used with a .pfb file.

    Windows 2000: To add a font whose information comes from several resource files, have lpszFileName point to a string with the file names separated by a | --for example, abcxxxxx.pfm | abcxxxxx.pfb.

    Return Values
    If the function succeeds, the return value specifies the number of fonts added.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Monday, March 26, 2007 12:15 PM
  • AdjustTokenPrivileges

    The AdjustTokenPrivileges function enables or disables privileges in the specified access token. Enabling or disabling privileges in an access token requires TOKEN_ADJUST_PRIVILEGES access.

    VB4-32,5,6
    Declare Function AdjustTokenPrivileges Lib "advapi32.dll" Alias "AdjustTokenPrivileges" (ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, PreviousState As TOKEN_PRIVILEGES, ReturnLength As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Win9x/ME: Not supported

    Library
    Advapi32

    Parameter Information
    · TokenHandle
    Identifies the access token that contains the privileges to be modified.

    · DisableAllPrivileges
    Specifies whether the function disables all of the token’s privileges. If this value is TRUE, the function disables all privileges and ignores the NewState parameter. If it is FALSE, the function modifies privileges based on the information pointed to by the NewState parameter.

    · NewState
    Pointer to a TOKEN_PRIVILEGES structure that specifies an array of privileges and their attributes. If the DisableAllPrivileges parameter is FALSE, AdjustTokenPrivileges enables or disables these privileges for the token. If you set the SE_PRIVILEGE_ENABLED attribute for a privilege, the function enables that privilege; otherwise, it disables the privilege.
    If DisableAllPrivileges is TRUE, the function ignores this parameter.

    · BufferLength
    Specifies the size, in bytes, of the buffer pointed to by the PreviousState parameter. This parameter can be NULL if the PreviousState parameter is NULL.

    · PreviousState
    Pointer to a buffer that the function fills with a TOKEN_PRIVILEGES structure containing the previous state of any privileges the function modifies. The token must be open for TOKEN_QUERY access to use this parameter. This parameter can be NULL.
    If you specify a buffer that is too small to receive the complete list of modified privileges, the function fails and does not adjust any privileges. In this case, the function sets the variable pointed to by the ReturnLength parameter to the number of bytes required to hold the complete list of modified privileges.

    · ReturnLength
    Pointer to a variable that receives the required size, in bytes, of the buffer pointed to by the PreviousState parameter. This parameter can be NULL if PreviousState is NULL.

    Return Values
    If the function succeeds, the return value is nonzero. To determine whether the function adjusted all of the specified privileges, call GetLastError, which returns one of the following values when the function succeeds:
    ERROR_SUCCESS
    The function adjusted all specified privileges.

    ERROR_NOT_ALL_ASSIGNED
    The token does not have one or more of the privileges specified in the NewState parameter. The function may succeed with this error value even if no privileges were adjusted. The PreviousState parameter indicates the privileges that were adjusted.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.

    Example :

    ' Shutdown Flags
    Const EWX_LOGOFF = 0
    Const EWX_SHUTDOWN = 1
    Const EWX_REBOOT = 2
    Const EWX_FORCE = 4
    Const SE_PRIVILEGE_ENABLED = &H2
    Const TokenPrivileges = 3
    Const TOKEN_ASSIGN_PRIMARY = &H1
    Const TOKEN_DUPLICATE = &H2
    Const TOKEN_IMPERSONATE = &H4
    Const TOKEN_QUERY = &H8
    Const TOKEN_QUERY_SOURCE = &H10
    Const TOKEN_ADJUST_PRIVILEGES = &H20
    Const TOKEN_ADJUST_GROUPS = &H40
    Const TOKEN_ADJUST_DEFAULT = &H80
    Const SE_SHUTDOWN_NAME = "SeShutdownPrivilege"
    Const ANYSIZE_ARRAY = 1
    Private Type LARGE_INTEGER
    lowpart As Long
    highpart As Long
    End Type
    Private Type Luid
    lowpart As Long
    highpart As Long
    End Type
    Private Type LUID_AND_ATTRIBUTES
    'pLuid As Luid
    pLuid As LARGE_INTEGER
    Attributes As Long
    End Type
    Private Type TOKEN_PRIVILEGES
    PrivilegeCount As Long
    Privileges(ANYSIZE_ARRAY) As LUID_AND_ATTRIBUTES
    End Type
    Private Declare Function InitiateSystemShutdown Lib "advapi32.dll" Alias "InitiateSystemShutdownA" (ByVal lpMachineName As String, ByVal lpMessage As String, ByVal dwTimeout As Long, ByVal bForceAppsClosed As Long, ByVal bRebootAfterShutdown As Long) As Long
    Private Declare Function OpenProcessToken Lib "advapi32.dll" (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As Long
    Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
    Private Declare Function LookupPrivilegeValue Lib "advapi32.dll" Alias "LookupPrivilegeValueA" (ByVal lpSystemName As String, ByVal lpName As String, lpLuid As LARGE_INTEGER) As Long
    Private Declare Function AdjustTokenPrivileges Lib "advapi32.dll" (ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, PreviousState As TOKEN_PRIVILEGES, ReturnLength As Long) As Long
    Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    Private Declare Function GetLastError Lib "kernel32" () As Long
    Public Function InitiateShutdownMachine(ByVal Machine As String, Optional Force As Variant, Optional Restart As Variant, Optional AllowLocalShutdown As Variant, Optional Delay As Variant, Optional Message As Variant) As Boolean
    Dim hProc As Long
    Dim OldTokenStuff As TOKEN_PRIVILEGES
    Dim OldTokenStuffLen As Long
    Dim NewTokenStuff As TOKEN_PRIVILEGES
    Dim NewTokenStuffLen As Long
    Dim pSize As Long
    If IsMissing(Force) Then Force = False
    If IsMissing(Restart) Then Restart = True
    If IsMissing(AllowLocalShutdown) Then AllowLocalShutdown = False
    If IsMissing(Delay) Then Delay = 0
    If IsMissing(Message) Then Message = ""
    'Make sure the Machine-name doesn't start with '\\'
    If InStr(Machine, "\\") = 1 Then
    Machine = Right(Machine, Len(Machine) - 2)
    End If
    'check if it's the local machine that's going to be shutdown
    If (LCase(GetMyMachineName) = LCase(Machine)) Then
    'may we shut this computer down?
    If AllowLocalShutdown = False Then Exit Function
    'open access token
    If OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY, hProc) = 0 Then
    MsgBox "OpenProcessToken Error: " & GetLastError()
    Exit Function
    End If
    'retrieve the locally unique identifier to represent the Shutdown-privilege name
    If LookupPrivilegeValue(vbNullString, SE_SHUTDOWN_NAME, OldTokenStuff.Privileges(0).pLuid) = 0 Then
    MsgBox "LookupPrivilegeValue Error: " & GetLastError()
    Exit Function
    End If
    NewTokenStuff = OldTokenStuff
    NewTokenStuff.PrivilegeCount = 1
    NewTokenStuff.Privileges(0).Attributes = SE_PRIVILEGE_ENABLED
    NewTokenStuffLen = Len(NewTokenStuff)
    pSize = Len(NewTokenStuff)
    'Enable shutdown-privilege
    If AdjustTokenPrivileges(hProc, False, NewTokenStuff, NewTokenStuffLen, OldTokenStuff, OldTokenStuffLen) = 0 Then
    MsgBox "AdjustTokenPrivileges Error: " & GetLastError()
    Exit Function
    End If
    'initiate the system shutdown
    If InitiateSystemShutdown("\\" & Machine, Message, Delay, Force, Restart) = 0 Then
    Exit Function
    End If
    NewTokenStuff.Privileges(0).Attributes = 0
    'Disable shutdown-privilege
    If AdjustTokenPrivileges(hProc, False, NewTokenStuff, Len(NewTokenStuff), OldTokenStuff, Len(OldTokenStuff)) = 0 Then
    Exit Function
    End If
    Else
    'initiate the system shutdown
    If InitiateSystemShutdown("\\" & Machine, Message, Delay, Force, Restart) = 0 Then
    Exit Function
    End If
    End If
    InitiateShutdownMachine = True
    End Function
    Function GetMyMachineName() As String
    Dim sLen As Long
    'create a buffer
    GetMyMachineName = Space(100)
    sLen = 100
    'retrieve the computer name
    If GetComputerName(GetMyMachineName, sLen) Then
    GetMyMachineName = Left(GetMyMachineName, sLen)
    End If
    End Function
    Private Sub Form_Load()
    InitiateShutdownMachine GetMyMachineName, True, True, True, 60, "You initiated a system shutdown..."
    End Sub

    Monday, March 26, 2007 12:16 PM
  • AdjustWindowRect

    The AdjustWindowRect function calculates the required size of the window rectangle, based on the desired client-rectangle size. The window rectangle can then be passed to the CreateWindow function to create a window whose client area is the desired size.

    VB4-32,5,6
    Declare Function AdjustWindowRect Lib "user32" Alias "AdjustWindowRect" (lpRect As RECT, ByVal dwStyle As Long, ByVal bMenu As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · lpRect
    Pointer to a RECT structure that contains the coordinates of the top-left and bottom-right corners of the desired client area. When the function returns, the structure contains the coordinates of the top-left and bottom-right corners of the window to accommodate the desired client area.

    · dwStyle
    Specifies the window styles of the window whose required size is to be calculated.

    · bMenu
    Specifies whether the window has a menu.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.

    Example :
    Const WS_BORDER = &H800000
    Const WS_DLGFRAME = &H400000
    Const WS_THICKFRAME = &H40000
    Const WS_CAPTION = &HC00000 ' WS_BORDER Or WS_DLGFRAME
    Const HWND_BOTTOM = 1
    Const HWND_TOP = 0
    Const HWND_TOPMOST = -1
    Const HWND_NOTOPMOST = -2
    Const SWP_SHOWWINDOW = &H40
    Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
    End Type
    Private Declare Function AdjustWindowRect Lib "user32" (lpRect As RECT, ByVal dwStyle As Long, ByVal bMenu As Long) As Long
    Private Declare Function BeginDeferWindowPos Lib "user32" (ByVal nNumWindows As Long) As Long
    Private Declare Function DeferWindowPos Lib "user32" (ByVal hWinPosInfo As Long, ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    Private Declare Function EndDeferWindowPos Lib "user32" (ByVal hWinPosInfo As Long) As Long
    Private Sub Form_Load()
    Dim R As RECT, hDWP As Long
    R.Left = 30
    R.Top = 30
    R.Bottom = 200
    R.Right = 120
    AdjustWindowRect R, WS_THICKFRAME Or WS_CAPTION, False
    hDWP = BeginDeferWindowPos(1)
    DeferWindowPos hDWP, Me.hwnd, HWND_TOP, R.Left, R.Top, R.Right - R.Left, R.Bottom - R.Top, SWP_SHOWWINDOW
    EndDeferWindowPos hDWP
    End Sub

    Monday, March 26, 2007 12:17 PM
  • AdjustWindowRectEx

    The AdjustWindowRectEx function calculates the required size of the window rectangle, based on the desired size of the client rectangle. The window rectangle can then be passed to the CreateWindowEx function to create a window whose client area is the desired size.

    VB4-32,5,6
    Declare Function AdjustWindowRectEx Lib "user32" Alias "AdjustWindowRectEx" (lpRect As RECT, ByVal dsStyle As Long, ByVal bMenu As Long, ByVal dwEsStyle As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · lpRect
    Pointer to a RECT structure that contains the coordinates of the top-left and bottom-right corners of the desired client area. When the function returns, the structure contains the coordinates of the top-left and bottom-right corners of the window to accommodate the desired client area.

    · dwStyle
    Specifies the window styles of the window whose required size is to be calculated.

    · bMenu
    Specifies whether the window has a menu.

    · dwExStyle
    Specifies the extended style of the window whose required size is to be calculated.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.

    Examples
    Const WS_BORDER = &H800000
    Const WS_DLGFRAME = &H400000
    Const WS_THICKFRAME = &H40000
    Const WS_CAPTION = &HC00000                  ' WS_BORDER Or WS_DLGFRAME
    Const WS_EX_CLIENTEDGE = &H200
    Private Type RECT
            Left As Long
            Top As Long
            Right As Long
            Bottom As Long
    End Type
    Private Declare Function AdjustWindowRectEx Lib "user32" (lpRect As RECT, ByVal dsStyle As Long, ByVal bMenu As Long, ByVal dwEsStyle As Long) As Long
    Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
    Private Sub Form_Load()
        Dim R As RECT, hDWP As Long
        R.Left = 30
        R.Top = 30
        R.Bottom = 200
        R.Right = 120
        AdjustWindowRectEx R, WS_THICKFRAME Or WS_CAPTION, False, WS_EX_CLIENTEDGE
        MoveWindow Me.hwnd, R.Left, R.Top, R.Right - R.Left, R.Bottom - R.Top, False
    End Sub

    Monday, March 26, 2007 12:20 PM
  • AllocConsole

    The AllocConsole function allocates a new console for the calling process.

    VB4-32,5,6
    Declare Function AllocConsole Lib "kernel32" () As Long

    VB.NET
    System.Console

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Kernel32

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.

    Example :
    Private Const FOREGROUND_BLUE = &H1
    Private Const FOREGROUND_GREEN = &H2
    Private Const FOREGROUND_RED = &H4
    Private Const BACKGROUND_BLUE = &H10
    Private Const BACKGROUND_GREEN = &H20
    Private Const BACKGROUND_RED = &H40
    Private Const BACKGROUND_INTENSITY = &H80&
    Private Const BACKGROUND_SEARCH = &H20&
    Private Const FOREGROUND_INTENSITY = &H8&
    Private Const FOREGROUND_SEARCH = (&H10&)
    Private Const ENABLE_LINE_INPUT = &H2&
    Private Const ENABLE_ECHO_INPUT = &H4&
    Private Const ENABLE_MOUSE_INPUT = &H10&
    Private Const ENABLE_PROCESSED_INPUT = &H1&
    Private Const ENABLE_WINDOW_INPUT = &H8&
    Private Const ENABLE_PROCESSED_OUTPUT = &H1&
    Private Const ENABLE_WRAP_AT_EOL_OUTPUT = &H2&
    Private Const STD_OUTPUT_HANDLE = -11&
    Private Const STD_INPUT_HANDLE = -10&
    Private Const STD_ERROR_HANDLE = -12&
    Private Const INVALID_HANDLE_VALUE = -1&
    Private Declare Function AllocConsole Lib "kernel32" () As Long
    Private Declare Function FreeConsole Lib "kernel32" () As Long
    Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
    Private Declare Function GetStdHandle Lib "kernel32" (ByVal nStdHandle As Long) As Long
    Private Declare Function WriteConsole Lib "kernel32" Alias "WriteConsoleA" (ByVal hConsoleOutput As Long, lpBuffer As Any, ByVal nNumberOfCharsToWrite As Long, lpNumberOfCharsWritten As Long, lpReserved As Any) As Long
    Private Declare Function ReadConsole Lib "kernel32" Alias "ReadConsoleA" (ByVal hConsoleInput As Long, ByVal lpBuffer As String, ByVal nNumberOfCharsToRead As Long, lpNumberOfCharsRead As Long, lpReserved As Any) As Long
    Private Declare Function SetConsoleTextAttribute Lib "kernel32" (ByVal hConsoleOutput As Long, ByVal wAttributes As Long) As Long
    Private Declare Function SetConsoleTitle Lib "kernel32" Alias "SetConsoleTitleA" (ByVal lpConsoleTitle As String) As Long
    Private hConsoleOut As Long, hConsoleIn As Long, hConsoleErr As Long
    Private Sub Form_Load()
        'Create console
        If AllocConsole() Then
            hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE)
            If hConsoleOut = INVALID_HANDLE_VALUE Then MsgBox "Unable to get STDOUT"
            hConsoleIn = GetStdHandle(STD_INPUT_HANDLE)
            If hConsoleOut = INVALID_HANDLE_VALUE Then MsgBox "Unable to get STDIN"
        Else
            MsgBox "Couldn't allocate console"
        End If
        'Set the caption of the console window
        SetConsoleTitle "The KPD-Team 2001"
        'Set the background color of the text in the console to bright YELLOW text
        'on a BLUE background
        SetConsoleTextAttribute hConsoleOut, FOREGROUND_RED Or FOREGROUND_GREEN Or FOREGROUND_INTENSITY Or BACKGROUND_BLUE
        'Write something in the console
        ConsoleWriteLine "Hello World!"
        ConsoleWrite "Please enter your name: "
        'Ask for user input and show it in the caption
        Me.Caption = "Your name: " + ConsoleReadLine()
    End Sub
    Private Sub Form_Unload(Cancel As Integer)
        'Delete console
        CloseHandle hConsoleOut
        CloseHandle hConsoleIn
        FreeConsole
    End Sub
    Sub ConsoleWriteLine(sInput As String)
         ConsoleWrite sInput + vbCrLf
    End Sub
    Sub ConsoleWrite(sInput As String)
         Dim cWritten As Long
         WriteConsole hConsoleOut, ByVal sInput, Len(sInput), cWritten, ByVal 0&
    End Sub
    Function ConsoleReadLine() As String
        Dim ZeroPos As Long
        'Create a buffer
        ConsoleReadLine = String(10, 0)
        'Read the input
        ReadConsole hConsoleIn, ConsoleReadLine, Len(ConsoleReadLine), vbNull, vbNull
        'Strip off trailing vbCrLf and Chr$(0)'s
        ZeroPos = InStr(ConsoleReadLine, Chr$(0))
        If ZeroPos > 0 Then ConsoleReadLine = Left$(ConsoleReadLine, ZeroPos - 3)
    End Function

    Monday, March 26, 2007 12:21 PM
  • Guys Please contribute.
    Monday, March 26, 2007 12:23 PM
  • Hey harshil, i've started TAPI thread and am contributing there. am not that much well in winapi. but will try to contribute something here.

    anyways, you are sharing good information here. keep it up. Smile
    Tuesday, March 27, 2007 5:53 PM
  • AnimateWindow

    The AnimateWindow function enables you to produce special effects when showing or hiding windows. There are three types of animation: roll, slide, and alpha-blended fade.

    VB4-32,5,6
    Declare Function AnimateWindow Lib "user32" (ByVal hwnd As Long, ByVal dwTime As Long, ByVal dwFlags As Long) As Boolean

    Operating Systems Supported
    Requires Windows 2000 or later; Requires Windows 98 or later

    Library
    User32

    Parameter Information
    · hwnd
    [in] Handle to the window to animate. The calling thread must own this window.

    · dwTime
    [in] Specifies how long it takes to play the animation, in milliseconds. Typically, an animation takes 200 milliseconds to play.

    · dwFlags
    [in] Specifies the type of animation. This parameter can be one or more of the following values.
    AW_SLIDE
    Uses slide animation. By default, roll animation is used. This flag is ignored when used with AW_CENTER.
    AW_ACTIVATE
    Activates the window. Do not use this value with AW_HIDE.
    AW_BLEND
    Uses a fade effect. This flag can be used only if hwnd is a top-level window.
    AW_HIDE
    Hides the window. By default, the window is shown.
    AW_CENTER
    Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used.
    AW_HOR_POSITIVE
    Animates the window from left to right. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
    AW_HOR_NEGATIVE
    Animates the window from right to left. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
    AW_VER_POSITIVE
    Animates the window from top to bottom. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
    AW_VER_NEGATIVE
    Animates the window from bottom to top. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. The function will fail in the following situations:

    The window uses the window region.
    The window is already visible and you are trying to show the window.
    The window is already hidden and you are trying to hide the window.
    To get extended error information, call the GetLastError function.
    Sunday, April 29, 2007 5:20 PM
  • Please give API for screen saver & how to use it in vb.

    Tuesday, May 1, 2007 6:35 PM

  • Code Snippet

    The sample code below shows how to start a Visual Basic screen saver by sending a Windows message to the Control-menu box on a form.

    Microsoft Windows starts screen savers through the System-menu box on a form. The System-menu box is also known as the Control-menu box in Visual Basic. You can send Windows messages to the Control-menu box by using the SendMessage Windows API (application programming interface) function.


    ---------------------


    [general declarations]
    #If Win32 Then
    Private Declare Function SendMessage Lib "user32" Alias _
    "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _ ByVal wParam
    As Long, ByVal lParam As Long) As Long
    Const WM_SYSCOMMAND = &H112&
    Const SC_SCREENSAVE = &HF140&
    #Else
    Private Declare Function SendMessage Lib "User" (ByVal _ hWnd
    As Integer, ByVal wMsg As Integer, ByVal wParam As _ Integer,
    lParam As Any) As Long
    Const WM_SYSCOMMAND = &H112
    Const SC_SCREENSAVE = &HF140&
    #End If

    Private Sub Command1_Click()
    Dim result As Long
    result = SendMessage(Form1.hWnd, WM_SYSCOMMAND, _
    SC_SCREENSAVE, 0&)
    End Sub

    Wednesday, May 2, 2007 4:26 AM
  • @Harshil- The thread has become too long... It is very difficult to navigate.. Pls start the continuation thread...
    Wednesday, June 13, 2007 12:40 AM

All replies

  • ActivateKeyboardLayout

    The ActivateKeyboardLayout function sets the input locale identifier (formerly called the keyboard layout handle) for the calling thread or the current process. The input locale identifier specifies a locale as well as the physical layout of the keyboard.

    VB4-32,5,6
    Declare Function ActivateKeyboardLayout Lib "user32" (ByVal HKL As Long, ByVal Flags As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hkl
    [in] Input locale identifier to be activated.
    Windows 95/98/Me: This parameter can be obtained using LoadKeyboardLayout or GetKeyboardLayoutList, or it can be one of the values in the table that follows.
    Windows NT/2000/XP: The input locale identifier must have been loaded by a previous call to the LoadKeyboardLayout function. This parameter must be either the handle to a keyboard layout or one of the following values.
    HKL_NEXT
    Selects the next locale identifier in the circular list of loaded locale identifiers maintained by the system.
    HKL_PREV
    Selects the previous locale identifier in the circular list of loaded locale identifiers maintained by the system.

    · Flags
    [in] Specifies how the input locale identifier is to be activated. This parameter can be one of the following values.

    KLF_REORDER
    If this bit is set, the system's circular list of loaded locale identifiers is reordered by moving the locale identifier to the head of the list. If this bit is not set, the list is rotated without a change of order.
    For example, if a user had an English locale identifier active, as well as having French, German, and Spanish locale identifiers loaded (in that order), then activating the German locale identifier with the KLF_REORDER bit set would produce the following order: German, English, French, Spanish. Activating the German locale identifier without the KLF_REORDER bit set would produce the following order: German, Spanish, English, French.
    If less than three locale identifiers are loaded, the value of this flag is irrelevant.

    KLF_RESET
    Windows 2000/XP: If set but KLF_SHIFTLOCK is not set, the Caps Lock state is turned off by pressing the Caps Lock key again. If set and KLF_SHIFTLOCK is also set, the Caps Lock state is turned off by pressing either SHIFT key.
    These two methods are mutually exclusive, and the setting persists as part of the User's profile in the registry.

    KLF_SETFORPROCESS
    Windows 2000/XP: Activates the specified locale identifier for the entire process and sends the WM_INPUTLANGCHANGE message to the current thread's Focus or Active window.

    KLF_SHIFTLOCK
    Windows 2000/XP: This is used with KLF_RESET. See KLF_RESET for an explanation.

    KLF_UNLOADPREVIOUS
    This flag is unsupported. Use the UnloadKeyboardLayout function instead.

    Return Values
    Windows NT 3.51 and earlier: The return value is of type BOOL. If the function succeeds, it is nonzero. If the function fails, it is zero.

    Windows 95/98, Windows NT 4.0 and later: The return value is of type HKL. If the function succeeds, the return value is the previous input locale identifier. Otherwise, it is zero.

    To get extended error information, use the GetLastError function.





    Monday, March 26, 2007 12:13 PM
  • AddAccessAllowedAce

    The AddAccessAllowedAce function adds an access-allowed ACE to an ACL. The access is granted to a specified SID. To control whether the new ACE can be inherited by child objects, use the AddAccessAllowedAceEx function.

    VB4-32,5,6
    Declare Function AddAccessAllowedAce Lib "advapi32.dll" (pAcl As Byte, ByVal dwAceRevision As Long, ByVal AccessMask As Long, pSid As Byte) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Win9x/ME: Not supported

    Library
    Advapi32

    Parameter Information
    · pAcl
    [in/out] Pointer to an ACL structure. This function adds an access-allowed ACE to the end of this ACL. The ACE is in the form of an ACCESS_ALLOWED_ACE structure.

    · dwAceRevision
    [in] Specifies the revision level of the ACL being modified.
    Windows NT 4.0 and earlier: This value must be ACL_REVISION.
    Windows 2000: This value can be ACL_REVISION or ACL_REVISION_DS. Use ACL_REVISION_DS if the ACL contains object-specific ACEs.

    · AccessMask
    [in] Specifies the mask of access rights to be granted to the specified SID.

    · pSid
    [in] Pointer to the SID structure representing a user, group, or logon account being granted access.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Monday, March 26, 2007 12:15 PM
  • AddAce

    The AddAce function adds one or more ACEs to a specified ACL. An ACE is an access-control entry. An ACL is an access-control list.

    VB4-32,5,6
    Declare Function AddAce Lib "advapi32.dll" (ByVal pAcl As Long, ByVal dwAceRevision As Long, ByVal dwStartingAceIndex As Long, ByVal pAceList As Long, ByVal nAceListLength As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Win9x/ME: Not supported

    Library
    Advapi32

    Parameter Information
    · pAcl
    [in/out] Pointer to an ACL structure. This function adds an ACE to this ACL.

    · dwAceRevision
    [in] Specifies the revision level of the ACL being modified.
    Windows NT 4.0 and earlier: This value must be ACL_REVISION.
    Windows 2000: This value can be ACL_REVISION or ACL_REVISION_DS. Use ACL_REVISION_DS if the ACL contains object-specific ACEs.

    · dwStartingAceIndex
    [in] Specifies the position in the ACL's list of ACEs at which to add new ACEs. A value of zero inserts the ACEs at the beginning of the list. A value of MAXDWORD appends the ACEs to the end of the list.

    · pAceList
    [in] Pointer to a list of one or more ACEs to be added to the specified ACL. The ACEs in the list must be stored contiguously.

    · nAceListLength
    [in] Specifies the size, in bytes, of the input buffer pointed to by the pAceList parameter.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Monday, March 26, 2007 12:15 PM
  • AddFontResource

    The AddFontResource function adds the font resource from the specified file to the system font table. The font can subsequently be used for text output by any Win32-based application.

    VB4-32,5,6
    Declare Function AddFontResource Lib "gdi32" Alias "AddFontResourceA" (ByVal lpFileName As String) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Gdi32

    Parameter Information
    · lpszFilename
    [in] Pointer to a null-terminated character string that contains a valid font file name. This parameter can specify any of the following files.
    .fon
    Font resource file.
    .fnt
    Raw bitmap font file.
    .ttf
    Raw TrueType file.
    .ttc
    Windows 95/98 East Asian and Windows NT: TrueType font collection.
    .fot
    TrueType resource file.
    .otf
    PostScript OpenType font.
    .mmm
    multiple master Type1 font resource file. It must be used with .pfm and .pfb files.
    .pfb
    Type 1 font bits file. It is used with a .pfm file.
    .pfm
    Type 1 font metrics file. It is used with a .pfb file.

    Windows 2000: To add a font whose information comes from several resource files, have lpszFileName point to a string with the file names separated by a | --for example, abcxxxxx.pfm | abcxxxxx.pfb.

    Return Values
    If the function succeeds, the return value specifies the number of fonts added.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Monday, March 26, 2007 12:15 PM
  • AdjustTokenPrivileges

    The AdjustTokenPrivileges function enables or disables privileges in the specified access token. Enabling or disabling privileges in an access token requires TOKEN_ADJUST_PRIVILEGES access.

    VB4-32,5,6
    Declare Function AdjustTokenPrivileges Lib "advapi32.dll" Alias "AdjustTokenPrivileges" (ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, PreviousState As TOKEN_PRIVILEGES, ReturnLength As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Win9x/ME: Not supported

    Library
    Advapi32

    Parameter Information
    · TokenHandle
    Identifies the access token that contains the privileges to be modified.

    · DisableAllPrivileges
    Specifies whether the function disables all of the token’s privileges. If this value is TRUE, the function disables all privileges and ignores the NewState parameter. If it is FALSE, the function modifies privileges based on the information pointed to by the NewState parameter.

    · NewState
    Pointer to a TOKEN_PRIVILEGES structure that specifies an array of privileges and their attributes. If the DisableAllPrivileges parameter is FALSE, AdjustTokenPrivileges enables or disables these privileges for the token. If you set the SE_PRIVILEGE_ENABLED attribute for a privilege, the function enables that privilege; otherwise, it disables the privilege.
    If DisableAllPrivileges is TRUE, the function ignores this parameter.

    · BufferLength
    Specifies the size, in bytes, of the buffer pointed to by the PreviousState parameter. This parameter can be NULL if the PreviousState parameter is NULL.

    · PreviousState
    Pointer to a buffer that the function fills with a TOKEN_PRIVILEGES structure containing the previous state of any privileges the function modifies. The token must be open for TOKEN_QUERY access to use this parameter. This parameter can be NULL.
    If you specify a buffer that is too small to receive the complete list of modified privileges, the function fails and does not adjust any privileges. In this case, the function sets the variable pointed to by the ReturnLength parameter to the number of bytes required to hold the complete list of modified privileges.

    · ReturnLength
    Pointer to a variable that receives the required size, in bytes, of the buffer pointed to by the PreviousState parameter. This parameter can be NULL if PreviousState is NULL.

    Return Values
    If the function succeeds, the return value is nonzero. To determine whether the function adjusted all of the specified privileges, call GetLastError, which returns one of the following values when the function succeeds:
    ERROR_SUCCESS
    The function adjusted all specified privileges.

    ERROR_NOT_ALL_ASSIGNED
    The token does not have one or more of the privileges specified in the NewState parameter. The function may succeed with this error value even if no privileges were adjusted. The PreviousState parameter indicates the privileges that were adjusted.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.

    Example :

    ' Shutdown Flags
    Const EWX_LOGOFF = 0
    Const EWX_SHUTDOWN = 1
    Const EWX_REBOOT = 2
    Const EWX_FORCE = 4
    Const SE_PRIVILEGE_ENABLED = &H2
    Const TokenPrivileges = 3
    Const TOKEN_ASSIGN_PRIMARY = &H1
    Const TOKEN_DUPLICATE = &H2
    Const TOKEN_IMPERSONATE = &H4
    Const TOKEN_QUERY = &H8
    Const TOKEN_QUERY_SOURCE = &H10
    Const TOKEN_ADJUST_PRIVILEGES = &H20
    Const TOKEN_ADJUST_GROUPS = &H40
    Const TOKEN_ADJUST_DEFAULT = &H80
    Const SE_SHUTDOWN_NAME = "SeShutdownPrivilege"
    Const ANYSIZE_ARRAY = 1
    Private Type LARGE_INTEGER
    lowpart As Long
    highpart As Long
    End Type
    Private Type Luid
    lowpart As Long
    highpart As Long
    End Type
    Private Type LUID_AND_ATTRIBUTES
    'pLuid As Luid
    pLuid As LARGE_INTEGER
    Attributes As Long
    End Type
    Private Type TOKEN_PRIVILEGES
    PrivilegeCount As Long
    Privileges(ANYSIZE_ARRAY) As LUID_AND_ATTRIBUTES
    End Type
    Private Declare Function InitiateSystemShutdown Lib "advapi32.dll" Alias "InitiateSystemShutdownA" (ByVal lpMachineName As String, ByVal lpMessage As String, ByVal dwTimeout As Long, ByVal bForceAppsClosed As Long, ByVal bRebootAfterShutdown As Long) As Long
    Private Declare Function OpenProcessToken Lib "advapi32.dll" (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As Long
    Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
    Private Declare Function LookupPrivilegeValue Lib "advapi32.dll" Alias "LookupPrivilegeValueA" (ByVal lpSystemName As String, ByVal lpName As String, lpLuid As LARGE_INTEGER) As Long
    Private Declare Function AdjustTokenPrivileges Lib "advapi32.dll" (ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, PreviousState As TOKEN_PRIVILEGES, ReturnLength As Long) As Long
    Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    Private Declare Function GetLastError Lib "kernel32" () As Long
    Public Function InitiateShutdownMachine(ByVal Machine As String, Optional Force As Variant, Optional Restart As Variant, Optional AllowLocalShutdown As Variant, Optional Delay As Variant, Optional Message As Variant) As Boolean
    Dim hProc As Long
    Dim OldTokenStuff As TOKEN_PRIVILEGES
    Dim OldTokenStuffLen As Long
    Dim NewTokenStuff As TOKEN_PRIVILEGES
    Dim NewTokenStuffLen As Long
    Dim pSize As Long
    If IsMissing(Force) Then Force = False
    If IsMissing(Restart) Then Restart = True
    If IsMissing(AllowLocalShutdown) Then AllowLocalShutdown = False
    If IsMissing(Delay) Then Delay = 0
    If IsMissing(Message) Then Message = ""
    'Make sure the Machine-name doesn't start with '\\'
    If InStr(Machine, "\\") = 1 Then
    Machine = Right(Machine, Len(Machine) - 2)
    End If
    'check if it's the local machine that's going to be shutdown
    If (LCase(GetMyMachineName) = LCase(Machine)) Then
    'may we shut this computer down?
    If AllowLocalShutdown = False Then Exit Function
    'open access token
    If OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES Or TOKEN_QUERY, hProc) = 0 Then
    MsgBox "OpenProcessToken Error: " & GetLastError()
    Exit Function
    End If
    'retrieve the locally unique identifier to represent the Shutdown-privilege name
    If LookupPrivilegeValue(vbNullString, SE_SHUTDOWN_NAME, OldTokenStuff.Privileges(0).pLuid) = 0 Then
    MsgBox "LookupPrivilegeValue Error: " & GetLastError()
    Exit Function
    End If
    NewTokenStuff = OldTokenStuff
    NewTokenStuff.PrivilegeCount = 1
    NewTokenStuff.Privileges(0).Attributes = SE_PRIVILEGE_ENABLED
    NewTokenStuffLen = Len(NewTokenStuff)
    pSize = Len(NewTokenStuff)
    'Enable shutdown-privilege
    If AdjustTokenPrivileges(hProc, False, NewTokenStuff, NewTokenStuffLen, OldTokenStuff, OldTokenStuffLen) = 0 Then
    MsgBox "AdjustTokenPrivileges Error: " & GetLastError()
    Exit Function
    End If
    'initiate the system shutdown
    If InitiateSystemShutdown("\\" & Machine, Message, Delay, Force, Restart) = 0 Then
    Exit Function
    End If
    NewTokenStuff.Privileges(0).Attributes = 0
    'Disable shutdown-privilege
    If AdjustTokenPrivileges(hProc, False, NewTokenStuff, Len(NewTokenStuff), OldTokenStuff, Len(OldTokenStuff)) = 0 Then
    Exit Function
    End If
    Else
    'initiate the system shutdown
    If InitiateSystemShutdown("\\" & Machine, Message, Delay, Force, Restart) = 0 Then
    Exit Function
    End If
    End If
    InitiateShutdownMachine = True
    End Function
    Function GetMyMachineName() As String
    Dim sLen As Long
    'create a buffer
    GetMyMachineName = Space(100)
    sLen = 100
    'retrieve the computer name
    If GetComputerName(GetMyMachineName, sLen) Then
    GetMyMachineName = Left(GetMyMachineName, sLen)
    End If
    End Function
    Private Sub Form_Load()
    InitiateShutdownMachine GetMyMachineName, True, True, True, 60, "You initiated a system shutdown..."
    End Sub

    Monday, March 26, 2007 12:16 PM
  • AdjustWindowRect

    The AdjustWindowRect function calculates the required size of the window rectangle, based on the desired client-rectangle size. The window rectangle can then be passed to the CreateWindow function to create a window whose client area is the desired size.

    VB4-32,5,6
    Declare Function AdjustWindowRect Lib "user32" Alias "AdjustWindowRect" (lpRect As RECT, ByVal dwStyle As Long, ByVal bMenu As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · lpRect
    Pointer to a RECT structure that contains the coordinates of the top-left and bottom-right corners of the desired client area. When the function returns, the structure contains the coordinates of the top-left and bottom-right corners of the window to accommodate the desired client area.

    · dwStyle
    Specifies the window styles of the window whose required size is to be calculated.

    · bMenu
    Specifies whether the window has a menu.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.

    Example :
    Const WS_BORDER = &H800000
    Const WS_DLGFRAME = &H400000
    Const WS_THICKFRAME = &H40000
    Const WS_CAPTION = &HC00000 ' WS_BORDER Or WS_DLGFRAME
    Const HWND_BOTTOM = 1
    Const HWND_TOP = 0
    Const HWND_TOPMOST = -1
    Const HWND_NOTOPMOST = -2
    Const SWP_SHOWWINDOW = &H40
    Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
    End Type
    Private Declare Function AdjustWindowRect Lib "user32" (lpRect As RECT, ByVal dwStyle As Long, ByVal bMenu As Long) As Long
    Private Declare Function BeginDeferWindowPos Lib "user32" (ByVal nNumWindows As Long) As Long
    Private Declare Function DeferWindowPos Lib "user32" (ByVal hWinPosInfo As Long, ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
    Private Declare Function EndDeferWindowPos Lib "user32" (ByVal hWinPosInfo As Long) As Long
    Private Sub Form_Load()
    Dim R As RECT, hDWP As Long
    R.Left = 30
    R.Top = 30
    R.Bottom = 200
    R.Right = 120
    AdjustWindowRect R, WS_THICKFRAME Or WS_CAPTION, False
    hDWP = BeginDeferWindowPos(1)
    DeferWindowPos hDWP, Me.hwnd, HWND_TOP, R.Left, R.Top, R.Right - R.Left, R.Bottom - R.Top, SWP_SHOWWINDOW
    EndDeferWindowPos hDWP
    End Sub

    Monday, March 26, 2007 12:17 PM
  • AdjustWindowRectEx

    The AdjustWindowRectEx function calculates the required size of the window rectangle, based on the desired size of the client rectangle. The window rectangle can then be passed to the CreateWindowEx function to create a window whose client area is the desired size.

    VB4-32,5,6
    Declare Function AdjustWindowRectEx Lib "user32" Alias "AdjustWindowRectEx" (lpRect As RECT, ByVal dsStyle As Long, ByVal bMenu As Long, ByVal dwEsStyle As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · lpRect
    Pointer to a RECT structure that contains the coordinates of the top-left and bottom-right corners of the desired client area. When the function returns, the structure contains the coordinates of the top-left and bottom-right corners of the window to accommodate the desired client area.

    · dwStyle
    Specifies the window styles of the window whose required size is to be calculated.

    · bMenu
    Specifies whether the window has a menu.

    · dwExStyle
    Specifies the extended style of the window whose required size is to be calculated.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.

    Examples
    Const WS_BORDER = &H800000
    Const WS_DLGFRAME = &H400000
    Const WS_THICKFRAME = &H40000
    Const WS_CAPTION = &HC00000                  ' WS_BORDER Or WS_DLGFRAME
    Const WS_EX_CLIENTEDGE = &H200
    Private Type RECT
            Left As Long
            Top As Long
            Right As Long
            Bottom As Long
    End Type
    Private Declare Function AdjustWindowRectEx Lib "user32" (lpRect As RECT, ByVal dsStyle As Long, ByVal bMenu As Long, ByVal dwEsStyle As Long) As Long
    Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
    Private Sub Form_Load()
        Dim R As RECT, hDWP As Long
        R.Left = 30
        R.Top = 30
        R.Bottom = 200
        R.Right = 120
        AdjustWindowRectEx R, WS_THICKFRAME Or WS_CAPTION, False, WS_EX_CLIENTEDGE
        MoveWindow Me.hwnd, R.Left, R.Top, R.Right - R.Left, R.Bottom - R.Top, False
    End Sub

    Monday, March 26, 2007 12:20 PM
  • AllocateAndInitializeSid

    The AllocateAndInitializeSid function allocates and initializes a security identifier (SID) with up to eight subauthorities.

    VB4-32,5,6
    Declare Function AllocateAndInitializeSid Lib "Advapi32" (pIdentifierAuthority As SID_IDENTIFIER_AUTHORITY, ByVal nSubAuthorityCount As Byte, ByVal nSubAuthority0 As Long, ByVal nSubAuthority1 As Long, ByVal nSubAuthority2 As Long, ByVal nSubAuthority3 As Long, ByVal nSubAuthority4 As Long, ByVal nSubAuthority5 As Long, ByVal nSubAuthority6 As Long, ByVal nSubAuthority7 As Long, lpPSid As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Win9x/ME: Not supported

    Library
    Advapi32

    Parameter Information
    · pIdentifierAuthority
    [in] Pointer to a SID_IDENTIFIER_AUTHORITY structure, giving the top-level identifier authority value to set in the SID.

    · nSubAuthorityCount
    [in] Specifies the number of subauthorities to place in the SID. This parameter also identifies how many of the subauthority parameters have meaningful values. This parameter must contain a value from 1 to 8.
    For example, a value of 3 indicates that the subauthority values specified by the dwSubAuthority0, dwSubAuthority1, and dwSubAuthority2 parameters have meaningful values and to ignore the remainder.

    · dwSubAuthority0
    [in] Subauthority value to place in the SID.

    · dwSubAuthority1
    [in] Subauthority value to place in the SID.

    · dwSubAuthority2
    [in] Subauthority value to place in the SID.

    · dwSubAuthority3
    [in] Subauthority value to place in the SID.

    · dwSubAuthority4
    [in] Subauthority value to place in the SID.

    · dwSubAuthority5
    [in] Subauthority value to place in the SID.

    · dwSubAuthority6
    [in] Subauthority value to place in the SID.

    · dwSubAuthority7
    [in] Subauthority value to place in the SID.

    · pSid
    [out] Pointer to a variable that receives the pointer to the allocated and initialized SID structure.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.

    Examples
    Option Explicit
    Private Sub Form_Load()
        If IsAdmin Then
            MsgBox "Your an Administrator", vbInformation, Caption
        Else
            MsgBox "Keep Dreaming", vbInformation, Caption
        End If
    End Sub

    'in a module
    Option Explicit
    Option Base 0     ' Important assumption for this code

    Private Const ANYSIZE_ARRAY = 20 'Fixed at this size for comfort. Could be bigger or made dynamic.

    ' Security APIs
    Private Const TokenUser = 1
    Private Const TokenGroups = 2
    Private Const TokenPrivileges = 3
    Private Const TokenOwner = 4
    Private Const TokenPrimaryGroup = 5
    Private Const TokenDefaultDacl = 6
    Private Const TokenSource = 7
    Private Const TokenType = 8
    Private Const TokenImpersonationLevel = 9
    Private Const TokenStatistics = 10

    ' Token Specific Access Rights
    Private Const TOKEN_ASSIGN_PRIMARY = &H1
    Private Const TOKEN_DUPLICATE = &H2
    Private Const TOKEN_IMPERSONATE = &H4
    Private Const TOKEN_QUERY = &H8
    Private Const TOKEN_QUERY_SOURCE = &H10
    Private Const TOKEN_ADJUST_PRIVILEGES = &H20
    Private Const TOKEN_ADJUST_GROUPS = &H40
    Private Const TOKEN_ADJUST_DEFAULT = &H80

    ' NT well-known SIDs
    Private Const SECURITY_DIALUP_RID = &H1
    Private Const SECURITY_NETWORK_RID = &H2
    Private Const SECURITY_BATCH_RID = &H3
    Private Const SECURITY_INTERACTIVE_RID = &H4
    Private Const SECURITY_SERVICE_RID = &H6
    Private Const SECURITY_ANONYMOUS_LOGON_RID = &H7
    Private Const SECURITY_LOGON_IDS_RID = &H5
    Private Const SECURITY_LOCAL_SYSTEM_RID = &H12
    Private Const SECURITY_NT_NON_UNIQUE = &H15
    Private Const SECURITY_BUILTIN_DOMAIN_RID = &H20

    ' Well-known domain relative sub-authority values (RIDs)
    Private Const DOMAIN_ALIAS_RID_ADMINS = &H220
    Private Const DOMAIN_ALIAS_RID_USERS = &H221
    Private Const DOMAIN_ALIAS_RID_GUESTS = &H222
    Private Const DOMAIN_ALIAS_RID_POWER_USERS = &H223
    Private Const DOMAIN_ALIAS_RID_ACCOUNT_OPS = &H224
    Private Const DOMAIN_ALIAS_RID_SYSTEM_OPS = &H225
    Private Const DOMAIN_ALIAS_RID_PRINT_OPS = &H226
    Private Const DOMAIN_ALIAS_RID_BACKUP_OPS = &H227
    Private Const DOMAIN_ALIAS_RID_REPLICATOR = &H228

    Private Const SECURITY_NT_AUTHORITY = &H5

    Type SID_AND_ATTRIBUTES
        Sid As Long
        Attributes As Long
    End Type

    Type TOKEN_GROUPS
        GroupCount As Long
        Groups(ANYSIZE_ARRAY) As SID_AND_ATTRIBUTES
    End Type

    Type SID_IDENTIFIER_AUTHORITY
        Value(0 To 5) As Byte
    End Type

    Declare Function GetCurrentProcess Lib "Kernel32" () As Long

    Declare Function GetCurrentThread Lib "Kernel32" () As Long

    Declare Function OpenProcessToken Lib "Advapi32" ( _
        ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, _
        TokenHandle As Long) As Long

    Declare Function OpenThreadToken Lib "Advapi32" ( _
        ByVal ThreadHandle As Long, ByVal DesiredAccess As Long, _
        ByVal OpenAsSelf As Long, TokenHandle As Long) As Long

    Declare Function GetTokenInformation Lib "Advapi32" ( _
        ByVal TokenHandle As Long, TokenInformationClass As Integer, _
        TokenInformation As Any, ByVal TokenInformationLength As Long, _
        ReturnLength As Long) As Long

    Declare Function AllocateAndInitializeSid Lib "Advapi32" ( _
        pIdentifierAuthority As SID_IDENTIFIER_AUTHORITY, _
        ByVal nSubAuthorityCount As Byte, ByVal nSubAuthority0 As Long, _
        ByVal nSubAuthority1 As Long, ByVal nSubAuthority2 As Long, _
        ByVal nSubAuthority3 As Long, ByVal nSubAuthority4 As Long, _
        ByVal nSubAuthority5 As Long, ByVal nSubAuthority6 As Long, _
        ByVal nSubAuthority7 As Long, lpPSid As Long) As Long

    Declare Function RtlMoveMemory Lib "Kernel32" ( _
        Dest As Any, Source As Any, ByVal lSize As Long) As Long

    Declare Function IsValidSid Lib "Advapi32" (ByVal pSid As Long) As Long

    Declare Function EqualSid Lib "Advapi32" (pSid1 As Any, pSid2 As Any) As Long

    Declare Sub FreeSid Lib "Advapi32" (pSid As Any)

    Declare Function CloseHandle Lib "Kernel32" (ByVal hObject As Long) As Long

    Public Function IsAdmin() As Boolean
        Dim hProcessToken       As Long
        Dim BufferSize          As Long
        Dim psidAdmin           As Long
        Dim lResult             As Long
        Dim X                   As Integer
        Dim tpTokens            As TOKEN_GROUPS
        Dim tpSidAuth           As SID_IDENTIFIER_AUTHORITY

        IsAdmin = False
        tpSidAuth.Value(5) = SECURITY_NT_AUTHORITY
       
        ' Obtain current process token
        If Not OpenThreadToken(GetCurrentThread(), TOKEN_QUERY, True, hProcessToken) Then
            Call OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, hProcessToken)
        End If
        If hProcessToken Then

            ' Deternine the buffer size required
            Call GetTokenInformation(hProcessToken, ByVal TokenGroups, 0, 0, BufferSize) ' Determine required buffer size
            If BufferSize Then
                ReDim InfoBuffer((BufferSize \ 4) - 1) As Long
               
                ' Retrieve your token information
                lResult = GetTokenInformation(hProcessToken, ByVal TokenGroups, InfoBuffer(0), BufferSize, BufferSize)
                If lResult <> 1 Then Exit Function
               
                ' Move it from memory into the token structure
                Call RtlMoveMemory(tpTokens, InfoBuffer(0), Len(tpTokens))
               
                ' Retreive the admins sid pointer
                lResult = AllocateAndInitializeSid(tpSidAuth, 2, SECURITY_BUILTIN_DOMAIN_RID, _
                        DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, psidAdmin)
                If lResult <> 1 Then Exit Function
                If IsValidSid(psidAdmin) Then
                    For X = 0 To tpTokens.GroupCount
                   
                        ' Run through your token sid pointers
                        If IsValidSid(tpTokens.Groups(X).Sid) Then
                       
                            ' Test for a match between the admin sid equalling your sid's
                            If EqualSid(ByVal tpTokens.Groups(X).Sid, ByVal psidAdmin) Then
                                IsAdmin = True
                                Exit For
                            End If
                        End If
                    Next
                End If
                If psidAdmin Then Call FreeSid(psidAdmin)
            End If
            Call CloseHandle(hProcessToken)
        End If
    End Function



    Monday, March 26, 2007 12:21 PM
  • AllocConsole

    The AllocConsole function allocates a new console for the calling process.

    VB4-32,5,6
    Declare Function AllocConsole Lib "kernel32" () As Long

    VB.NET
    System.Console

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Kernel32

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.

    Example :
    Private Const FOREGROUND_BLUE = &H1
    Private Const FOREGROUND_GREEN = &H2
    Private Const FOREGROUND_RED = &H4
    Private Const BACKGROUND_BLUE = &H10
    Private Const BACKGROUND_GREEN = &H20
    Private Const BACKGROUND_RED = &H40
    Private Const BACKGROUND_INTENSITY = &H80&
    Private Const BACKGROUND_SEARCH = &H20&
    Private Const FOREGROUND_INTENSITY = &H8&
    Private Const FOREGROUND_SEARCH = (&H10&)
    Private Const ENABLE_LINE_INPUT = &H2&
    Private Const ENABLE_ECHO_INPUT = &H4&
    Private Const ENABLE_MOUSE_INPUT = &H10&
    Private Const ENABLE_PROCESSED_INPUT = &H1&
    Private Const ENABLE_WINDOW_INPUT = &H8&
    Private Const ENABLE_PROCESSED_OUTPUT = &H1&
    Private Const ENABLE_WRAP_AT_EOL_OUTPUT = &H2&
    Private Const STD_OUTPUT_HANDLE = -11&
    Private Const STD_INPUT_HANDLE = -10&
    Private Const STD_ERROR_HANDLE = -12&
    Private Const INVALID_HANDLE_VALUE = -1&
    Private Declare Function AllocConsole Lib "kernel32" () As Long
    Private Declare Function FreeConsole Lib "kernel32" () As Long
    Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
    Private Declare Function GetStdHandle Lib "kernel32" (ByVal nStdHandle As Long) As Long
    Private Declare Function WriteConsole Lib "kernel32" Alias "WriteConsoleA" (ByVal hConsoleOutput As Long, lpBuffer As Any, ByVal nNumberOfCharsToWrite As Long, lpNumberOfCharsWritten As Long, lpReserved As Any) As Long
    Private Declare Function ReadConsole Lib "kernel32" Alias "ReadConsoleA" (ByVal hConsoleInput As Long, ByVal lpBuffer As String, ByVal nNumberOfCharsToRead As Long, lpNumberOfCharsRead As Long, lpReserved As Any) As Long
    Private Declare Function SetConsoleTextAttribute Lib "kernel32" (ByVal hConsoleOutput As Long, ByVal wAttributes As Long) As Long
    Private Declare Function SetConsoleTitle Lib "kernel32" Alias "SetConsoleTitleA" (ByVal lpConsoleTitle As String) As Long
    Private hConsoleOut As Long, hConsoleIn As Long, hConsoleErr As Long
    Private Sub Form_Load()
        'Create console
        If AllocConsole() Then
            hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE)
            If hConsoleOut = INVALID_HANDLE_VALUE Then MsgBox "Unable to get STDOUT"
            hConsoleIn = GetStdHandle(STD_INPUT_HANDLE)
            If hConsoleOut = INVALID_HANDLE_VALUE Then MsgBox "Unable to get STDIN"
        Else
            MsgBox "Couldn't allocate console"
        End If
        'Set the caption of the console window
        SetConsoleTitle "The KPD-Team 2001"
        'Set the background color of the text in the console to bright YELLOW text
        'on a BLUE background
        SetConsoleTextAttribute hConsoleOut, FOREGROUND_RED Or FOREGROUND_GREEN Or FOREGROUND_INTENSITY Or BACKGROUND_BLUE
        'Write something in the console
        ConsoleWriteLine "Hello World!"
        ConsoleWrite "Please enter your name: "
        'Ask for user input and show it in the caption
        Me.Caption = "Your name: " + ConsoleReadLine()
    End Sub
    Private Sub Form_Unload(Cancel As Integer)
        'Delete console
        CloseHandle hConsoleOut
        CloseHandle hConsoleIn
        FreeConsole
    End Sub
    Sub ConsoleWriteLine(sInput As String)
         ConsoleWrite sInput + vbCrLf
    End Sub
    Sub ConsoleWrite(sInput As String)
         Dim cWritten As Long
         WriteConsole hConsoleOut, ByVal sInput, Len(sInput), cWritten, ByVal 0&
    End Sub
    Function ConsoleReadLine() As String
        Dim ZeroPos As Long
        'Create a buffer
        ConsoleReadLine = String(10, 0)
        'Read the input
        ReadConsole hConsoleIn, ConsoleReadLine, Len(ConsoleReadLine), vbNull, vbNull
        'Strip off trailing vbCrLf and Chr$(0)'s
        ZeroPos = InStr(ConsoleReadLine, Chr$(0))
        If ZeroPos > 0 Then ConsoleReadLine = Left$(ConsoleReadLine, ZeroPos - 3)
    End Function

    Monday, March 26, 2007 12:21 PM
  • Guys Please contribute.
    Monday, March 26, 2007 12:23 PM
  • Hey harshil, i've started TAPI thread and am contributing there. am not that much well in winapi. but will try to contribute something here.

    anyways, you are sharing good information here. keep it up. Smile
    Tuesday, March 27, 2007 5:53 PM
  • AllowSetForegroundWindow

    The AllowSetForegroundWindow function enables the specified process to set the foreground window using the SetForegroundWindow function.

    VB4-32,5,6
    Declare Function AllowSetForegroundWindow Lib "user32.dll" (ByVal dwProcessId As Long) As Long

    Operating Systems Supported
    Requires Windows 2000 or later; Requires Windows ME

    Library
    User32

    Parameter Information
    · dwProcessId
    [in] Specifies the identifier of the process that will be enabled to set the foreground window. If this parameter is ASFW_ANY, all processes will be enabled to set the foreground window.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. The function will fail if the calling process cannot set the foreground window. To get extended error information, call GetLastError.
    Sunday, April 29, 2007 5:19 PM
  • AlphaBlend

    The AlphaBlend function displays bitmaps that have transparent or semitransparent pixels.

    VB4-32,5,6
    Declare Function AlphaBlend Lib "msimg32.dll" (ByVal hdc As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal hdc As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal BLENDFUNCT As Long) As Long

    Operating Systems Supported
    Requires Windows 2000 or later; Requires Windows 98 or later

    Library
    Msimg32

    Parameter Information
    · hdcDest
    [in] Handle to the destination device context.

    · nXOriginDest
    [in] Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle.

    · nYOriginDest
    [in] Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle.

    · nWidthDest
    [in] Specifies the width, in logical units, of the destination rectangle.

    · nHeightDest
    [in] Specifies the height, in logical units, of the destination rectangle.

    · hdcSrc
    [in] Handle to the source device context.

    · nXOriginSrc
    [in] Specifies the x-coordinate, in logical units, of the upper-left corner of the source rectangle.

    · nYOriginSrc
    [in] Specifies the y-coordinate, in logical units, of the upper-left corner of the source rectangle.

    · nWidthSrc
    [in] Specifies the width, in logical units, of the source rectangle.

    · nHeightSrc
    [in] Specifies the height, in logical units, of the source rectangle.

    · blendFunction
    [in] Specifies the alpha-blending function for source and destination bitmaps, a global alpha value to be applied to the entire source bitmap, and format information for the source bitmap. The source and destination blend functions are currently limited to AC_SRC_OVER. See the BLENDFUNCTION and EMRALPHABLEND structures.

    Return Values
    If the function succeeds, the return value is TRUE.
    If the function fails, the return value is FALSE.

    Windows NT/ 2000: To get extended error information, call GetLastError. This can return the following value.
    ERROR_INVALID_PARAMETER One or more of the input parameters is invalid.
    Sunday, April 29, 2007 5:19 PM
  • AngleArc

    The AngleArc function draws a line segment and an arc. The line segment is drawn from the current position to the beginning of the arc. The arc is drawn along the perimeter of a circle with the given radius and center. The length of the arc is defined by the given start and sweep angles.

    VB4-32,5,6
    Declare Function AngleArc Lib "gdi32" Alias "AngleArc" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal dwRadius As Long, ByVal eStartAngle As Double, ByVal eSweepAngle As Double) As Long

    VB.NET
    System.Graphics.DrawArc

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Win9x/ME: Not supported

    Library
    Gdi32

    Parameter Information
    · hdc
    Identifies a device context.

    · X
    Specifies the logical x-coordinate of the center of the circle.

    · Y
    Specifies the logical y-coordinate of the center of the circle.

    · dwRadius
    Specifies the radius, in logical units, of the circle. This value must be positive.

    · eStartAngle
    Specifies the start angle, in degrees, relative to the x-axis.

    · eSweepAngle
    Specifies the sweep angle, in degrees, relative to the starting angle.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Sunday, April 29, 2007 5:19 PM
  • AnimateWindow

    The AnimateWindow function enables you to produce special effects when showing or hiding windows. There are three types of animation: roll, slide, and alpha-blended fade.

    VB4-32,5,6
    Declare Function AnimateWindow Lib "user32" (ByVal hwnd As Long, ByVal dwTime As Long, ByVal dwFlags As Long) As Boolean

    Operating Systems Supported
    Requires Windows 2000 or later; Requires Windows 98 or later

    Library
    User32

    Parameter Information
    · hwnd
    [in] Handle to the window to animate. The calling thread must own this window.

    · dwTime
    [in] Specifies how long it takes to play the animation, in milliseconds. Typically, an animation takes 200 milliseconds to play.

    · dwFlags
    [in] Specifies the type of animation. This parameter can be one or more of the following values.
    AW_SLIDE
    Uses slide animation. By default, roll animation is used. This flag is ignored when used with AW_CENTER.
    AW_ACTIVATE
    Activates the window. Do not use this value with AW_HIDE.
    AW_BLEND
    Uses a fade effect. This flag can be used only if hwnd is a top-level window.
    AW_HIDE
    Hides the window. By default, the window is shown.
    AW_CENTER
    Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used.
    AW_HOR_POSITIVE
    Animates the window from left to right. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
    AW_HOR_NEGATIVE
    Animates the window from right to left. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
    AW_VER_POSITIVE
    Animates the window from top to bottom. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
    AW_VER_NEGATIVE
    Animates the window from bottom to top. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. The function will fail in the following situations:

    The window uses the window region.
    The window is already visible and you are trying to show the window.
    The window is already hidden and you are trying to hide the window.
    To get extended error information, call the GetLastError function.
    Sunday, April 29, 2007 5:20 PM
  • AppendMenu

    The AppendMenu function appends a new item to the end of the specified menu bar, drop-down menu, submenu, or shortcut menu. You can use this function to specify the content, appearance, and behavior of the menu item.

    VB4-32,5,6
    Declare Function AppendMenu Lib "user32" Alias "AppendMenuA" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As Any) As Long

    VB.NET
    System.Windows.Forms.Menu.MenuItems.Add

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hMenu
    Identifies the menu bar, drop-down menu, submenu, or shortcut menu to be changed.

    · uFlags
    Specifies flags to control the appearance and behavior of the new menu item. This parameter can be a combination of the values listed in the following Remarks section.

    · uIDNewItem
    Specifies either the identifier of the new menu item or, if the uFlags parameter is set to MF_POPUP, the handle to the drop-down menu or submenu.

    · lpNewItem
    Specifies the content of the new menu item. The interpretation of lpNewItem depends on whether the uFlags parameter includes the MF_BITMAP, MF_OWNERDRAW, or MF_STRING flag, as follows:
    MF_BITMAP
    Contains a bitmap handle.
    MF_OWNERDRAW
    Contains a 32-bit value supplied by the application that can be used to maintain additional data related to the menu item. The value is in the itemData member of the structure pointed to by the lparam parameter of the WM_MEASURE or WM_DRAWITEM message sent when the menu is created or its appearance is updated.
    MF_STRING
    Contains a pointer to a null-terminated string.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Sunday, April 29, 2007 5:20 PM
  • Arc

    The Arc function draws an elliptical arc.

    VB4-32,5,6
    Declare Function Arc Lib "gdi32" Alias "Arc" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long, ByVal X4 As Long, ByVal Y4 As Long) As Long

    VB.NET
    System.Drawing.Graphics.DrawArc

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Gdi32

    Parameter Information
    · hdc
    Identifies the device context where drawing takes place.

    · nLeftRect
    Specifies the logical x-coordinate of the upper-left corner of the bounding rectangle.
    Windows 95: The sum of nLeftRect plus nRightRect must be less than 32768.

    · nTopRect
    Specifies the logical y-coordinate of the upper-left corner of the bounding rectangle.
    Windows 95: The sum of nTopRect plus nBottomRect must be less than 32768.

    · nRightRect
    Specifies the logical x-coordinate of the lower-right corner of the bounding rectangle.
    Windows 95: The sum of nLeftRect plus nRightRect must be less than 32768.

    · nBottomRect
    Specifies the logical y-coordinate of the lower-right corner of the bounding rectangle.
    Windows 95: The sum of nTopRect plus nBottomRect must be less than 32768.

    · nXStartArc
    Specifies the logical x-coordinate of the ending point of the radial line defining the starting point of the arc.

    · nYStartArc
    Specifies the logical y-coordinate of the ending point of the radial line defining the starting point of the arc.

    · nXEndArc
    Specifies the logical x-coordinate of the ending point of the radial line defining the ending point of the arc.

    · nYEndArc
    Specifies the logical y-coordinate of the ending point of the radial line defining the ending point of the arc.

    Return Values
    If the arc is drawn, the return value is nonzero.

    If the arc is not drawn, the return value is zero.
    Sunday, April 29, 2007 5:21 PM
  • ArcTo

    The ArcTo function draws an elliptical arc.

    VB4-32,5,6
    Declare Function ArcTo Lib "gdi32" Alias "ArcTo" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long, ByVal X4 As Long, ByVal Y4 As Long) As Long

    VB.NET
    System.Drawing.Graphics.DrawArc

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Win9x/ME: Not supported

    Library
    Gdi32

    Parameter Information
    · hdc
    Identifies the device context where drawing takes place.

    · nLeftRect
    Specifies the logical x-coordinate of the upper-left corner of the bounding rectangle.

    · nTopRect
    Specifies the logical y-coordinate of the upper-left corner of the bounding rectangle.

    · nRightRect
    Specifies the logical x-coordinate of the lower-right corner of the bounding rectangle.

    · nBottomRect
    Specifies the logical y-coordinate of the lower-right corner of the bounding rectangle.

    · nXRadial1
    Specifies the logical x-coordinate of the endpoint of the radial defining the starting point of the arc.

    · nYRadial1
    Specifies the logical y-coordinate of the endpoint of the radial defining the starting point of the arc.

    · nXRadial2
    Specifies the logical x-coordinate of the endpoint of the radial defining the ending point of the arc.

    · nYRadial2
    Specifies the logical y-coordinate of the endpoint of the radial defining the ending point of the arc.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Sunday, April 29, 2007 5:21 PM
  • auxGetDevCaps

    The auxGetDevCaps function retrieves the capabilities of a given auxiliary output device.

    VB4-32,5,6
    Declare Function auxGetDevCaps Lib "winmm.dll" Alias "auxGetDevCapsA" (ByVal uDeviceID As Long, lpCaps As AUXCAPS, ByVal uSize As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · uDeviceID
    Identifier of the auxiliary output device to be queried. Specify a valid device identifier (see the following comments section), or use the following constant:
    AUX_MAPPER
    Auxiliary audio mapper. The function returns an error if no auxiliary audio mapper is installed.

    · lpCaps
    Address of an AUXCAPS structure to be filled with information about the capabilities of the device.

    · cbCaps
    Size, in bytes, of the AUXCAPS structure.

    Return Values
    Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following: MMSYSERR_BADDEVICEID
    Specified device identifier is out of range.
    Sunday, April 29, 2007 5:22 PM
  • auxGetNumDevs

    The auxGetNumDevs function retrieves the number of auxiliary output devices present in the system.

    VB4-32,5,6
    Declare Function auxGetNumDevs Lib "winmm.dll" Alias "auxGetNumDevs" () As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Return Values
    Returns the number of device. A return value of zero means that no devices are present or that an error occurred.
    Sunday, April 29, 2007 5:22 PM
  • auxGetVolume

    The auxGetVolume function retrieves the current volume setting of the specified auxiliary output device.

    VB4-32,5,6
    Declare Function auxGetVolume Lib "winmm.dll" Alias "auxGetVolume" (ByVal uDeviceID As Long, lpdwVolume As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · uDeviceID
    Identifier of the auxiliary output device to be queried.

    · lpdwVolume
    Address of a variable to be filled with the current volume setting. The low-order word of this location contains the left channel volume setting, and the high-order word contains the right channel setting. A value of 0xFFFF represents full volume, and a value of 0x0000 is silence.
    If a device does not support both left and right volume control, the low-order word of the specified location contains the volume level.
    The full 16-bit setting(s) set with the auxSetVolume function are returned, regardless of whether the device supports the full 16 bits of volume-level control.

    Return Values
    Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following: MMSYSERR_BADDEVICEID
    Specified device identifier is out of range.
    Sunday, April 29, 2007 5:22 PM
  • auxSetVolume

    The auxSetVolume function sets the volume of the specified auxiliary output device.

    VB4-32,5,6
    Declare Function auxSetVolume Lib "winmm.dll" Alias "auxSetVolume" (ByVal uDeviceID As Long, ByVal dwVolume As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · uDeviceID
    Identifier of the auxiliary output device to be queried. Device identifiers are determined implicitly from the number of devices present in the system. Device identifier values range from zero to one less than the number of devices present. Use the auxGetNumDevs function to determine the number of auxiliary devices in the system.

    · dwVolume
    Specifies the new volume setting. The low-order word specifies the left-channel volume setting, and the high-order word specifies the right-channel setting. A value of 0xFFFF represents full volume, and a value of 0x0000 is silence.
    If a device does not support both left and right volume control, the low-order word of dwVolume specifies the volume level, and the high-order word is ignored.

    Return Values
    Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following: MMSYSERR_BADDEVICEID
    Specified device identifier is out of range.
    Sunday, April 29, 2007 5:23 PM
  • AVIFileExit

    The AVIFileExit function exits the AVIFile library and decrements the reference count for the library.

    VB4-32,5,6
    Declare Sub AVIFileExit Lib "avifil32" ()

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Avifil32

    Return Values
    This function does not return a value.
    Sunday, April 29, 2007 5:23 PM
  • AVIFileInfo

    The AVIFileInfo function obtains information about an AVI file.

    VB4-32,5,6
    Declare Function AVIFileInfo Lib "avifil32" Alias "AVIFileInfoA" (ByVal pfile As Long, pfi As AVIFILEINFO, ByVal lSize As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Avifil32

    Parameter Information
    · pfile
    Handle of an open AVI file.

    · pfi
    Address of the structure used to return file information. Typically, this parameter points to an AVIFILEINFO structure.

    · lSize
    Size, in bytes, of the structure.

    Return Values
    Returns zero if successful or an error otherwise.
    Sunday, April 29, 2007 5:23 PM
  • AVIFileInit

    The AVIFileInit function initializes the AVIFile library.
    The AVIFile library maintains a count of the number of times it is initialized, but not the number of times it was released. Use the AVIFileExit function to release the AVIFile library and decrement the reference count. Call AVIFileInit before using any other AVIFile functions.

    VB4-32,5,6
    Declare Sub AVIFileInit Lib "avifil32" ()

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Avifil32

    Return Values
    This function does not return a value.
    Sunday, April 29, 2007 5:24 PM
  • AVIFileOpen

    The AVIFileOpen function opens an AVI file and returns the address of a file interface used to access it. The AVIFile library maintains a count of the number of times a file is opened, but not the number of times it was released. Use the AVIFileRelease function to release the file and decrement the count.

    VB4-32,5,6
    Declare Function AVIFileOpen Lib "avifil32" Alias "AVIFileOpenA" (ppfile As Long, ByVal szFile As String, ByVal mode As Long, pclsidHandler As Any) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Avifil32

    Parameter Information
    · ppfile
    Address to contain the new file interface pointer.

    · szFile
    Null-terminated string containing the name of the file to open.

    · mode
    Access mode to use when opening the file. The default access mode is OF_READ. The following access modes can be specified with AVIFileOpen:
    OF_CREATE
    Creates a new file. If the file already exists, it is truncated to zero length.

    OF_SHARE_DENY_NONE
    Opens the file nonexclusively. Other processes can open the file with read or write access. AVIFileOpen fails if another process has opened the file in compatibility mode.

    OF_SHARE_DENY_READ
    Opens the file nonexclusively. Other processes can open the file with write access. AVIFileOpen fails if another process has opened the file in compatibility mode or has read access to it.

    OF_SHARE_DENY_WRITE
    Opens the file nonexclusively. Other processes can open the file with read access. AVIFileOpen fails if another process has opened the file in compatibility mode or has write access to it.

    OF_SHARE_EXCLUSIVE
    Opens the file and denies other processes any access to it. AVIFileOpen fails if any other process has opened the file.

    OF_READ
    Opens the file for reading.

    OF_READWRITE
    Opens the file for reading and writing.

    OF_WRITE
    Opens the file for writing.

    · pclsidHandler
    Address of a class identifier of the standard or custom handler you want to use. If the value is NULL, the system chooses a handler from the registry based on the file extension or the RIFF type specified in the file.

    Return Values
    Returns zero if successful or an error otherwise. Possible error values include the following:
    AVIERR_BADFORMAT
    The file couldn’t be read, indicating a corrupt file or an unrecognized format.
    AVIERR_MEMORY
    The file could not be opened because of insufficient memory.
    AVIERR_FILEREAD
    A disk error occurred while reading the file.
    AVIERR_FILEOPEN
    A disk error occurred while opening the file.
    REGDB_E_CLASSNOTREG
    According to the registry, the type of file specified in AVIFileOpen does not have a handler to process it.
    Sunday, April 29, 2007 5:24 PM
  • AVIFileRelease

    The AVIFileRelease function decrements the reference count of an AVI file interface handle and closes the file if the count reaches zero.

    VB4-32,5,6
    Declare Function AVIFileRelease Lib "avifil32" (ByVal pfile As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Avifil32

    Parameter Information
    · pfile
    Handle of an open AVI file.

    Return Values
    Returns the reference count of the file. This return value should be used only for debugging purposes.
    Sunday, April 29, 2007 5:24 PM
  • Please give API for screen saver & how to use it in vb.

    Tuesday, May 1, 2007 6:35 PM
  • I dont understand your question ?

    Do you want to start a screen saver from vb ? I guess you can just do it .....

    A screen saver is infact a pure executable file, with a .SCR extension, or in other words it is just a renamed EXE file. But just renaming any EXE file will not do. You need to interpret a few specific messages that Windows sends to you. A basic screen saver code needs to interpret the screensaver messages, draw the graphics and release control back to Windows on user return.

    The Messages & Sub Main()

    Whenever Windows executes a screen saver it sends a message string in the command line. This string can be accessed by the VB Command$ function. Lets see what each message means.

    "/s" : Normal Mode
    "/p" : Preview Mode
    "/c" : Configuration Mode
    "/a" : Set Password Mode

    The best way to interpret these messages would be to use a Sub Main(). For this add a module to your application & create a sub called Main(). The code for interpreting should go in here. Download the sample source code, each step is well explained there.

    Once we are done with Sub Main(), we need to make it the start-up object. For this click on Project > Properties Menu and change the start-up opject to Sub Main().

    Running the Screen Saver

    The screen saver should be run normally when a "/s" switch is passed or when no command is passed at all. The main form should be loaded when this occurs. This form is where the actual graphics and the screensaver content is done. I have included a floating picture as an example in the sample. You can use your own colourful ideas. This is the playground for you.

    The Preview Mode

    As you might have noticed the Preview command has a slight catch. This is the tricky part of the project. We need to show the screen saver in the small preview window in the Display properties dialog. The "/p" command sends a number which is the hWnd of the Display properties dialog. hWnd is a number that is used in Win API to identify each window. The best way to implement the preview mode, is to display the screen saver window as a child to the Display properties. That is what all those API does in the code!

    Finishing Touches

    So now that we have the graphics done, we need to bother about returning the control to Windows. This is to be done when an user activity like keyboard tap, mouse click or mouse move occurs. All you have to do is unload all the forms and end the application when this occurs and the control is transferred back to windows. It's that simple!

    That is the coding part done. Now compile the application with .SCR extension. If you copy your screen saver to the windows directory, you will see it listed in the Screensaver tab of the Display properties dialog. Select your screen saver and you can see the preview mode in action. Clicking on Preview button gives you the full scale test of the screen saver.

    Viola! The Screen saver is ready!

    Downloads

    Before you go..

    This screensaver was coded in VB. But you can modify it easily to run in any other language that supports Windows API, like Delphi, VC++. You might get better results in these languages. So try it out too. It is a nice way to test your programming skills.
    Wednesday, May 2, 2007 4:24 AM

  • Code Snippet

    The sample code below shows how to start a Visual Basic screen saver by sending a Windows message to the Control-menu box on a form.

    Microsoft Windows starts screen savers through the System-menu box on a form. The System-menu box is also known as the Control-menu box in Visual Basic. You can send Windows messages to the Control-menu box by using the SendMessage Windows API (application programming interface) function.


    ---------------------


    [general declarations]
    #If Win32 Then
    Private Declare Function SendMessage Lib "user32" Alias _
    "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _ ByVal wParam
    As Long, ByVal lParam As Long) As Long
    Const WM_SYSCOMMAND = &H112&
    Const SC_SCREENSAVE = &HF140&
    #Else
    Private Declare Function SendMessage Lib "User" (ByVal _ hWnd
    As Integer, ByVal wMsg As Integer, ByVal wParam As _ Integer,
    lParam As Any) As Long
    Const WM_SYSCOMMAND = &H112
    Const SC_SCREENSAVE = &HF140&
    #End If

    Private Sub Command1_Click()
    Dim result As Long
    result = SendMessage(Form1.hWnd, WM_SYSCOMMAND, _
    SC_SCREENSAVE, 0&)
    End Sub

    Wednesday, May 2, 2007 4:26 AM
  • BackupEventLog

    The BackupEventLog function saves the specified event log to a backup file. The function does not clear the event log.

    VB4-32,5,6
    Declare Function BackupEventLog Lib "advapi32.dll" Alias "BackupEventLogA" (ByVal hEventLog As Long, ByVal lpBackupFileName As String) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Win9x/ME: Not supported

    Library
    Advapi32

    Parameter Information
    · hEventLog
    [in] Handle to the open event log. This handle is returned by the OpenEventLog or OpenBackupEventLog function.

    · lpBackupFileName
    [in] Pointer to a null-terminated string that names the backup file.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Thursday, June 7, 2007 5:33 PM
  • Beep

    The Beep function generates simple tones on the speaker. The function is synchronous; it does not return control to its caller until the sound finishes.

    VB4-32,5,6
    Declare Function Beep Lib "kernel32" Alias "Beep" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Kernel32

    Parameter Information
    · dwFreq
    Windows NT:
    Specifies the frequency, in hertz, of the sound. This parameter must be in the range 37 through 32,767 (0x25 through 0x7FFF).
    Windows 95:
    The parameter is ignored.

    · dwDuration
    Windows NT:
    Specifies the duration, in milliseconds, of the sound.
    Windows 95:
    The parameter is ignored.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Thursday, June 7, 2007 5:34 PM
  • BeginDeferWindowPos

    The BeginDeferWindowPos function allocates memory for a multiple-window- position structure and returns the handle to the structure.

    VB4-32,5,6
    Declare Function BeginDeferWindowPos Lib "user32" Alias "BeginDeferWindowPos" (ByVal nNumWindows As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · nNumWindows
    Specifies the initial number of windows for which to store position information. The DeferWindowPos function increases the size of the structure, if necessary.

    Return Values
    If the function succeeds, the return value identifies the multiple-window - position structure. If insufficient system resources are available to allocate the structure, the return value is NULL.
    Thursday, June 7, 2007 6:25 PM
  • BitBlt

    The BitBlt function performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device context into a destination device context.

    VB4-32,5,6
    Declare Function BitBlt Lib "gdi32" Alias "BitBlt" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long

    VB.NET
    System.Drawing.Graphics.DrawImage

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Gdi32

    Parameter Information
    · hdcDest
    Identifies the destination device context.

    · nXDest
    Specifies the logical x-coordinate of the upper-left corner of the destination rectangle.

    · nYDest
    Specifies the logical y-coordinate of the upper-left corner of the destination rectangle.

    · nWidth
    Specifies the logical width of the source and destination rectangles.

    · nHeight
    Specifies the logical height of the source and the destination rectangles.

    · hdcSrc
    Identifies the source device context.

    · nXSrc
    Specifies the logical x-coordinate of the upper-left corner of the source rectangle.

    · nYSrc
    Specifies the logical y-coordinate of the upper-left corner of the source rectangle.

    · dwRop
    Specifies a raster-operation code. These codes define how the color data for the source rectangle is to be combined with the color data for the destination rectangle to achieve the final color.
    The following list shows some common raster operation codes:
    BLACKNESS
    Fills the destination rectangle using the color associated with index 0 in the physical palette. (This color is black for the default physical palette.)
    DSTINVERT
    Inverts the destination rectangle.
    MERGECOPY
    Merges the colors of the source rectangle with the specified pattern by using the Boolean AND operator.
    MERGEPAINT
    Merges the colors of the inverted source rectangle with the colors of the destination rectangle by using the Boolean OR operator.
    NOTSRCCOPY
    Copies the inverted source rectangle to the destination.
    NOTSRCERASE
    Combines the colors of the source and destination rectangles by using the Boolean OR operator and then inverts the resultant color.
    PATCOPY
    Copies the specified pattern into the destination bitmap.
    PATINVERT
    Combines the colors of the specified pattern with the colors of the destination rectangle by using the Boolean XOR operator.
    PATPAINT
    Combines the colors of the pattern with the colors of the inverted source rectangle by using the Boolean OR operator. The result of this operation is combined with the colors of the destination rectangle by using the Boolean OR operator.
    SRCAND
    Combines the colors of the source and destination rectangles by using the Boolean AND operator.
    SRCCOPY
    Copies the source rectangle directly to the destination rectangle.
    SRCERASE
    Combines the inverted colors of the destination rectangle with the colors of the source rectangle by using the Boolean AND operator.
    SRCINVERT
    Combines the colors of the source and destination rectangles by using the Boolean XOR operator.
    SRCPAINT
    Combines the colors of the source and destination rectangles by using the Boolean OR operator.
    WHITENESS
    Fills the destination rectangle using the color associated with index 1 in the physical palette. (This color is white for the default physical palette.)

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Thursday, June 7, 2007 6:26 PM
  • BlockInput

    The BlockInput function blocks keyboard and mouse input events from reaching applications.

    VB4-32,5,6
    Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long

    Operating Systems Supported
    Requires Windows 2000 or later; Requires Windows 98 or later

    Library
    User32

    Parameter Information
    · fBlock
    [in] Specifies the function's purpose. If this parameter is TRUE, keyboard and mouse input events are blocked. If this parameter is FALSE, keyboard and mouse events are unblocked. Note that only the thread that blocked input can successfully unblock input.

    Return Values
    If the function succeeds, the return value is nonzero.

    If input is already blocked, the return value is zero. To get extended error information, call GetLastError.
    Thursday, June 7, 2007 6:26 PM
  • BringWindowToTop

    The BringWindowToTop function brings the specified window to the top of the Z order. If the window is a top-level window, it is activated. If the window is a child window, the top-level parent window associated with the child window is activated.

    VB4-32,5,6
    Declare Function BringWindowToTop Lib "user32" Alias "BringWindowToTop" (ByVal hwnd As Long) As Long

    VB.NET
    System.Windows.Forms.Form.Activate

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hWnd
    Identifies the window to bring to the top of the Z order.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Thursday, June 7, 2007 6:27 PM
  • BroadcastSystemMessage

    The BroadcastSystemMessage function sends a message to the specified recipients. The recipients can be applications, installable drivers, Windows-based network drivers, system-level device drivers, or any combination of these system components.

    VB4-32,5,6
    Declare Function BroadcastSystemMessage Lib "user32" Alias "BroadcastSystemMessage" (ByVal dw As Long, pdw As Long, ByVal un As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

    Operating Systems Supported
    Requires Windows NT 4.0 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · dwFlags
    Option flags. Can be a combination of the following values:
    BSF_FLUSHDISK
    Flush the disk after each recipient processes the message.
    BSF_FORCEIFHUNG
    Continue to broadcast the message, even if the time-out period elapses or one of the recipients is hung..
    BSF_IGNORECURRENTTASK
    Do not send the message to windows that belong to the current task. This prevents an application from receiving its own message.
    BSF_NOHANG
    Force a hung application to time out. If one of the recipients times out, do not continue broadcasting the message.
    BSF_NOTIMEOUTIFNOTHUNG
    Wait for a response to the message, as long as the recipient is not hung. Do not time out.
    BSF_POSTMESSAGE
    Post the message. Do not use in combination with BSF_QUERY.
    BSF_QUERY
    Send the message to one recipient at a time, sending to a subsequent recipient only if the current recipient returns TRUE.

    · lpdwRecipients
    Pointer to a variable that contains and receives information about the recipients of the message. The variable can be a combination of the following values:
    BSM_ALLCOMPONENTS
    Broadcast to all system components.
    BSM_ALLDESKTOPS
    Windows NT only: Broadcast to all desktops. Requires the SE_TCB_NAME privilege.
    BSM_APPLICATIONS
    Broadcast to applications.
    BSM_INSTALLABLEDRIVERS
    Windows 95: Broadcast to installable drivers.
    Windows NT: This value is not meaningful.
    BSM_NETDRIVER
    Windows 95: Broadcast to Windows-based network drivers.
    Windows NT: This value is not meaningful.
    BSM_VXDS
    Windows 95: Broadcast to all system-level device drivers.
    Windows NT: This value is not meaningful.

    When the function returns, this variable receives a combination of these values identifying which recipients actually received the message.
    If this parameter is NULL, the function broadcasts to all components.

    · uiMessage
    Identifier of the system message.

    · wParam
    32-bit message-specific value.

    · lParam
    32-bit message-specific value.

    Return Values
    If the function succeeds, the return value is a positive value.

    If the function is unable to broadcast the message, the return value is -1.

    If the dwFlags parameter is BSF_QUERY and at least one recipient returned BROADCAST_QUERY_DENY to the corresponding message, the return value is zero.
    Thursday, June 7, 2007 6:27 PM
  • CallNextHookEx

    The CallNextHookEx function passes the hook information to the next hook procedure in the current hook chain. A hook procedure can call this function either before or after processing the hook information.

    VB4-32,5,6
    Declare Function CallNextHookEx Lib "user32" Alias "CallNextHookEx" (ByVal hHook As Long, ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hhk
    Identifies the current hook. An application receives this handle as a result of a previous call to the SetWindowsHookEx function.

    · nCode
    Specifies the hook code passed to the current hook procedure. The next hook procedure uses this code to determine how to process the hook information.

    · wParam
    Specifies the wParam value passed to the current hook procedure. The meaning of this parameter depends on the type of hook associated with the current hook chain.

    · lParam
    Specifies the lParam value passed to the current hook procedure. The meaning of this parameter depends on the type of hook associated with the current hook chain.

    Return Values
    If the function succeeds, the return value is the value returned by the next hook procedure in the chain. The current hook procedure must also return this value. The meaning of the return value depends on the hook type. For more information, see the descriptions of the individual hook procedures.
    Friday, June 8, 2007 5:15 PM
  • CallWindowProc

    The CallWindowProc function passes message information to the specified window procedure.

    VB4-32,5,6
    Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hWnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

    VB.NET
    System.Windows.Forms.Form.WndProc

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · lpPrevWndFunc
    Pointer to the previous window procedure.
    If this value is obtained by calling the GetWindowLong function with the nIndex parameter set to GWL_WNDPROC or DWL_DLGPROC, it is actually either the address of a window or dialog box procedure, or a handle representing that address.

    · hWnd
    Identifies the window procedure to receive the message.

    · Msg
    Specifies the message.

    · wParam
    Specifies additional message-specific information. The contents of this parameter depend on the value of the Msg parameter.

    · lParam
    Specifies additional message-specific information. The contents of this parameter depend on the value of the Msg parameter.

    Return Values
    The return value specifies the result of the message processing and depends on the message sent.
    Friday, June 8, 2007 5:15 PM
  • ChangeDisplaySettings

    The ChangeDisplaySettings function changes the display settings to the specified graphics mode.

    VB4-32,5,6
    Declare Function ChangeDisplaySettings Lib "user32" Alias "ChangeDisplaySettingsA" (lpDevMode As Any, ByVal dwFlags As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.5(1) or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · lpDevMode
    Pointer to a DEVMODE structure that describes the graphics mode to switch to. The dmSize member must be initialized to the size, in bytes, of the DEVMODE structure. The following fields in the DEVMODE structure are used:
    dmBitsPerPel
    Bits per pixel
    dmPelsWidth
    Pixel width
    dmPelsHeight
    Pixel height
    dmDisplayFlags
    Mode flags
    dmDisplayFrequency
    Mode frequency

    In addition to setting a value in one or more of the preceding DEVMODE members, you must also set the appropriate flags in the dmFields member. The flags indicate which members of the DEVMODE structure are used for the display settings change. If the appropriate bit is not set in dmFields, the display setting will not be changed. Set one or more of the following flags:
    DM_BITSPERPEL
    Use the dmBitsPerPel value.
    DM_PELSWIDTH
    Use the dmPelsWidth value.
    DM_PELSHEIGHT
    Use the dmPelsHeight value.
    DM_DISPLAYFLAGS
    Use the dmDisplayFlags value.
    DM_DISPLAYFREQENCY
    Use the dmDisplayFrequency value.

    If lpDevMode is NULL, all the values currently in the registry will be used for the display setting. Passing NULL for the lpDevMode parameter is the easiest way to return to the default mode after a dynamic mode change.

    · dwflags
    Indicates how the graphics mode should be changed. May be one of the following:
    0
    The graphics mode for the current screen will be changed dynamically.
    CDS_UPDATEREGISTRY
    The graphics mode for the current screen will be changed dynamically and the graphics mode will be updated in the registry. The mode information is stored in the USER profile.
    CDS_TEST
    The system tests if the requested graphics mode could be set.

    If CDS_UPDATEREGISTRY is specified and it is possible to change the graphics mode dynamically, the information is stored in the registry and DISP_CHANGE_SUCCESSFUL is returned. If it is not possible to change the graphics mode dynamically, the information is stored in the registry and DISP_CHANGE_RESTART is returned.
    Windows NT: If the information could not be stored in the registry, the graphics mode is not changed and DISP_CHANGE_NOTUPDATED is returned.
    Specifying CDS_TEST allows an application to determine which graphics modes are actually valid, without causing the system to change to that graphics mode.

    Return Values
    The ChangeDisplaySettings function returns one of the following values.

    DISP_CHANGE_SUCCESSFUL The settings change was successful.
    DISP_CHANGE_RESTART The computer must be restarted in order for the graphics mode to work.
    DISP_CHANGE_BADFLAGS An invalid set of flags was passed in.
    DISP_CHANGE_BADPARAM An invalid parameter was passed in. This can include an invalid flag or combination of flags.
    DISP_CHANGE_FAILED The display driver failed the specified graphics mode.
    DISP_CHANGE_BADMODE The graphics mode is not supported.
    DISP_CHANGE_NOTUPDATED Windows NT/2000: Unable to write settings to the registry.
    Friday, June 8, 2007 5:16 PM
  • ChangeDisplaySettingsEx

    The ChangeDisplaySettingsEx function changes the settings of the display device specified in the lpszDeviceName parameter to the graphics mode specified in the lpDevMode parameter.

    VB4-32,5,6
    Declare Function ChangeDisplaySettingsEx Lib "user32" Alias "ChangeDisplaySettingsExA" (lpszDeviceName As Any, lpDevMode As Any, ByVal hWnd As Long, ByVal dwFlags As Long, lParam As Any) As Long

    Operating Systems Supported
    Requires Windows 2000 or later; Requires Windows 98 or later

    Library
    User32

    Parameter Information
    · lpszDeviceName
    [in] Pointer to a null-terminated string that specifies the display device whose graphics mode the function will obtain information about. Only display device names as returned by EnumDisplayDevices are valid. See EnumDisplayDevices for further information on the names associated with these display devices.
    The lpszDeviceName parameter can be NULL. A NULL value specifies the default display device. The default device can be determined by calling EnumDisplayDevices and checking for the DISPLAY_DEVICE_PRIMARY_DEVICE flag.

    · lpDevMode
    [in] Pointer to a DEVMODE structure that describes the new graphics mode. If lpDevMode is NULL, all the values currently in the registry will be used for the display setting. Passing NULL for the lpDevMode parameter and 0 for the dwFlags parameter is the easiest way to return to the default mode after a dynamic mode change.
    The dmSize member must be initialized to the size, in bytes, of the DEVMODE structure. The dmDriverExtra member must be initialized to indicate the number of bytes of private driver data following the DEVMODE structure. In addition, you can use any of the following members of the DEVMODE structure.
    dmBitsPerPel
    Bits per pixel
    dmPelsWidth
    Pixel width
    dmPelsHeight
    Pixel height
    dmDisplayFlags
    Mode flags
    dmDisplayFrequency
    Mode frequency
    dmPosition
    Windows 98, Windows 2000: Position of the device in a multi-monitor configuration.

    In addition to using one or more of the preceding DEVMODE members, you must also set one or more of the following values in the dmFields member to change the display settings.
    DM_BITSPERPEL
    Use the dmBitsPerPel value.
    DM_PELSWIDTH
    Use the dmPelsWidth value.
    DM_PELSHEIGHT
    Use the dmPelsHeight value.
    DM_DISPLAYFLAGS
    Use the dmDisplayFlags value.
    DM_DISPLAYFREQUENCY
    Use the dmDisplayFrequency value.
    DM_POSITION
    Windows 98, Windows 2000: Use the dmPosition value.

    · hwnd
    Reserved; must be NULL.

    · dwflags
    [in] Indicates how the graphics mode should be changed. This parameter can be one of the following values.
    0
    The graphics mode for the current screen will be changed dynamically.
    CDS_FULLSCREEN
    The mode is temporary in nature.
    Windows NT/2000: If you change to and from another desktop, this mode will not be reset.
    CDS_GLOBAL
    The settings will be saved in the global settings area so that they will affect all users on the machine. Otherwise, only the settings for the user are modified. This flag is only valid when specified with the CDS_UPDATEREGISTRY flag.
    CDS_NORESET
    The settings will be saved in the registry, but will not take effect. This flag is only valid when specified with the CDS_UPDATEREGISTRY flag.
    CDS_RESET
    The settings should be changed, even if the requested settings are the same as the current settings.
    CDS_SET_PRIMARY
    This device will become the primary device.
    CDS_TEST
    The system tests if the requested graphics mode could be set.
    CDS_UPDATEREGISTRY
    The graphics mode for the current screen will be changed dynamically and the graphics mode will be updated in the registry. The mode information is stored in the USER profile.
    CDS_VIDEOPARAMETERS
    Windows NT/2000: When set, the lParam parameter is a pointer to a VIDEOPARAMETERS structure.

    Specifying CDS_TEST allows an application to determine which graphics modes are actually valid, without causing the system to change to them.

    If CDS_UPDATEREGISTRY is specified and it is possible to change the graphics mode dynamically, the information is stored in the registry and DISP_CHANGE_SUCCESSFUL is returned. If it is not possible to change the graphics mode dynamically, the information is stored in the registry and DISP_CHANGE_RESTART is returned.

    Windows NT/2000: If CDS_UPDATEREGISTRY is specified and the information could not be stored in the registry, the graphics mode is not changed and DISP_CHANGE_NOTUPDATED is returned.

    · lParam
    Windows NT/2000: [in] If dwFlags is CDS_VIDEOPARAMETERS, lParam is a pointer to a VIDEOPARAMETERS structure. Otherwise lParam must be NULL.

    Return Values
    The ChangeDisplaySettingsEx function returns one of the following values.

    DISP_CHANGE_BADFLAGS An invalid set of flags was passed in.
    DISP_CHANGE_BADMODE The graphics mode is not supported.
    DISP_CHANGE_BADPARAM An invalid parameter was passed in. This can include an invalid flag or combination of flags.
    DISP_CHANGE_FAILED The display driver failed the specified graphics mode.
    DISP_CHANGE_NOTUPDATED Windows NT/2000: Unable to write settings to the registry.
    DISP_CHANGE_RESTART The computer must be restarted for the graphics mode to work.
    DISP_CHANGE_SUCCESSFUL The settings change was successful.
    Friday, June 8, 2007 5:16 PM
  • CharLower

    The CharLower function converts a character string or a single character to lowercase. If the operand is a character string, the function converts the characters in place. This function supersedes the AnsiLower function.

    VB4-32,5,6
    Declare Function CharLower Lib "user32" Alias "CharLowerA" (ByVal lpsz As String) As String

    VB.NET
    System.String.ToLower

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · lpsz
    Pointer to a null-terminated string or specifies a single character. If the high-order word of this parameter is zero, the low-order word must contain a single character to be converted.

    Return Values
    If the operand is a character string, the function returns a pointer to the converted string. Since the string is converted in place, the return value is equal to lpsz.

    If the operand is a single character, the return value is a 32-bit value whose high-order word is zero, and low-order word contains the converted character.

    There is no indication of success or failure. Failure is rare.
    Friday, June 8, 2007 5:17 PM
  • CharLowerBuff

    The CharLowerBuff function converts uppercase characters in a buffer to lowercase characters. The function converts the characters in place. The function supersedes the AnsiLowerBuff function.

    VB4-32,5,6
    Declare Function CharLowerBuff Lib "user32" Alias "CharLowerBuffA" (ByVal lpsz As String, ByVal cchLength As Long) As Long

    VB.NET
    System.String.ToLower

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · lpsz
    Pointer to a buffer containing one or more characters to process.

    · cchLength
    Specifies the size, in bytes (ANSI version) or characters (Unicode version), of the buffer pointed to by lpsz.
    The function examines each character, and converts uppercase characters to lowercase characters. The function examines the number of bytes or characters indicated by cchLength, even if one or more characters are null characters.

    Return Values
    If the function succeeds, the return value is the number of bytes (ANSI version) or characters (Unicode version) processed.

    For example, if CharLowerBuff("Acme of Operating Systems", 10) succeeds, the return value is 10.
    Friday, June 8, 2007 5:17 PM
  • CharUpper

    The CharUpper function converts a character string or a single character to uppercase. If the operand is a character string, the function converts the characters in place. This function supersedes the AnsiUpper function.

    VB4-32,5,6
    Declare Function CharUpper Lib "user32" Alias "CharUpperA" (ByVal lpsz As String) As String

    VB.NET
    System.String.ToUpper

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · lpsz
    Pointer to a null-terminated string or specifies a single character. If the high-order word of this parameter is zero, the low-order word must contain a single character to be converted.

    Return Values
    If the operand is a character string, the function returns a pointer to the converted string. Since the string is converted in place, the return value is equal to lpsz.

    If the operand is a single character, the return value is a 32-bit value whose high-order word is zero, and low-order word contains the converted character.

    There is no indication of success or failure. Failure is rare.
    Friday, June 8, 2007 5:18 PM
  • CheckMenuRadioItem

    The CheckMenuRadioItem function checks a specified menu item and makes it a radio item. At the same time, the function clears all other menu items in the associated group and clears the radio-item type flag for those items.

    VB4-32,5,6
    Declare Function CheckMenuRadioItem Lib "user32" (ByVal hMenu As Long, ByVal un1 As Long, ByVal un2 As Long, ByVal un3 As Long, ByVal un4 As Long) As Long

    VB.NET
    System.Windows.Forms.MenuItem.RadioCheck

    Operating Systems Supported
    Requires Windows NT 4.0 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hmenu
    [in] Handle to the menu that contains the group of menu items.

    · idFirst
    [in] Identifier or position of the first menu item in the group.

    · idLast
    [in] Identifier or position of the last menu item in the group.

    · idCheck
    [in] Identifier or position of the menu item to check.

    · uFlags
    [in] Value specifying the meaning of idFirst, idLast, and idCheck. If this parameter is MF_BYCOMMAND, the other parameters specify menu item identifiers. If it is MF_BYPOSITION, the other parameters specify the menu item positions.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, use the GetLastError function.
    Friday, June 8, 2007 5:18 PM
  • CHOOSECOLOR

    The ChooseColor function creates a Color common dialog box that enables the user to select a color.

    VB4-32,5,6
    Declare Function ChooseColor Lib "comdlg32.dll" Alias "ChooseColorA" (pChoosecolor As CHOOSECOLOR) As Long

    VB.NET
    System.Windows.ColorDialog.RunDialog

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Comdlg32

    Parameter Information
    · lpcc
    Pointer to a CHOOSECOLOR structure that contains information used to initialize the dialog box. When ChooseColor returns, this structure contains information about the user’s color selection.

    Return Values
    If the user clicks the OK button of the dialog box, the return value is nonzero. The rgbResult member of the CHOOSECOLOR structure contains the RGB color value of the color selected by the user.

    If the user cancels or closes the Color dialog box or an error occurs, the return value is zero. To get extended error information, call the CommDlgExtendedError function, which can return one of the following values:
    CDERR_FINDRESFAILURE, CDERR_MEMLOCKFAILURE, CDERR_INITIALIZATION, CDERR_NOHINSTANCE, CDERR_LOCKRESFAILURE, CDERR_NOHOOK, CDERR_LOADRESFAILURE, CDERR_NOTEMPLATE, CDERR_LOADSTRFAILURE, CDERR_STRUCTSIZE, CDERR_MEMALLOCFAILURE
    Friday, June 8, 2007 5:18 PM
  • CHOOSEFONT

    The ChooseFont function creates a Font common dialog box that enables the user to choose attributes for a logical font. These attributes include a typeface name, style (bold, italic, or regular), point size, effects (underline, strikeout, and text color), and a script (or character set).

    VB4-32,5,6
    Declare Function ChooseFont Lib "comdlg32.dll" Alias "ChooseFontA" (pChoosefont As CHOOSEFONT) As Long

    VB.NET
    System.Windows.FontDialog.RunDialog

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Comdlg32

    Parameter Information
    · lpcf
    Pointer to a CHOOSEFONT structure that contains information used to initialize the dialog box. When ChooseFont returns, this structure contains information about the user’s font selection.

    Return Values
    If the user clicks the OK button of the dialog box, the return value is nonzero. The members of the CHOOSEFONT structure indicate the user’s selections.

    If the user cancels or closes the Font dialog box or an error occurs, the return value is zero. To get extended error information, call the CommDlgExtendedError function, which can return one of the following values:
    CDERR_FINDRESFAILURE, CDERR_NOHINSTANCE, CDERR_INITIALIZATION, CDERR_NOHOOK, CDERR_LOCKRESFAILURE, CDERR_NOTEMPLATE, CDERR_LOADRESFAILURE, CDERR_STRUCTSIZE, CDERR_LOADSTRFAILURE, CFERR_MAXLESSTHANMIN, CDERR_MEMALLOCFAILURE, CFERR_NOFONTS, CDERR_MEMLOCKFAILURE
    Friday, June 8, 2007 5:19 PM
  • Chord

    The Chord function draws a chord (a region bounded by the intersection of an ellipse and a line segment, called a "secant"). The chord is outlined by using the current pen and filled by using the current brush.

    VB4-32,5,6
    Declare Function Chord Lib "gdi32" Alias "Chord" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long, ByVal X4 As Long, ByVal Y4 As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Gdi32

    Parameter Information
    · hdc
    Identifies the device context in which the chord appears.

    · nLeftRect
    Specifies the x-coordinate of the upper-left corner of the bounding rectangle.

    · nTopRect
    Specifies the y-coordinate of the upper-left corner of the bounding rectangle.

    · nRightRect
    Specifies the x-coordinate of the lower-right corner of the bounding rectangle.

    · nBottomRect
    Specifies the y-coordinate of the lower-right corner of the bounding rectangle.

    · nXRadial1
    Specifies the x-coordinate of the endpoint of the radial defining the beginning of the chord.

    · nYRadial1
    Specifies the y-coordinate of the endpoint of the radial defining the beginning of the chord.

    · nXRadial2
    Specifies the x-coordinate of the endpoint of the radial defining the end of the chord.

    · nYRadial2
    Specifies the y-coordinate of the endpoint of the radial defining the end of the chord.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Friday, June 8, 2007 5:19 PM
  • ClearEventLog

    The ClearEventLog function clears the specified event log, and optionally saves the current copy of the logfile to a backup file.

    VB4-32,5,6
    Declare Function ClearEventLog Lib "advapi32.dll" Alias "ClearEventLogA" (ByVal hEventLog As Long, ByVal lpBackupFileName As String) As Long

    VB.NET
    System.Diagnostics.EventLog.Clear

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Win9x/ME: Not supported

    Library
    Advapi32

    Parameter Information
    · hEventLog
    [in] Handle to the event log to be cleared. This handle is returned by the OpenEventLog function.

    · lpBackupFileName
    [in] Pointer to the null-terminated string specifying the name of a file in which a current copy of the event logfile will be placed. If this file already exists, the function fails.
    If the lpBackupFileName parameter is NULL, the current event logfile is not backed up.

    Return Values
    If the function succeeds, the return value is nonzero. The specified event log has been backed up (if lpBackupFileName is not NULL) and then cleared.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Friday, June 8, 2007 5:19 PM
  • ClientToScreen

    The ClientToScreen function converts the client coordinates of a specified point to screen coordinates.

    VB4-32,5,6
    Declare Function ClientToScreen Lib "user32" Alias "ClientToScreen" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hWnd
    Identifies the window whose client area is used for the conversion.

    · lpPoint
    Points to a POINT structure that contains the client coordinates to be converted. The new screen coordinates are copied into this structure if the function succeeds.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Friday, June 8, 2007 5:20 PM
  • ClipCursor

    The ClipCursor function confines the cursor to a rectangular area on the screen.

    VB4-32,5,6
    Declare Function ClipCursor Lib "user32" Alias "ClipCursor" (lpRect As Any) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · lprc
    Points to the RECT structure that contains the screen coordinates of the upper-left and lower-right corners of the confining rectangle. If this parameter is NULL, the cursor is free to move anywhere on the screen.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Friday, June 8, 2007 5:20 PM
  • CloseClipboard

    The CloseClipboard function closes the clipboard.

    VB4-32,5,6
    Declare Function CloseClipboard Lib "user32" Alias "CloseClipboard" () As Long

    VB.NET
    N/A; See System.Windows.Forms.Clipboard for details

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Friday, June 8, 2007 5:20 PM
  • CloseEventLog

    The CloseEventLog function closes a read handle to the specified event log.

    VB4-32,5,6
    Declare Function CloseEventLog Lib "advapi32.dll" (ByVal hEventLog As Long) As Long

    VB.NET
    System.Diagnostics.EventLog.Close

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Win9x/ME: Not supported

    Library
    Advapi32

    Parameter Information
    · hEventLog
    [in/out] Handle to the event log to be closed. This handle is returned by the OpenEventLog or OpenBackupEventLog function.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Friday, June 8, 2007 5:21 PM
  • CloseHandle

    The CloseHandle function closes an open object handle.

    VB4-32,5,6
    Declare Function CloseHandle Lib "kernel32" Alias "CloseHandle" (ByVal hObject As Long) As Long

    VB.NET
    N/A; Usually ClassName.Close()

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Kernel32

    Parameter Information
    · hObject
    Identifies an open object handle.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Friday, June 8, 2007 5:21 PM
  • ClosePrinter

    The ClosePrinter function closes the specified printer object.

    VB4-32,5,6
    Declare Function ClosePrinter Lib "winspool.drv" (ByVal hPrinter As Long) As Long

    VB.NET
    N/A; See System.Drawing.Printing.* for details

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winspool

    Parameter Information
    · hPrinter
    [in] Handle to the printer object to be closed. This handle is returned by the OpenPrinter or AddPrinter function.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Friday, June 8, 2007 5:21 PM
  • CloseServiceHandle

    The CloseServiceHandle function closes the following types of handles:· handle to a service control manager object as returned by the OpenSCManager function· handle to a service object as returned by either the OpenService or CreateService function

    VB4-32,5,6
    Declare Function CloseServiceHandle Lib "advapi32.dll" (ByVal hSCObject As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Win9x/ME: Not supported

    Library
    Advapi32

    Parameter Information
    · hSCObject
    [in] Handle to the service control manager object or the service object to close.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Friday, June 8, 2007 5:22 PM
  • closesocket

    The Windows Sockets closesocket function closes an existing socket.

    VB4-32,5,6
    Declare Function closesocket Lib "wsock32.dll" (ByVal s As Long) As Long

    VB.NET
    System.Net.Sockets.Socket.Close

    Operating Systems Supported
    Requires Windows Sockets 1.1

    Library
    Wsock32.dll

    Parameter Information
    · s
    [in] A descriptor identifying a socket to close.

    Return Values
    If no error occurs, closesocket returns zero. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError.
    Friday, June 8, 2007 5:22 PM
  • CloseWindow

    The CloseWindow function minimizes (but does not destroy) the specified window.

    VB4-32,5,6
    Declare Function CloseWindow Lib "user32" Alias "CloseWindow" (ByVal hwnd As Long) As Long

    VB.NET
    System.Windows.Forms.Form.Close

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hWnd
    Identifies the window to be minimized.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Friday, June 8, 2007 5:22 PM
  • CoCreateGuid

    Creates a GUID, a unique 128-bit integer used for CLSIDs and interface identifiers.

    VB4-32,5,6
    Declare Function CoCreateGuid Lib "ole32" (id As Any) As Long

    VB.NET
    System.Guid

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Ole32

    Parameter Information
    · pguid
    [out] Pointer to the requested GUID on return.

    Return Values
    · S_OK
    The GUID was successfully created.
    Friday, June 8, 2007 5:23 PM
  • CombineRgn

    The CombineRgn function combines two regions and stores the result in a third region. The two regions are combined according to the specified mode.

    VB4-32,5,6
    Declare Function CombineRgn Lib "gdi32" Alias "CombineRgn" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long

    VB.NET
    System.Drawing.Region

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Gdi32

    Parameter Information
    · hrgnDest
    Identifies a new region with dimensions defined by combining two other regions. (This region must exist before CombineRgn is called.)

    · hrgnSrc1
    Identifies the first of two regions to be combined.

    · hrgnSrc2
    Identifies the second of two regions to be combined.

    · fnCombineMode
    Specifies a mode indicating how the two regions will be combined. This parameter can be one of the following values:
    RGN_AND
    Creates the intersection of the two combined regions.
    RGN_COPY
    Creates a copy of the region identified by hrgnSrc1.
    RGN_DIFF
    Combines the parts of hrgnSrc1 that are not part of hrgnSrc2.
    RGN_OR
    Creates the union of two combined regions.
    RGN_XOR
    Creates the union of two combined regions except for any overlapping areas.

    Return Values
    The return value specifies the type of the resulting region. It can be one of the following values:
    NULLREGION
    The region is empty.

    SIMPLEREGION
    The region is a single rectangle.

    COMPLEXREGION
    The region is more than a single rectangle.

    ERROR
    No region is created.
    Friday, June 8, 2007 5:23 PM
  • CommDlgExtendedError

    The CommDlgExtendedError function returns a common dialog box error code.

    VB4-32,5,6
    Declare Function CommDlgExtendedError Lib "comdlg32.dll" Alias "CommDlgExtendedError" () As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Comdlg32

    Return Values
    If the most recent call to a common dialog box function succeeded, the return value is undefined.

    If the common dialog box function returned FALSE because the user closed or canceled the dialog box, the return value is zero. Otherwise, the return value is a nonzero error code. For more information, see the following Remarks section.
    Friday, June 8, 2007 5:24 PM
  • CompareFileTime

    The CompareFileTime function compares two 64-bit file times.

    VB4-32,5,6
    Declare Function CompareFileTime Lib "kernel32" (lpFileTime1 As FILETIME, lpFileTime2 As FILETIME) As Long

    VB.NET
    System.DateTime.Compare

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Kernel32

    Parameter Information
    · lpFileTime1
    Points to a FILETIME structure that specifies the first 64-bit file time.

    · lpFileTime2
    Points to a FILETIME structure that specifies the second 64-bit file time.

    Return Values
    If the function succeeds, the return value is one of the following values:
    -1
    First file time is less than second file time.

    0
    First file time is equal to second file time.

    +1
    First file time is greater than second file time.
    Friday, June 8, 2007 5:24 PM
  • CompareString

    The CompareString function compares two character strings, using the locale specified by the given identifier as the basis for the comparison.

    VB4-32,5,6
    Declare Function CompareString Lib "kernel32" Alias "CompareStringA" (ByVal Locale As Long, ByVal dwCmpFlags As Long, ByVal lpString1 As String, ByVal cchCount1 As Long, ByVal lpString2 As String, ByVal cchCount2 As Long) As Long

    VB.NET
    System.String.Compare

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Kernel32

    Parameter Information
    · Locale
    Specifies the locale used for the comparison. This parameter can be one of the following predefined locale identifiers:
    LOCALE_SYSTEM_DEFAULT
    The system’s default locale.
    LOCALE_USER_DEFAULT
    The current user’s default locale.
    This parameter can also be a locale identifier created by the MAKELCID macro.

    · dwCmpFlags
    A set of flags that indicate how the function compares the two strings. By default, these flags are not set. This parameter can specify zero to get the default behavior, or it can be any combination of the following values:
    NORM_IGNORECASE
    Ignore case.
    NORM_IGNOREKANATYPE
    Do not differentiate between Hiragana and Katakana characters. Corresponding Hiragana and Katakana characters compare as equal.
    NORM_IGNORENONSPACE
    Ignore nonspacing characters.
    NORM_IGNORESYMBOLS
    Ignore symbols.
    NORM_IGNOREWIDTH
    Do not differentiate between a single-byte character and the same character as a double-byte character.
    SORT_STRINGSORT
    Treat punctuation the same as symbols.

    · lpString1
    Points to the first string to be compared.

    · cchCount1
    Specifies the size, in bytes (ANSI version) or characters (Unicode version), of the string pointed to by the lpString1 parameter. If this parameter is - 1, the string is assumed to be null terminated and the length is calculated automatically.

    · lpString2
    Points to the second string to be compared.

    · cchCount2
    Specifies the size, in bytes (ANSI version) or characters (Unicode version), of the string pointed to by the lpString2 parameter. If this parameter is - 1, the string is assumed to be null terminated and the length is calculated automatically.

    Return Values
    If the function succeeds, the return value is one of the following values:
    CSTR_LESS_THAN
    The string pointed to by the lpString1 parameter is less in lexical value than the string pointed to by the lpString2 parameter.

    CSTR_EQUAL
    The string pointed to by lpString1 is equal in lexical value to the string pointed to by lpString2.

    CSTR_GREATER_THAN
    The string pointed to by lpString1 is greater in lexical value than the string pointed to by lpString2.



    If the function fails, the return value is zero. To get extended error information, call GetLastError. GetLastError may return one of the following error codes: ERROR_INVALID_FLAGS

    ERROR_INVALID_PARAMETER
    Friday, June 8, 2007 5:24 PM
  • ConfigurePort

    The ConfigurePort function displays the port-configuration dialog box for a port on the specified server.

    VB4-32,5,6
    Declare Function ConfigurePort Lib "winspool.drv" Alias "ConfigurePortA" (ByVal pName As String, ByVal hwnd As Long, ByVal pPortName As String) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winspool.drv

    Parameter Information
    · pName
    Points to a null-terminated string that specifies the name of the server on which the specified port exists. If this parameter is NULL, the port is local.

    · hWnd
    Identifies the parent window of the port-configuration dialog box.

    · pPortName
    Points to a null-terminated string that specifies the name of the port to be configured.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Friday, June 8, 2007 5:25 PM
  • Connect

    The Windows Sockets connect function establishes a connection to a specifed socket.

    VB4-32,5,6
    Declare Function Connect Lib "wsock32.dll" Alias "connect" (ByVal s As Long, addr As sockaddr, ByVal namelen As Long) As Long

    VB.NET
    System.Net.Sockets.Socket.Connect

    Operating Systems Supported
    Requires Windows Sockets 1.1

    Library
    Wsock32.dll

    Parameter Information
    · s
    [in] A descriptor identifying an unconnected socket.

    · name
    [in] The name of the socket to connect to.

    · namelen
    [in] The length of the name parameter.

    Return Values
    If no error occurs, connect returns zero. Otherwise, it returns SOCKET_ERROR, and a specific error code can be retrieved by calling WSAGetLastError.

    On a blocking socket, the return value indicates success or failure of the connection attempt.

    With a nonblocking socket, the connection attempt cannot be completed immediately. In this case, connect will return SOCKET_ERROR, and WSAGetLastError will return WSAEWOULDBLOCK. In this case, there are three different steps you can take:

    1. Use the select function to determine the completion of the connection request by checking to see if the socket is writeable.

    2. If the application is using WSAAsyncSelect to indicate interest in connection events, then the application will receive an FD_CONNECT notification indicating that the connect operation is complete.

    3. If the application is using WSAEventSelect to indicate interest in connection events, then the associated event object will be signaled indicating that the connect operation is complete.

    Until the connection attempt completes on a nonblocking socket, all subsequent calls to connect on the same socket will fail with the error code WSAEALREADY.

    If the error code returned indicates the connection attempt failed (that is, WSAECONNREFUSED, WSAENETUNREACH, WSAETIMEDOUT) the application can call connect again for the same socket.
    Friday, June 8, 2007 5:25 PM
  • CopyFile

    The CopyFile function copies an existing file to a new file.

    VB4-32,5,6
    Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long

    VB.NET
    System.IO.File.Copy

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Kernel32

    Parameter Information
    · lpExistingFileName
    Points to a null-terminated string that specifies the name of an existing file.

    · lpNewFileName
    Points to a null-terminated string that specifies the name of the new file.

    · bFailIfExists
    Specifies how this operation is to proceed if a file of the same name as that specified by lpNewFileName already exists. If this parameter is TRUE and the new file already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Friday, June 8, 2007 5:25 PM
  • CopyFileEx

    The CopyFileEx function copies an existing file to a new file. This function preserves extended attributes, OLE structured storage, NTFS alternate data streams, and file attributes. Security attributes for the existing file are not copied to the new file.

    VB4-32,5,6
    Declare Function CopyFileEx Lib "kernel32.dll" Alias "CopyFileExA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal lpProgressRoutine As Long, lpData As Any, ByRef pbCancel As Long, ByVal dwCopyFlags As Long) As Long

    VB.NET
    System.IO.File.Copy

    Operating Systems Supported
    Requires Windows NT 4.0 or later; Win9x/ME: Not supported

    Library
    Kernel32

    Parameter Information
    · lpExistingFileName
    Points to a null-terminated string that specifies the name of an existing file.

    · lpNewFileName
    Points to a null-terminated string that specifies the name of the new file.

    · lpProgressRoutine
    Specifies the address of a callback function of type LPPROGRESS_ROUTINE that is called each time another portion of the file has been copied. This parameter can be NULL. For more information on the progress callback function, see CopyProgressRoutine.

    · lpData
    Specifies an argument to be passed to the callback function. This parameter can be NULL.

    · pbCancel
    Points to a Boolean variable that can be used to cancel the operation. If this flag is set to TRUE during the copy operation, the operation is canceled.

    · dwCopyFlags
    Specifies how the file is to be copied. This parameter can be a combination of the following values:
    COPY_FILE_FAIL_IF_EXISTS
    The copy operation fails immediately if the target file already exists.
    COPY_FILE_RESTARTABLE
    Progress of the copy is tracked in the target file in case the copy fails. The failed copy can be restarted at a later time by specifying the same values for lpExistingFileName and lpNewFileName as those used in the call that failed.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Friday, June 8, 2007 5:26 PM
  • CopyIcon

    The CopyIcon function copies the specified icon from another module to the current module.

    VB4-32,5,6
    Declare Function CopyIcon Lib "user32" (ByVal hIcon As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hIcon
    [in] Handle to the icon to be copied.

    Return Values
    If the function succeeds, the return value is a handle to the duplicate icon.

    If the function fails, the return value is NULL. To get extended error information, call GetLastError.
    Friday, June 8, 2007 5:26 PM
  • CopyImage

    The CopyImage function creates a new image (icon, cursor, or bitmap) and copies the attributes of the specified image to the new one. If necessary, the function stretches the bits to fit the desired size of the new image.

    VB4-32,5,6
    Declare Function CopyImage Lib "user32" (ByVal handle As Long, ByVal imageType As Long, ByVal newWidth As Long, ByVal newHeight As Long, ByVal lFlags As Long) As Long

    VB.NET
    System.Drawing.Image.Close

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hinst
    Identifies an instance of the module that contains the image to be copied.

    · uType
    Specifies the type of image to be copied. This parameter can be one of the following values:
    IMAGE_BITMAP
    Copies a bitmap.
    IMAGE_CURSOR
    Copies a cursor.
    IMAGE_ICON
    Copies an icon.

    · cxDesired
    Specifies the desired width, in pixels, of the image.

    · cyDesired
    Specifies the desired height, in pixels, of the image.

    · fuFlags
    Specifies a combination of the following values:
    LR_COPYDELETEORG
    Deletes the original image after creating the copy.
    LR_COPYRETURNORG
    Creates an exact copy of the image, ignoring the cxDesired and cyDesired parameters.
    LR_MONOCHROME
    Creates a new monochrome image.
    LR_COPYFROMRESOURCE
    Tries to reload an icon or cursor resource from the original resource file rather than simply copying the current image. This is useful for creating a different-sized copy when the resource file contains multiple sizes of the resource. Without this flag, CopyImage stretches the original image to the new size. If this flag is set, CopyImage uses the size in the resource file closest to the desired size.

    This will succeed only if hImage was loaded by LoadIcon or LoadCursor, or by LoadImage with the LR_SHARED flag.

    Return Values
    If the function succeeds, the return value is the handle to the newly created image.

    If the function fails, the return value is NULL. To get extended error information, call GetLastError.
    Friday, June 8, 2007 5:26 PM
  • CopyMemory

    The CopyMemory function copies a block of memory from one location to another.

    VB4-32,5,6
    Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)

    VB.NET
    N/A

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Kernel32

    Parameter Information
    · Destination
    Points to the starting address of the copied block’s destination.

    · Source
    Points to the starting address of the block of memory to copy.

    · Length
    Specifies the size, in bytes, of the block of memory to copy.

    Return Values
    This function has no return value.
    Friday, June 8, 2007 5:27 PM
  • CopyRect

    The CopyRect function copies the coordinates of one rectangle to another.

    VB4-32,5,6
    Declare Function CopyRect Lib "user32" Alias "CopyRect" (lpDestRect As RECT, lpSourceRect As RECT) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · lprcDst
    Points to the RECT structure that will receive the logical coordinates of the source rectangle.

    · lprcSrc
    Points to the RECT structure whose coordinates are to be copied.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Friday, June 8, 2007 5:28 PM
  • CreateBitmap

    The CreateBitmap function creates a bitmap with the specified width, height, and color format (color planes and bits per pixel).

    VB4-32,5,6
    Declare Function CreateBitmap Lib "gdi32" Alias "CreateBitmap" (ByVal nWidth As Long, ByVal nHeight As Long, ByVal nPlanes As Long, ByVal nBitCount As Long, lpBits As Any) As Long

    VB.NET
    System.Drawing.Bitmap

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Gdi32

    Parameter Information
    · nWidth
    Specifies the bitmap width, in pixels.

    · nHeight
    Specifies the bitmap height, in pixels.

    · cPlanes
    Specifies the number of color planes used by the device.

    · cBitsPerPel
    Specifies the number of bits required to identify the color of a single pixel.

    · lpvBits
    Points to an array of color data used to set the colors in a rectangle of pixels. Each scan line in the rectangle must be word aligned (scan lines that are not word aligned must be padded with zeros). If this parameter is NULL, the new bitmap is undefined.

    Return Values
    If the function succeeds, the return value is a handle to a bitmap.

    If the function fails, the return value is NULL.
    Friday, June 8, 2007 5:28 PM
  • CreateCompatibleDC

    The CreateCompatibleDC function creates a memory device context (DC) compatible with the specified device.

    VB4-32,5,6
    Declare Function CreateCompatibleDC Lib "gdi32" Alias "CreateCompatibleDC" (ByVal hdc As Long) As Long

    VB.NET
    System.Drawing.Graphics.FromHdc

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Gdi32

    Parameter Information
    · hdc
    Identifies the device context. If this handle is NULL, the function creates a memory device context compatible with the application’s current screen.

    Return Values
    If the function succeeds, the return value is the handle to a memory device context.

    If the function fails, the return value is NULL.
    Friday, June 8, 2007 5:28 PM
  • CreateCompatibleBitmap

    The CreateCompatibleBitmap function creates a bitmap compatible with the device that is associated with the specified device context.

    VB4-32,5,6
    Declare Function CreateCompatibleBitmap Lib "gdi32" Alias "CreateCompatibleBitmap" (ByVal hdc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long

    VB.NET
    System.Drawing.Bitmap

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Gdi32

    Parameter Information
    · hdc
    Identifies a device context.

    · nWidth
    Specifies the bitmap width, in pixels.

    · nHeight
    Specifies the bitmap height, in pixels.

    Return Values
    If the function succeeds, the return value is a handle to the bitmap.

    If the function fails, the return value is NULL.
    Friday, June 8, 2007 5:28 PM
  • CreateCursor

    The CreateCursor function creates a cursor having the specified size, bit patterns, and hot spot.

    VB4-32,5,6
    Declare Function CreateCursor Lib "user32" Alias "CreateCursor" (ByVal hInstance As Long, ByVal nXhotspot As Long, ByVal nYhotspot As Long, ByVal nWidth As Long, ByVal nHeight As Long, lpANDbitPlane As Any, lpXORbitPlane As Any) As Long

    VB.NET
    System.Windows.Forms.Cursor

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hInst
    Identifies the current instance of the application creating the cursor.

    · xHotSpot
    Specifies the horizontal position of the cursor’s hot spot.

    · yHotSpot
    Specifies the vertical position of the cursor’s hot spot.

    · nWidth
    Specifies the width, in pixels, of the cursor.

    · nHeight
    Specifies the height, in pixels, of the cursor.

    · pvANDplane
    Points to an array of bytes that contains the bit values for the AND bitmask of the cursor, as in a device-dependent monochrome bitmap.

    · pvXORplane
    Points to an array of bytes that contains the bit values for the XOR bitmask of the cursor, as in a device-dependent monochrome bitmap.

    Return Values
    If the function succeeds, the return value identifies the cursor.

    If the function fails, the return value is NULL. To get extended error information, call GetLastError.
    Friday, June 8, 2007 5:29 PM
  • CreateDC

    The CreateDC function creates a device context (DC) for a device by using the specified name.

    VB4-32,5,6
    Declare Function CreateDC Lib "gdi32" Alias "CreateDCA" (ByVal lpDriverName As String, ByVal lpDeviceName As String, ByVal lpOutput As String, lpInitData As DEVMODE) As Long

    VB.NET
    System.Drawing.Graphics

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Gdi32

    Parameter Information
    · lpszDriver
    Applications written for earlier versions of Windows used this parameter to specify the filename (without extension) of the device driver.
    Windows 95: In Win32-based applications, this parameter is ignored and should be NULL, with one exception: You may obtain a display device context by specifying the null-terminated string “DISPLAY”. If this parameter is “DISPLAY”, all other parameters must be NULL.
    Windows NT: Points to a null-terminated character string that specifies either “DISPLAY” for a display driver, or the name of a printer driver, which is usually “WINSPOOL”.

    · lpszDevice
    Points to a null-terminated character string that specifies the name of the specific output device being used, as shown by the Print Manager (for example, “Epson FX-80”). It is not the printer model name. The lpszDevice parameter must be used.

    · lpszOutput
    This parameter is ignored. Do not use it in a Win32 application. Win32-based applications should set this parameter to NULL. It exists to provide compatibility for applications written for earlier versions of Windows. For more information, see the following Remarks section.

    · lpInitData
    Points to a DEVMODE structure containing device-specific initialization data for the device driver. The DocumentProperties function retrieves this structure filled in for a specified device. The lpInitData parameter must be NULL if the device driver is to use the default initialization (if any) specified by the user.

    Return Values
    If the function succeeds, the return value is the handle to a device context for the specified device.

    If the function fails, the return value is NULL.
    Friday, June 8, 2007 5:29 PM
  • CreateDIBPatternBrushPt

    The CreateDIBPatternBrushPt function creates a logical brush that has the pattern specified by the device-independent bitmap (DIB).

    VB4-32,5,6
    Declare Function CreateDIBPatternBrushPt Lib "gdi32" Alias "CreateDIBPatternBrushPt" (lpPackedDIB As Any, ByVal iUsage As Long) As Long

    VB.NET
    System.Drawing.Brush

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Gdi32

    Parameter Information
    · lpPackedDIB
    Points to a packed DIB consisting of a BITMAPINFO structure immediately followed by an array of bytes defining the pixels of the bitmap.
    Windows 95: Creating brushes from bitmaps or DIBs larger than 8x8 pixels is not supported. If a larger bitmap is specified, only a portion of the bitmap is used.

    · iUsage
    Specifies whether the bmiColors member of the BITMAPINFO structure contains a valid color table and, if so, whether the entries in this color table contain explicit red, green, blue (RGB) values or palette indices. The iUsage parameter must be one of the following values:
    DIB_PAL_COLORS
    A color table is provided and consists of an array of 16-bit indices into the logical palette of the device context into which the brush is to be selected.
    DIB_RGB_COLORS
    A color table is provided and contains literal RGB values.

    Return Values
    If the function succeeds, the return value identifies a logical brush.

    If the function fails, the return value is NULL.
    Friday, June 8, 2007 5:29 PM
  • CreateDIBSection

    The CreateDIBSection function creates a device-independent bitmap (DIB) that applications can write to directly. The function gives you a pointer to the location of the bitmap’s bit values. You can supply a handle to a file mapping object that the function will use to create the bitmap, or you can let the operating system allocate the memory for the bitmap.

    VB4-32,5,6
    Declare Function CreateDIBSection Lib "gdi32" (ByVal hdc As Long, pBitmapInfo As BITMAPINFO, ByVal un As Long, ByVal lplpVoid As Long, ByVal handle As Long, ByVal dw As Long) As Long

    VB.NET
    System.Drawing.Bitmap

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Gdi32

    Parameter Information
    · hdc
    Handle to a device context. If the value of iUsage is DIB_PAL_COLORS, the function uses this device context’s logical palette to initialize the device-independent bitmap’s colors.

    · pbmi
    Points to a BITMAPINFO structure that specifies various attributes of the device-independent bitmap, including the bitmap’s dimensions and colors.

    · iUsage
    Specifies the type of data contained in the bmiColors array member of the BITMAPINFO structure pointed to by pbmi: logical palette indices or literal RGB values. The following values are defined:
    DIB_PAL_COLORS
    The bmiColors member is an array of 16-bit indices into the logical palette of the device context specified by hdc.
    DIB_RGB_COLORS
    The BITMAPINFO structure contains an array of literal RGB values.

    · ppvBits
    Points to a variable that receives a pointer to the location of the device-independent bitmap’s bit values.

    · hSection
    Handle to a file mapping object that the function will use to create the device-independent bitmap. This parameter can be NULL.
    If hSection is not NULL, it must be a handle to a file mapping object created by calling the CreateFileMapping function. Handles created by other means will cause CreateDIBSection to fail.
    If hSection is not NULL, the CreateDIBSection function locates the bitmap’s bit values at offset dwOffset in the file mapping object referred to by hSection. An application can later retrieve the hSection handle by calling the GetObject function with the HBITMAP returned by CreateDIBSection.
    If hSection is NULL, the operating system allocates memory for the device-independent bitmap. In this case, the CreateDIBSection function ignores the dwOffset parameter. An application cannot later obtain a handle to this memory: the dshSection member of the DIBSECTION structure filled in by calling the GetObject function will be NULL.

    · dwOffset
    Specifies the offset from the beginning of the file mapping object referenced by hSection where storage for the bitmap’s bit values is to begin. This value is ignored if hSection is NULL. The bitmap’s bit values are aligned on doubleword boundaries, so dwOffset must be a multiple of the size of a DWORD.

    Return Values
    If the function succeeds, the return value is a handle to the newly created device-independent bitmap, and *ppvBits points to the bitmap’s bit values.

    If the function fails, the return value is NULL, and *ppvBits is NULL. To get extended error information, call GetLastError.
    Friday, June 8, 2007 5:30 PM
  • CreateDirectory

    The CreateDirectory function creates a new directory. If the underlying file system supports security on files and directories, the function applies a specified security descriptor to the new directory. Note that CreateDirectory does not have a template parameter, while CreateDirectoryEx does.

    VB4-32,5,6
    Declare Function CreateDirectory Lib "kernel32" Alias "CreateDirectoryA" (ByVal lpPathName As String, lpSecurityAttributes As SECURITY_ATTRIBUTES) As Long

    VB.NET
    System.IO.Directory.CreateDirectory

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Kernel32

    Parameter Information
    · lpPathName
    Points to a null-terminated string that specifies the path of the directory to be created.
    There is a default string size limit for paths of MAX_PATH characters. This limit is related to how the CreateDirectory function parses paths.
    Windows NT: An application can transcend this limit and send in paths longer than MAX_PATH characters by calling the wide (W) version of CreateDirectory and prepending “\\?\” to the path. The “\\?\” tells the function to turn off path parsing; it lets paths longer than MAX_PATH be used with CreateDirectoryW. This also works with UNC names. The “\\?\” is ignored as part of the path. For example, “\\?\C:\myworld\private” is seen as “C:\myworld\private”, and “\\?\UNC\bill_g_1\hotstuff\coolapps” is seen as “\\bill_g_1\hotstuff\coolapps”.

    · lpSecurityAttributes
    Pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle can be inherited by child processes. If lpSecurityAttributes is NULL, the handle cannot be inherited.
    Windows NT: The lpSecurityDescriptor member of the structure specifies a security descriptor for the new directory. If lpSecurityAttributes is NULL, the directory gets a default security descriptor. The target file system must support security on files and directories for this parameter to have an effect.
    Windows 95: The lpSecurityDescriptor member of the structure is ignored.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Friday, June 8, 2007 5:30 PM
  • DdeConnect

    The DdeConnect function establishes a conversation with a server application that supports the specified service name and topic name pair. If more than one such server exists, the system selects only one.

    VB4-32,5,6
    Declare Function DdeConnect Lib "user32" Alias "DdeConnect" (ByVal idInst As Long, ByVal hszService As Long, ByVal hszTopic As Long, pCC As CONVCONTEXT) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · idInst
    Specifies the application instance identifier obtained by a previous call to the DdeInitialize function.

    · hszService
    Identifies the string that specifies the service name of the server application with which a conversation is to be established. This handle must have been created by a previous call to the DdeCreateStringHandle function. If this parameter is 0L, a conversation is established with any available server.

    · hszTopic
    Identifies the string that specifies the name of the topic on which a conversation is to be established. This handle must have been created by a previous call to DdeCreateStringHandle. If this parameter is 0L, a conversation on any topic supported by the selected server is established.

    · pCC
    Points to the CONVCONTEXT structure that contains conversation context information. If this parameter is NULL, the server receives the default CONVCONTEXT structure during the XTYP_CONNECT or XTYP_WILDCONNECT transaction.

    Return Values
    If the function succeeds, the return value is the handle to the established conversation.

    If the function fails, the return value is 0L.
    Saturday, June 9, 2007 4:43 PM
  • DecryptFile

    The DecryptFile function decrypts an encrypted file or directory.

    VB4-32,5,6
    Declare Function DecryptFile Lib "ADVAPI32" Alias "DecryptFileA" (ByVal lpFileName As String, ByVal dwReserved As Long) As Boolean

    Operating Systems Supported
    Requires Windows 2000 or later; Win9x/ME: Not supported

    Library
    Advapi32

    Parameter Information
    · lpFileName
    [in] Pointer to a null-terminated Unicode string that specifies the name of the file to decrypt.
    The caller must have FILE_READ_DATA, FILE_WRITE_DATA, FILE_READ_ATTRIBUTES, FILE_WRITE_ATTRIBUTES, and SYNCHRONIZE access to the file.

    · dwReserved
    Reserved; must be zero.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Saturday, June 9, 2007 4:43 PM
  • DeferWindowPos

    The DeferWindowPos function updates the specified multiple-window-position structure for the specified window. The function then returns a handle to the updated structure. The EndDeferWindowPos function uses the information in this structure to change the position and size of a number of windows simultaneously. The BeginDeferWindowPos function creates the structure.

    VB4-32,5,6
    Declare Function DeferWindowPos Lib "user32" Alias "DeferWindowPos" (ByVal hWinPosInfo As Long, ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hWinPosInfo
    Identifies a multiple-window - position structure that contains size and position information for one or more windows. This structure is returned by BeginDeferWindowPos or by the most recent call to DeferWindowPos.

    · hWnd
    Identifies the window for which update information is stored in the structure.

    · hWndInsertAfter
    Identifies the window that precedes the positioned window in the Z order. This parameter must be a window handle or one of the following values:
    HWND_BOTTOM
    Places the window at the bottom of the Z order. If the hWnd parameter identifies a topmost window, the window loses its topmost status and is placed at the bottom of all other windows.
    HWND_NOTOPMOST
    Places the window above all non-topmost windows (that is, behind all topmost windows). This flag has no effect if the window is already a non-topmost window.
    HWND_TOP
    Places the window at the top of the Z order.
    HWND_TOPMOST
    Places the window above all non-topmost windows. The window maintains its topmost position even when it is deactivated.

    This parameter is ignored if the SWP_NOZORDER flag is set in the uFlags parameter.

    · x
    Specifies the x-coordinate of the window’s upper-left corner.

    · y
    Specifies the y-coordinate of the window’s upper-left corner.

    · cx
    Specifies the window’s new width, in pixels.

    · cy
    Specifies the window’s new height, in pixels.

    · uFlags
    Specifies a combination of the following values that affect the size and position of the window:
    SWP_DRAWFRAME
    Draws a frame (defined in the window’s class description) around the window.
    SWP_FRAMECHANGED
    Sends a WM_NCCALCSIZE message to the window, even if the window’s size is not being changed. If this flag is not specified, WM_NCCALCSIZE is sent only when the window’s size is being changed.
    SWP_HIDEWINDOW
    Hides the window.
    SWP_NOACTIVATE
    Does not activate the window. If this flag is not set, the window is activated and moved to the top of either the topmost or non-topmost group (depending on the setting of the hWndInsertAfter parameter).
    SWP_NOCOPYBITS
    Discards the entire contents of the client area. If this flag is not specified, the valid contents of the client area are saved and copied back into the client area after the window is sized or repositioned.
    SWP_NOMOVE
    Retains the current position (ignores the X and Y parameters).
    SWP_NOOWNERZORDER
    Does not change the owner window’s position in the Z order.
    SWP_NOREDRAW
    Does not redraw changes. If this flag is set, no repainting of any kind occurs. This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of the window being moved. When this flag is set, the application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.
    SWP_NOREPOSITION
    Same as the SWP_NOOWNERZORDER flag.
    SWP_NOSENDCHANGING
    Prevents the window from receiving the WM_WINDOWPOSCHANGING message.
    SWP_NOSIZE
    Retains the current size (ignores the cx and cy parameters).
    SWP_NOZORDER
    Retains the current Z order (ignores the hWndInsertAfter parameter).
    SWP_SHOWWINDOW
    Displays the window.

    Return Values
    The return value identifies the updated multiple-window - position structure. The handle returned by this function may differ from the handle passed to the function. The new handle that this function returns should be passed during the next call to the DeferWindowPos or EndDeferWindowPos function.

    If insufficient system resources are available for the function to succeed, the return value is NULL.
    Saturday, June 9, 2007 4:44 PM
  • DefMDIChildProc

    The DefMDIChildProc function provides default processing for any window message that the window procedure of a multiple document interface (MDI) child window does not process. A window message not processed by the window procedure must be passed to the DefMDIChildProc function, not to the DefWindowProc function.

    VB4-32,5,6
    Declare Function DefMDIChildProc Lib "user32" Alias "DefMDIChildProcA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hWnd
    Identifies the MDI child window.

    · uMsg
    Specifies the message to be processed.

    · wParam
    Specifies additional message-specific information.

    · lParam
    Specifies additional message-specific information.

    Return Values
    The return value specifies the result of the message processing and depends on the message.
    Saturday, June 9, 2007 4:44 PM
  • DefWindowProc

    The DefWindowProc function calls the default window procedure to provide default processing for any window messages that an application does not process. This function ensures that every message is processed. DefWindowProc is called with the same parameters received by the window procedure.

    VB4-32,5,6
    Declare Function DefWindowProc Lib "user32" Alias "DefWindowProcA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hWnd
    Identifies the window procedure that received the message.

    · Msg
    Specifies the message.

    · wParam
    Specifies additional message information. The content of this parameter depends on the value of the Msg parameter.

    · lParam
    Specifies additional message information. The content of this parameter depends on the value of the Msg parameter.

    Return Values
    The return value is the result of the message processing and depends on the message.
    Saturday, June 9, 2007 4:44 PM
  • DeleteDC

    The DeleteDC function deletes the specified device context (DC).

    VB4-32,5,6
    Declare Function DeleteDC Lib "gdi32" Alias "DeleteDC" (ByVal hdc As Long) As Long

    VB.NET
    N/A

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Gdi32

    Parameter Information
    · hdc
    Identifies the device context.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Saturday, June 9, 2007 4:44 PM
  • DeleteFile

    The DeleteFile function deletes an existing file.

    VB4-32,5,6
    Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" (ByVal lpFileName As String) As Long

    VB.NET
    System.IO.File.Delete

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Kernel32

    Parameter Information
    · lpFileName
    Points to a null-terminated string that specifies the file to be deleted.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Saturday, June 9, 2007 4:45 PM
  • DeleteMenu

    The DeleteMenu function deletes an item from the specified menu. If the menu item opens a menu or submenu, this function destroys the handle to the menu or submenu and frees the memory used by the menu or submenu.

    VB4-32,5,6
    Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Kernel32

    Parameter Information
    · hMenu
    [in] Handle to the menu to be changed.

    · uPosition
    [in] Specifies the menu item to be deleted, as determined by the uFlags parameter.

    · uFlags
    [in] Specifies how the uPosition parameter is interpreted. This parameter must be one of the following values.
    MF_BYCOMMAND
    Indicates that uPosition gives the identifier of the menu item. The MF_BYCOMMAND flag is the default flag if neither the MF_BYCOMMAND nor MF_BYPOSITION flag is specified.
    MF_BYPOSITION
    Indicates that uPosition gives the zero-based relative position of the menu item.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Saturday, June 9, 2007 4:45 PM
  • DeleteObject

    The DeleteObject function deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object. After the object is deleted, the specified handle is no longer valid.

    VB4-32,5,6
    Declare Function DeleteObject Lib "gdi32" Alias "DeleteObject" (ByVal hObject As Long) As Long

    VB.NET
    N/A

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Gdi32

    Parameter Information
    · hObject
    Identifies a logical pen, brush, font, bitmap, region, or palette.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the specified handle is not valid or is currently selected into a device context, the return value is zero.
    Saturday, June 9, 2007 4:45 PM
  • DeleteTimerQueue

    The DeleteTimerQueue function deletes a timer queue. Any pending timers in the queue are canceled and deleted.
    To use a completion event, call the DeleteTimerQueueEx function.

    VB4-32,5,6
    Declare Function DeleteTimerQueue Lib "kernel32.dll" (ByVal TimerQueue As Long) As Long

    Operating Systems Supported
    Requires Windows 2000 or later; Win9x/ME: Not supported

    Library
    Kernel32

    Parameter Information
    · TimerQueue
    [in] Handle to a timer queue. This handle is returned by the CreateTimerQueue function.
    If the timer was created using the default timer queue, this parameter should be NULL.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Saturday, June 9, 2007 4:45 PM
  • DeleteTimerQueueTimer

    The DeleteTimerQueueTimer function cancels a timer-queue timer.

    VB4-32,5,6
    Declare Function DeleteTimerQueueTimer Lib "kernel32.dll" (ByVal TimerQueue As Long, ByVal Timer As Long, ByVal CompletionEvent As Long) As Long

    Operating Systems Supported
    Requires Windows 2000 or later; Win9x/ME: Not supported

    Library
    Kernel32

    Parameter Information
    · TimerQueue
    [in] Handle to a timer queue. This handle is returned by the CreateTimerQueue function.
    If the timer was created using the default timer queue, this parameter should be NULL.

    · Timer
    [in] Handle to a timer-queue timer. This handle is returned by the CreateTimerQueueTimer function.

    · CompletionEvent
    [in] Specifies an optional event to be signaled when the function is successful and all callback functions have completed. This parameter can be NULL.
    If this parameter is INVALID_HANDLE_VALUE, the function waits for all callback functions to complete before returning.
    If this parameter is NULL, the function marks the timer for deletion and returns immediately. However, most callers should wait for the callback function to complete so they can perform any needed cleanup.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Saturday, June 9, 2007 5:29 PM
  • MakeSureDirectoryPathExists

    The MakeSureDirectoryPathExists function creates all the directories in the specified DirPath, beginning with the root.

    VB4-32,5,6
    Declare Function MakeSureDirectoryPathExists Lib "imagehlp.dll" (ByVal lpPath As String) As Long

    VB.NET
    System.IO.Directory.CreateDirectory

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Imagehlp

    Parameter Information
    · DirPath
    [in] Pointer to a null-terminated string that specifies a valid path name. If the final component of the path is a directory, not a file name, the string must end with a backslash (\) character.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Tuesday, June 12, 2007 5:41 AM
  • mciExecute

    The API function MCIEXECUTE can be used to access a variety of MCI devices.

    VB4-32,5,6
    Declare Function mciExecute Lib "winmm.dll" (ByVal lpstrCommand As String) As Long

    Operating Systems Supported
    Windows 3.1

    Library
    Winmm

    Parameter Information
    · lpstrCommand
    Specifies what the function should do.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Tuesday, June 12, 2007 5:43 AM
  • mciGetErrorString

    The mciGetErrorString function retrieves a string that describes the specified MCI error code.

    VB4-32,5,6
    Declare Function mciGetErrorString Lib "winmm.dll" Alias "mciGetErrorStringA" (ByVal dwError As Long, ByVal lpstrBuffer As String, ByVal uLength As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · fdwError
    Error code returned by the mciSendCommand or mciSendString function.

    · lpszErrorText
    Address of a buffer that receives a null-terminated string describing the specified error.

    · cchErrorText
    Length of the buffer, in characters, pointed to by the lpszErrorText parameter.

    Return Values
    Returns TRUE if successful or FALSE if the error code is not known.
    Tuesday, June 12, 2007 5:45 AM
  • mciSendCommand

    The mciSendCommand function sends a command message to the specified MCI device.

    VB4-32,5,6
    Declare Function mciSendCommand Lib "winmm.dll" Alias "mciSendCommandA" (ByVal wDeviceID As Long, ByVal uMessage As Long, ByVal dwParam1 As Long, ByRef dwParam2 As Any) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · IDDevice
    Device identifier of the MCI device that is to receive the command message. This parameter is not used with the MCI_OPEN command message.

    · uMsg
    Command message. For information about command messages, see Command Messages.

    · fdwCommand
    Flags for the command message.

    · dwParam
    Address of a structure that contains parameters for the command message.

    Return Values
    Returns zero if successful or an error otherwise. The low-order word of the returned doubleword value contains the error return value. If the error is device-specific, the high-order word of the return value is the driver identifier; otherwise, the high-order word is zero. For a list of possible return values, see Constants: MCIERR Return Values.

    To retrieve a text description of mciSendCommand return values, pass the return value to the mciGetErrorString function.
    Tuesday, June 12, 2007 5:45 AM
  • Thanks dude, for the help. I was getting loaded with lots of work.
    Tuesday, June 12, 2007 6:16 AM
  • Thanx for the encoragement Harshil... I 'll try to post more...
    Tuesday, June 12, 2007 5:07 PM
  • mciSendString

    The mciSendString function sends a command string to an MCI device. The device that the command is sent to is specified in the command string.

    VB4-32,5,6
    Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · lpszCommand
    Address of a null-terminated string that specifies an MCI command string. For more information about the command strings, see Command Strings.

    · lpszReturnString
    Address of a buffer that receives return information. If no return information is needed, this parameter can be NULL.

    · cchReturn
    Size, in characters, of the return buffer specified by the lpszReturnString parameter.

    · hwndCallback
    Handle of a callback window if the “notify” flag was specified in the command string.

    Return Values
    Returns zero if successful or an error otherwise. The low-order word of the returned doubleword value contains the error return value. If the error is device-specific, the high-order word of the return value is the driver identifier; otherwise, the high-order word is zero. For a list of possible error values, see Constants: MCIERR Return Values.

    To retrieve a text description of mciSendString return values, pass the return value to the mciGetErrorString function.
    Tuesday, June 12, 2007 5:10 PM
  • MessageBeep

    The MessageBeep function plays a waveform sound. The waveform sound for each sound type is identified by an entry in the [sounds] section of the registry.

    VB4-32,5,6
    Declare Function MessageBeep Lib "user32" Alias "MessageBeep" (ByVal wType As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · uType
    Specifies the sound type, as identified by an entry in the [sounds] section of the registry. This parameter can be one of the following values:
    0xFFFFFFFF
    Standard beep using the computer speaker
    MB_ICONASTERISK
    SystemAsterisk
    MB_ICONEXCLAMATION
    SystemExclamation
    MB_ICONHAND
    SystemHand
    MB_ICONQUESTION
    SystemQuestion
    MB_OK
    SystemDefault

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Tuesday, June 12, 2007 5:11 PM
  • MessageBoxEx

    The MessageBoxEx function creates, displays, and operates a message box. The message box contains an application-defined message and title, plus any combination of predefined icons and push buttons.

    VB4-32,5,6
    Declare Function MessageBoxEx Lib "user32" Alias "MessageBoxExA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal uType As Long, ByVal wLanguageId As Long) As Long

    VB.NET
    System.Windows.Forms.MessageBox

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hWnd
    Identifies the owner window of the message box to be created. If this parameter is NULL, the message box has no owner window.

    · lpCaption
    Points to a null-terminated string containing the message to be displayed.

    · lpszTitle
    Points to a null-terminated string used for the dialog box title. If this parameter is NULL, the default title Error is used.

    · uType
    Specifies a set of bit flags that determine the contents and behavior of the dialog box. This parameter can be a combination of flags from the following groups of flags.
    Specify one of the following flags to indicate the buttons contained in the message box:
    MB_ABORTRETRYIGNORE
    The message box contains three push buttons: Abort, Retry, and Ignore.
    MB_OK
    The message box contains one push button: OK. This is the default.
    MB_OKCANCEL
    The message box contains two push buttons: OK and Cancel.
    MB_RETRYCANCEL
    The message box contains two push buttons: Retry and Cancel.
    MB_YESNO
    The message box contains two push buttons: Yes and No.
    MB_YESNOCANCEL
    The message box contains three push buttons: Yes, No, and Cancel.

    Specify one of the following flags to display an icon in the message box:
    MB_ICONEXCLAMATION,
    MB_ICONWARNING
    An exclamation-point icon appears in the message box.
    MB_ICONINFORMATION, MB_ICONASTERISK
    An icon consisting of a lowercase letter i in a circle appears in the message box.
    MB_ICONQUESTION
    A question-mark icon appears in the message box.
    MB_ICONSTOP,
    MB_ICONERROR,
    MB_ICONHAND
    A stop-sign icon appears in the message box.

    Specify one of the following flags to indicate the default button:
    MB_DEFBUTTON1
    The first button is the default button.
    MB_DEFBUTTON1 is the default unless MB_DEFBUTTON2, MB_DEFBUTTON3, or MB_DEFBUTTON4 is specified.
    MB_DEFBUTTON2
    The second button is the default button.
    MB_DEFBUTTON3
    The third button is the default button.
    MB_DEFBUTTON4
    The fourth button is the default button.

    Specify one of the following flags to indicate the modality of the dialog box:
    MB_APPLMODAL
    The user must respond to the message box before continuing work in the window identified by the hWnd parameter. However, the user can move to the windows of other applications and work in those windows.
    Depending on the hierarchy of windows in the application, the user may be able to move to other windows within the application. All child windows of the parent of the message box are automatically disabled, but popup windows are not.
    MB_APPLMODAL is the default if neither MB_SYSTEMMODAL nor MB_TASKMODAL is specified.
    MB_SYSTEMMODAL
    Same as MB_APPLMODAL except that the message box has the WS_EX_TOPMOST style. Use system-modal message boxes to notify the user of serious, potentially damaging errors that require immediate attention (for example, running out of memory). This flag has no effect on the user's ability to interact with windows other than those associated with hWnd.
    MB_TASKMODAL
    Same as MB_APPLMODAL except that all the top-level windows belonging to the current task are disabled if the hWnd parameter is NULL. Use this flag when the calling application or library does not have a window handle available but still needs to prevent input to other windows in the current application without suspending other applications.

    In addition, you can specify the following flags:
    MB_DEFAULT_DESKTOP_ONLY
    The desktop currently receiving input must be a default desktop; otherwise, the function fails. A default desktop is one an application runs on after the user has logged on.
    MB_HELP
    Adds a Help button to the message box. Choosing the Help button or pressing F1 generates a Help event.
    MB_RIGHT
    The text is right-justified.
    MB_RTLREADING
    Displays message and caption text using right-to-left reading order on Hebrew and Arabic systems.
    MB_SETFOREGROUND
    The message box becomes the foreground window. Internally, Windows calls the SetForegroundWindow function for the message box.
    MB_TOPMOST
    The message box is created with the WS_EX_TOPMOST window style.
    MB_SERVICE_NOTIFICATION
    Windows NT only: The caller is a service notifying the user of an event. The function displays a message box on the current active desktop, even if there is no user logged on to the computer.
    If this flag is set, the hWnd parameter must be NULL. This is so the message box can appear on a desktop other than the desktop corresponding to the hWnd.
    For Windows NT version 4.0, the value of MB_SERVICE_NOTIFICATION has changed. See WINUSER.H for the old and new values. Windows NT 4.0 provides backward compatibility for pre-existing services by mapping the old value to the new value in the implementation of MessageBox and MessageBoxEx. This mapping is only done for executables that have a version number, as set by the linker, less than 4.0.
    To build a service that uses MB_SERVICE_NOTIFICATION, and can run on both Windows NT 3.x and Windows NT 4.0, you have two choices.
    1. At link-time, specify a version number less than 4.0; or
    2. At link-time, specify version 4.0. At run-time, use the GetVersionEx function to check the system version. Then when running on Windows NT 3.x, use MB_SERVICE_NOTIFICATION_NT3X; and on Windows NT 4.0, use MB_SERVICE_NOTIFICATION.
    MB_SERVICE_NOTIFICATION_NT3X
    Windows NT only: This value corresponds to the value defined for MB_SERVICE_NOTIFICATION for Windows NT version 3.51.

    · wLanguageId
    Specifies the language in which to display the text contained in the predefined push buttons. This value must be in the form returned by the MAKELANGID macro.
    For a list of the language identifiers supported by Win32, see Language Identifiers. Note that each localized release of Windows typically contains resources only for a limited set of languages. Thus, for example, the U.S. version offers LANG_ENGLISH, the French version offers LANG_FRENCH, the German version offers LANG_GERMAN, and the Japanese version offers LANG_JAPANESE. Each version offers LANG_NEUTRAL. This limits the set of values that can be used with the wLanguageId parameter. Before specifying a language identifier, you should enumerate the locales that are installed on a system.

    Return Values
    If the function succeeds, the return value is a nonzero menu-item value returned by the dialog box.
    IDABORT
    Abort button was selected.

    IDCANCEL
    Cancel button was selected.

    IDIGNORE
    Ignore button was selected.

    IDNO
    No button was selected.

    IDOK
    OK button was selected.

    IDRETRY
    Retry button was selected.

    IDYES
    Yes button was selected.



    If a message box has a Cancel button, the function returns the IDCANCEL value when either the ESC key or Cancel button is pressed. If the message box has no Cancel button, pressing the ESC key has no effect.

    If the function fails, the return value is zero. To get extended error information, call GetLastError
    Tuesday, June 12, 2007 5:14 PM
  • MessageBoxIndirect

    The MessageBoxIndirect function creates, displays, and operates a message box. The message box contains application-defined message text and title, any icon, and any combination of predefined push buttons.

    VB4-32,5,6
    Declare Function MessageBoxIndirect Lib "user32" Alias "MessageBoxIndirectA" (lpMsgBoxParams As MSGBOXPARAMS) As Long

    VB.NET
    System.Windows.Forms.MessageBox

    Operating Systems Supported
    Requires Windows NT 4.0 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · lpMsgBoxParams
    Pointer to a MSGBOXPARAMS structure that contains information used to display the message box.

    Return Values
    The return value is zero if there is not enough memory to create the message box.

    If the function succeeds, the return value is one of the following menu-item values returned by the dialog box:
    IDABORT
    Abort button was selected.

    IDCANCEL
    Cancel button was selected.

    IDIGNORE
    Ignore button was selected.

    IDNO
    No button was selected.

    IDOK
    OK button was selected.

    IDRETRY
    Retry button was selected.

    IDYES
    Yes button was selected.



    If a message box has a Cancel button, the function returns the IDCANCEL value if either the ESC key is pressed or the Cancel button is selected. If the message box has no Cancel button, pressing ESC has no effect.
    Tuesday, June 12, 2007 5:15 PM
  • midiOutClose

    The midiOutClose function closes the specified MIDI output device.

    VB4-32,5,6
    Declare Function midiOutClose Lib "winmm.dll" (ByVal hMidiOut As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · hmo
    Handle of the MIDI output device. If the function is successful, the handle is no longer valid after the call to this function.

    Return Values
    Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following:
    MIDIERR_STILLPLAYING
    Buffers are still in the queue.

    MMSYSERR_INVALHANDLE
    The specified device handle is invalid.

    MMSYSERR_NOMEM
    The system is unable to load mapper string description.
    Tuesday, June 12, 2007 5:43 PM
  • midiOutGetDevCaps

    The midiOutGetDevCaps function queries a specified MIDI output device to determine its capabilities.

    VB4-32,5,6
    Declare Function midiOutGetDevCaps Lib "winmm.dll" Alias "midiOutGetDevCapsA" (ByVal uDeviceID As Long, lpCaps As MIDIOUTCAPS, ByVal uSize As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · uDeviceID
    Identifier of the MIDI output device. The device identifier specified by this parameter varies from zero to one less than the number of devices present. The MIDI_MAPPER constant is also a valid device identifier.
    This parameter can also be a properly cast device handle.

    · lpMidiOutCaps
    Address of a MIDIOUTCAPS structure. This structure is filled with information about the capabilities of the device.

    · cbMidiOutCaps
    Size, in bytes, of the MIDIOUTCAPS structure. Only cbMidiOutCaps bytes (or less) of information is copied to the location pointed to by lpMidiOutCaps. If cbMidiOutCaps is zero, nothing is copied, and the function returns MMSYSERR_NOERROR.

    Return Values
    Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following:
    MMSYSERR_BADDEVICEID
    The specified device identifier is out of range.

    MMSYSERR_INVALPARAM
    The specified pointer or structure is invalid.

    MMSYSERR_NODRIVER
    The driver is not installed.

    MMSYSERR_NOMEM
    The system is unable to load mapper string description.
    Tuesday, June 12, 2007 5:43 PM
  • midiOutGetNumDevs

    The midiOutGetNumDevs function retrieves the number of MIDI output devices present in the system.

    VB4-32,5,6
    Declare Function midiOutGetNumDevs Lib "winmm" Alias "midiOutGetNumDevs" () As Integer

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Return Values
    Returns the number of MIDI output devices. A return value of zero means that there are no devices (not that there is no error).
    Tuesday, June 12, 2007 5:44 PM
  • midiOutOpen

    The midiOutOpen function opens a MIDI output device for playback.

    VB4-32,5,6
    Declare Function midiOutOpen Lib "winmm.dll" (lphMidiOut As Long, ByVal uDeviceID As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · lphmo
    Address of an HMIDIOUT handle. This location is filled with a handle identifying the opened MIDI output device. The handle is used to identify the device in calls to other MIDI output functions.

    · uDeviceID
    Identifier of the MIDI output device that is to be opened.

    · dwCallback
    Address of a callback function, an event handle, a thread identifier, or a handle of a window or thread called during MIDI playback to process messages related to the progress of the playback. If no callback is desired, specify NULL for this parameter. For more information on the callback function, see MidiOutProc.

    · dwCallbackInstance
    User instance data passed to the callback. This parameter is not used with window callbacks or threads.

    · dwFlags
    Callback flag for opening the device. It can be the following values:
    CALLBACK_EVENT
    The dwCallback parameter is an event handle. This callback mechanism is for output only.
    CALLBACK_FUNCTION
    The dwCallback parameter is a callback function address.
    CALLBACK_NULL
    There is no callback mechanism. This value is the default setting.
    CALLBACK_THREAD
    The dwCallback parameter is a thread identifier.
    CALLBACK_WINDOW
    The dwCallback parameter is a window handle.

    Return Values
    Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following:
    MIDIERR_NODEVICE
    No MIDI port was found. This error occurs only when the mapper is opened.

    MMSYSERR_ALLOCATED
    The specified resource is already allocated.

    MMSYSERR_BADDEVICEID
    The specified device identifier is out of range.

    MMSYSERR_INVALPARAM
    The specified pointer or structure is invalid.

    MMSYSERR_NOMEM
    The system is unable to allocate or lock memory.

    Tuesday, June 12, 2007 5:45 PM
  • midiOutShortMsg

    The midiOutShortMsg function sends a short MIDI message to the specified MIDI output device.

    VB4-32,5,6
    Declare Function midiOutShortMsg Lib "winmm.dll" (ByVal hMidiOut As Long, ByVal dwMsg As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · hmo
    Handle of the MIDI output device. This parameter can also be the handle of a MIDI stream cast to HMIDIOUT.

    · dwMsg
    MIDI message. The message is packed into a doubleword value with the first byte of the message in the low-order byte. The message is packed into this parameter as follows:
    High word High-order byte Not used.
    Low-order byte Contains a second byte of MIDI data (when needed).
    Low word High-order byte Contains the first byte of MIDI data (when needed).
    Low-order byte Contains the MIDI status.

    The two MIDI data bytes are optional, depending on the MIDI status byte. When a series of messages have the same status byte, the status byte can be omitted from messages after the first one in the series, creating a running status. Pack a message for running status as follows:
    High word High-order byte Not used.
    Low-order byte Not used.
    Low word High-order byte Contains a second byte of MIDI data (when needed).
    Low-order byte Contains the first byte of MIDI data.

    Return Values
    Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following:
    MIDIERR_BADOPENMODE
    The application sent a message without a status byte to a stream handle.

    MIDIERR_NOTREADY
    The hardware is busy with other data.

    MMSYSERR_INVALHANDLE
    The specified device handle is invalid.
    Tuesday, June 12, 2007 5:46 PM
  • mixerClose

    The mixerClose function closes the specified mixer device.

    VB4-32,5,6
    Declare Function mixerClose Lib "winmm.dll" Alias "mixerClose" (ByVal hmx As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · hmx
    Handle of the mixer device. This handle must have been returned successfully by the mixerOpen function. If mixerClose is successful, hmx is no longer valid.

    Return Values
    Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following:
    MMSYSERR_INVALHANDLE
    Specified device handle is invalid.
    Tuesday, June 12, 2007 5:46 PM
  • mixerGetControlDetails

    The mixerGetControlDetails function retrieves details about a single control associated with an audio line.

    VB4-32,5,6
    Declare Function mixerGetControlDetails Lib "winmm.dll" Alias "mixerGetControlDetailsA" (ByVal hmxobj As Long, pmxcd As MIXERCONTROLDETAILS, ByVal fdwDetails As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · hmxobj
    Handle of the mixer device object being queried.

    · pmxcd
    Address of a MIXERCONTROLDETAILS structure, which is filled with state information about the control.

    · fdwDetails
    Flags for retrieving control details. The following values are defined:
    MIXER_GETCONTROLDETAILSF_LISTTEXT
    The paDetails member of the MIXERCONTROLDETAILS structure points to one or more MIXERCONTROLDETAILS_LISTTEXT structures to receive text labels for multiple-item controls. An application must get all list text items for a multiple-item control at once. This flag cannot be used with MIXERCONTROL_CONTROLTYPE_CUSTOM controls.
    MIXER_GETCONTROLDETAILSF_VALUE
    Current values for a control are retrieved. The paDetails member of the MIXERCONTROLDETAILS structure points to one or more details structures appropriate for the control class.
    MIXER_OBJECTF_AUX
    The hmxobj parameter is an auxiliary device identifier in the range of zero to one less than the number of devices returned by the auxGetNumDevs function.
    MIXER_OBJECTF_HMIDIIN
    The hmxobj parameter is the handle of a MIDI (Musical Instrument Digital Interface) input device. This handle must have been returned by the midiInOpen function.
    MIXER_OBJECTF_HMIDIOUT
    The hmxobj parameter is the handle of a MIDI output device. This handle must have been returned by the midiOutOpen function.
    MIXER_OBJECTF_HMIXER
    The hmxobj parameter is a mixer device handle returned by the mixerOpen function. This flag is optional.
    MIXER_OBJECTF_HWAVEIN
    The hmxobj parameter is a waveform-audio input handle returned by the waveInOpen function.
    MIXER_OBJECTF_HWAVEOUT
    The hmxobj parameter is a waveform-audio output handle returned by the waveOutOpen function.
    MIXER_OBJECTF_MIDIIN
    The hmxobj parameter is the identifier of a MIDI input device. This identifier must be in the range of zero to one less than the number of devices returned by the midiInGetNumDevs function.
    MIXER_OBJECTF_MIDIOUT
    The hmxobj parameter is the identifier of a MIDI output device. This identifier must be in the range of zero to one less than the number of devices returned by the midiOutGetNumDevs function.
    MIXER_OBJECTF_MIXER
    The hmxobj parameter is the identifier of a mixer device in the range of zero to one less than the number of devices returned by the mixerGetNumDevs function. This flag is optional.
    MIXER_OBJECTF_WAVEIN
    The hmxobj parameter is the identifier of a waveform-audio input device in the range of zero to one less than the number of devices returned by the waveInGetNumDevs function.
    MIXER_OBJECTF_WAVEOUT
    The hmxobj parameter is the identifier of a waveform-audio output device in the range of zero to one less than the number of devices returned by the waveOutGetNumDevs function.

    Return Values
    Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following:
    MIXERR_INVALCONTROL
    The control reference is invalid.

    MMSYSERR_BADDEVICEID
    The hmxobj parameter specifies an invalid device identifier.

    MMSYSERR_INVALFLAG
    One or more flags are invalid.

    MMSYSERR_INVALHANDLE
    The hmxobj parameter specifies an invalid handle.

    MMSYSERR_INVALPARAM
    One or more parameters are invalid.

    MMSYSERR_NODRIVER
    No mixer device is available for the object specified by hmxobj.
    Tuesday, June 12, 2007 5:47 PM
  • mixerGetDevCaps

    The mixerGetDevCaps function queries a specified mixer device to determine its capabilities.

    VB4-32,5,6
    Declare Function mixerGetDevCaps Lib "winmm.dll" Alias "mixerGetDevCapsA" (ByVal uMxId As Long, ByVal pmxcaps As MIXERCAPS, ByVal cbmxcaps As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · uMxId
    Identifier or handle of an open mixer device.

    · pmxcaps
    Address of a MIXERCAPS structure that receives information about the capabilities of the device.

    · cbmxcaps
    Size, in bytes, of the MIXERCAPS structure.

    Return Values
    Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following:
    MMSYSERR_BADDEVICEID
    The specified device identifier is out of range.

    MMSYSERR_INVALHANDLE
    The mixer device handle is invalid.

    MMSYSERR_INVALPARAM
    One or more parameters are invalid.

    Tuesday, June 12, 2007 5:49 PM
  • mixerGetID

    The mixerGetID function retrieves the device identifier for a mixer device associated with a specified device handle.

    VB4-32,5,6
    Declare Function mixerGetID Lib "winmm.dll" Alias "mixerGetID" (ByVal hmxobj As Long, pumxID As Long, ByVal fdwId As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · hmxobj
    Handle of the audio mixer object to map to a mixer device identifier.

    · puMxId
    Address of a variable that receives the mixer device identifier. If no mixer device is available for the hmxobj object, the value - 1 is placed in this location and the MMSYSERR_NODRIVER error value is returned.

    · fdwId
    Flags for mapping the mixer object hmxobj. The following values are defined:
    MIXER_OBJECTF_AUX
    The hmxobj parameter is an auxiliary device identifier in the range of zero to one less than the number of devices returned by the auxGetNumDevs function.
    MIXER_OBJECTF_HMIDIIN
    The hmxobj parameter is the handle of a MIDI input device. This handle must have been returned by the midiInOpen function.
    MIXER_OBJECTF_HMIDIOUT
    The hmxobj parameter is the handle of a MIDI output device. This handle must have been returned by the midiOutOpen function.
    MIXER_OBJECTF_HMIXER
    The hmxobj parameter is a mixer device handle returned by the mixerOpen function. This flag is optional.
    MIXER_OBJECTF_HWAVEIN
    The hmxobj parameter is a waveform-audio input handle returned by the waveInOpen function.
    MIXER_OBJECTF_HWAVEOUT
    The hmxobj parameter is a waveform-audio output handle returned by the waveOutOpen function.
    MIXER_OBJECTF_MIDIIN
    The hmxobj parameter is the identifier of a MIDI input device. This identifier must be in the range of zero to one less than the number of devices returned by the midiInGetNumDevs function.
    MIXER_OBJECTF_MIDIOUT
    The hmxobj parameter is the identifier of a MIDI output device. This identifier must be in the range of zero to one less than the number of devices returned by the midiOutGetNumDevs function.
    MIXER_OBJECTF_MIXER
    The hmxobj parameter is the identifier of a mixer device in the range of zero to one less than the number of devices returned by the mixerGetNumDevs function. This flag is optional.
    MIXER_OBJECTF_WAVEIN
    The hmxobj parameter is the identifier of a waveform-audio input device in the range of zero to one less than the number of devices returned by the waveInGetNumDevs function.
    MIXER_OBJECTF_WAVEOUT
    The hmxobj parameter is the identifier of a waveform-audio output device in the range of zero to one less than the number of devices returned by the waveOutGetNumDevs function.

    Return Values
    Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following:
    MMSYSERR_BADDEVICEID
    The hmxobj parameter specifies an invalid device identifier.

    MMSYSERR_INVALFLAG
    One or more flags are invalid.

    MMSYSERR_INVALHANDLE
    The hmxobj parameter specifies an invalid handle.

    MMSYSERR_INVALPARAM
    One or more parameters are invalid.

    MMSYSERR_NODRIVER
    No audio mixer device is available for the object specified by hmxobj. The location referenced by puMxId also contains the value -1.
    Tuesday, June 12, 2007 5:49 PM
  • mixerGetLineControls

    The mixerGetLineControls function retrieves one or more controls associated with an audio line.

    VB4-32,5,6
    Declare Function mixerGetLineControls Lib "winmm.dll" Alias "mixerGetLineControlsA" (ByVal hmxobj As Long, pmxlc As MIXERLINECONTROLS, ByVal fdwControls As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · hmxobj
    Handle of the mixer device object that is being queried.

    · pmxlc
    Address of a MIXERLINECONTROLS structure. This structure is used to reference one or more MIXERCONTROL structures to be filled with information about the controls associated with an audio line. The cbStruct member of the MIXERLINECONTROLS structure must always be initialized to be the size, in bytes, of the MIXERLINECONTROLS structure.

    · fdwControls
    Flags for retrieving information about one or more controls associated with an audio line. The following values are defined:
    MIXER_GETLINECONTROLSF_ALL
    The pmxlc parameter references a list of MIXERCONTROL structures that will receive information on all controls associated with the audio line identified by the dwLineID member of the MIXERLINECONTROLS structure. The cControls member must be initialized to the number of controls associated with the line. This number is retrieved from the cControls member of the MIXERLINE structure returned by the mixerGetLineInfo function. The cbmxctrl member must be initialized to the size, in bytes, of a single MIXERCONTROL structure. The pamxctrl member must point to the first MIXERCONTROL structure to be filled. The dwControlID and dwControlType members are ignored for this query.

    MIXER_GETLINECONTROLSF_ONEBYID
    The pmxlc parameter references a single MIXERCONTROL structure that will receive information on the control identified by the dwControlID member of the MIXERLINECONTROLS structure. The cControls member must be initialized to 1. The cbmxctrl member must be initialized to the size, in bytes, of a single MIXERCONTROL structure. The pamxctrl member must point to a MIXERCONTROL structure to be filled. The dwLineID and dwControlType members are ignored for this query. This query is usually used to refresh a control after receiving a MM_MIXM_CONTROL_CHANGE control change notification message by the user-defined callback (see mixerOpen).

    MIXER_GETLINECONTROLSF_ONEBYTYPE
    The mixerGetLineControls function retrieves information about the first control of a specific class for the audio line that is being queried. The pmxlc parameter references a single MIXERCONTROL structure that will receive information about the specific control. The audio line is identified by the dwLineID member. The control class is specified in the dwControlType member of the MIXERLINECONTROLS structure.
    The dwControlID member is ignored for this query. This query can be used by an application to get information on a single control associated with a line. For example, you might want your application to use a peak meter only from a waveform-audio output line.

    MIXER_OBJECTF_AUX
    The hmxobj parameter is an auxiliary device identifier in the range of zero to one less than the number of devices returned by the auxGetNumDevs function.

    MIXER_OBJECTF_HMIDIIN
    The hmxobj parameter is the handle of a MIDI input device. This handle must have been returned by the midiInOpen function.

    MIXER_OBJECTF_HMIDIOUT
    The hmxobj parameter is the handle of a MIDI output device. This handle must have been returned by the midiOutOpen function.

    MIXER_OBJECTF_HMIXER
    The hmxobj parameter is a mixer device handle returned by the mixerOpen function. This flag is optional.

    MIXER_OBJECTF_HWAVEIN
    The hmxobj parameter is a waveform-audio input handle returned by the waveInOpen function.

    MIXER_OBJECTF_HWAVEOUT
    The hmxobj parameter is a waveform-audio output handle returned by the waveOutOpen function.

    MIXER_OBJECTF_MIDIIN
    The hmxobj parameter is the identifier of a MIDI input device. This identifier must be in the range of zero to one less than the number of devices returned by the midiInGetNumDevs function.

    MIXER_OBJECTF_MIDIOUT
    The hmxobj parameter is the identifier of a MIDI output device. This identifier must be in the range of zero to one less than the number of devices returned by the midiOutGetNumDevs function.

    MIXER_OBJECTF_MIXER
    The hmxobj parameter is the identifier of a mixer device in the range of zero to one less than the number of devices returned by the mixerGetNumDevs function. This flag is optional.

    MIXER_OBJECTF_WAVEIN
    The hmxobj parameter is the identifier of a waveform-audio input device in the range of zero to one less than the number of devices returned by the waveInGetNumDevs function.

    MIXER_OBJECTF_WAVEOUT
    The hmxobj parameter is the identifier of a waveform-audio output device in the range of zero to one less than the number of devices returned by the waveOutGetNumDevs function.

    Return Values
    Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following:
    MIXERR_INVALCONTROL
    The control reference is invalid.

    MIXERR_INVALLINE
    The audio line reference is invalid.

    MMSYSERR_BADDEVICEID
    The hmxobj parameter specifies an invalid device identifier.

    MMSYSERR_INVALFLAG
    One or more flags are invalid.

    MMSYSERR_INVALHANDLE
    The hmxobj parameter specifies an invalid handle.

    MMSYSERR_INVALPARAM
    One or more parameters are invalid.

    MMSYSERR_NODRIVER
    No mixer device is available for the object specified by hmxobj.
    Tuesday, June 12, 2007 5:50 PM
  • mixerGetLineInfo

    The mixerGetLineInfo function retrieves information about a specific line of a mixer device.

    VB4-32,5,6
    Declare Function mixerGetLineInfo Lib "winmm.dll" Alias "mixerGetLineInfoA" (ByVal hmxobj As Long, pmxl As MIXERLINE, ByVal fdwInfo As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · hmxobj
    Handle of the mixer device object that controls the specific audio line.

    · 0pmxl
    Address of a MIXERLINE structure. This structure is filled with information about the audio line for the mixer device. The cbStruct member must always be initialized to be the size, in bytes, of the MIXERLINE structure.

    · fdwInfo
    Flags for retrieving information about an audio line. The following values are defined:
    MIXER_GETLINEINFOF_COMPONENTTYPE
    The pmxl parameter will receive information about the first audio line of the type specified in the dwComponentType member of the MIXERLINE structure. This flag is used to retrieve information about an audio line of a specific component type. Remaining structure members except cbStruct require no further initialization.
    MIXER_GETLINEINFOF_DESTINATION
    The pmxl parameter will receive information about the destination audio line specified by the dwDestination member of the MIXERLINE structure. This index ranges from zero to one less than the value in the cDestinations member of the MIXERCAPS structure. All remaining structure members except cbStruct require no further initialization.
    MIXER_GETLINEINFOF_LINEID
    The pmxl parameter will receive information about the audio line specified by the dwLineID member of the MIXERLINE structure. This is usually used to retrieve updated information about the state of an audio line. All remaining structure members except cbStruct require no further initialization.
    MIXER_GETLINEINFOF_SOURCE
    The pmxl parameter will receive information about the source audio line specified by the dwDestination and dwSource members of the MIXERLINE structure. The index specified by dwDestination ranges from zero to one less than the value in the cDestinations member of the MIXERCAPS structure. The index specified by dwSource ranges from zero to one less than the value in the cConnections member of the MIXERLINE structure returned for the audio line stored in the dwDestination member. All remaining structure members except cbStruct require no further initialization.
    MIXER_GETLINEINFOF_TARGETTYPE
    The pmxl parameter will receive information about the audio line that is for the dwType member of the Target structure, which is a member of the MIXERLINE structure. This flag is used to retrieve information about an audio line that handles the target type (for example, MIXERLINE_TARGETTYPE_WAVEOUT). An application must initialize the dwType, wMid, wPid, vDriverVersion and szPname members of the MIXERLINE structure before calling mixerGetLineInfo. All of these values can be retrieved from the device capabilities structures for all media devices. Remaining structure members except cbStruct require no further initialization.
    MIXER_OBJECTF_AUX
    The hmxobj parameter is an auxiliary device identifier in the range of zero to one less than the number of devices returned by the auxGetNumDevs function.
    MIXER_OBJECTF_HMIDIIN
    The hmxobj parameter is the handle of a MIDI input device. This handle must have been returned by the midiInOpen function.
    MIXER_OBJECTF_HMIDIOUT
    The hmxobj parameter is the handle of a MIDI output device. This handle must have been returned by the midiOutOpen function.
    MIXER_OBJECTF_HMIXER
    The hmxobj parameter is a mixer device handle returned by the mixerOpen function. This flag is optional.
    MIXER_OBJECTF_HWAVEIN
    The hmxobj parameter is a waveform-audio input handle returned by the waveInOpen function.
    MIXER_OBJECTF_HWAVEOUT
    The hmxobj parameter is a waveform-audio output handle returned by the waveOutOpen function.
    MIXER_OBJECTF_MIDIIN
    The hmxobj parameter is the identifier of a MIDI input device. This identifier must be in the range of zero to one less than the number of devices returned by the midiInGetNumDevs function.
    MIXER_OBJECTF_MIDIOUT
    The hmxobj parameter is the identifier of a MIDI output device. This identifier must be in the range of zero to one less than the number of devices returned by the midiOutGetNumDevs function.
    MIXER_OBJECTF_MIXER
    The hmxobj parameter is a mixer device identifier in the range of zero to one less than the number of devices returned by the mixerGetNumDevs function. This flag is optional.
    MIXER_OBJECTF_WAVEIN
    The hmxobj parameter is the identifier of a waveform-audio input device in the range of zero to one less than the number of devices returned by the waveInGetNumDevs function.
    MIXER_OBJECTF_WAVEOUT
    The hmxobj parameter is the identifier of a waveform-audio output device in the range of zero to one less than the number of devices returned by the waveOutGetNumDevs function.

    Return Values
    Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following:
    MIXERR_INVALLINE
    The audio line reference is invalid.

    MMSYSERR_BADDEVICEID
    The hmxobj parameter specifies an invalid device identifier.

    MMSYSERR_INVALFLAG
    One or more flags are invalid.

    MMSYSERR_INVALHANDLE
    The hmxobj parameter specifies an invalid handle.

    MMSYSERR_INVALPARAM
    One or more parameters are invalid.

    MMSYSERR_NODRIVER
    No mixer device is available for the object specified by hmxobj.

    Tuesday, June 12, 2007 5:51 PM
  • mixerGetNumDevs

    The mixerGetNumDevs function retrieves the number of mixer devices present in the system.

    VB4-32,5,6
    Declare Function mixerGetNumDevs Lib "winmm.dll" Alias "mixerGetNumDevs" () As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Return Values
    Returns the number of mixer devices or zero if no mixer devices are available.
    Tuesday, June 12, 2007 5:52 PM
  • mixerMessage

    The mixerMessage function sends a custom mixer driver message directly to a mixer driver.

    VB4-32,5,6
    Declare Function mixerMessage Lib "winmm.dll" Alias "mixerMessage" (ByVal hmx As Long, ByVal uMsg As Long, ByVal dwParam1 As Long, ByVal dwParam2 As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · hmx
    Handle of an open instance of a mixer device. This handle is returned by the mixerOpen function.

    · uMsg
    Custom mixer driver message to send to the mixer driver. This message must be above or equal to the MXDM_USER constant.

    · dwParam1 and dwParam2
    Arguments associated with the message being sent.

    Return Values
    Returns a value that is specific to the custom mixer driver message. Possible error values include the following:
    MMSYSERR_INVALHANDLE
    The specified device handle is invalid.

    MMSYSERR_INVALPARAM
    The uMsg parameter specified in the MXDM_USER message is invalid.

    MMSYSERR_NOTSUPPORTED
    The mixer device did not process the message.
    Tuesday, June 12, 2007 5:52 PM
  • mixerOpen

    The mixerOpen function opens a specified mixer device and ensures that the device will not be removed until the application closes the handle.

    VB4-32,5,6
    Declare Function mixerOpen Lib "winmm.dll" Alias "mixerOpen" (phmx As Long, ByVal uMxId As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal fdwOpen As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · phmx
    Address of a variable that will receive a handle identifying the opened mixer device. Use this handle to identify the device when calling other audio mixer functions. This parameter cannot be NULL.

    · uMxId
    Identifier of the mixer device to open. Use a valid device identifier or any HMIXEROBJ (see the mixerGetID function for a description of mixer object handles). A “mapper” for audio mixer devices does not currently exist, so a mixer device identifier of - 1 is not valid.

    · dwCallback
    Handle of a window called when the state of an audio line and/or control associated with the device being opened is changed. Specify zero for this parameter if no callback mechanism is to be used.

    · dwInstance
    User instance data passed to the callback function. This parameter is not used with window callback functions.

    · fdwOpen
    Flags for opening the device. The following values are defined:
    CALLBACK_WINDOW
    The dwCallback parameter is assumed to be a window handle.
    MIXER_OBJECTF_AUX
    The uMxId parameter is an auxiliary device identifier in the range of zero to one less than the number of devices returned by the auxGetNumDevs function.
    MIXER_OBJECTF_HMIDIIN
    The uMxId parameter is the handle of a MIDI input device. This handle must have been returned by the midiInOpen function.
    MIXER_OBJECTF_HMIDIOUT
    The uMxId parameter is the handle of a MIDI output device. This handle must have been returned by the midiOutOpen function.
    MIXER_OBJECTF_HMIXER
    The uMxId parameter is a mixer device handle returned by the mixerOpen function. This flag is optional.
    MIXER_OBJECTF_HWAVEIN
    The uMxId parameter is a waveform-audio input handle returned by the waveInOpen function.
    MIXER_OBJECTF_HWAVEOUT
    The uMxId parameter is a waveform-audio output handle returned by the waveOutOpen function.
    MIXER_OBJECTF_MIDIIN
    The uMxId parameter is the identifier of a MIDI input device. This identifier must be in the range of zero to one less than the number of devices returned by the midiInGetNumDevs function.
    MIXER_OBJECTF_MIDIOUT
    The uMxId parameter is the identifier of a MIDI output device. This identifier must be in the range of zero to one less than the number of devices returned by the midiOutGetNumDevs function.
    MIXER_OBJECTF_MIXER
    The uMxId parameter is a mixer device identifier in the range of zero to one less than the number of devices returned by the mixerGetNumDevs function. This flag is optional.
    MIXER_OBJECTF_WAVEIN
    The uMxId parameter is the identifier of a waveform-audio input device in the range of zero to one less than the number of devices returned by the waveInGetNumDevs function.
    MIXER_OBJECTF_WAVEOUT
    The uMxId parameter is the identifier of a waveform-audio output device in the range of zero to one less than the number of devices returned by the waveOutGetNumDevs function.

    Return Values
    Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following:
    MMSYSERR_ALLOCATED
    The specified resource is already allocated by the maximum number of clients possible.

    MMSYSERR_BADDEVICEID
    The uMxId parameter specifies an invalid device identifier.

    MMSYSERR_INVALFLAG
    One or more flags are invalid.

    MMSYSERR_INVALHANDLE
    The uMxId parameter specifies an invalid handle.

    MMSYSERR_INVALPARAM
    One or more parameters are invalid.

    MMSYSERR_NODRIVER
    No mixer device is available for the object specified by uMxId. Note that the location referenced by uMxId will also contain the value - 1.

    MMSYSERR_NOMEM
    Unable to allocate resources.
    Tuesday, June 12, 2007 5:53 PM
  • mixerSetControlDetails

    The mixerSetControlDetails function sets properties of a single control associated with an audio line.

    VB4-32,5,6
    Declare Function mixerSetControlDetails Lib "winmm.dll" Alias "mixerSetControlDetails" (ByVal hmxobj As Long, pmxcd As MIXERCONTROLDETAILS, ByVal fdwDetails As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · hmxobj
    Handle of the mixer device object for which properties are being set.

    · pmxcd
    Address of a MIXERCONTROLDETAILS structure. This structure is used to reference control detail structures that contain the desired state for the control.

    · fdwDetails
    Flags for setting properties for a control. The following values are defined:
    MIXER_OBJECTF_AUX
    The hmxobj parameter is an auxiliary device identifier in the range of zero to one less than the number of devices returned by the auxGetNumDevs function.
    MIXER_OBJECTF_HMIDIIN
    The hmxobj parameter is the handle of a MIDI input device. This handle must have been returned by the midiInOpen function.
    MIXER_OBJECTF_HMIDIOUT
    The hmxobj parameter is the handle of a MIDI output device. This handle must have been returned by the midiOutOpen function.
    MIXER_OBJECTF_HMIXER
    The hmxobj parameter is a mixer device handle returned by the mixerOpen function. This flag is optional.
    MIXER_OBJECTF_HWAVEIN
    The hmxobj parameter is a waveform-audio input handle returned by the waveInOpen function.
    MIXER_OBJECTF_HWAVEOUT
    The hmxobj parameter is a waveform-audio output handle returned by the waveOutOpen function.
    MIXER_OBJECTF_MIDIIN
    The hmxobj parameter is the identifier of a MIDI input device. This identifier must be in the range of zero to one less than the number of devices returned by the midiInGetNumDevs function.
    MIXER_OBJECTF_MIDIOUT
    The hmxobj parameter is the identifier of a MIDI output device. This identifier must be in the range of zero to one less than the number of devices returned by the midiOutGetNumDevs function.
    MIXER_OBJECTF_MIXER
    The hmxobj parameter is a mixer device identifier in the range of zero to one less than the number of devices returned by the mixerGetNumDevs function. This flag is optional.
    MIXER_OBJECTF_WAVEIN
    The hmxobj parameter is the identifier of a waveform-audio input device in the range of zero to one less than the number of devices returned by the waveInGetNumDevs function.
    MIXER_OBJECTF_WAVEOUT
    The hmxobj parameter is the identifier of a waveform-audio output device in the range of zero to one less than the number of devices returned by the waveOutGetNumDevs function.
    MIXER_SETCONTROLDETAILSF_CUSTOM
    A custom dialog box for the specified custom mixer control is displayed. The mixer device gathers the required information from the user and returns the data in the specified buffer. The handle for the owning window is specified in the hwndOwner member of the MIXERCONTROLDETAILS structure. (This handle can be set to NULL.) The application can then save the data from the dialog box and use it later to reset the control to the same state by using the MIXER_SETCONTROLDETAILSF_VALUE flag.
    MIXER_SETCONTROLDETAILSF_VALUE
    The current value(s) for a control are set. The paDetails member of the MIXERCONTROLDETAILS structure points to one or more mixer-control details structures of the appropriate class for the control.

    Return Values
    Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following:
    MIXERR_INVALCONTROL
    The control reference is invalid.

    MMSYSERR_BADDEVICEID
    The hmxobj parameter specifies an invalid device identifier.

    MMSYSERR_INVALFLAG
    One or more flags are invalid.

    MMSYSERR_INVALHANDLE
    The hmxobj parameter specifies an invalid handle.

    MMSYSERR_INVALPARAM
    One or more parameters are invalid.

    MMSYSERR_NODRIVER
    No mixer device is available for the object specified by hmxobj.

    Tuesday, June 12, 2007 5:53 PM
  • mmioAscend

    The mmioAscend function ascends out of a chunk in a RIFF file descended into with the mmioDescend function or created with the mmioCreateChunk function.

    VB4-32,5,6
    Declare Function mmioAscend Lib "winmm.dll" Alias "mmioAscend" (ByVal hmmio As Long, lpck As MMCKINFO, ByVal uFlags As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · hmmio
    File handle of an open RIFF file.

    · lpck
    Address of an application-defined MMCKINFO structure previously filled by the mmioDescend or mmioCreateChunk function.

    · wFlags
    Reserved; must be zero.

    Return Values
    Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following:
    MMIOERR_CANNOTSEEK
    There was an error while seeking to the end of the chunk.

    MMIOERR_CANNOTWRITE
    The contents of the buffer could not be written to disk.
    Tuesday, June 12, 2007 5:54 PM
  • mmioClose

    The mmioClose function closes a file that was opened by using the mmioOpen function.

    VB4-32,5,6
    Declare Function mmioClose Lib "winmm.dll" Alias "mmioClose" (ByVal hmmio As Long, ByVal uFlags As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · hmmio
    File handle of the file to close.

    · wFlags
    Flags for the close operation. The following value is defined:
    MMIO_FHOPEN
    If the file was opened by passing a file handle whose type is not HMMIO, using this flag tells the mmioClose function to close the multimedia file handle, but not the standard file handle.

    Return Values
    Returns zero if successful or an error otherwise. The error value can originate from the mmioFlush function or from the I/O procedure. Possible error values include the following:
    MMIOERR_CANNOTWRITE
    The contents of the buffer could not be written to disk.
    Tuesday, June 12, 2007 5:54 PM
  • mmioDescend

    The mmioDescend function descends into a chunk of a RIFF file that was opened by using the mmioOpen function. It can also search for a given chunk.

    VB4-32,5,6
    Declare Function mmioDescend Lib "winmm.dll" Alias "mmioDescend" (ByVal hmmio As Long, lpck As MMCKINFO, lpckParent As MMCKINFO, ByVal uFlags As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · hmmio
    File handle of an open RIFF file.

    · lpck
    Address an application-defined MMCKINFO structure.

    · lpckParent
    Address of an optional application-defined MMCKINFO structure identifying the parent of the chunk being searched for. If this parameter is not NULL, mmioDescend assumes the MMCKINFO structure it refers to was filled when mmioDescend was called to descend into the parent chunk, and mmioDescend searches for a chunk within the parent chunk. Set this parameter to NULL if no parent chunk is being specified.

    · wFlags
    Search flags. If no flags are specified, mmioDescend descends into the chunk beginning at the current file position. The following values are defined:
    MMIO_FINDCHUNK
    Searches for a chunk with the specified chunk identifier.
    MMIO_FINDLIST
    Searches for a chunk with the chunk identifier “LIST” and with the specified form type.
    MMIO_FINDRIFF
    Searches for a chunk with the chunk identifier “RIFF” and with the specified form type.

    Return Values
    Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following:
    MMIOERR_CHUNKNOTFOUND
    The end of the file (or the end of the parent chunk, if given) was reached before the desired chunk was found.
    Tuesday, June 12, 2007 5:55 PM
  • mmioOpen

    The mmioOpen function opens a file for unbuffered or buffered I/O. The file can be a standard file, a memory file, or an element of a custom storage system. The handle returned by mmioOpen is not a standard file handle; do not use it with any file I/O functions other than multimedia file I/O functions.

    VB4-32,5,6
    Declare Function mmioOpen Lib "winmm.dll" Alias "mmioOpenA" (ByVal szFileName As String, lpmmioinfo As MMIOINFO, ByVal dwOpenFlags As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · szFilename
    Address of a string containing the filename of the file to open. If no I/O procedure is specified to open the file, the filename determines how the file is opened, as follows:
    · If the filename does not contain a plus sign (+), it is assumed to be the name of a standard file (that is, a file whose type is not HMMIO).
    · If the filename is of the form EXAMPLE.EXT+ABC, the extension EXT is assumed to identify an installed I/O procedure which is called to perform I/O on the file. For more information, see mmioInstallIOProc.
    · If the filename is NULL and no I/O procedure is given, the adwInfo member of the MMIOINFO structure is assumed to be the standard (non-HMMIO) file handle of a currently open file.
    The filename should not be longer than 128 bytes, including the terminating NULL character.
    When opening a memory file, set szFilename to NULL.

    · lpmmioinfo
    Address of an MMIOINFO structure containing extra parameters used by mmioOpen. Unless you are opening a memory file, specifying the size of a buffer for buffered I/O, or specifying an uninstalled I/O procedure to open a file, this parameter should be NULL. If this parameter is not NULL, all unused members of the MMIOINFO structure it references must be set to zero, including the reserved members.

    · dwOpenFlags
    Flags for the open operation. The MMIO_READ, MMIO_WRITE, and MMIO_READWRITE flags are mutually exclusive ¾ only one should be specified. The MMIO_COMPAT, MMIO_EXCLUSIVE, MMIO_DENYWRITE, MMIO_DENYREAD, and MMIO_DENYNONE flags are file-sharing flags. The following values are defined:
    MMIO_ALLOCBUF
    Opens a file for buffered I/O. To allocate a buffer larger or smaller than the default buffer size (8K, defined as MMIO_DEFAULTBUFFER), set the cchBuffer member of the MMIOINFO structure to the desired buffer size. If cchBuffer is zero, the default buffer size is used. If you are providing your own I/O buffer, this flag should not be used.
    MMIO_COMPAT
    Opens the file with compatibility mode, allowing any process on a given machine to open the file any number of times. If the file has been opened with any of the other sharing modes, mmioOpen fails.
    MMIO_CREATE
    Creates a new file. If the file already exists, it is truncated to zero length. For memory files, this flag indicates the end of the file is initially at the start of the buffer.
    MMIO_DELETE
    Deletes a file. If this flag is specified, szFilename should not be NULL. The return value is TRUE (cast to HMMIO) if the file was deleted successfully or FALSE otherwise. Do not call the mmioClose function for a file that has been deleted. If this flag is specified, all other flags that open files are ignored.
    MMIO_DENYNONE
    Opens the file without denying other processes read or write access to the file. If the file has been opened in compatibility mode by any other process, mmioOpen fails.
    MMIO_DENYREAD
    Opens the file and denies other processes read access to the file. If the file has been opened in compatibility mode or for read access by any other process, mmioOpen fails.
    MMIO_DENYWRITE
    Opens the file and denies other processes write access to the file. If the file has been opened in compatibility mode or for write access by any other process, mmioOpen fails.
    MMIO_EXCLUSIVE
    Opens the file and denies other processes read and write access to the file. If the file has been opened in any other mode for read or write access, even by the current process, mmioOpen fails.
    MMIO_EXIST
    Determines whether the specified file exists and creates a fully qualified filename from the path specified in szFilename. The filename is placed back into szFilename. The return value is TRUE (cast to HMMIO) if the qualification was successful and the file exists or FALSE otherwise. The file is not opened, and the function does not return a valid multimedia file I/O file handle, so do not attempt to close the file.
    MMIO_GETTEMP
    Creates a temporary filename, optionally using the parameters passed in szFilename. For example, you can specify “C:F” to create a temporary file residing on drive C, starting with letter “F”. The resulting filename is placed in the buffer pointed to by szFilename. The return value is MMSYSERR_NOERROR (cast to HMMIO) if the temporary filename was created successfully or MMIOERR_FILENOTFOUND otherwise. The file is not opened, and the function does not return a valid multimedia file I/O file handle, so do not attempt to close the file. This flag overrides all other flags.
    MMIO_PARSE
    Creates a fully qualified filename from the path specified in szFilename. The filename is placed back into szFilename. The return value is TRUE (cast to HMMIO) if the qualification was successful or FALSE otherwise. The file is not opened, and the function does not return a valid multimedia file I/O file handle, so do not attempt to close the file. If this flag is specified, all flags that open files are ignored.
    MMIO_READ
    Opens the file for reading only. This is the default if MMIO_WRITE and MMIO_READWRITE are not specified.
    MMIO_READWRITE
    Opens the file for reading and writing.
    MMIO_WRITE
    Opens the file for writing only.

    Return Values
    Returns a handle of the opened file. If the file cannot be opened, the return value is NULL. If lpmmioinfo is not NULL, the wErrorRet member of the MMIOINFO structure will contain one of the following error values:
    MMIOERR_ACCESSDENIED
    The file is protected and cannot be opened.

    MMIOERR_INVALIDFILE
    Another failure condition occurred. This is the default error for an open-file failure.

    MMIOERR_NETWORKERROR
    The network is not responding to the request to open a remote file.

    MMIOERR_PATHNOTFOUND
    The directory specification is incorrect.

    MMIOERR_SHARINGVIOLATION
    The file is being used by another application and is unavailable.

    MMIOERR_TOOMANYOPENFILES
    The number of files simultaneously open is at a maximum level. The system has run out of available file handles.
    Tuesday, June 12, 2007 5:56 PM
  • mmioRead

    The mmioRead function reads a specified number of bytes from a file opened by using the mmioOpen function.

    VB4-32,5,6
    Declare Function mmioRead Lib "winmm.dll" Alias "mmioRead" (ByVal hmmio As Long, ByVal pch As String, ByVal cch As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · hmmio
    File handle of the file to be read.

    · pch
    Address of a buffer to contain the data read from the file.

    · cch
    Number of bytes to read from the file.

    Return Values
    Returns the number of bytes actually read. If the end of the file has been reached and no more bytes can be read, the return value is 0. If there is an error reading from the file, the return value is - 1.
    Tuesday, June 12, 2007 5:56 PM
  • mmioSeek

    The mmioSeek function changes the current file position in a file opened by using the mmioOpen function.

    VB4-32,5,6
    Declare Function mmioSeek Lib "winmm.dll" Alias "mmioSeek" (ByVal hmmio As Long, ByVal lOffset As Long, ByVal iOrigin As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · hmmio
    File handle of the file to seek in.

    · lOffset
    Offset to change the file position.

    · iOrigin
    Flags indicating how the offset specified by lOffset is interpreted. The following values are defined:
    SEEK_CUR
    Seeks to lOffset bytes from the current file position.
    SEEK_END
    Seeks to lOffset bytes from the end of the file.
    SEEK_SET
    Seeks to lOffset bytes from the beginning of the file.

    Return Values
    Returns the new file position, in bytes, relative to the beginning of the file. If there is an error, the return value is - 1.

    Tuesday, June 12, 2007 5:58 PM
  • TabbedTextOut

    The TabbedTextOut function writes a character string at a specified location, expanding tabs to the values specified in an array of tab-stop positions. Text is written in the currently selected font.

    VB4-32,5,6
    Declare Function TabbedTextOut Lib "user32" Alias "TabbedTextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long, ByVal nTabPositions As Long, lpnTabStopPositions As Long, ByVal nTabOrigin As Long) As Long

    VB.NET
    System.Drawing.Graphics.DrawString

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hDC
    Identifies the device context.

    · X
    Specifies the x-coordinate of the starting point of the string, in logical units.

    · Y
    Specifies the y-coordinate of the starting point of the string, in logical units.

    · lpString
    Points to the character string to draw. The string does not need to be zero-terminated, since nCount specifies the length of the string.

    · nCount
    Specifies the number of characters in the string.

    · nTabPositions
    Specifies the number of values in the array of tab-stop positions.

    · lpnTabStopPositions
    Points to an array containing the tab-stop positions, in device units. The tab stops must be sorted in increasing order; the smallest x-value should be the first item in the array.
    Windows 95: A tab stop can be specified as a negative value, which causes text to be right-aligned on the tab stop rather than left-aligned.

    · nTabOrigin
    Specifies the x-coordinate of the starting position from which tabs are expanded, in logical units.

    Return Values
    If the function succeeds, the return value is the dimensions, in logical units, of the string. The height is in the high-order word and the width is in the low-order word.
    Tuesday, June 12, 2007 5:59 PM
  • mmioStringToFOURCC

    The mmioStringToFOURCC function converts a null-terminated string to a four-character code.

    VB4-32,5,6
    Declare Function mmioStringToFOURCC Lib "winmm.dll" Alias "mmioStringToFOURCCA" (ByVal sz As String, ByVal uFlags As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · sz
    Address of a null-terminated string to convert to a four-character code.

    · wFlags
    Flags for the conversion. The following value is defined:
    MMIO_TOUPPER
    Converts all characters to uppercase.

    Return Values
    Returns the four-character code created from the given string.
    Tuesday, June 12, 2007 5:59 PM
  • tapiRequestMakeCall

    The tapiRequestMakeCall function requests the establishment of a voice call. A call-manager application is responsible for establishing the call on behalf of the requesting application, which is then controlled by the user's call-manager application.

    VB4-32,5,6
    Declare Function tapiRequestMakeCall Lib "TAPI32.DLL" (ByVal Dest As String, ByVal AppName As String, ByVal CalledParty As String, ByVal Comment As String) As Long

    Operating Systems Supported
    Requires Windows NT 4.0 SP3 or later; Requires Windows 95 or later

    Library
    Tapi32

    Parameter Information
    · lpszDestAddress
    A pointer to a memory location where the null-terminated destination address of the call request is located. The address can use the canonical address format. Validity of the specified address is not checked by this operation. The maximum length of the address is TAPIMAXDESTADDRESSSIZE characters, which includes the NULL terminator.

    · lpszAppName
    A pointer to a memory location where the null-terminated user-friendly application name of the call request is located. This pointer can be left NULL if the application does not supply an application name. The maximum length of the address is TAPIMAXAPPNAMESIZE characters, which includes the NULL terminator. Longer strings are truncated.

    · lpszCalledParty
    A pointer to a memory location where the null-terminated called party name for the called party of the call is located. This pointer can be left NULL if the application does not wish to supply this information. The maximum length of the string is TAPIMAXCALLEDPARTYSIZE characters, which includes the NULL terminator. Longer strings are truncated.

    · lpszComment
    A pointer to a memory location where the null-terminated comment about the call is located. This pointer can be left NULL if the application does not supply a comment. The maximum length of the address is TAPIMAXCOMMENTSIZE characters, which includes the NULL terminator. Longer strings are truncated.

    Return Values
    Returns zero if the request succeeds or a negative error number if an error occurs. Possible error return value are:

    TAPIERR_NOREQUESTRECIPIENT, TAPIERR_INVALDESTADDRESS, TAPIERR_REQUESTQUEUEFULL, TAPIERR_INVALPOINTER.
    Tuesday, June 12, 2007 5:59 PM
  • ModifyMenu

    The ModifyMenu function changes an existing menu item. This function is used to specify the content, appearance, and behavior of the menu item.

    VB4-32,5,6
    Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpString As Any) As Long

    VB.NET
    System.Windows.Forms.Menu.MenuItems()

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hMnu
    Identifies the menu to be changed.

    · uPosition
    Specifies the menu item to be changed, as determined by the uFlags parameter.

    · uFlags
    Specifies flags that control the interpretation of the uPosition parameter and the content, appearance, and behavior of the menu item. This parameter must be a combination of one of the following required values and at least one of the values listed in the following Remarks section.
    MF_BYCOMMAND
    Indicates that the uPosition parameter gives the identifier of the menu item. The MF_BYCOMMAND flag is the default if neither the MF_BYCOMMAND nor MF_BYPOSITION flag is specified.
    MF_BYPOSITION
    Indicates that the uPosition parameter gives the zero-based relative position of the menu item.

    · uIDNewItem
    Specifies either the identifier of the modified menu item or, if the uFlags parameter has the MF_POPUP flag set, the handle of the drop-down menu or submenu.

    · lpNewItem
    Points to the content of the changed menu item. The interpretation of this parameter depends on whether the uFlags parameter includes the MF_BITMAP, MF_OWNERDRAW, or MF_STRING flag.
    MF_BITMAP
    Contains a bitmap handle.
    MF_OWNERDRAW
    Contains a 32-bit value supplied by an application that is used to maintain additional data related to the menu item. The value is in the itemData member of the structure pointed to by the lparam parameter of the WM_MEASUREITEM or WM_DRAWITEM messages sent when the menu item is created or its appearance is updated.
    MF_STRING
    Contains a pointer to a null-terminated string (the default).

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.

    Tuesday, June 12, 2007 6:00 PM
  • TerminateProcess

    The TerminateProcess function terminates the specified process and all of its threads.

    VB4-32,5,6
    Declare Function TerminateProcess Lib "kernel32" Alias "TerminateProcess" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long

    VB.NET
    System.Diagnostics.Process.Kill

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Kernel32

    Parameter Information
    · hProcess
    Identifies the process to terminate.
    Windows NT: The handle must have PROCESS_TERMINATE access. For more information, see Process Objects.

    · uExitCode
    Specifies the exit code for the process and for all threads terminated as a result of this call. Use the GetExitCodeProcess function to retrieve the process’s exit value. Use the GetExitCodeThread function to retrieve a thread’s exit value.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Tuesday, June 12, 2007 6:01 PM
  • extOut

    The TextOut function writes a character string at the specified location, using the currently selected font.

    VB4-32,5,6
    Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount As Long) As Long

    VB.NET
    System.Drawing.Graphics.DrawString

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Gdi32

    Parameter Information
    · hdc
    Identifies the device context.

    · nXStart
    Specifies the logical x-coordinate of the reference point that Windows uses to align the string.

    · nYStart
    Specifies the logical y-coordinate of the reference point that Windows uses to align the string.

    · lpString
    Points to the string to be drawn. The string does not need to be zero-terminated, since cbString specifies the length of the string.

    · cbString
    Specifies the number of characters in the string.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Tuesday, June 12, 2007 6:02 PM
  • timeGetTime

    The timeGetTime function retrieves the system time, in milliseconds. The system time is the time elapsed since Windows was started.

    VB4-32,5,6
    Private Declare Function timeGetTime Lib "winmm.dll" () As Long

    VB.NET
    System.DateTime.Now

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Return Values
    Returns the system time, in milliseconds.
    Tuesday, June 12, 2007 6:03 PM
  • timeKillEvent

    The timeKillEvent function cancels a specified timer event.

    VB4-32,5,6
    Declare Function timeKillEvent Lib "winmm.dll" (ByVal uID As Long) As Long

    VB.NET
    System.Threading.Timer.Dispose

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · uTimerID
    Identifier of the timer event to cancel. This identifier was returned by the timeSetEvent function when the timer event was set up.

    Return Values
    Returns TIMERR_NOERROR if successful or MMSYSERR_INVALPARAM if the specified timer event does not exist.
    Tuesday, June 12, 2007 6:03 PM
  • timeSetEvent

    The timeSetEvent function starts a specified timer event. The multimedia timer runs in its own thread. After the event is activated, it calls the specified callback function or sets or pulses the specified event object.

    VB4-32,5,6
    Declare Function timeSetEvent Lib "winmm.dll" (ByVal uDelay As Long, ByVal uResolution As Long, ByVal lpFunction As Long, ByVal dwUser As Long, ByVal uFlags As Long) As Long

    VB.NET
    System.Threading.Timer

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    Winmm

    Parameter Information
    · uDelay
    Event delay, in milliseconds. If this value is not in the range of the minimum and maximum event delays supported by the timer, the function returns an error.

    · uResolution
    Resolution of the timer event, in milliseconds. The resolution increases with smaller values; a resolution of 0 indicates periodic events should occur with the greatest possible accuracy. To reduce system overhead, however, you should use the maximum value appropriate for your application.

    · lpTimeProc
    Address of a callback function that is called once upon expiration of a single event or periodically upon expiration of periodic events. If fuEvent specifies the TIME_CALLBACK_EVENT_SET or TIME_CALLBACK_EVENT_PULSE flag, then the lpTimeProc parameter is interpreted as a handle to an event object. The event will be set or pulsed upon completion of a single event or periodically upon completion of periodic events.

    · dwUser
    User-supplied callback data.

    · fuEvent
    Timer event type. This parameter may include one of the following values.
    TIME_ONESHOT
    Event occurs once, after uDelay milliseconds.
    TIME_PERIODIC
    Event occurs every uDelay milliseconds.

    The fuEvent parameter may also include one of the following values:
    TIME_CALLBACK_FUNCTION
    When the timer expires, Windows calls the function pointed to by the lpTimeProc parameter. This is the default.
    TIME_CALLBACK_EVENT_SET
    When the timer expires, Windows calls theSetEvent function to set the event pointed to by the lpTimeProc parameter. The dwUser parameter is ignored.
    TIME_CALLBACK_EVENT_PULSE
    When the timer expires, Windows calls thePulseEvent function to pulse the event pointed to by the lpTimeProc parameter. The dwUser parameter is ignored.

    Return Values
    Returns an identifier for the timer event if successful or an error otherwise. This function returns NULL if it fails and the timer event was not created. (This identifier is also passed to the callback function.)
    Tuesday, June 12, 2007 6:04 PM
  • TouchFileTimes

    The TouchFileTimes function updates the date and time at which the specified file was last modified.

    VB4-32,5,6
    Declare Function TouchFileTimes Lib "imagehlp.dll" (ByVal FileHandle As Long, ByRef pSystemTime As Any) As Long

    Operating Systems Supported
    Requires Windows 2000 or later; Win9x/ME: Not supported

    Library
    Imagehlp

    Parameter Information
    · FileHandle
    [in] Handle to the file of interest.

    · pSystemTime
    [in] Pointer to a SYSTEMTIME structure. If this parameter is NULL, the current system date and time is used.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Tuesday, June 12, 2007 6:04 PM
  • TrackMouseEvent

    The TrackMouseEvent function posts messages when the mouse pointer leaves a window or hovers over a window for a specified amount of time.

    VB4-32,5,6
    Declare Function TrackMouseEvent Lib "user32" (lpEventTrack As TRACKMOUSEEVENTTYPE) As Long

    Operating Systems Supported
    Requires Windows NT 4.0 or later; Requires Windows 98 or later

    Library
    User32

    Parameter Information
    · lpEventTrack
    [in/out] Pointer to a TRACKMOUSEEVENT structure that contains tracking information.

    Return Values
    If the function succeeds, the return value is nonzero .

    If the function fails, return value is zero. To get extended error information, call GetLastError.

    The messages that the function can post are the following:
    WM_MOUSEHOVER
    The mouse hovered over the client area of the window for the period of time specified in a prior call to TrackMouseEvent. Hover tracking stops when this message is generated. The application must call TrackMouseEvent again if it requires further tracking of mouse hover behavior.

    WM_MOUSELEAVE
    The mouse left the client area of the window specified in a prior call to TrackMouseEvent. All tracking requested by TrackMouseEvent is canceled when this message is generated. The application must call TrackMouseEvent when the mouse re-enters its window if it requires further tracking of mouse hover behavior.
    Tuesday, June 12, 2007 6:05 PM
  • TrackMouseEvent2

    The _TrackMouseEvent function posts messages when the mouse pointer leaves a window or hovers over a window for a specified amount of time. This function calls TrackMouseEvent if it exists, otherwise it emulates it.

    VB4-32,5,6
    Declare Function TrackMouseEvent2 Lib "comctl32" Alias "_TrackMouseEvent" (lpEventTrack As TRACKMOUSEEVENTTYPE) As Long

    Operating Systems Supported
    Requires Windows 2000 or later (or Windows NT 4.0 with Internet Explorer 3.0 or later); Requires Windows 98/Me (or Windows 95 with Internet Explorer 3.0 or later)

    Library
    Comctl32

    Parameter Information
    · lpEventTrack
    [in/out] Pointer to a TRACKMOUSEEVENT structure that contains tracking information.

    Return Values
    If the function succeeds, the return value is nonzero .

    If the function fails, return value is zero. To get extended error information, call GetLastError.

    The function can post the following messages.
    WM_NCMOUSEHOVER Windows 98, Windows 2000: The same meaning as WM_MOUSEHOVER except this is for the nonclient area of the window.
    WM_NCMOUSELEAVE Windows 98, Windows 2000: The same meaning as WM_MOUSELEAVE except this is for the nonclient area of the window.
    WM_MOUSEHOVER The mouse hovered over the client area of the window for the period of time specified in a prior call to TrackMouseEvent. Hover tracking stops when this message is generated. The application must call TrackMouseEvent again if it requires further tracking of mouse hover behavior.
    WM_MOUSELEAVE The mouse left the client area of the window specified in a prior call to TrackMouseEvent. All tracking requested by TrackMouseEvent is canceled when this message is generated. The application must call TrackMouseEvent when the mouse reenters its window if it requires further tracking of mouse hover behavior.
    Tuesday, June 12, 2007 6:05 PM
  • TrackPopupMenu

    The TrackPopupMenu function displays a shortcut menu at the specified location and tracks the selection of items on the menu.

    VB4-32,5,6
    Declare Function TrackPopupMenu Lib "user32" Alias "TrackPopupMenu" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal x As Long, ByVal y As Long, ByVal nReserved As Long, ByVal hwnd As Long, lprc As Rect) As Long

    VB.NET
    System.Windows.Forms.ContextMenu.Show

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hMenu
    Identifies the shortcut menu to be displayed. The handle can be obtained by calling CreatePopupMenu to create a new shortcut menu, or by calling GetSubMenu to retrieve the handle of a submenu associated with an existing menu item.

    · uFlags
    A set of bit flags that specify function options.
    Use one of the following bit flag constants to specify how the function positions the shortcut menu horizontally.
    TPM_CENTERALIGN
    If this flag is set, the function centers the shortcut menu horizontally relative to the coordinate specified by the x parameter.
    TPM_LEFTALIGN
    If this flag is set, the function positions the shortcut menu so that its left side is aligned with the coordinate specified by the x parameter.
    TPM_RIGHTALIGN
    Positions the shortcut menu so that its right side is aligned with the coordinate specified by the x parameter.

    Use one of the following bit flag constants to specify how the function positions the shortcut menu vertically.
    TPM_BOTTOMALIGN
    If this flag is set, the function positions the shortcut menu so that its bottom side is aligned with the coordinate specified by the y parameter.
    TPM_TOPALIGN
    If this flag is set, the function positions the shortcut menu so that its top side is aligned with the coordinate specified by the y parameter.
    TPM_VCENTERALIGN
    If this flag is set, the function centers the shortcut menu vertically relative to the coordinate specified by the y parameter.

    Use the following bit flag constants to determine the user selection without having to set up a parent window for the menu.
    TPM_NONOTIFY
    If this flag is set, the function does not send notification messages when the user clicks on a menu item.
    TPM_RETURNCMD
    If this flag is set, the function returns the menu item identifier of the user's selection in the return value.

    Use one of the following bit flag constants to specify which mouse button the shortcut menu tracks.
    TPM_LEFTBUTTON
    If this flag is set, the shortcut menu tracks the left mouse button.
    TPM_RIGHTBUTTON
    If this flag is set, the shortcut menu tracks the right mouse button

    Windows 98/Me, Windows 2000 or later: Use any reasonable combination of the following flags to modify the animation of a menu. For example, by selecting a horizontal and a vertical flag you can achieve diagonal animation.
    TPM_HORNEGANIMATION
    Animates the menu from right to left.
    TPM_HORPOSANIMATION
    Animates the menu from left to right.
    TPM_NOANIMATION
    Displays menu without animation.
    TPM_VERNEGANIMATION
    Animates the menu from bottom to top.
    TPM_VERPOSANIMATION
    Animates the menu from top to bottom.

    · x
    Specifies the horizontal location of the shortcut menu, in screen coordinates.

    · y
    Specifies the vertical location of the shortcut menu, in screen coordinates.

    · nReserved
    Reserved; must be zero.

    · hWnd
    Identifies the window that owns the shortcut menu. This window receives all messages from the menu. The window does not receive a WM_COMMAND message from the menu until the function returns.
    If you specify TPM_NONOTIFY in the uFlags parameter, the function does not send messages to the window identified by hWnd. However, you must still pass a window handle in hWnd. It can be any window handle from your application.

    · prcRect
    Points to a RECT structure that specifies the portion of the screen in which the user can select without dismissing the shortcut menu. If this parameter is NULL, the shortcut menu is dismissed if the user clicks outside the shortcut menu.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.

    If you specify TPM_RETURNCMD in the uFlags parameter, the return value is the menu-item identifier of the item selected. If no item is selected, the return value is zero.
    Tuesday, June 12, 2007 6:06 PM
  • TrackPopupMenuEx

    The TrackPopupMenuEx function displays a shortcut menu at the specified location and tracks the selection of items on the shortcut menu. The shortcut menu can appear anywhere on the screen.

    VB4-32,5,6
    Declare Function TrackPopupMenuEx Lib "user32" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal x As Long, ByVal y As Long, ByVal HWnd As Long, ByVal lptpm As Any) As Long

    VB.NET
    System.Windows.Forms.ContextMenu.Show

    Operating Systems Supported
    Requires Windows NT 4.0 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hmenu
    [in] Handle to the shortcut menu to be displayed. This handle can be obtained by calling the CreatePopupMenu function to create a new shortcut menu or by calling the GetSubMenu function to retrieve a handle to a submenu associated with an existing menu item.

    ? fuFlags
    [in] Specifies function options.
    Use one of the following flags to specify how the function positions the shortcut menu horizontally.
    TPM_CENTERALIGN
    If this flag is set, the function centers the shortcut menu horizontally relative to the coordinate specified by the x parameter.
    TPM_LEFTALIGN
    If this flag is set, the function positions the shortcut menu so that its left side is aligned with the coordinate specified by the x parameter.
    TPM_RIGHTALIGN
    Positions the shortcut menu so that its right side is aligned with the coordinate specified by the x parameter.

    Use one of the following flags to specify how the function positions the shortcut menu vertically.
    TPM_BOTTOMALIGN
    If this flag is set, the function positions the shortcut menu so that its bottom side is aligned with the coordinate specified by the y parameter.
    TPM_TOPALIGN
    If this flag is set, the function positions the shortcut menu so that its top side is aligned with the coordinate specified by the y parameter.
    TPM_VCENTERALIGN
    If this flag is set, the function centers the shortcut menu vertically relative to the coordinate specified by the y parameter.

    Use the following flags to determine the user selection without having to set up a parent window for the menu.
    TPM_NONOTIFY
    If this flag is set, the function does not send notification messages when the user clicks on a menu item.
    TPM_RETURNCMD
    If this flag is set, the function returns the menu item identifier of the user's selection in the return value.

    Use one of the following flags to specify which mouse button the shortcut menu tracks.
    TPM_LEFTBUTTON
    If this flag is set, the user can select menu items with only the left mouse button.
    TPM_RIGHTBUTTON
    If this flag is set, the user can select menu items with both the left and right mouse buttons.

    Windows 98/Me, Windows 2000/XP: Use any reasonable combination of the following flags to modify the animation of a menu. For example, by selecting a horizontal and a vertical flag you can achieve diagonal animation.
    TPM_HORNEGANIMATION
    Animates the menu from left to right.
    TPM_HORPOSANIMATION
    Animates the menu from right to left.
    TPM_NOANIMATION
    Displays menu without animation.
    TPM_VERNEGANIMATION
    Animates the menu from bottom to top.
    TPM_VERPOSANIMATION
    Animates the menu from top to bottom.

    For any animation to occur, the SystemParametersInfo function must set SPI_SETMENUANIMATION. Also, all the TPM_*ANIMATION flags, except TPM_NOANIMATION, are ignored if menu fade animation is on, See the SPI_GETMENUFADE flag in SystemParametersInfo.

    Windows 98/Me, Windows 2000/XP: Use the TPM_RECURSE flag to display a menu when another menu is already displayed. This is intended to support context menus within a menu.

    Use one of the following flags to specify whether to accommodate horizontal or vertical alignment.
    TPM_HORIZONTAL
    If the menu cannot be shown at the specified location without overlapping the excluded rectangle, the system tries to accommodate the requested horizontal alignment before the requested vertical alignment.
    TPM_VERTICAL
    If the menu cannot be shown at the specified location without overlapping the excluded rectangle, the system tries to accommodate the requested vertical alignment before the requested horizontal alignment.

    The excluded rectangle is a portion of the screen that the menu should not overlap; it is specified by lptpm.

    Windows XP: To have text layout from right-to-left, use TPM_LAYOUTRTL. By default, the text layout is left-to-right.

    · x
    [in] Horizontal location of the shortcut menu, in screen coordinates.

    · y
    [in] Vertical location of the shortcut menu, in screen coordinates.

    · hwnd
    [in] Handle to the window that owns the shortcut menu. This window receives all messages from the menu. The window does not receive a WM_COMMAND message from the menu until the function returns.
    If you specify TPM_NONOTIFY in the fuFlags parameter, the function does not send messages to the window identified by hwnd. However, you still have to pass a window handle in hwnd. It can be any window handle from your application.

    · lptpm
    [in] Pointer to a TPMPARAMS structure that specifies an area of the screen the menu should not overlap. This parameter can be NULL.

    Return Values
    If you specify TPM_RETURNCMD in the fuFlags parameter, the return value is the menu-item identifier of the item that the user selected. If the user cancels the menu without making a selection, or if an error occurs, then the return value is zero.

    If you do not specify TPM_RETURNCMD in the fuFlags parameter, the return value is nonzero if the function succeeds and zero if it fails. To get extended error information, call GetLastError.
    Tuesday, June 12, 2007 6:06 PM
  • TrackPopupMenuEx

    The TrackPopupMenuEx function displays a shortcut menu at the specified location and tracks the selection of items on the shortcut menu. The shortcut menu can appear anywhere on the screen.

    VB4-32,5,6
    Declare Function TrackPopupMenuEx Lib "user32" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal x As Long, ByVal y As Long, ByVal HWnd As Long, ByVal lptpm As Any) As Long

    VB.NET
    System.Windows.Forms.ContextMenu.Show

    Operating Systems Supported
    Requires Windows NT 4.0 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hmenu
    [in] Handle to the shortcut menu to be displayed. This handle can be obtained by calling the CreatePopupMenu function to create a new shortcut menu or by calling the GetSubMenu function to retrieve a handle to a submenu associated with an existing menu item.

    ? fuFlags
    [in] Specifies function options.
    Use one of the following flags to specify how the function positions the shortcut menu horizontally.
    TPM_CENTERALIGN
    If this flag is set, the function centers the shortcut menu horizontally relative to the coordinate specified by the x parameter.
    TPM_LEFTALIGN
    If this flag is set, the function positions the shortcut menu so that its left side is aligned with the coordinate specified by the x parameter.
    TPM_RIGHTALIGN
    Positions the shortcut menu so that its right side is aligned with the coordinate specified by the x parameter.

    Use one of the following flags to specify how the function positions the shortcut menu vertically.
    TPM_BOTTOMALIGN
    If this flag is set, the function positions the shortcut menu so that its bottom side is aligned with the coordinate specified by the y parameter.
    TPM_TOPALIGN
    If this flag is set, the function positions the shortcut menu so that its top side is aligned with the coordinate specified by the y parameter.
    TPM_VCENTERALIGN
    If this flag is set, the function centers the shortcut menu vertically relative to the coordinate specified by the y parameter.

    Use the following flags to determine the user selection without having to set up a parent window for the menu.
    TPM_NONOTIFY
    If this flag is set, the function does not send notification messages when the user clicks on a menu item.
    TPM_RETURNCMD
    If this flag is set, the function returns the menu item identifier of the user's selection in the return value.

    Use one of the following flags to specify which mouse button the shortcut menu tracks.
    TPM_LEFTBUTTON
    If this flag is set, the user can select menu items with only the left mouse button.
    TPM_RIGHTBUTTON
    If this flag is set, the user can select menu items with both the left and right mouse buttons.

    Windows 98/Me, Windows 2000/XP: Use any reasonable combination of the following flags to modify the animation of a menu. For example, by selecting a horizontal and a vertical flag you can achieve diagonal animation.
    TPM_HORNEGANIMATION
    Animates the menu from left to right.
    TPM_HORPOSANIMATION
    Animates the menu from right to left.
    TPM_NOANIMATION
    Displays menu without animation.
    TPM_VERNEGANIMATION
    Animates the menu from bottom to top.
    TPM_VERPOSANIMATION
    Animates the menu from top to bottom.

    For any animation to occur, the SystemParametersInfo function must set SPI_SETMENUANIMATION. Also, all the TPM_*ANIMATION flags, except TPM_NOANIMATION, are ignored if menu fade animation is on, See the SPI_GETMENUFADE flag in SystemParametersInfo.

    Windows 98/Me, Windows 2000/XP: Use the TPM_RECURSE flag to display a menu when another menu is already displayed. This is intended to support context menus within a menu.

    Use one of the following flags to specify whether to accommodate horizontal or vertical alignment.
    TPM_HORIZONTAL
    If the menu cannot be shown at the specified location without overlapping the excluded rectangle, the system tries to accommodate the requested horizontal alignment before the requested vertical alignment.
    TPM_VERTICAL
    If the menu cannot be shown at the specified location without overlapping the excluded rectangle, the system tries to accommodate the requested vertical alignment before the requested horizontal alignment.

    The excluded rectangle is a portion of the screen that the menu should not overlap; it is specified by lptpm.

    Windows XP: To have text layout from right-to-left, use TPM_LAYOUTRTL. By default, the text layout is left-to-right.

    · x
    [in] Horizontal location of the shortcut menu, in screen coordinates.

    · y
    [in] Vertical location of the shortcut menu, in screen coordinates.

    · hwnd
    [in] Handle to the window that owns the shortcut menu. This window receives all messages from the menu. The window does not receive a WM_COMMAND message from the menu until the function returns.
    If you specify TPM_NONOTIFY in the fuFlags parameter, the function does not send messages to the window identified by hwnd. However, you still have to pass a window handle in hwnd. It can be any window handle from your application.

    · lptpm
    [in] Pointer to a TPMPARAMS structure that specifies an area of the screen the menu should not overlap. This parameter can be NULL.

    Return Values
    If you specify TPM_RETURNCMD in the fuFlags parameter, the return value is the menu-item identifier of the item that the user selected. If the user cancels the menu without making a selection, or if an error occurs, then the return value is zero.

    If you do not specify TPM_RETURNCMD in the fuFlags parameter, the return value is nonzero if the function succeeds and zero if it fails. To get extended error information, call GetLastError.
    Tuesday, June 12, 2007 6:07 PM
  • TranslateColor

    Converts an OLE_COLOR type to an RGB color.

    VB4-32,5,6
    Declare Function TranslateColor Lib "olepro32.dll" Alias "OleTranslateColor" (ByVal clr As OLE_COLOR, ByVal palet As Long, col As Long) As Long

    Operating Systems Supported
    Requires Windows NT 4.0 or later; Requires Windows 95 or later

    Library
    Olepro32

    Parameter Information
    · clr
    [in] The OLE color to be converted into a COLORREF.

    · hpal
    [in] Palette used as a basis for the conversion.

    · pcolorref
    [out] Pointer to the caller's variable that receives the converted COLORREF result. This can be NULL, indicating that the caller wants only to verify that a converted color exists.

    Return Values
    This function supports the standard return values E_INVALIDARG and E_UNEXPECTED, as well as the following:
    S_OK
    The color was translated successfully.
    Tuesday, June 12, 2007 6:08 PM
  • TranslateMessage

    The TranslateMessage function translates virtual-key messages into character messages. The character messages are posted to the calling thread’s message queue, to be read the next time the thread calls the GetMessage or PeekMessage function.

    VB4-32,5,6
    Declare Function TranslateMessage Lib "user32" Alias "TranslateMessage" (lpMsg As MSG) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · lpMsg
    Points to an MSG structure that contains message information retrieved from the calling thread’s message queue by using the GetMessage or PeekMessage function.

    Return Values
    If the message is translated (that is, a character message is posted to the thread’s message queue), the return value is nonzero.

    If the message is not translated (that is, a character message is not posted to the thread’s message queue), the return value is zero.

    Windows NT: The TranslateMessage function returns a nonzero value for function and arrow keys as well as for character and digit keys.
    Tuesday, June 12, 2007 6:08 PM
  • TransparentBlt

    The TransparentBlt function performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device context into a destination device context.

    VB4-32,5,6
    Declare Function TransparentBlt Lib "msimg32.dll" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal crTransparent As Long) As Boolean

    Operating Systems Supported
    Requires Windows 2000 or later; Requires Windows 98 or later

    Library
    Msimg32

    Parameter Information
    · hdcDest
    [in] Handle to the destination device context.

    · nXOriginDest
    [in] Specifies the x-coordinate, in logical units, of the upper-left corner of the destination rectangle.

    · nYOriginDest
    [in] Specifies the y-coordinate, in logical units, of the upper-left corner of the destination rectangle.

    · nWidthDest
    [in] Specifies the width, in logical units, of the destination rectangle.

    · hHeightDest
    [in] Handle to the height, in logical units, of the destination rectangle.

    · hdcSrc
    [in] Handle to the source device context.

    · nXOriginSrc
    [in] Specifies the x-coordinate, in logical units, of the source rectangle.

    · nYOriginSrc
    [in] Specifies the y-coordinate, in logical units, of the source rectangle.

    · nWidthSrc
    [in] Specifies the width, in logical units, of the source rectangle.

    · nHeightSrc
    [in] Specifies the height, in logical units, of the source rectangle.

    · crTransparent
    [in] The RGB color in the source bitmap to treat as transparent.

    Return Values
    If the function succeeds, the return value is TRUE.

    If the function fails, the return value is FALSE.

    Windows NT/ 2000: To get extended error information, call GetLastError.
    Tuesday, June 12, 2007 6:09 PM
  • UnhookWindowsHookEx

    The UnhookWindowsHookEx function removes a hook procedure installed in a hook chain by the SetWindowsHookEx function.

    VB4-32,5,6
    Declare Function UnhookWindowsHookEx Lib "user32" Alias "UnhookWindowsHookEx" (ByVal hHook As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hhk
    Identifies the hook to be removed. This parameter is a hook handle obtained by a previous call to SetWindowsHookEx.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Tuesday, June 12, 2007 6:10 PM
  • UninitializeFlatSB

    Uninitializes flat scroll bars for a particular window. The specified window will revert to having standard scroll bars.

    VB4-32,5,6
    Declare Function UninitializeFlatSB Lib "comctl32" (ByVal hWnd As Long) As Long

    Operating Systems Supported
    Windows 2000 (or Windows NT 4.0 with Internet Explorer 4.0 or later); Windows 98 (or Windows 95 with Internet Explorer 4.0 or later)

    Library
    Comctl32

    Parameter Information
    · hwnd
    Handle to the window with the flat scroll bars that will be uninitialized.

    Return Values
    Returns one of the following values: E_FAIL One of the window's scroll bars is currently in use. The operation cannot be completed at this time.
    S_FALSE The window doesn't have flat scroll bars initialized.
    S_OK The operation was successful.
    Tuesday, June 12, 2007 6:10 PM
  • UnregisterClass

    The UnregisterClass function removes a window class, freeing the memory required for the class.

    VB4-32,5,6
    Declare Function UnregisterClass Lib "user32" Alias "UnregisterClassA" (ByVal lpClassName As String, ByVal hInstance As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · lpClassName
    Points to a null-terminated string or is an integer atom. If lpClassName is a string, it specifies the window class name. This class name must have been registered by a previous call to the RegisterClass function. System global classes, such as dialog box controls, cannot be unregistered.
    If this parameter is an integer atom, it must be a global atom created by a previous call to the RegisterClass function. The atom, a 16-bit value less than 0xC000, must be in the low-order word of lpClassName; the high-order word must be zero.

    · hInstance
    Identifies the instance of the module that created the class.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the class could not be found or if a window still exists that was created with the class, the return value is zero. To get extended error information, call GetLastError.
    Tuesday, June 12, 2007 6:11 PM
  • UnionRect

    The UnionRect function creates the union of two rectangles. The union is the smallest rectangle that contains both source rectangles.

    VB4-32,5,6
    Declare Function UnionRect Lib "user32" Alias "UnionRect" (lpDestRect As RECT, lpSrc1Rect As RECT, lpSrc2Rect As RECT) As Long

    VB.NET
    System.Drawing.Rectangle.Union

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · lprcDst
    Points to the RECT structure that will receive a rectangle containing the rectangles pointed to by the lprcSrc1 and lprcSrc2 parameters.

    · lprcSrc1
    Points to the RECT structure that contains the first source rectangle.

    · lprcSrc2
    Points to the RECT structure that contains the second source rectangle.

    Return Values
    If the specified structure contains a nonempty rectangle, the return value is nonzero.

    If the specified structure does not contain a nonempty rectangle, the return value is zero. To get extended error information, call GetLastError.
    Tuesday, June 12, 2007 6:12 PM
  • UnregisterHotKey

    The UnregisterHotKey function frees a hot key previously registered by the calling thread.

    VB4-32,5,6
    Declare Function UnregisterHotKey Lib "user32" Alias "UnregisterHotKey" (ByVal hwnd As Long, ByVal id As Long) As Long

    Operating Systems Supported
    Requires Windows NT 3.1 or later; Requires Windows 95 or later

    Library
    User32

    Parameter Information
    · hWnd
    Identifies the window associated with the hot key to be freed. This parameter should be NULL if the hot key is not associated with a window.

    · id
    Specifies the identifier of the hot key to be freed.

    Return Values
    If the function succeeds, the return value is nonzero.

    If the function fails, the return value is zero. To get extended error information, call GetLastError.
    Tuesday, June 12, 2007 6:12 PM
  • URLDownloadToFile

    Downloads bits from the Internet and saves them to a file.

    VB4-32,5,6
    Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

    Operating Systems Supported
    Requires Windows NT 4.0 or later; Requires Windows 95 or later

    Library
    Urlmon

    Parameter Information
    · pCaller
    Address of the controlling IUnknown interface of the calling Microsoft® ActiveX® component (if the caller is an ActiveX component). If the calling application is not an ActiveX component, this value can be set to NULL. Otherwise, the caller is a Component Object Model (COM) object that is contained in another component (such as an ActiveX control within the context of an HTML page). This parameter represents the outermost IUnknown of the calling component. The function attempts the download within the context of the ActiveX client framework and allows the caller's container to receive callbacks on the progress of the download.

    · szURL
    Address of a string value containing the URL to be downloaded. Cannot be set to NULL.

    · szFileName
    Address of a string value containing the name of the file to create for bits that come from the download.

    · dwReserved
    Reserved. Must be zero.

    · lpfnCB
    Address of the caller's IBindStatusCallback interface. URLDownloadToFile calls this interface's IBindStatusCallback:SurprisenProgress method on a connection activity, including the arrival of data. IBindStatusCallback:SurprisenDataAvailable is never called. Implementing IBindStatusCallback:SurprisenProgress allows a caller to implement a user interface or other progress monitoring functionality. It also allows the download operation to be canceled by returning E_