1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| Imports System.Runtime.InteropServices
Public Class Form1
Public Shared Function SetWindowPos(ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal uFlags As Integer) As Boolean
End Function
Dim X As String
<DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
Public Shared Function SetParent(ByVal hWndChild As IntPtr, ByVal hWndNewParent As IntPtr) As IntPtr
End Function
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
une_sub()
End Sub
'méthode a ignorer sa sert a afficher une executable dans ma form lors d'un clic
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim p As Process
p = Process.Start("C:\monapplication.exe")
p.WaitForInputIdle()
SetParent(p.MainWindowHandle, Me.Handle)
SetWindowPos(p.MainWindowHandle, IntPtr.Zero, 0, 0, 0, 0, 0)
End Sub
Private _stop As Boolean
Private Sub une_sub()
Dim t As New System.Threading.Thread(AddressOf masub)
t.isbackground = True
t.start()
End Sub
Private Sub masub()
While _stop = False
F1sub() ' j'ai essayer sa mai il aime pas le visual^^
System.Threading.Thread.Sleep(5000) ' permet de pas bouffer trop de ressources si les choses à faire ne sont pas totalement continues
End While
End Sub
Private Sub buttonclick() Handles boutonarret.Click
_stop = True
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
masub()
End Sub
Public Sub F1sub()
My.Computer.Keyboard.SendKeys("F1") 'Simuler la pression sur la touche F1
End Sub
End Class |
Partager