Registrato: Aug 04, 2006 Messaggi: 419 Località: Vicenza
Inviato: Mar Gen 06, 2009 19.05 Oggetto: Visual basic per inviare macro verso Falcon AF
Vorrei fare una domanda.
Stiamo cercando attraverso Visual Basic di interfacciare dei PIC per inviare delle macro al simulatore.
Come primo passo vogliamo vedere se compilando un piccolo programma in Visual Basic è possibile inviare al PC delle combinazioni di tasti che corrispondano a delle macro riconosciute da Falcon.
Se ad esempio diciamo al programma in VB di simulare l'invio della lettera G, osserviamo su un blocco note aperto l'effettiva comparsa della lettera "G".... e lo stesso vale per altre combinazioni di tasti e macro..
Il punto è che la stessa sequenza di tasti indirizzata via VB non sortisce nessun effetto su Falcon....
Sarà mica che VB non è adatto a Falcon o che Falcon non può ricevere input da VB???
O c'è qualche file strano da editare???
Vi prego aiutatemi.
Grazie.
Allora sto facendo delle prove proprio in questi giorni per il mio pit per falcon,non ho avuto grandi risultati,motivo perchè non ho il secondo pc per provare(al momento senza alimentatore).
Se hai la pazienza posso aiutarti ma mi ci vogliono un paio di settimane per risolvere dei problemi.
Ti lascio questi link dove ne parlano.
io avevo fatto un proggetto ma non riesco a trovarlo e mi funzionava bene!!!
Registrato: Aug 04, 2006 Messaggi: 419 Località: Vicenza
Inviato: Mar Gen 06, 2009 22.37 Oggetto:
Dunque, vediamo....
Ho la fortuna di avere un collaboratore esperto in programmazione che voleva avventurarsi nella programmazione di microcontroller tramite delle routines di VB.
Quindi il programmino lo stiamo, anzi lo stà scrivendo.
Io sebbene conosca abbastanza bene MFS non conosco molto Falcon, quindi non posso aiutarlo molto...
Oggi aveva compilato un programma di "eventi", ove ogni 2 secondi simulava la combinazione di uno o più tasti....
Lanciava questo programmino di eventi e sul notepad le letterine venivano a mano a mano scritte....
Con MFS tutto a posto, carrello e luci che si attivavano che erano una bellezza!!
Ma con Falcon niente.
Il programma parte e si vede che stà generando combinazioni di tasti ma quelle combinazioni che se digitate direttamente dalla tastiera azionano dei comandi in Falcon, non hanno effetti se generate dal software.
Cosa stiamo sbagliando???
Spero che presto si possa approfondire l'argomento direttamente con lui.
Per quanto riguarda il tempo, no problem.
Io stò approntando il mio pit, quindi non ho nessuna fretta.
In che senso il progetto di Spinter, funzionava bene??
Ho la fortuna di avere un collaboratore esperto in programmazione che voleva avventurarsi nella programmazione di microcontroller tramite delle routines di VB.
questo dovrei essere io anche se esperto non lo sono, in quanto autodidatta in VB.Net
Piccolo progettista elettronico, più che altro per hobby, per una serie di fortunate coincidenze mi trovo ad avere alcuni dei miei progetti (non inerenti alla costruzione di cockpit) in sintonia con Firefox.
E vi spiego anche meglio cosa intendo precisamente:
1. Comunicazione tra un'interfaccia a microcontrollore (PIC) ed il computer (Visual Basic)
2. Comunicazione tra l'interfaccia HW connessa al pc, con altre (indefinite) periferiche "figlie"
3. Possibilità di fare interagire i miei programmi in Visual Basic con altri programmi esterni, in particolare tramite "macro" da tastiera.
« firefox » ha scritto:
Quindi il programmino lo stiamo, anzi lo stà scrivendo.
Io sebbene conosca abbastanza bene MFS non conosco molto Falcon, quindi non posso aiutarlo molto...
Oggi aveva compilato un programma di "eventi", ove ogni 2 secondi simulava la combinazione di uno o più tasti....
Lanciava questo programmino di eventi e sul notepad le letterine venivano a mano a mano scritte....
Con MFS tutto a posto, carrello e luci che si attivavano che erano una bellezza!!
Ma con Falcon niente.
Il programma parte e si vede che stà generando combinazioni di tasti ma quelle combinazioni che se digitate direttamente dalla tastiera azionano dei comandi in Falcon, non hanno effetti se generate dal software.
Cosa stiamo sbagliando???
Spero che presto si possa approfondire l'argomento direttamente con lui.
A questo proposito siamo nel punto 3, quindi cerco di spiegare meglio i miei test.
Utilizzo VB.NET, parte di Visual Studio 2008, quindi l'ultima versione del linguaggio Basic.net.
Qui è implementata una funzione "SENDKEY" che mi permette di inviare un tasto come se fosse stato premuto da tastiera, ma Microsoft stessa, nelle guide online, spiega chiaramente che NON E' come premere i tasti da tastiera.
Ecco spiegato il fatto che sul blocco note i caratteri apparivano, su FS i comandi funzionano (ovvio, FS è Microsoft!) mentre altri programmi come Falcon (che interessa a Firefox) o Dragon Naturally Speaking (che interessa a me) non ricevono queste combinazioni.
Più precisamente, la mia prova è stata di inviare, con pause di due secondi, sequenze semplici e/o complesse di tasti, da una singola "g" per muovere il carrello, a tasti macro come CTRL-E che se non ricordo male è l'avvio dei motori in FS2004.
« Spinter » ha scritto:
Allora sto facendo delle prove proprio in questi giorni per il mio pit per falcon,non ho avuto grandi risultati,motivo perchè non ho il secondo pc per provare(al momento senza alimentatore).
Se hai la pazienza posso aiutarti ma mi ci vogliono un paio di settimane per risolvere dei problemi.
Ti lascio questi link dove ne parlano.
io avevo fatto un proggetto ma non riesco a trovarlo e mi funzionava bene!!!
il primo parametro indica il tasto da premere (qui una lista dei tasti "speciali" http://msdn.microsoft.com/en-us/library/ms645540.aspx )
il secondo l'ho sempre usato a 0 e nn ricordo il significato
il terzo è l'azione tipo rilascia
il quarto pure lui non lo ricordo e anche lui l'ho sempre lasciato a 0
spero vi possa servire un pochino... _________________
Esist
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Threading;
namespace LightningSamples
{
public class KeyAndMouseUtils
{
internal enum INPUT_TYPE : uint
{
INPUT_MOUSE = 0,
INPUT_KEYBOARD = 1,
INPUT_HARDWARE = 2,
}
[Flags()]
internal enum KEYEVENTF : uint
{
EXTENDEDKEY = 0x0001,
KEYUP = 0x0002,
UNICODE = 0x0004,
SCANCODE = 0x0008,
}
internal enum MAPVK_MAPTYPES : uint
{
MAPVK_VK_TO_VSC = 0x0,
MAPVK_VSC_TO_VK = 0x1,
MAPVK_VK_TO_CHAR = 0x2,
MAPVK_VSC_TO_VK_EX = 0x3,
MAPVK_VK_TO_VSC_EX = 0x4,
}
[Flags()]
internal enum MOUSEEVENTF : uint
{
MOVE = 0x0001, // mouse move
LEFTDOWN = 0x0002, // left button down
LEFTUP = 0x0004, // left button up
RIGHTDOWN = 0x0008, // right button down
RIGHTUP = 0x0010, // right button up
MIDDLEDOWN = 0x0020, // middle button down
MIDDLEUP = 0x0040, // middle button up
XDOWN = 0x0080, // x button down
XUP = 0x0100, // x button down
WHEEL = 0x0800, // wheel button rolled
VIRTUALDESK = 0x4000, // map to entire virtual desktop
ABSOLUTE = 0x8000, // absolute move
}
[StructLayout(LayoutKind.Sequential)]
internal struct MOUSEINPUT
{
public int dx;
public int dy;
public uint mouseData;
public MOUSEEVENTF dwFlags;
public uint time;
public UIntPtr dwExtraInfo;
}
[StructLayout(LayoutKind.Sequential)]
internal struct HARDWAREINPUT
{
public uint uMsg;
public ushort wParamL;
public ushort wParamH;
}
[StructLayout(LayoutKind.Sequential)]
internal struct KEYBDINPUT
{
public ushort wVk;
public ushort wScan;
public KEYEVENTF dwFlags;
public uint time;
public IntPtr dwExtraInfo;
}
[StructLayout(LayoutKind.Explicit)]
internal struct INPUT
{
[FieldOffset(0)]
public INPUT_TYPE type;
[FieldOffset(4)]
public MOUSEINPUT mi;
[FieldOffset(4)]
public KEYBDINPUT ki;
[FieldOffset(4)]
public HARDWAREINPUT hi;
}
/// <summary>
///Moves the mouse to the given relative (x,y) coordinates.
/// </summary>
public static void MouseMoveRelative(int x, int y)
{
int cur_x = Cursor.Position.X;
int cur_y = Cursor.Position.Y;
int new_x = cur_x + x;
int new_y = cur_y + y;
MouseMoveAbsolute(new_x, new_y);
}
/// <summary>
///Moves the mouse to the given absolute (x,y) coordinates.
/// </summary>
public static void MouseMoveAbsolute(int x, int y)
{
x = x * 65535 / Screen.PrimaryScreen.Bounds.Width;
y = y * 65535 / Screen.PrimaryScreen.Bounds.Height;
SendMouseInput((MOUSEEVENTF.ABSOLUTE | MOUSEEVENTF.MOVE), (uint)x, (uint)y, (uint)0, UIntPtr.Zero);
}
/// <summary>
///Moves the mouse wheel by given amount.
/// </summary>
public static void MouseWheelMove(int amount)
{
SendMouseInput(MOUSEEVENTF.WHEEL, (uint)0, (uint)0, (uint)amount, UIntPtr.Zero);
}
/// <summary>
///Sends a left mouse button up event at the current cursor position.
/// </summary>
public static void LeftUp()
{
SendMouseInput(MOUSEEVENTF.LEFTUP, 0, 0, 0, UIntPtr.Zero);
}
/// <summary>
///Sends a right mouse button up event at the current cursor position.
/// </summary>
public static void RightUp()
{
SendMouseInput(MOUSEEVENTF.RIGHTUP, 0, 0, 0, UIntPtr.Zero);
}
/// <summary>
///Sends a middle mouse button up event at the current cursor position.
/// </summary>
public static void MiddleUp()
{
SendMouseInput(MOUSEEVENTF.MIDDLEUP, 0, 0, 0, UIntPtr.Zero);
}
/// <summary>
///Sends a middle mouse button down event at the current cursor position.
/// </summary>
public static void MiddleDown()
{
SendMouseInput(MOUSEEVENTF.MIDDLEDOWN, 0, 0, 0, UIntPtr.Zero);
}
/// <summary>
///Sends a right mouse button down event at the current cursor position.
/// </summary>
public static void RightDown()
{
SendMouseInput(MOUSEEVENTF.RIGHTDOWN, 0, 0, 0, UIntPtr.Zero);
}
/// <summary>
///Sends a left mouse button down event at the current cursor position.
/// </summary>
public static void LeftDown()
{
SendMouseInput(MOUSEEVENTF.LEFTDOWN, 0, 0, 0, UIntPtr.Zero);
}
/// <summary>
///Sends a middle mouse button double click at the current cursor position.
/// </summary>
public static void MiddleDoubleClick()
{
SendMouseInput(MOUSEEVENTF.MIDDLEDOWN, 0, 0, 0, UIntPtr.Zero);
Thread.Sleep(100);
SendMouseInput(MOUSEEVENTF.MIDDLEUP, 0, 0, 0, UIntPtr.Zero);
Thread.Sleep(100);
SendMouseInput(MOUSEEVENTF.MIDDLEDOWN, 0, 0, 0, UIntPtr.Zero);
Thread.Sleep(100);
SendMouseInput(MOUSEEVENTF.MIDDLEUP, 0, 0, 0, UIntPtr.Zero);
Thread.Sleep(100);
}
/// <summary>
///Sends a right mouse button double click at the current cursor position.
/// </summary>
public static void RightDoubleClick()
{
SendMouseInput(MOUSEEVENTF.RIGHTDOWN, 0, 0, 0, UIntPtr.Zero);
Thread.Sleep(100);
SendMouseInput(MOUSEEVENTF.RIGHTUP, 0, 0, 0, UIntPtr.Zero);
Thread.Sleep(100);
SendMouseInput(MOUSEEVENTF.RIGHTDOWN, 0, 0, 0, UIntPtr.Zero);
Thread.Sleep(100);
SendMouseInput(MOUSEEVENTF.RIGHTUP, 0, 0, 0, UIntPtr.Zero);
Thread.Sleep(100);
}
/// <summary>
///Sends a left mouse button double click at the current cursor position.
/// </summary>
public static void LeftDoubleClick()
{
SendMouseInput(MOUSEEVENTF.LEFTDOWN, 0, 0, 0, UIntPtr.Zero);
Thread.Sleep(100);
SendMouseInput(MOUSEEVENTF.LEFTUP, 0, 0, 0, UIntPtr.Zero);
Thread.Sleep(100);
SendMouseInput(MOUSEEVENTF.LEFTDOWN, 0, 0, 0, UIntPtr.Zero);
Thread.Sleep(100);
SendMouseInput(MOUSEEVENTF.LEFTUP, 0, 0, 0, UIntPtr.Zero);
Thread.Sleep(100);
}
/// <summary>
///Sends a right mouse button click at the current cursor position.
/// </summary>
public static void RightClick()
{
SendMouseInput(MOUSEEVENTF.RIGHTDOWN, 0, 0, 0, UIntPtr.Zero);
Thread.Sleep(100);
SendMouseInput(MOUSEEVENTF.RIGHTUP, 0, 0, 0, UIntPtr.Zero);
Thread.Sleep(100);
}
/// <summary>
///Sends a left mouse button click at the current cursor position.
/// </summary>
public static void LeftClick()
{
SendMouseInput(MOUSEEVENTF.LEFTDOWN, 0, 0, 0, UIntPtr.Zero);
Thread.Sleep(100);
SendMouseInput(MOUSEEVENTF.LEFTUP, 0, 0, 0, UIntPtr.Zero);
Thread.Sleep(100);
}
/// <summary>
///Sends a middle mouse button click at the current cursor position.
/// </summary>
public static void MiddleClick()
{
SendMouseInput(MOUSEEVENTF.MIDDLEDOWN, 0, 0, 0, UIntPtr.Zero);
Thread.Sleep(100);
SendMouseInput(MOUSEEVENTF.MIDDLEUP, 0, 0, 0, UIntPtr.Zero);
Thread.Sleep(100);
}
}
}
Questo codice scritto in C basterebbe capirci qualchecosa di C ,io sto provando!!!
esatto, questo è quello che sto tentando di utilizzare!
ho fatto una prova veloce e pare funzionare con programmi "non-microsoft", ora ho quasi finito un programma di test da far provare a firefox con Falcon, ci dirà lui i risultati
esatto, questo è quello che sto tentando di utilizzare!
ho fatto una prova veloce e pare funzionare con programmi "non-microsoft", ora ho quasi finito un programma di test da far provare a firefox con Falcon, ci dirà lui i risultati
esatto, questo è quello che sto tentando di utilizzare!
ho fatto una prova veloce e pare funzionare con programmi "non-microsoft", ora ho quasi finito un programma di test da far provare a firefox con Falcon, ci dirà lui i risultati
Public Class KeyAndMouseUtils
Friend Enum INPUT_TYPE As UInteger
INPUT_MOUSE = 0
INPUT_KEYBOARD = 1
INPUT_HARDWARE = 2
End Enum
<Flags()> _
Friend Enum KEYEVENTF As UInteger
EXTENDEDKEY = &H1
KEYUP = &H2
UNICODE = &H4
SCANCODE = &H8
End Enum
Friend Enum MAPVK_MAPTYPES As UInteger
MAPVK_VK_TO_VSC = &H0
MAPVK_VSC_TO_VK = &H1
MAPVK_VK_TO_CHAR = &H2
MAPVK_VSC_TO_VK_EX = &H3
MAPVK_VK_TO_VSC_EX = &H4
End Enum
<Flags()> _
Friend Enum MOUSEEVENTF As UInteger
'&H1
'0x1
hit = &H2
MOVE = &H1
' mouse move
LEFTDOWN = &H2
' left button down
LEFTUP = &H4
' left button up
RIGHTDOWN = &H8
' right button down
RIGHTUP = &H10
' right button up
MIDDLEDOWN = &H20
' middle button down
MIDDLEUP = &H40
' middle button up
XDOWN = &H80
' x button down
XUP = &H100
' x button down
WHEEL = &H800
' wheel button rolled
VIRTUALDESK = &H4000
' map to entire virtual desktop
ABSOLUTE = &H8000
End Enum
' absolute move
<StructLayout(LayoutKind.Sequential)> _
Friend Structure MOUSEINPUT
Public dx As Integer
Public dy As Integer
Public mouseData As UInteger
Public dwFlags As MOUSEEVENTF
Public time As UInteger
Public dwExtraInfo As UIntPtr
End Structure
<StructLayout(LayoutKind.Sequential)> _
Friend Structure HARDWAREINPUT
Public uMsg As UInteger
Public wParamL As UShort
Public wParamH As UShort
End Structure
<StructLayout(LayoutKind.Sequential)> _
Friend Structure KEYBDINPUT
Public wVk As UShort
Public wScan As UShort
Public dwFlags As KEYEVENTF
Public time As UInteger
Public dwExtraInfo As IntPtr
End Structure
<StructLayout(LayoutKind.Explicit)> _
Friend Structure INPUT
<FieldOffset(0)> _
Public type As INPUT_TYPE
<FieldOffset(4)> _
Public mi As MOUSEINPUT
<FieldOffset(4)> _
Public ki As KEYBDINPUT
<FieldOffset(4)> _
Public hi As HARDWAREINPUT
End Structure
<DllImport("user32.dll", CallingConvention:=CallingConvention.StdCall, CharSet:=CharSet.Unicode, EntryPoint:="MapVirtualKey", SetLastError:=False)> _
Friend Shared Function MapVirtualKey(ByVal uCode As UInteger, ByVal uMapType As MAPVK_MAPTYPES) As UInteger
End Function
<DllImport("user32.dll")> _
Friend Shared Function GetMessageExtraInfo() As IntPtr
End Function
<DllImport("user32.dll", SetLastError:=True)> _
Friend Shared Function SendInput(ByVal nInputs As UInteger, ByVal pInputs As INPUT(), ByVal cbSize As Integer) As UInteger
End Function
<DllImportAttribute("User32.dll", SetLastError:=True)> _
Friend Shared Function FindWindow(ByVal ClassName As String, ByVal WindowName As String) As IntPtr
End Function
<DllImportAttribute("User32.dll", SetLastError:=True)> _
Friend Shared Function SetForegroundWindow(ByVal hWnd As IntPtr) As Boolean
End Function
<DllImport("user32.dll")> _
Private Shared Sub keybd_event(ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As UInteger, ByVal dwExtraInfo As UIntPtr)
End Sub
Friend Shared Sub SendMouseInput(ByVal dwFlags As MOUSEEVENTF, ByVal dx As UInteger, ByVal dy As UInteger, ByVal dwData As UInteger, ByVal dwExtraInfo As UIntPtr)
Dim input As New INPUT()
input.mi = New MOUSEINPUT()
input.type = INPUT_TYPE.INPUT_MOUSE
input.mi.dwFlags = dwFlags
input.mi.dx = CInt(dx)
input.mi.dy = CInt(dy)
input.mi.mouseData = dwData
input.mi.time = 0
input.mi.dwExtraInfo = dwExtraInfo
SendInput(1, New INPUT() {input}, Marshal.SizeOf(GetType(INPUT)))
End Sub
Public Shared Sub SendKeyInput(ByVal keys__1 As Keys, ByVal press As Boolean, ByVal release As Boolean)
If Not press AndAlso Not release Then
Exit Sub
End If
Dim numInputs As Integer = 0
If press AndAlso release Then
numInputs = 2
Else
numInputs = 1
End If
Dim inputs As INPUT() = New INPUT(numInputs - 1) {}
Dim curInput As Integer = 0
If press Then
Dim input As New INPUT()
input.ki = New KEYBDINPUT()
Dim scanCode As UShort = CUShort(MapVirtualKey(CUInt((keys__1 And Keys.KeyCode)), MAPVK_MAPTYPES.MAPVK_VK_TO_VSC))
input.ki.wScan = scanCode
input.ki.time = 0
input.ki.dwFlags = KEYEVENTF.SCANCODE
If (CInt((keys__1 And Keys.KeyCode)) And &HE000) > 0 Then
input.ki.dwFlags = input.ki.dwFlags Or KEYEVENTF.EXTENDEDKEY
End If
input.ki.dwExtraInfo = GetMessageExtraInfo()
input.type = INPUT_TYPE.INPUT_KEYBOARD
inputs(curInput) = input
curInput += 1
End If
If release Then
Dim input As New INPUT()
input.ki = New KEYBDINPUT()
Dim scanCode As UShort = CUShort(MapVirtualKey(CUInt((keys__1 And Keys.KeyCode)), MAPVK_MAPTYPES.MAPVK_VK_TO_VSC))
input.ki.wScan = scanCode
input.ki.time = 0
input.ki.dwFlags = (KEYEVENTF.KEYUP Or KEYEVENTF.SCANCODE)
If (CInt((keys__1 And Keys.KeyCode)) And &HE000) > 0 Then
input.ki.dwFlags = input.ki.dwFlags Or KEYEVENTF.EXTENDEDKEY
End If
input.ki.dwExtraInfo = GetMessageExtraInfo()
input.type = INPUT_TYPE.INPUT_KEYBOARD
inputs(curInput) = input
End If
SendInput(CUInt(numInputs), inputs, Marshal.SizeOf(GetType(INPUT)))
End Sub
Public Shared Sub SendKeyInputToFalcon(ByVal keys As Keys, ByVal press As Boolean, ByVal release As Boolean)
Dim falconWindow As IntPtr = FindWindow("FalconDisplay", Nothing)
SetForegroundWindow(falconWindow)
SendKeyInputToFalcon(keys, press, release)
End Sub
''' <summary>
'''Moves the mouse to the given relative (x,y) coordinates.
''' </summary>
Public Shared Sub MouseMoveRelative(ByVal x As Integer, ByVal y As Integer)
Dim cur_x As Integer = Cursor.Position.X
Dim cur_y As Integer = Cursor.Position.Y
Dim new_x As Integer = cur_x + x
Dim new_y As Integer = cur_y + y
MouseMoveAbsolute(new_x, new_y)
End Sub
''' <summary>
'''Moves the mouse to the given absolute (x,y) coordinates.
''' </summary>
Public Shared Sub MouseMoveAbsolute(ByVal x As Integer, ByVal y As Integer)
x = x * 65535 / Screen.PrimaryScreen.Bounds.Width
y = y * 65535 / Screen.PrimaryScreen.Bounds.Height
SendMouseInput((MOUSEEVENTF.ABSOLUTE Or MOUSEEVENTF.MOVE), CUInt(x), CUInt(y), CUInt(0), UIntPtr.Zero)
End Sub
''' <summary>
'''Moves the mouse wheel by given amount.
''' </summary>
Public Shared Sub MouseWheelMove(ByVal amount As Integer)
SendMouseInput(MOUSEEVENTF.WHEEL, CUInt(0), CUInt(0), CUInt(amount), UIntPtr.Zero)
End Sub
''' <summary>
'''Sends a left mouse button up event at the current cursor position.
''' </summary>
Public Shared Sub LeftUp()
SendMouseInput(MOUSEEVENTF.LEFTUP, 0, 0, 0, UIntPtr.Zero)
End Sub
''' <summary>
'''Sends a right mouse button up event at the current cursor position.
''' </summary>
Public Shared Sub RightUp()
SendMouseInput(MOUSEEVENTF.RIGHTUP, 0, 0, 0, UIntPtr.Zero)
End Sub
''' <summary>
'''Sends a middle mouse button up event at the current cursor position.
''' </summary>
Public Shared Sub MiddleUp()
SendMouseInput(MOUSEEVENTF.MIDDLEUP, 0, 0, 0, UIntPtr.Zero)
End Sub
''' <summary>
'''Sends a middle mouse button down event at the current cursor position.
''' </summary>
Public Shared Sub MiddleDown()
SendMouseInput(MOUSEEVENTF.MIDDLEDOWN, 0, 0, 0, UIntPtr.Zero)
End Sub
''' <summary>
'''Sends a right mouse button down event at the current cursor position.
''' </summary>
Public Shared Sub RightDown()
SendMouseInput(MOUSEEVENTF.RIGHTDOWN, 0, 0, 0, UIntPtr.Zero)
End Sub
''' <summary>
'''Sends a left mouse button down event at the current cursor position.
''' </summary>
Public Shared Sub LeftDown()
SendMouseInput(MOUSEEVENTF.LEFTDOWN, 0, 0, 0, UIntPtr.Zero)
End Sub
''' <summary>
'''Sends a middle mouse button double click at the current cursor position.
''' </summary>
Public Shared Sub MiddleDoubleClick()
SendMouseInput(MOUSEEVENTF.MIDDLEDOWN, 0, 0, 0, UIntPtr.Zero)
Thread.Sleep(100)
SendMouseInput(MOUSEEVENTF.MIDDLEUP, 0, 0, 0, UIntPtr.Zero)
Thread.Sleep(100)
SendMouseInput(MOUSEEVENTF.MIDDLEDOWN, 0, 0, 0, UIntPtr.Zero)
Thread.Sleep(100)
SendMouseInput(MOUSEEVENTF.MIDDLEUP, 0, 0, 0, UIntPtr.Zero)
Thread.Sleep(100)
End Sub
''' <summary>
'''Sends a right mouse button double click at the current cursor position.
''' </summary>
Public Shared Sub RightDoubleClick()
SendMouseInput(MOUSEEVENTF.RIGHTDOWN, 0, 0, 0, UIntPtr.Zero)
Thread.Sleep(100)
SendMouseInput(MOUSEEVENTF.RIGHTUP, 0, 0, 0, UIntPtr.Zero)
Thread.Sleep(100)
SendMouseInput(MOUSEEVENTF.RIGHTDOWN, 0, 0, 0, UIntPtr.Zero)
Thread.Sleep(100)
SendMouseInput(MOUSEEVENTF.RIGHTUP, 0, 0, 0, UIntPtr.Zero)
Thread.Sleep(100)
End Sub
''' <summary>
'''Sends a left mouse button double click at the current cursor position.
''' </summary>
Public Shared Sub LeftDoubleClick()
SendMouseInput(MOUSEEVENTF.LEFTDOWN, 0, 0, 0, UIntPtr.Zero)
Thread.Sleep(100)
SendMouseInput(MOUSEEVENTF.LEFTUP, 0, 0, 0, UIntPtr.Zero)
Thread.Sleep(100)
SendMouseInput(MOUSEEVENTF.LEFTDOWN, 0, 0, 0, UIntPtr.Zero)
Thread.Sleep(100)
SendMouseInput(MOUSEEVENTF.LEFTUP, 0, 0, 0, UIntPtr.Zero)
Thread.Sleep(100)
End Sub
''' <summary>
'''Sends a right mouse button click at the current cursor position.
''' </summary>
Public Shared Sub RightClick()
SendMouseInput(MOUSEEVENTF.RIGHTDOWN, 0, 0, 0, UIntPtr.Zero)
Thread.Sleep(100)
SendMouseInput(MOUSEEVENTF.RIGHTUP, 0, 0, 0, UIntPtr.Zero)
Thread.Sleep(100)
End Sub
''' <summary>
'''Sends a left mouse button click at the current cursor position.
''' </summary>
Public Shared Sub LeftClick()
SendMouseInput(MOUSEEVENTF.LEFTDOWN, 0, 0, 0, UIntPtr.Zero)
Thread.Sleep(100)
SendMouseInput(MOUSEEVENTF.LEFTUP, 0, 0, 0, UIntPtr.Zero)
Thread.Sleep(100)
End Sub
''' <summary>
'''Sends a middle mouse button click at the current cursor position.
''' </summary>
Public Shared Sub MiddleClick()
SendMouseInput(MOUSEEVENTF.MIDDLEDOWN, 0, 0, 0, UIntPtr.Zero)
Thread.Sleep(100)
SendMouseInput(MOUSEEVENTF.MIDDLEUP, 0, 0, 0, UIntPtr.Zero)
Thread.Sleep(100)
End Sub
Friend Shared Sub SendKeyInput()
SendKeyInput()
End Sub
End Class
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'KeyAndMouseUtils.LeftClick()
KeyAndMouseUtils.SendKeyInput(Keys.B, 1, 1)
End Sub
Tutti i fusi orari sono GMT + 1 ora Vai a pagina 1, 2Successivo
Pagina 1 di 2
Non puoi inserire nuovi Topic in questo forum Non puoi rispondere ai Topic in questo forum Non puoi modificare i tuoi messaggi in questo forum Non puoi cancellare i tuoi messaggi in questo forum Non puoi votare nei sondaggi in questo forum