EXECUTAR UM DOUBLE CLICK NO MOUSE FORA DO FORM

USUARIO.EXCLUIDOS 12/04/2004 13:00:33
#20044
Olá pessoal,

Tem como eu EXECUTAR UM DOUBLE CLICK NO MOUSE FORA DO FORM, sendo tudo executado via Código ??
Ex.:
o mouse esta sobre o icone da lixeira

quando eu executar o codigo o mouse irá dar um duplo clique e a lixeira irá abrir

Tem como ??

Obrigado
USUARIO.EXCLUIDOS 13/04/2004 16:58:33
#20360
Resposta escolhida
coloque isso num módulo:

[txt-color=blue]Private Declare Function[/txt-color] SetCursorPos [txt-color=blue]Lib[/txt-color] "USER32" ([txt-color=blue]ByVal[/txt-color] x [txt-color=blue]As Long[/txt-color], [txt-color=blue]ByVal[/txt-color] y [txt-color=blue]As Long[/txt-color]) [txt-color=blue]As Long[/txt-color] 
[txt-color=blue]Private Declare Sub[/txt-color] mouse_event [txt-color=blue]Lib[/txt-color] "USER32" _
([txt-color=blue]ByVal[/txt-color] dwFlags [txt-color=blue]As Long[/txt-color], [txt-color=blue]ByVal[/txt-color] dX [txt-color=blue]As Long[/txt-color], _
[txt-color=blue]ByVal[/txt-color] dy [txt-color=blue]As Long[/txt-color], [txt-color=blue]ByVal[/txt-color] cButtons [txt-color=blue]As Long[/txt-color], _
[txt-color=blue]ByVal[/txt-color] dwExtraInfo [txt-color=blue]As Long[/txt-color])
[txt-color=blue]Public Const[/txt-color] MOUSE_LEFT = 0
[txt-color=blue]Public Const[/txt-color] MOUSE_MIDDLE = 1
[txt-color=blue]Public Const[/txt-color] MOUSE_RIGHT = 2
[txt-color=blue]Public Sub[/txt-color] SendMausklick([txt-color=blue]ByVal[/txt-color] mButton [txt-color=blue]As Long[/txt-color])
[txt-color=blue]Const[/txt-color] MOUSEEVENTF_LEFTDOWN = &H2
[txt-color=blue]Const[/txt-color] MOUSEEVENTF_LEFTUP = &H4
[txt-color=blue]Const[/txt-color] MOUSEEVENTF_MIDDLEDOWN = &H20
[txt-color=blue]Const[/txt-color] MOUSEEVENTF_MIDDLEUP = &H40
[txt-color=blue]Const[/txt-color] MOUSEEVENTF_RIGHTDOWN = &H8
[txt-color=blue]Const[/txt-color] MOUSEEVENTF_RIGHTUP = &H10
[txt-color=blue]If[/txt-color] (mButton = MOUSE_LEFT) [txt-color=blue]Then[/txt-color]
[txt-color=blue]Call[/txt-color] mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
[txt-color=blue]Call[/txt-color] mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
[txt-color=blue]ElseIf[/txt-color] (mButton = MOUSE_MIDDLE) [txt-color=blue]Then[/txt-color]
[txt-color=blue]Call[/txt-color] mouse_event(MOUSEEVENTF_MIDDLEDOWN, 0, 0, 0, 0)
[txt-color=blue]Call[/txt-color] mouse_event(MOUSEEVENTF_MIDDLEUP, 0, 0, 0, 0)
[txt-color=blue]Else[/txt-color]
[txt-color=blue]Call[/txt-color] mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
[txt-color=blue]Call[/txt-color] mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)
[txt-color=blue]End If[/txt-color]
[txt-color=blue]End Sub[/txt-color]
[txt-color=green]'e no evento onde vc precisar dar o clique: [/txt-color]
[txt-color=green]'vc coloca: [/txt-color]
[txt-color=green]'SetCursorPos x, y onde x e y são as coordenadas [/txt-color]
[txt-color=green]'SendMausklick(MOUSE_LEFT ) simula o clique do botão esquerdo. [/txt-color]
Tópico encerrado , respostas não são mais permitidas