
18.04.2020, 12:52
|
|
Постоянный
Регистрация: 15.12.2013
Сообщений: 412
С нами:
6530249
Репутация:
133
|
|
Сообщение от 21sCenturyHacker
я задолбался
Сообщение от Спойлер
Желательно поставить для всех конфигураций

И добавить

По поводу кода, как-то так хоть, правда еще желательно больше проверок разных на валидность GetDC, например, и т.д.
C++:
Код:
#include
#include
// ...
void
__stdcall
getp
(
std
::
string param
)
{
std
::
smatch match
;
const
auto
regex_result
=
std
::
regex_search
(
param
,
match
,
std
::
regex
(
R"eof((\d+)\s+(\d+))eof"
)
)
;
struct
DCResource
{
HWND hwnd
;
HDC hdc
;
DCResource
(
const
HWND hwnd
=
::
GetActiveWindow
(
)
)
:
hwnd
(
hwnd
)
,
hdc
(
::
GetDC
(
this
->
hwnd
)
)
{
}
~
DCResource
(
)
{
::
ReleaseDC
(
hwnd
,
hdc
)
;
}
inline
HDC
operator
*
(
)
{
return
hdc
;
}
}
;
int
numbers
[
2
]
;
for
(
unsigned
int
i
=
0
;
i
getSAMP
(
)
->
getChat
(
)
->
AddChatMessage
(
D3DCOLOR_RGBA
(
255
,
255
,
0
,
0
)
,
": Defaulting %s to 0"
,
!
i
?
"X"
:
"Y"
)
;
numbers
[
i
]
=
0
;
}
}
union
{
struct
{
unsigned
red
:
8
;
unsigned
green
:
8
;
unsigned
blue
:
8
;
unsigned
alpha
:
8
;
}
;
COLORREF as_int
;
}
color
{
.
as_int
=
::
GetPixel
(
*
DCResource
{
}
,
numbers
[
0
]
,
numbers
[
1
]
)
}
;
if
(
color
.
as_int
==
CLR_INVALID
)
{
SF
->
getSAMP
(
)
->
getChat
(
)
->
AddChatMessage
(
D3DCOLOR_XRGB
(
255
,
255
,
0
)
,
": Color cannot be retrieved"
)
;
}
else
{
SF
->
getSAMP
(
)
->
getChat
(
)
->
AddChatMessage
(
color
.
as_int
|
0xFF000000
,
"Color of the point %d %d is the following: %u (0x%x) (R: %u, G: %u, B: %u)"
,
numbers
[
0
]
,
numbers
[
1
]
,
color
.
as_int
,
color
.
as_int
,
color
.
red
,
color
.
green
,
color
.
blue
)
;
}
}
|
|
|