- ©«¤l
- 218
- ¥DÃD
- 73
- ºëµØ
- 0
- ¿n¤À
- 290
- ÂI¦W
- 0
- §@·~¨t²Î
- WIN10
- ³nÅ骩¥»
- Office2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¤k
- µù¥U®É¶¡
- 2014-5-19
- ³Ì«áµn¿ý
- 2022-11-29
|
#If VBA7 Then
Private Declare PtrSafe Function GetPixel Lib "gdi32" (ByVal hdc As LongPtr, ByVal x As Long, ByVal y As Long) As Long
Private Declare PtrSafe Function GetCursorPos Lib "user32" (ByRef lpPoint As POINT) As LongPtr
Private Declare PtrSafe Function GetWindowDC Lib "user32" (ByVal hwnd As LongPtr) As LongPtr
#Else
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (ByRef lpPoint As POINT) As Long
Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
#End If
Private Type POINT
x As Long
y As Long
End Type
Sub Picture1_Click()
Dim pLocation As POINT
Dim lColour As Long
Dim lDC As Variant
lDC = GetWindowDC(0)
Call GetCursorPos(pLocation)
lColour = GetPixel(lDC, pLocation.x, pLocation.y)
Range("a1").Interior.Color = lColour
End Sub
--------------------------------------------------------------------------------
¥H¤W¬Oºô¸ô¤j¯«À°¦£´£¨Ñªº·Æ¹«´å¼Ð§ì¦âµ{¦¡½X¡A¦ý§Ú¤£ª¾¹Dn«ç»ò§ï¦¨§PÂ_·Æ¹«´å¼Ð¦ì¸m¡A¦pªG§ì¨ì¤°»òÃC¦â®É¡A´N©¹¤U¤@¨B¶i¦æ¡A¤£ª¾¹D¦³¨S¤j¯«¥i¥HÀ°¦£§ï§ï©O |
|