flat assembler
Message board for the users of flat assembler.

Index > Windows > Print text in window win7 32

Thread Post new topic Reply to topic

Joined: 31 Oct 2014
Posts: 4
aasom65 01 Nov 2014, 14:22
I want print text on picture.Help me please.
format PE GUI 5.0
include 'win32wx.inc'
width  = 1280
height = 1024
 ; Open file and save its handle into EBX
    invoke    CreateFileA, achFileName, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, 0 
    mov       ebx, eax 
    ; If file is not opened - get out! 
    cmp       eax, INVALID_HANDLE_VALUE 
    je         WM_CLOSE
    ; ESI = file size in bytes 
    invoke    GetFileSize, ebx, 0 
    mov       esi, eax 
    mov       [dwFileSize], eax 
    ; Allocate memory for the file contents 
    ; EDI = pointer to that buffer 
    invoke    VirtualAlloc, 0, esi, MEM_RESERVE or MEM_COMMIT, PAGE_READWRITE 
    mov       edi, eax 
    mov       [pFileBytes], eax 
    ; If allocation fails - close file and get out! 
    test      eax, eax 
    jz        .close_file 
    ; Read the file into buffer and then close file. 

    invoke    ReadFile, ebx, Raster-54, [dwFileSize], dwNumLoaded, 0
    invoke    CloseHandle, ebx 
    ; Now the file is fully loaded at the address in EDI... do whatever... 
    ; Release memory and quit 
    invoke    VirtualFree, [pFileBytes], 0, MEM_RELEASE 

    invoke    CloseHandle, ebx 

invoke CreateWindowExW,0,static,0,WS_VISIBLE+WS_OVERLAPPEDWINDOW+SS_BITMAP+SS_CENTERIMAGE,0,0,width,height,0,0,0,0
mov    [wnd],eax
invoke SetWindowLongW,[wnd],GWL_WNDPROC,WndProc
invoke GetDC,[wnd]
mov    [DC],eax
;Òóò ìîæíî ðèñîâàòü
;mov  esi,Raster             ;ïåðåìåííàÿ Raster ñîäåðæèò èôîðìàöèþ î öâåòå ïèêñåëåé
;add  esi,width*3
;mov  dword[esi-3],255
;mov  ecx,(width-1)*height
;   xor eax,[esi-width*3]
;   mov [esi],eax
;loop @b
@@:invoke GetMessageW,msg,0,0,0
   invoke DispatchMessageW,msg
jmp @b
  cmp dword[esp+8],WM_PAINT
  jz  .WM_PAINT
  cmp dword[esp+8],WM_CLOSE
  jz  .WM_CLOSE
      jmp [DefWindowProcW]
      invoke SetDIBitsToDevice,[DC],0,0,width,height,0,0,0,height,Raster,bmi,0
      ret 16
     invoke ExitProcess,0
static du 'STATIC',0
    pFileBytes   dd 0
    dwFileSize   dd 0 
    dwNumLoaded  dd 0 
    achFileName  db 'f:\333.bmp',0

bmi     BITMAPINFOHEADER sizeof.BITMAPINFOHEADER,width,-height,1,24,0,width*height*3
msg     MSG
wnd     rd 1
DC      rd 1
Raster  rd width*height
.end start    

Filename: pack.zip
Filesize: 2.04 KB
Downloaded: 205 Time(s)

Post 01 Nov 2014, 14:22
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.