есть в виндовсе такой файл cards.dll, в нём лежат битмапы карт.
Вот как бы мне эти самые битмапы вытащить себе в прогу.
Для умников:Ресторатр и прочие не предлагать
CaptW писал(а):есть в виндовсе такой файл cards.dll, в нём лежат битмапы карт.
Вот как бы мне эти самые битмапы вытащить себе в прогу.
Для умников:Ресторатр и прочие не предлагать
CaptW писал(а):tyomitch:90 уже устарели. Рисовать средствами кардс? там функция есть что ли? пойдёт.
Option Explicit
Private Declare Function cdtInit Lib "C:\WINDOWS\system32\cards.dll" (ByRef width As Long, ByRef height As Long) As Long
Private Declare Sub cdtTerm Lib "C:\WINDOWS\system32\cards.dll" ()
Private Declare Function cdtDraw Lib "C:\WINDOWS\system32\cards.dll" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long, ByVal CardNumber As Long, ByVal DrawWhat As cdtDrawWhat, ByVal BackColor As Long) As Long
Private Declare Function cdtDrawExt Lib "C:\WINDOWS\system32\cards.dll" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long, ByVal width As Long, ByVal height As Long, ByVal CardNumber As Long, ByVal DrawWhat As cdtDrawWhat, ByVal BackColor As Long) As Long
Private Enum cdtDrawWhat
[Сама карта, как она есть]
[Сама карта, на фоне указанного цвета]
[Негатив карты]
[Рубашка указанного цвета]
[Прямоугольник указанного цвета размером с карту]
[Рубашка указанного цвета, но темнее]
[Рубашка с крестом]
[Рубашка с кругом]
End Enum
Private Enum cdtSuits
[Трефы]
[Бубны]
[Червы]
[Пики]
End Enum
Private Enum cdtValues
[Туз] = 1
[Двойка]
[Тройка]
[Четвёрка]
[Пятёрка]
[Шестёрка]
[Семёрка]
[Восьмёрка]
[Девятка]
[Десятка]
[Валет]
[Дама]
[Король]
End Enum
Private w As Long, h As Long
Private Sub Command1_Click()
cdtDraw Me.hDC, 0, 0, GetCardNumber([Червы], [Дама]), [Сама карта, как она есть], 0
End Sub
Private Function GetCardNumber(ByVal Suit As cdtSuits, ByVal Value As cdtValues) As Long
GetCardNumber = (Value - 1) * 4 + Suit
End Function
Private Sub Form_Load()
cdtInit w, h
End Sub
Private Sub Form_Unload(Cancel As Integer)
cdtTerm
End Sub
GSerg писал(а):Тёмич, ты вредный и нехороший человек
Я тут, понимаешь, в дизасм с головой ушёл, а ты?
Нет уж, что сам сейчас нарыл, то и выложу!
.NOLIST
.486
.MODEL FLAT, STDCALL
OPTION CASEMAP: NONE
INCLUDE \masm32\include\windows.inc
INCLUDE \masm32\include\kernel32.inc
INCLUDELIB \masm32\lib\kernel32.lib
INCLUDE \masm32\include\wow32.inc
INCLUDELIB \masm32\lib\wow32.lib
INCLUDE \masm32\include\cards16.inc
INCLUDELIB \masm32\lib\cards16.lib
BREAK equ ;int 3
PUBLIC cdtInit, cdtTerm, cdtDraw
.DATA?
hLib dd ?
hLib16 dd ?
QT_Thunk dd ?
p_cdtInit dd ?
p_cdtTerm dd ?
p_cdtDraw dd ?
p16_cdtInit dd ?
p16_cdtTerm dd ?
p16_cdtDraw dd ?
.CODE
CardsName db "cards.dll", 0
KernelName db "kernel32", 0
ThunkName db "QT_Thunk", 0
f_cdtInit db "cdtInit", 0
f_cdtTerm db "cdtTerm", 0
f_cdtDraw db "cdtDraw", 0
.LIST
LibMain PROC hInstDll: DWORD, reason: DWORD, unused: DWORD
push ebx
cmp reason, DLL_PROCESS_DETACH
je detach
cmp reason, DLL_PROCESS_ATTACH
jne success
push offset CardsName
call LoadLibrary
or eax, eax
jz _16bit
mov hLib, eax
xchg eax, ebx
push offset f_cdtInit
push ebx
call GetProcAddress
mov p_cdtInit, eax
push offset f_cdtTerm
push ebx
call GetProcAddress
mov p_cdtTerm, eax
push offset f_cdtDraw
push ebx
call GetProcAddress
mov p_cdtDraw, eax
jmp success
_16bit:
call GetLastError
cmp eax, ERROR_DLL_NOT_FOUND
je fail
cmp eax, ERROR_GEN_FAILURE
jne fail
push offset KernelName
call GetModuleHandle
push offset ThunkName
push eax
call GetProcAddress
mov QT_Thunk, eax
push offset CardsName
call LoadLibrary16
or eax, eax
jz fail
mov hLib16, eax
xchg eax, ebx
push offset f_cdtInit
push ebx
call GetProcAddress16
mov p16_cdtInit, eax
push offset f_cdtTerm
push ebx
call GetProcAddress16
mov p16_cdtTerm, eax
push offset f_cdtDraw
push ebx
call GetProcAddress16
mov p16_cdtDraw, eax
success:
pop ebx
mov eax, TRUE
ret
fail:
pop ebx
xor eax, eax
ret
detach:
mov eax, hLib
or eax, eax
jz free16
push eax
call FreeLibrary
jmp success
free16:
mov eax, hLib16
or eax, eax
jz fail
push eax
call FreeLibrary16
jmp success
LibMain ENDP
Proxy:
push eax
ret
;Private Declare Function cdtInit Lib "CARDS32.DLL" (nWidth As Long, nHeight As Long) As Long
cdtInit:
mov eax, p_cdtInit
or eax, eax
jnz Proxy
BREAK
push ebp
mov ebp, esp
sub esp, 40h
push ebx
push 0
push 32
push GMEM_FIXED + GMEM_ZEROINIT + GMEM_SHARE
call WOWGlobalAllocLock16
xchg eax, ebx
push 1
push 32
push ebx
call WOWGetVDMPointerFix
push esi
xchg eax, esi
push ebx
add ebx, 4
push ebx
mov edx, p16_cdtInit
call QT_Thunk
push edi
mov edi, [ebp + 8]
movsd
mov edi, [ebp + 0ch]
movsd
pop edi
xchg eax, esi
push ebx
call WOWGlobalUnlockFree16
xchg eax, esi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 8
;Private Declare Function cdtTerm Lib "CARDS32.DLL" () As Long
cdtTerm:
mov eax, p_cdtTerm
or eax, eax
jnz Proxy
BREAK
sub esp, 40h
mov edx, p16_cdtTerm
call QT_Thunk
add esp, 40h
ret
;Private Declare Function cdtDraw Lib "CARDS32.DLL" (ByVal hDC As Long, ByVal xOrg As Long, ByVal yOrg As Long, ByVal nCard As Long, ByVal nDraw As Long, ByVal nColor As Long) As Long
cdtDraw:
mov eax, p_cdtDraw
or eax, eax
jnz Proxy
BREAK
push ebp
mov ebp, esp
sub esp, 40h
push WOW_TYPE_HDC
push dword ptr [ebp + 8]
call WOWHandle16
push ax
push word ptr [ebp + 0ch]
push word ptr [ebp + 10h]
push word ptr [ebp + 14h]
push word ptr [ebp + 18h]
push dword ptr [ebp + 1ch]
mov edx, p16_cdtDraw
call QT_Thunk
mov esp, ebp
pop ebp
ret 18h
END LibMain
Сейчас этот форум просматривают: AhrefsBot, SemrushBot, Yandex-бот и гости: 69