flat assembler
Message board for the users of flat assembler.

Index > Windows > How to use the resource file (. Rc)

Author
Thread Post new topic Reply to topic
118d2b1d



Joined: 24 May 2010
Posts: 2
118d2b1d 24 May 2010, 10:08
How to use resources in fasm file creation window. To a routine.
Post 24 May 2010, 10:08
View user's profile Send private message Reply with quote
mjrod5



Joined: 09 Apr 2010
Posts: 1
mjrod5 26 May 2010, 23:39
I'm guessing you are asking for something like the following?
Sorry i didn't include credits, it didn't come with any and i forgot where i downloaded it from.
Code:
; Template using RES file

include 'win32ax.inc'

 IDD_MAINDLG     =       101                             ; Control IDs
       IDC_EXIT        =       40001                           ; Retrieved from the .h file automatically made from VC++

.data
      hInstance       dd      ?                               ; Our instance handle

.code
  start:
          invoke  GetModuleHandle, 0
          mov     [hInstance], eax
            invoke  DialogBoxParam, [hInstance], IDD_MAINDLG, 0, dlgProc, 0
             invoke  ExitProcess, 0
      .end start

proc  dlgProc, hDlg, uMsg, wParam, lParam
 push    ebx esi edi
 cmp     [uMsg], WM_COMMAND
  je      .wmcommand
  cmp     [uMsg], WM_CLOSE
    je      .wmclose
    cmp     [uMsg], WM_INITDIALOG
       je      .wminitdlg
  cmp     [uMsg], WM_DESTROY
  je      .wmclose
    cmp     [uMsg], WM_COMMAND
  je      .wmcommand
  xor     eax, eax
    jmp     .finish

 .wminitdlg:
             mov     eax, 1
              jmp     .finish

 .wmclose:
               invoke  EndDialog, [hDlg], 0
                mov     eax, 1
              jmp     .finish

 .wmcommand:
             mov     eax, [wParam]
               and     eax, 0x0FFFF                            ; To get the LOWORD of wParam

           cmp     eax, IDC_EXIT
               je      .wmclose

                mov     eax, 0
              jmp     .finish                                 ; Just here incase I add another message below, such as WM_TIMER

        .finish:
                pop     edi esi ebx
         ret
endp

section '.rsrc' data readable resource from 'resource.res'       ; Import external .res file (created by a different program, such as VC++)    


Or were you referring to something like...
Reading the resource data into a buffer and writing the buffer to a file?
Post 26 May 2010, 23:39
View user's profile Send private message Reply with quote
118d2b1d



Joined: 24 May 2010
Posts: 2
118d2b1d 30 May 2010, 01:02
Thank!
Post 30 May 2010, 01:02
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.