۰۶-دى-۱۳۸۵, ۱۹:۱۱:۱۹
صفحهها: 1 2
۱۱-مرداد-۱۳۸۶, ۱۱:۲۲:۴۲
از تابع getmessage و postmessage استفاده کن.
۱۳-مرداد-۱۳۸۶, ۱۸:۴۱:۴۶
واسه ListView خود برنامه ای که بازش کردم میشه ولی در مورد برنامه های دیگه نمیشه (اون برنامه بسته میشه)
مشکل اصلی من اینه
مشکل اصلی من اینه
۱۴-مرداد-۱۳۸۶, ۰۰:۵۵:۱۷
'گفتم که با توابع postmessage، getmessage و توابع مربوط به کنترل صف برنامه کار کن و با ترجمه lparam و wparam می تونی مقادیر داخل لیست رو پیدا کنی. تنها چیزی که احتیاج داری پیدا کردن ثابت های مربوط به list view هست که اونها رو هم میتونی با برنامه SPY++ که همراه ویژوال سی 6 هست خیلی راحت پیدا کنی.
۱۴-مرداد-۱۳۸۶, ۰۴:۰۰:۲۸
اگه خواستی ستون اول رو پیدا کنی iSubItem رو برابر 0 قرار بده
I هم شماره ردیفت هست که بازم از 0 شروع میشه
نکته آخر هم اینکه مواد لازمش رو دیگه ننوشتم
همه این Type ها(حالا خوبه یدونه بیشتر نیستا
LVITEM) یا ثابت ها رو توی API-Viewer میتونی پیدا کنی
I هم شماره ردیفت هست که بازم از 0 شروع میشه
نکته آخر هم اینکه مواد لازمش رو دیگه ننوشتم


کد:
Public Function ListView_GetItemText(I As Long, iSubItem As Long) As String
Dim lpPitem As LVITEM
Dim SubItemText As String
SubItemText = String$(28, 0)
lpPitem.iSubItem = iSubItem
lpPitem.cchTextMax = 28
lpPitem.pszText = SubItemText
Call SendMessage(hwndLV, LVM_GETITEMTEXT, ByVal I, lpPitem)
ListView_GetItemText = Left$(lpPitem.pszText, InStr(lpPitem.pszText, vbNullChar) - 1)
End Function
۱۴-مرداد-۱۳۸۶, ۱۱:۵۸:۲۰
کدی که خودم قبلا نوشته بودم کار می کرد (منتها تو همون پروسه خودم) یعنی ایتم های لیست ویو خودمو نمایش می داد اما وقتی واسه برنامه ها و پنجره های دیگه استفاده می کردم باعث کرش شدن اون برنامه می شد.
این کد رو هم که پدرام جان زحمتشو کشیدن تست کردم ولی متاسفانه خروجی بهم نداد.
این کد رو هم که پدرام جان زحمتشو کشیدن تست کردم ولی متاسفانه خروجی بهم نداد.
کد:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Dim j As Long
Private Type LVITEM
iSubItem As Integer
cchTextMax As Integer
pszText As String
End Type
Private Function ListView_GetItemText(I As Long, iSubItem As Long) As String
Dim lpPitem As LVITEM
Dim SubItemText As String
SubItemText = String$(28, 0)
lpPitem.iSubItem = iSubItem
lpPitem.cchTextMax = 28
lpPitem.pszText = SubItemText
Call SendMessage(hwndLV, LVM_GETITEMTEXT, ByVal I, lpPitem)
ListView_GetItemText = Left$(lpPitem.pszText, InStr(lpPitem.pszText, vbNullChar) - 1)
End Function
Private Sub Command1_Click()
j = FindWindow("CabinetWClass", 0)
j = FindWindowEx(j, 0, "SHELLDLL_DefVie", 0)
j = FindWindowEx(j, 0, "DUIViewWndClassName", 0)
j = FindWindowEx(j, 0, "DirectUIHWND", 0)
j = FindWindowEx(j, 0, "CtrlNotifySink", 0)
j = FindWindowEx(j, 0, "SysListView32", 0)
Text1.Text = ListView_GetItemText(j, 2)
End Sub
۱۴-مرداد-۱۳۸۶, ۱۴:۰۵:۳۳
خوب اگه از كد بالا استفاده ميكني يه اشكال داره اونم توي قسمت Decelration هست كه جناب عالي LVM_GETITEMTEXT رو تعريف نكردي
ببين با اين حل ميشه يا نه
ببين با اين حل ميشه يا نه
۱۵-مرداد-۱۳۸۶, ۱۱:۱۱:۵۷
حاجی من اینو با دلفی هم که انجام می دم (اونجا که دیگه نیازی به Declration و این حرفا نیست)باز هم جواب منفی می گیرم
من فکر می کنم ListView ها تو ویندوز Secure باشن
(البته تو پروسس خودت می تونی اینو انجام بدی)
که در این صورت باید از اینجکت استفاده کرد
من فکر می کنم ListView ها تو ویندوز Secure باشن

که در این صورت باید از اینجکت استفاده کرد
۱۵-مرداد-۱۳۸۶, ۱۱:۱۶:۳۹
pswin نوشته است:'گفتم که با توابع postmessage، getmessage و توابع مربوط به کنترل صف برنامه کار کن
با getmessage و postmessage هم نمیشه کاری کرد اگر هم بشه فقط تو پروسه خودمون میشه کنترل کرد که جواب سوال من نیست
۱۵-مرداد-۱۳۸۶, ۲۲:۳۴:۴۶
برای کنترل فرمانهای صف مربوط به هر برنامه میتونین از hook استفاده کنین
The CallWndProc hook procedure is an application-defined or library-defined callback function that the system calls whenever the SendMessage function is called. Before passing the message to the destination window procedure, the system passes the message to the hook procedure. The hook procedure can examine the message; it cannot modify it.
CallWndProc is a placeholder for the application-defined or library-defined function name.
LRESULT CALLBACK CallWndProc(
int nCode, // hook code
WPARAM wParam, // current-process flag
LPARAM lParam // address of structure with message data
);
Parameters
nCode
Specifies whether the hook procedure must process the message. If nCode is HC_ACTION, the hook procedure must process the message. If nCode is less than zero, the hook procedure must pass the message to the CallNextHookEx function without further processing and should return the value returned by CallNextHookEx.
wParam
Specifies whether the message is sent by the current process. If the message is sent by the current process, it is nonzero; otherwise, it is NULL.
lParam
Pointer to a CWPSTRUCT structure that contains details about the message.
Return Values
The return value should be zero.
Remarks
The CallWndProc hook procedure can examine the message, but it cannot modify it. After the hook procedure returns control to the system, the message is passed to the window procedure.
An application installs the hook procedure by specifying the WH_CALLWNDPROC hook type and the address of the hook procedure in a call to the SetWindowsHookEx function.
The WM_CALLWNDPROC hook is called in the context of the thread that calls SendMessage, not the thread that receives the message.
The CallWndProc hook procedure is an application-defined or library-defined callback function that the system calls whenever the SendMessage function is called. Before passing the message to the destination window procedure, the system passes the message to the hook procedure. The hook procedure can examine the message; it cannot modify it.
CallWndProc is a placeholder for the application-defined or library-defined function name.
LRESULT CALLBACK CallWndProc(
int nCode, // hook code
WPARAM wParam, // current-process flag
LPARAM lParam // address of structure with message data
);
Parameters
nCode
Specifies whether the hook procedure must process the message. If nCode is HC_ACTION, the hook procedure must process the message. If nCode is less than zero, the hook procedure must pass the message to the CallNextHookEx function without further processing and should return the value returned by CallNextHookEx.
wParam
Specifies whether the message is sent by the current process. If the message is sent by the current process, it is nonzero; otherwise, it is NULL.
lParam
Pointer to a CWPSTRUCT structure that contains details about the message.
Return Values
The return value should be zero.
Remarks
The CallWndProc hook procedure can examine the message, but it cannot modify it. After the hook procedure returns control to the system, the message is passed to the window procedure.
An application installs the hook procedure by specifying the WH_CALLWNDPROC hook type and the address of the hook procedure in a call to the SetWindowsHookEx function.
The WM_CALLWNDPROC hook is called in the context of the thread that calls SendMessage, not the thread that receives the message.
۱۶-مرداد-۱۳۸۶, ۱۰:۰۷:۳۴
حاجی اگه ممکنه فارسی بنویس که اگه کسی هم خواست از مطالبت استفاده کنه راحت تر بتونه مطالبتو متوجه بشه.
صفحهها: 1 2