ok en vb.net c'est plus simple...
ex:
dim Prc() as process = process.getprocess()
for each p as process in Prc
if p.ProcessName = "Explorer" then p.kill ' repere si le nom du process est explorer. Si oui, termine le process (Quit)
next
en vb6 c'est pomal plus compliquer
la syntax est de vb.net mais si tu fait du vb6 tu vas te reconaitre unpeut
pour commencer on demmende la liste de hanlde ouvert avec un Delegate CallBack
Win32API.EnumWindowsDllImport(
New Win32API.EnumWindowsCallback(AddressOf _FillActiveWindowsList), 0)
'Pour chaque handle present, cette function ceras appeler
Function
FillActiveWindowsList(ByVal hWnd AsInteger, ByVal lParam AsInteger) AsBooleanDim ClassName AsNew StringBuilder(STRING_BUFFER_LENGTH)Win32API.GetClassName(hWnd, ClassName, STRING_BUFFER_LENGTH)
Dim str AsString = ClassName.ToStringDim windowText AsNew StringBuilder(STRING_BUFFER_LENGTH)' Get the Window Caption.Win32API.GetWindowText(hWnd, windowText, STRING_BUFFER_LENGTH)
dim FormCaption as string = windowtext.tostring
if FormCaption <> "" then
'si la caption n'est pas null on sait que c'est une Fenetre
'voici commen le fermer :
SendMessage(hWnd, &H10, 0&, 0&)
end if
enfin voici les declaration dans win32api
<DllImport(
"user32.dll", EntryPoint:="EnumWindows", SetLastError:=True, _CharSet:=CharSet.Ansi, ExactSpelling:=
True, _CallingConvention:=CallingConvention.StdCall)> _
PublicSharedFunction EnumWindowsDllImport(ByVal callback As EnumWindowsCallback, _ByVal lParam As long) AsIntegerEndFunctionPublic
DeclareFunction GetClassName Lib"user32.dll" _Alias"GetClassNameA" (ByVal hwnd As Long, _ByVal lpClassName As StringBuilder, _ByVal cch As long) AsIntegerPublic
DeclareSub GetWindowText Lib"user32.dll" _Alias"GetWindowTextA" (ByVal hWnd AsLong, _ByVal lpString As StringBuilder, _ByVal nMaxCount AsLong)
Private
DeclareFunction SendMessage Lib"user32"Alias"SendMessageA" (ByVal hWnd As Long, ByVal wMsg AsLong, ByVal wParam AsLong, ByVal lParam AsLong) AsIntegeret voila c'est pomal sa
jespere que jai bien repondu a ta question
RNsoft.cjb.net
<>