How to auto start an AVI in Visual Basic Classic

Code with C | Programming: Projects & Source Codes Forums Visual Basic Classic How to auto start an AVI in Visual Basic Classic

This topic contains 1 reply, has 1 voice, and was last updated by  Abhey 3 years, 8 months ago.

  • Author
    Posts
  • #7715

    Maxim6m0cj
    Member

    How to auto start an AVI in Visual Basic Classic

  • #7716

    Abhey
    Member

    I can’t help with the avi control but here’s how to position the mouse and force a double-click. (from MSDN)
    First Abstract
    This article explains how to position the mouse pointer over a specific control in a Microsoft® Visual Basic® application.
    Positioning the Mouse Pointer
    Sometimes you may need to position the mouse pointer over a specific control in a Microsoft® Visual Basic® application, even though that control does not have the current focus.
    To position the mouse pointer over a specific control, you need to use the Microsoft Windows® application programming interface (API) GetWindowRect and SetCursorPos functions. The GetWindowRect function is used to retrieve the coordinates of a control. The Declare statement for the GetWindowRect function is:

    Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect
    As RECT) As Long

    The GetWindowRect function requires two arguments. The first argument is the handle of the control. The second argument is the address of a RECT structure.
    After calling the GetWindowRect function, the control's coordinates are stored in the RECT structure. The RECT structure is defined as:

    Note that the left, top, right, and bottom positions of the control are stored in the RECT structure. After you know the exact position of the control, you need to use the SetCursorPos function to position the mouse pointer directly over the control. The Declare statement for the SetCursorPos function is:

    Then, to position the mouse pointer over the control, you retrieve the coordinates of the control's upper-left corner by using the values stored in the Left field and Top field of the RECT structure. Next, you call the SetCursorPos function with these two values to actually position the mouse pointer over the control.
    Example Program
    This program shows how to move the mouse pointer over a specific control.
    1.Create a new project in Visual Basic. Form1 is created by default.
    2.Add the following Declare statements to the General Declarations section of Form1 (note that each Declare statement must be typed as a single line of code):

    3.Add the following code to the Form_Load event for Form1:

    4.Add a Command Button control to Form1. Command1 is created by default. Set its Default property to False.
    5.Add a second Command Button control to Form1. Command2 is created by default. Set its Default property to True.
    6.From the Visual Basic Insert menu, select Module to create a new module. Module1.Bas is created by default.
    7.Add the following Type structure to Module1.Bas:

    3.Add the following code to the Form_Load event for Form1:

    4. Add a Text Box control to Form1. Text1 is created by default.
    5. Add a Directory List Box control to Form1. Dir1 is created by default.
    6. Add the following code to the Dir1_KeyPress event for Dir1:

    Run the example program by pressing F5. The Directory List Box control displays a list of directories found on your hard drive. The name of the default directory appears in the Text Box control.

    Select a directory from the Directory List Box control by pressing the first letter of the directory name or by clicking the directory name. Press ENTER. The currently selected directory is now the default directory.

You must be logged in to reply to this topic.