2 Replies - 774 Views - Last Post: 18 May 2013 - 01:46 PM

#1 olracselanreb  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 18-May 13

write data from textbox to txt file

Posted 18 May 2013 - 07:26 AM

; i cant use the writefile function correctly to get the data from textbox and write it to data.txt

.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib

WinMain proto :DWORD, :DWORD, :DWORD, :DWORD

.data

    dwBytesWritten dw "0", 0
    BytesToWrite dw "30", 0
    ClassName db "WinClass", 0
    AppName db "FINAL_PROJECT", 0
    EditClassName db "edit", 0
    EditClassName1 db "edit", 0
    EditClassName2 db "edit", 0
    ButtonClassName db "button", 0
    ButtonClassName1 db "button", 0
    StaticClassName db "static", 0
    StaticClassName1 db "static", 0
    StaticClassName2 db "static", 0
    Msg db "You Clicked the Button!", 0
    ButtonText db "OK", 0
    ButtonText1 db "CANCEL", 0
    p db "PLEASE CONFIRM EXIT ?", 0
    o db "PROMPT", 0
    StatText db "NAME:", 0
    StatText1 db "AGE:", 0
    StatText2 db "ADDRESS:", 0
    efren db "C:\Users\Lau\Desktop\ASS\nn\DATA.txt", 0
  
    
.data?
    hInstance HINSTANCE  ?
    hEdit     HWND       ?
    hButton1  HWND       ?
    hEdit1    HWND       ?
    hEdit2    HWND       ?
    hButton   HWND       ?
    hStatic   HWND       ?
    hStatic1  HWND       ? 
    hStatic2  HWND       ?
   
    hFile       dd ?
    FileSize    dd ?
    hMem        dd ?
    BytesRead   dd ?

    
.const
    EditID equ 12345
    ButtonID equ 67890
    EditID1 equ 1
    ButtonID1 equ 6
    EditID2 equ 2
    StaticID equ 123
    StaticID1 equ 456
    StaticID2 equ 789
    MEMORYSIZE equ 65535
.code
start:
    invoke GetModuleHandle, NULL
    mov hInstance, eax
    invoke WinMain, hInstance, NULL, NULL, 0
    invoke ExitProcess, eax

    WinMain proc hInst:HINSTANCE, hPrevInst:HINSTANCE, CmdLine:LPSTR,
CmdShow:DWORD
        local wc:WNDCLASSEX
        local msg:MSG
        local hwnd:HWND
        mov wc.cbSize, SIZEOF WNDCLASSEX
        mov wc.style, CS_HREDRAW or CS_VREDRAW
        mov wc.lpfnWndProc, offset WndProc
        mov wc.cbClsExtra, NULL
        mov wc.cbWndExtra, NULL
        push hInstance
        pop wc.hInstance
        mov wc.hbrBackground, COLOR_APPWORKSPACE+2
        mov wc.lpszMenuName, NULL
        mov wc.lpszClassName, offset ClassName
        invoke LoadIcon, NULL, IDI_APPLICATION
        mov wc.hIcon,eax
        mov wc.hIconSm, eax
        invoke LoadCursor, NULL, IDC_WAIT
        mov wc.hCursor, eax
        invoke RegisterClassEx, addr wc
        invoke CreateWindowEx,0, addr ClassName, addr AppName,
WS_SIZEBOX  or WS_VISIBLE, 230, 230, 230, 230, NULL, NULL, hInst, NULL
        mov hwnd, eax

        .while TRUE
            invoke GetMessage, addr msg, NULL, 0, 0
            .break .if (!eax)
            invoke TranslateMessage, addr msg
            invoke DispatchMessage, addr msg
            
        .endw    

        mov eax, msg.wParam
        ret
     WinMain endp

     WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
        .if uMsg == WM_DESTROY
            invoke PostQuitMessage, 0
        .elseif uMsg == WM_CREATE
        invoke CreateWindowEx, NULL, addr StaticClassName, addr StatText, WS_CHILD or WS_VISIBLE, 10, 10, 100, 20, hWnd, StaticID, hInstance, NULL
        invoke CreateWindowEx, NULL, addr StaticClassName1, addr StatText1, WS_CHILD or WS_VISIBLE, 10, 50, 100, 20, hWnd, StaticID, hInstance, NULL
        invoke CreateWindowEx, NULL, addr StaticClassName2, addr StatText2, WS_CHILD or WS_VISIBLE, 10, 90, 100, 20, hWnd, StaticID, hInstance, NULL
           
           invoke CreateWindowEx, NULL, addr ButtonClassName, addr ButtonText, WS_CHILD or WS_VISIBLE or BS_DEFPUSHBUTTON, 10, 130, 80, 20, hWnd, ButtonID, hInstance, NULL
           invoke CreateWindowEx, NULL, addr ButtonClassName1, addr ButtonText1, WS_CHILD or WS_VISIBLE or BS_DEFPUSHBUTTON, 110, 130, 80, 20, hWnd, ButtonID1, hInstance, NULL

                    mov hButton, eax
                    mov hButton1, eax
                    invoke CreateWindowEx, WS_EX_CLIENTEDGE, addr EditClassName, NULL, WS_CHILD or WS_VISIBLE,110, 10, 100, 20,hWnd, EditID, hInstance, NULL
                    invoke CreateWindowEx, WS_EX_CLIENTEDGE, addr EditClassName1, NULL, WS_CHILD or WS_VISIBLE,110, 50, 100, 20,hWnd, EditID1, hInstance, NULL
                    invoke CreateWindowEx, WS_EX_CLIENTEDGE, addr EditClassName2, NULL, WS_CHILD or WS_VISIBLE,110, 90, 100, 20,hWnd, EditID2, hInstance, NULL

                    mov hEdit, eax
                    mov hEdit1, eax
                    mov hEdit2, eax
         .elseif uMsg == WM_COMMAND
                    mov eax, wParam
                        .if ax == ButtonID
                            shr eax, 16
                        .endif
                        .if ax == BN_CLICKED

    invoke CreateFile, addr efren, GENERIC_READ or GENERIC_WRITE,0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL
mov hEdit,eax
invoke WriteFile,hFile,addr efren,FileSize,ADDR BytesRead,0
    mov     hFile,eax
    invoke  GetFileSize,eax,0
    mov     FileSize,eax
    inc     eax
    invoke  GlobalAlloc,GMEM_FIXED,eax
    mov     hMem,eax
    add     eax,FileSize
    mov     BYTE PTR [eax],0   ; Set the last byte to NULL so that StdOut
                               ; can safely display the text in memory.
                               
    invoke WriteFile,hFile,addr efren,FileSize,ADDR BytesRead,0
   invoke  ReadFile,hFile,hMem,FileSize,ADDR BytesRead,0
    invoke  CloseHandle,hFile
     invoke  MessageBox, NULL,hMem,addr p,MB_OK
    invoke  GlobalFree,hMem




      
                    
                         .elseif ax == ButtonID1
                         invoke MessageBox, NULL, addr p, addr o, MB_ICONINFORMATION + MB_YESNO
                         .if ax == IDYES
                         invoke ExitProcess, 90
                         .endif
                        .endif
          .else
                    invoke DefWindowProc, hWnd, uMsg, wParam, lParam
                    ret

          .endif
          xor eax, eax
          ret
      WndProc endp
end start


*** EDIT ***
Please use code tags when posting code
:code:

This post has been edited by GunnerInc: 18 May 2013 - 11:35 AM
Reason for edit:: Added code tags


Is This A Good Question/Topic? 0
  • +

Replies To: write data from textbox to txt file

#2 GunnerInc  Icon User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 858
  • View blog
  • Posts: 2,277
  • Joined: 28-March 11

Re: write data from textbox to txt file

Posted 18 May 2013 - 11:34 AM

Moved to Assembly, and added code tags.
Was This Post Helpful? 1
  • +
  • -

#3 GunnerInc  Icon User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 858
  • View blog
  • Posts: 2,277
  • Joined: 28-March 11

Re: write data from textbox to txt file

Posted 18 May 2013 - 01:46 PM

There is a lot wrong here, and some things can be changed to make the code "tidier".
First, you do not need to repeat the strings for the class names, this:
EditClassName db "edit", 0
EditClassName1 db "edit", 0
EditClassName2 db "edit", 0
ButtonClassName db "button", 0
ButtonClassName1 db "button", 0
StaticClassName db "static", 0
StaticClassName1 db "static", 0
StaticClassName2 db "static", 0

can be rewritten as:
szWndClsEdit    db "edit", 0
szWndClsBtn     db "button", 0
szWndClsLbl     db "static", 0

Now, everyplace you create an Edit control, you use szWndClsEdit, szWndClsBtn for all buttons, szWndClsLbl for all Static controls. The way you are doing it is unnecessary and adds 31 extra bytes to your exe.

Second, you define a WinMain procedure, and use the passed parameter - hInst once and use a global variable - hInstance. Since we need that global variable for the life of the program, we can change WinMain since passing parameters is not needed.
 WinMain proc hInst:HINSTANCE, hPrevInst:HINSTANCE, CmdLine:LPSTR, CmdShow:DWORD

So, we can change the WinMain proc, to say StartUp.
    invoke GetModuleHandle, NULL
    mov hInstance, eax
    
    call    StartUp
    invoke ExitProcess, eax

StartUp proc
local wc:WNDCLASSEX
local msg:MSG
;# local hwnd:HWND ; <------ Not needed

	mov wc.cbSize, SIZEOF WNDCLASSEX
	mov wc.style, CS_HREDRAW or CS_VREDRAW
	mov wc.lpfnWndProc, offset WndProc
	mov wc.cbClsExtra, NULL
	mov wc.cbWndExtra, NULL
	push hInstance
	pop wc.hInstance
	mov wc.hbrBackground, COLOR_APPWORKSPACE+2
	mov wc.lpszMenuName, NULL
	mov wc.lpszClassName, offset ClassName
	invoke LoadIcon, NULL,  IDI_APPLICATION
	mov wc.hIcon,eax
	mov wc.hIconSm, eax
	invoke LoadCursor, NULL, IDC_WAIT ; <----- Shouldn't this be IDC_ARROW??
	mov wc.hCursor, eax
	invoke RegisterClassEx, addr wc
	invoke CreateWindowEx,0, addr ClassName, addr AppName,
	WS_SIZEBOX  or WS_VISIBLE, 230, 230, 230, 230, NULL, NULL, hInstance, NULL
;#	mov hwnd, eax ; <------ Not needed

	.while TRUE
		invoke GetMessage, addr msg, NULL, 0, 0
		.break .if (!eax)
		invoke TranslateMessage, addr msg
		invoke DispatchMessage, addr msg	    
	.endw    

    mov eax, msg.wParam
    ret
StartUp endp


Now, onto the WndProc. I have a wide monitor and your CreateWindowEx code, runs off my screen, we can reformat all those CreateWindowEx calls from this:
invoke CreateWindowEx, NULL, addr StaticClassName, addr StatText, WS_CHILD or WS_VISIBLE, 10, 10, 100, 20, hWnd, StaticID, hInstance, NULL

to this:
	invoke CreateWindowEx, \
	            NULL, \
	            addr StaticClassName, \
	            addr StatText, \
	            WS_CHILD or WS_VISIBLE, \
	            10, 10, \
	            100, 20, \
	            hWnd, StaticID, \
	            hInstance, NULL

Notice the line continuation character at the end of each line - "\"

You create 2 buttons, but assign the handle of the second button to both vars hButton and hButton1. You need to save the returned handle after each call to Createwindow.
This is not correct:
	invoke CreateWindowEx, NULL, addr ButtonClassName, addr ButtonText, WS_CHILD or WS_VISIBLE or BS_DEFPUSHBUTTON, 10, 130, 80, 20, hWnd, ButtonID, hInstance, NULL
	invoke CreateWindowEx, NULL, addr ButtonClassName1, addr ButtonText1, WS_CHILD or WS_VISIBLE or BS_DEFPUSHBUTTON, 110, 130, 80, 20, hWnd, ButtonID1, hInstance, NULL
	mov hButton, eax
	mov hButton1, eax

This is correct:
	invoke CreateWindowEx, NULL, addr ButtonClassName, addr ButtonText, WS_CHILD or WS_VISIBLE or BS_DEFPUSHBUTTON, 10, 130, 80, 20, hWnd, ButtonID, hInstance, NULL
	mov hButton, eax

	invoke CreateWindowEx, NULL, addr ButtonClassName1, addr ButtonText1, WS_CHILD or WS_VISIBLE or BS_DEFPUSHBUTTON, 110, 130, 80, 20, hWnd, ButtonID1, hInstance, NULL
	mov hButton1, eax


Same for your Edit controls, not correct:
	invoke CreateWindowEx, WS_EX_CLIENTEDGE, addr EditClassName, NULL, WS_CHILD or WS_VISIBLE,110, 10, 100, 20,hWnd, EditID, hInstance, NULL
	invoke CreateWindowEx, WS_EX_CLIENTEDGE, addr EditClassName1, NULL, WS_CHILD or WS_VISIBLE,110, 50, 100, 20,hWnd, EditID1, hInstance, NULL
	invoke CreateWindowEx, WS_EX_CLIENTEDGE, addr EditClassName2, NULL, WS_CHILD or WS_VISIBLE,110, 90, 100, 20,hWnd, EditID2, hInstance, NULL
	
	mov hEdit, eax
	mov hEdit1, eax
	mov hEdit2, eax

Correct:
	invoke CreateWindowEx, WS_EX_CLIENTEDGE, addr EditClassName, NULL, WS_CHILD or WS_VISIBLE,110, 10, 100, 20,hWnd, EditID, hInstance, NULL
	mov hEdit, eax
	
	invoke CreateWindowEx, WS_EX_CLIENTEDGE, addr EditClassName1, NULL, WS_CHILD or WS_VISIBLE,110, 50, 100, 20,hWnd, EditID1, hInstance, NULL
	mov hEdit1, eax
	
	invoke CreateWindowEx, WS_EX_CLIENTEDGE, addr EditClassName2, NULL, WS_CHILD or WS_VISIBLE,110, 90, 100, 20,hWnd, EditID2, hInstance, NULL
	mov hEdit2, eax


Constants/Equates/Defines are normally all Uppercase, so when looking at code, you can tell right away those are equates:
EditID2 can be changed to EDIT_ADDRESS, EditID1 > EDIT_AGE, EditID > EDIT_NAME. Notice how I use names that make sense, you can look at the code and know what it is for. Same goes for your variables that hold the hWnds - hEdit > hEditName, hEdit1 > hEditAge, hEdit2 > hEditAddress

The "+" operator is NOT the same as OR'ing!!!!
invoke MessageBox, NULL, addr p, addr o, MB_ICONINFORMATION + MB_YESNO

Should be:
invoke MessageBox, NULL, addr p, addr o, MB_ICONINFORMATION OR MB_YESNO


On code readability, know when to use ADDR and OFFSET; use ADDR for all LOCAL variables, and use OFFSET for all variables defined in the .data and .data? sections. It helps make code self documenting, so when you or someone else looks at your code, they can tell what variable is local to the procedure, and which are global.

Not really sure what you are trying to do when a button is clicked, maybe save Name, Age, and Address to file? Before we get to that, let's clean up/change your WM_COMMAND handler:
   .elseif eax == WM_COMMAND
        mov		edx,wParam
        movzx	eax,dx
        shr		edx,16
        .if edx == BN_CLICKED
            .if eax == ButtonID ; Ok clicked
            
            .else ; Exit clicked
            
            .endif 
        .endif

Now your code for opening, and writing to a file is really whacked out.
First, it not good to hard code a path to a file, instead use the open file dialog to get the path and name for the file - GetOpenFileName
It will be easier for me to show how I would do it and comment my code. But first a few errors:
    invoke CreateFile, addr efren, GENERIC_READ or GENERIC_WRITE,0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL
    mov hEdit,eax

You just overwritten the handle for your edit control with the file handle, shouldn't that be mov hFile, eax??
invoke WriteFile,hFile,addr efren,FileSize,ADDR BytesRead,0
mov hFile,eax

WriteFile, returns status codes, you just overwritten the handle to the file with a status code.
mov hFile,eax is not needed.

Here is how I would do it: Your code is still in there:
include masm32rt.inc

EditControlsStruct struc
    hEdtName    DWORD ?
    hEdtAge     DWORD ?
    hEdtAddy    DWORD ?    
EditControlsStruct ends

.data

    dwBytesWritten dw "0", 0
    BytesToWrite dw "30", 0
    ClassName db "WinClass", 0
    AppName db "FINAL_PROJECT", 0
    
szWndClsEdit    db "edit", 0
szWndClsBtn     db "button", 0
szWndClsStc    db "static", 0

    Msg db "You Clicked the Button!", 0
    ButtonText db "OK", 0
    ButtonText1 db "CANCEL", 0
    p db "PLEASE CONFIRM EXIT ?", 0
    o db "PROMPT", 0
    StatText db "NAME:", 0
    StatText1 db "AGE:", 0
    StatText2 db "ADDRESS:", 0
    efren db "C:\Users\Lau\Desktop\ASS\nn\DATA.txt", 0

szCRLF      db  13, 10, 0   
szFilePath db "D:\Projects\Dream In Code User Code\olracselanreb\EditControlToFile\Data.txt", 0
  
    
.data?
    EditConrols EditControlsStruct <?>
    
    hInstance HINSTANCE  ?
    hEdit     HWND       ?
    hButton1  HWND       ?
    hEdit1    HWND       ?
    hEdit2    HWND       ?
    hButton   HWND       ?
    hStatic   HWND       ?
    hStatic1  HWND       ? 
    hStatic2  HWND       ?
   
    hFile       dd ?
    FileSize    dd ?
    hMem        dd ?
    BytesRead   dd ?

hHeap   dd  ?   
dwTextLen   dd  ?

.const
    EditID equ 12345
    ButtonID equ 67890
    EditID1 equ 1
    ButtonID1 equ 6
    EditID2 equ 2
    StaticID equ 123
    StaticID1 equ 456
    StaticID2 equ 789
    MEMORYSIZE equ 65535
.code
start:
    invoke GetModuleHandle, NULL
    mov hInstance, eax
    
    invoke  GetProcessHeap
    mov     hHeap, eax
    
    call    StartUp
    invoke ExitProcess, eax

StartUp proc
local wc:WNDCLASSEX
local msg:MSG
;local hwnd:HWND ; <------ Not needed

	mov wc.cbSize, SIZEOF WNDCLASSEX
	mov wc.style, CS_HREDRAW or CS_VREDRAW
	mov wc.lpfnWndProc, offset WndProc
	mov wc.cbClsExtra, NULL
	mov wc.cbWndExtra, NULL
	push hInstance
	pop wc.hInstance
	mov wc.hbrBackground, COLOR_APPWORKSPACE+2
	mov wc.lpszMenuName, NULL
	mov wc.lpszClassName, offset ClassName
	invoke LoadIcon, NULL,  IDI_APPLICATION
	mov wc.hIcon,eax
	mov wc.hIconSm, eax
	invoke LoadCursor, NULL, IDC_WAIT ; <----- Shouldn't this be IDC_ARROW??
	mov wc.hCursor, eax
	invoke RegisterClassEx, addr wc
	invoke CreateWindowEx,0, addr ClassName, addr AppName,
	WS_SIZEBOX  or WS_VISIBLE, 230, 230, 230, 230, NULL, NULL, hInstance, NULL
;~	mov hwnd, eax ; <------ Not needed

	.while TRUE
		invoke GetMessage, addr msg, NULL, 0, 0
		.break .if (!eax)
		invoke TranslateMessage, addr msg
		invoke DispatchMessage, addr msg	    
	.endw    

    mov eax, msg.wParam
    ret
StartUp endp

     WndProc proc uses esi edi ebx hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
        .if uMsg == WM_DESTROY
            invoke PostQuitMessage, 0
        .elseif uMsg == WM_CREATE
	invoke CreateWindowEx, \
	            NULL, \
	            addr szWndClsStc, \
	            addr StatText, \
	            WS_CHILD or WS_VISIBLE, \
	            10, 10, \
	            100, 20, \
	            hWnd, StaticID, \
	            hInstance, NULL
                    
        invoke CreateWindowEx, NULL, addr szWndClsStc, addr StatText1, WS_CHILD or WS_VISIBLE, 10, 50, 100, 20, hWnd, StaticID, hInstance, NULL
        invoke CreateWindowEx, NULL, addr szWndClsStc, addr StatText2, WS_CHILD or WS_VISIBLE, 10, 90, 100, 20, hWnd, StaticID, hInstance, NULL
           
	invoke CreateWindowEx, NULL, addr szWndClsBtn, addr ButtonText, WS_CHILD or WS_VISIBLE or BS_DEFPUSHBUTTON, 10, 130, 80, 20, hWnd, ButtonID, hInstance, NULL
	mov hButton, eax

	invoke CreateWindowEx, NULL, addr szWndClsBtn, addr ButtonText1, WS_CHILD or WS_VISIBLE or BS_DEFPUSHBUTTON, 110, 130, 80, 20, hWnd, ButtonID1, hInstance, NULL
	mov hButton1, eax
	
	invoke CreateWindowEx, WS_EX_CLIENTEDGE, addr szWndClsEdit, NULL, WS_CHILD or WS_VISIBLE,110, 10, 100, 20,hWnd, EditID, hInstance, NULL
	mov EditConrols.hEdtName , eax
	
	invoke CreateWindowEx, WS_EX_CLIENTEDGE, addr szWndClsEdit, NULL, WS_CHILD or WS_VISIBLE,110, 50, 100, 20,hWnd, EditID1, hInstance, NULL
	mov EditConrols.hEdtAge, eax
	
	invoke CreateWindowEx, WS_EX_CLIENTEDGE, addr szWndClsEdit, NULL, WS_CHILD or WS_VISIBLE,110, 90, 100, 20,hWnd, EditID2, hInstance, NULL
	mov EditConrols.hEdtAddy, eax

    .elseif uMsg == WM_COMMAND
        mov		edx,wParam
        movzx	eax,dx
        shr		edx,16
        .if edx == BN_CLICKED
            .if ax == ButtonID ; Ok clicked
                ; Use GetOpenFileName here
                ;
                invoke  CreateFile, \   
                    offset szFilePath, \
                    GENERIC_WRITE, \
                    NULL, \
                    NULL, \
                    OPEN_ALWAYS, \
                    FILE_ATTRIBUTE_NORMAL, \
                    NULL
                .if eax == INVALID_HANDLE_VALUE
                    ; Uh oh, could not open or create file!!!
                    ; inform user here
                    jmp     COMMAND_DONE
                .endif
                mov     hFile, eax
                
                xor     ebx, ebx
                xor     edi, edi
                lea     esi, EditConrols
                ; Get text length of all controls
                .while ebx <= sizeof EditConrols / 4 - 1
                    invoke  SendMessage, [esi + 4 * ebx], WM_GETTEXTLENGTH, 0, 0
                    add     edi, eax
                    inc     ebx
                .endw
                add     edi, 7 ; space for 3 CRLF pairs and NULL terminator
                               
                invoke  HeapAlloc, hHeap, HEAP_ZERO_MEMORY, edi
                mov     edi, eax
                
                ; Get text from all controls and append to buffer
                xor     ebx, ebx
                lea     esi, EditConrols
                ; Get text length of all controls
                .while ebx <= sizeof EditConrols / 4 - 1
                    invoke  SendMessage, [esi + 4 * ebx], WM_GETTEXTLENGTH, 0, 0
                    inc     eax
                    invoke  SendMessage, [esi + 4 * ebx], WM_GETTEXT, eax, edi
                    invoke  szCatStr, edi, offset szCRLF ; add crlf to text
                    invoke  szLen, edi  ; len of test
                    push    eax
                    invoke  SetFilePointer, hFile, NULL, NULL, FILE_END ; move file pointer to end of file
                    pop     eax
                    invoke  WriteFile, hFile, edi, eax, offset BytesRead, 0 ; write text to file
                    inc     ebx
                .endw            
                invoke  WriteFile, hFile, offset szCRLF, 2, offset BytesRead,0 ; write crlf to file to seperate entries
                invoke  CloseHandle, hFile
                invoke  HeapFree, hHeap, 0, edi    

            .else ; Exit clicked
                invoke MessageBox, NULL, addr p, addr o, MB_ICONINFORMATION or MB_YESNO
                .if eax == IDYES
                    invoke	SendMessage, hWnd, WM_DESTROY, NULL, NULL
                .endif
            .endif 
        COMMAND_DONE:
        .endif	
	.else
        invoke DefWindowProc, hWnd, uMsg, wParam, lParam
        ret	
	.endif
          xor eax, eax
          ret
      WndProc endp
end start


I entered info twice, and this is the result in data.txt

Quote

Me
21
Here

You
25
There

Was This Post Helpful? 2
  • +
  • -

Page 1 of 1