PDA

View Full Version : معرفي چند api



fidnah
شنبه 22 تیر 1387, 21:52 عصر
ميشه در مورد تابع getdesktopwindowde&getwindowdcتوضيح بدين
ممنون

فاطمه وطن دوست
شنبه 22 تیر 1387, 22:09 عصر
GetDesktopWindow

Declare Function GetDesktopWindow Lib "user32.dll" () As Long
پشتيباني


· ويندوز 95

· ويندوز 98

· ويندوز NT

· ويندوز32s

شرح و توضيحات
هندل پنجره اصلي ويندوز كه به آن دسكتاپ (DeskTop) نيز ميگويند را برميگرداند.اگر خطا باشد صفر و در صورت درست بودن تابع هندل را برميگرداند.

مثال
' Find the device context of the desktop
' The handle to the desktop is needed to find the device context
Dim deskhwnd As Long ' handle to the desktop
Dim deskhdc As Long ' device context to the desktop
Dim retval As Long ' return value

deskhwnd = GetDesktopWindow() ' get the desktop's handle
deskhdc = GetDC(deskhwnd) ' get the desktop's device context

' You could put any code that works with the desktop here

retval = ReleaseDC(deskhwnd, deskhdc) ' free up resources associated with the device context

فاطمه وطن دوست
شنبه 22 تیر 1387, 22:18 عصر
GetWindow

Declare Function GetWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
پشتيباني


· ويندوز 95

· ويندوز 98

· ويندوز NT

· ويندوز32s

شرح و توضيحات
اين تابع هندل يك پنجره را كه با پنجره داده شده ارتباط دارد را مشخص ميكند.اين ارتباط بيشتر به صورت ارتباط ميان پنجره زير مجموعه با پنجره اصلي و يا ارتباط ميان پنجره هاي زير مجموعه يك پنجره اصلي با هم . نوع ارتباط توسط wCmd مشخص ميشود.اگر تابع به خطا بخورد يا پنجره اي با ارتباط مشخص وجود نداشته باشد مقدار صفر برميگرداند.
hwnd

هندل پنجره اي كه ميخواهيم پنجره مرتبط با آن را پيدا كنيم.
wCmd

دقيقا يكي از فلگهاي زير كه نوع ارتباط ميان دو پنجره را مشخص ميكند.
GW_HWNDFIRST = 0

نخستين پنجره (بالاترين در Z-Order) كه با پنجره فعلي داراي يك پنجره اصلي مشترك ميباشد.
GW_HWNDLAST = 1

آخرين پنجره (پايين ترين در Z-Order) كه با پنجره فعلي داراي يك پنجره اصلي مشترك ميباشد.
GW_HWNDNEXT = 2

پنجره بعدي در Z-Order
GW_HWNDPREV = 3

پنجره قبلي در Z-Order
GW_OWNER = 4

پنجره اي كه اين پنجره مال آن ميباشد(با پنجره اصلي اشتباه نشود).
GW_CHILD = 5

بالاترين پنجره زير پنجره اين پنجره . اين دقيقا معادل تابع GetTopWindow (file:///c:/Documents%20and%20Settings/fatemeh/SetupAPITHMLrefggettopwindow.html) ميباشد.

مثال
' Flash the application's window that is below Form1 in the Z-order
' once.
Dim next As Long ' receives handle of next window in the Z-order
Dim retval As Long ' return value for flashing the window
next = GetWindow(Form1.hWnd, GW_HWNDNEXT) ' get the handle of the next window
If next <> 0 Then ' don't try to flags if no such window exists
' The next three lines flags the window once.
retval = FlashWindow (file:///c:/Documents%20and%20Settings/fatemeh/SetupAPITHMLreffflashwindow.html)(next, 1): Sleep (file:///c:/Documents%20and%20Settings/fatemeh/SetupAPITHMLrefssleep.html) 250
retval = FlashWindow (file:///c:/Documents%20and%20Settings/fatemeh/SetupAPITHMLreffflashwindow.html)(next, 1): Sleep (file:///c:/Documents%20and%20Settings/fatemeh/SetupAPITHMLrefssleep.html) 250
retval = FlashWindow (file:///c:/Documents%20and%20Settings/fatemeh/SetupAPITHMLreffflashwindow.html)(next, 0)
End If

rezavb6
جمعه 22 شهریور 1387, 21:29 عصر
سلام
کسی میدونه چجور میشه با توابع Api روی یک برنامه درمثل یاهو مسنجر یک دکمه یا تکست باکس اضافه کرد اگر کسی سورسی در این رابطه داره ممنون میشم