ايران ويج

نسخه‌ی کامل: كليك رو دسكتاپ
شما در حال مشاهده‌ی نسخه‌ی متنی این صفحه می‌باشید. مشاهده‌ی نسخه‌ی کامل با قالب بندی مناسب.
سلام Biggrin
با مخلوط كردن تواابع getforgroundwindow ، getwindowtext و GetAsyncKeyState ميشه تشخيص داد كه كاربر رو دسكتاپ كليك كرده يا نه
اما چطوري مي تونم اين رو تشخيص بدم كه روي زمينه دسكتاپ اين كار رو انجام داده يا روي يكي از آيكنهاي موجود در دسكتاپ ؟
Exclamation TANKS
شما میتونین برای این کار از mouse hook استفاده کنین
نقل قول: The MouseProc hook procedure is an application-defined or library-defined callback function the system calls whenever an application calls the GetMessage or PeekMessage function and there is a mouse message to be processed.

LRESULT CALLBACK MouseProc(

int nCode, // hook code
WPARAM wParam, // message identifier
LPARAM lParam // mouse coordinates
);


Parameters

nCode

Specifies a code the hook procedure uses to determine how to process the message. This parameter can be one of the following values:

Value Meaning
HC_ACTION The wParam and lParam parameters contain information about a mouse message.
HC_NOREMOVE The wParam and lParam parameters contain information about a mouse message, and the mouse message has not been removed from the message queue. (An application called the PeekMessage function, specifying the PM_NOREMOVE flag.)


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 the identifier of the mouse message.

lParam

Points to a MOUSEHOOKSTRUCT structure.



Return Values

To enable the system to process the message, the return value must be zero. To discard the message, the return value must be a nonzero value.
در واقع چيزي كه من مي خوام اينه كه آيكني رو دسكتاپ select شده يا نه
با موس هم اصلا كار ندارم
ممنون
پس این تابع میتونه به شما کمک کنه
کد php:
The ListView_GetSelectedCount macro determines the number of selected items in a list view controlYou can use this macro or explicitly send the LVM_GETSELECTEDCOUNT message.

UINT ListView_GetSelectedCount(

    
HWND hwnd    
   
);    
 

Parameters

hwnd

Handle to the 
list view control.

 

Return 
Values

Returns the number of selected items