۲۳-اردیبهشت-۱۳۸۷, ۱۸:۱۰:۲۸
۲۳-اردیبهشت-۱۳۸۷, ۲۰:۱۱:۱۴
از این تابع به تنهایی کار نمیکنه بلکه اطلاعاتی میخواهد که اونو باید از یه callback function دیگه دریافت کنه به اسم EnumWindowsProc که process های دارای پنجره رو میگیره
کد:
function EnumWindowsProc(h:hwnd;s:tstringlist):bool;stdcall;
var
c:array[0..256]of char;
begin
getwindowtext(h,c,sizeof(c));
if c>'' then
s.Add(string(c));
result:=true;
end;
enumwindows(@EnumWindowsProc,integer(listbox1.Items));
۲۴-اردیبهشت-۱۳۸۷, ۱۷:۵۷:۵۵
به زبان ویبی میخاستم
ولی در کل مرسی مشکلم حل شد.
ولی در کل مرسی مشکلم حل شد.
۰۸-خرداد-۱۳۸۷, ۱۰:۰۵:۱۷
HoseinVig نوشته است:به زبان ویبی میخاستم
ولی در کل مرسی مشکلم حل شد.
کد:
' Display the title bar text of all top-level windows. This
' task is given to the callback function, which will receive each handle individually.
' Note that if the window has no title bar text, it will not be displayed (for clarity's sake).
' *** Place this code in a module. This is the callback function. ***
' This function displays the title bar text of the window identified by hwnd.
Public Function EnumWindowsProc (ByVal hwnd As Long, ByVal lParam As Long) As Long
Dim slength As Long, buffer As String ' title bar text length and buffer
Dim retval As Long ' return value
Static winnum As Integer ' counter keeps track of how many windows have been enumerated
winnum = winnum + 1 ' one more window enumerated....
slength = GetWindowTextLength(hwnd) + 1 ' get length of title bar text
If slength > 1 ' if return value refers to non-empty string
buffer = Space(slength) ' make room in the buffer
retval = GetWindowText(hwnd, buffer, slength) ' get title bar text
Debug.Print "Window #"; winnum; " : "; ' display number of enumerated window
Debug.Print Left(buffer, slength - 1) ' display title bar text of enumerated window
End If
EnumWindowsProc = 1 ' return value of 1 means continue enumeration
End Function
' *** Place this code wherever you want to enumerate the windows. ***
Dim retval As Long ' return value
' Use the above callback function to list all of the enumerated windows. Note that lParam is
' set to 0 because we don't need to pass any additional information to the function.
retval = EnumWindows(AddressOf EnumWindowsProc, 0)