asm0day01, смотри WASM.ARTICLES → "Межпроцессное взаимодействие" Вывод иконки размером 256х256 на поверхность DialogBox Во вложении ico-/rc-/asm/exe-файлы
asm0day01, вариант #1 Сохраняем BMP- или JPG-файл в формате ICO-файла, допустим 256x256, в каком-нибудь спец-редакторе asm-файл Код (ASM): ; GUI # include win64a.inc ID_TXT equ 100 IDC_DIALOG equ 200 IDC_ICON1 equ 500 IDC_IMG1 equ 104 .code WinMain proc dummy:qword invoke LoadImage, IMAGE_BASE, IDC_ICON1, IMAGE_ICON, 256, 256, LR_DEFAULTCOLOR invoke DialogBoxParam,IMAGE_BASE,IDC_DIALOG,HWND_DESKTOP,qword ptr (offset DialogProc),eax invoke RtlExitUserProcess,NULL WinMain endp DialogProc proc hWnddlg:QWORD,uMsg:QWORD,wParam:QWORD,lParam:QWORD mov lParam,r9 cmp edx,WM_CLOSE je wmCLOSE cmp edx,WM_INITDIALOG je wmINITDIALOG xor eax,eax jmp exit0 wmINITDIALOG: invoke GetDlgItem,,IDC_IMG1 invoke SendMessage,eax,STM_SETIMAGE,IMAGE_ICON,lParam jmp wmBYE wmCLOSE:invoke EndDialog,,0 wmBYE: mov eax,TRUE exit0: leave retn DialogProc endp end ресурсы Код (C): #include "resource.h" #define IDC_DIALOG 200 #define IDC_ICON1 500 #define IDC_IMG1 104 IDC_ICON1 ICON "icon1.ico" IDC_DIALOG DIALOG 0, 0, 140, 120 STYLE 0x0004|DS_CENTER|WS_CAPTION|WS_MINIMIZEBOX|WS_SYSMENU|WS_VISIBLE| WS_OVERLAPPED|DS_MODALFRAME|DS_3DLOOK CAPTION "Вывод иконки на DialBox" BEGIN CONTROL "",IDC_IMG1,"Static",WS_CHILDWINDOW|WS_VISIBLE|SS_ICON,5,0,128,128 END результат Просто и быстро! В аттаче, ico-/asm-/rc-/exe-файлы
вариант #2 asm-файл Код (ASM): ; GUI # include win64a.inc IDC_DIALOG equ 200 IDC_BMP1 equ 500 IDC_IMG1 equ 104 .code WinMain proc dummy:qword invoke LoadImage,IMAGE_BASE,IDC_BMP1,IMAGE_BITMAP,562,383,LR_DEFAULTCOLOR invoke DialogBoxParam,IMAGE_BASE,IDC_DIALOG,HWND_DESKTOP,qword ptr (offset DialogProc),eax invoke RtlExitUserProcess,NULL WinMain endp DialogProc proc hWnddlg:QWORD,uMsg:QWORD,wParam:QWORD,lParam:QWORD mov lParam,r9 cmp edx,WM_CLOSE je wmCLOSE cmp edx,WM_INITDIALOG je wmINITDIALOG xor eax,eax jmp exit0 wmINITDIALOG:invoke GetDlgItem,,IDC_IMG1 invoke SendMessage,eax,STM_SETIMAGE,IMAGE_BITMAP,lParam jmp wmBYE wmCLOSE:invoke EndDialog,,0 wmBYE: mov eax,TRUE exit0: leave retn DialogProc endp end ресурсы Код (C): #include "resource.h" #define IDC_DIALOG 200 #define IDC_BMP1 500 #define IDC_IMG1 104 IDC_BMP1 BITMAP "47.bmp" IDC_DIALOG DIALOG 0, 0, 291, 195 STYLE 0x0004|DS_CENTER|WS_CAPTION|WS_MINIMIZEBOX|WS_SYSMENU|WS_VISIBLE|WS_OVERLAPPED|DS_MODALFRAME|DS_3DLOOK CAPTION "Вывод BMP на DialBox" BEGIN CONTROL "",IDC_IMG1,"Static",WS_CHILDWINDOW|WS_VISIBLE|SS_BITMAP,5,0,562,383 END результат В аттаче, bmp-/asm-/rc-/exe-файлы
вариант #3 asm-файл Код (ASM): ; GUI # include win64a.inc IDD_DLG1 equ 100 IDC_IMG1 equ 102 .code WinMain proc local pBmp :QWORD local hBmp :QWORD ; initialise GDIPlus invoke GdiplusStartup,qword ptr (offset graphics),qword ptr (offset gdii),0 invoke GdipCreateBitmapFromFile,qword ptr (offset FileNameU),ADDR pBmp ; create a GDI+ bitmap invoke GdipCreateHBITMAPFromBitmap,pBmp,ADDR hBmp,0 ; create normal bitmap handle from it invoke GdipDisposeImage,pBmp ; remove the GDI+ bitmap invoke DialogBoxParam,IMAGE_BASE,IDD_DLG1,0,qword ptr (offset main),hBmp ; GdiPlus cleanup invoke GdiplusShutdown,graphics ; cleanup on exit invoke RtlExitUserProcess,NULL WinMain endp ;------------------------------------------------- main proc hWin:QWORD,uMsg:QWORD,wParam:QWORD,lParam:QWORD mov lParam,r9 cmp edx,WM_INITDIALOG je wmINITDIALOG cmp edx,WM_CLOSE je wmCLOSE xor eax,eax jmp wmBYE wmINITDIALOG:invoke GetDlgItem,,IDC_IMG1 invoke SendMessage,eax,STM_SETIMAGE,IMAGE_BITMAP,lParam jmp wmBYE wmCLOSE:invoke EndDialog,,0 ; exit from system menu wmBYE: leave retn main endp ;------------------------------------------------------ gdii GdiplusStartupInput <1,0,0,0> graphics dq ? FileNameU: du <90.jpg> end ресурсы Код (C): #include "resource.h" #define IDD_DLG1 100 #define IDC_IMG1 102 #define IMAGE1 20 IDD_DLG1 DIALOGEX 10,10,485,300 CAPTION "Вывод JPG на DialBox" FONT 8,"MS Sans Serif",0,0,0 STYLE 0x0004|DS_CENTER|WS_CAPTION|WS_MINIMIZEBOX|WS_SYSMENU| WS_VISIBLE|WS_OVERLAPPED|DS_MODALFRAME|DS_3DLOOK BEGIN CONTROL "",IDC_IMG1,"Static",WS_CHILDWINDOW|WS_VISIBLE|SS_BITMAP,0,0,717,479 END результат В аттаче, jpg-/asm-/rc-/exe-файлы