سلام - امروز می خوایم یه کاری روی Desktop انجام بدیم - با سورس زیر تمام آیکونهای روی صفحه از سمت چپ چیده می شن.
کد ماژول :
Option Explicit
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Const GW_CHILD = 5
Private Const LVA_ALIGNLEFT = &H1
Private Const LVM_ARRANGE = &H1016
حالا یک Command با نام Command1 به فرم اضافه کرده و :
Private Sub Command1_Click()
Dim HWnd1 As Long
Dim HWnd2 As Long
Dim MER As Long
HWnd1 = FindWindow("Progman", vbNullString)
HWnd2 = GetWindow(HWnd1, GW_CHILD)
HWnd1 = GetWindow(HWnd2, GW_CHILD)
MER = SendMessage(HWnd1, LVM_ARRANGE, LVA_ALIGNLEFT, 0)
End Sub
مفید بود ...مرسی
موفق باشی