flat assembler
Message board for the users of flat assembler.

Index > Windows > fileread fileopen and closehandle?

Author
Thread Post new topic Reply to topic
sina



Joined: 18 Aug 2003
Posts: 132
Location: istanbul turkey
sina
hi i am trying to write something like this
the program will open the text file containing lines like

Code:
H = 1
0 = 16 
    


and then in the dialog's edit box i am going to write H20 (water molecule)
and the program will calculate the mass (2xh + 0) and print it on a static (18g Smile )

but now i am in the beginning and dealing to open the file including the constant masses

Code:
  data_file file 'data.txt'
  data_file_handle dd ?

section '.code' code readable executable

  start:

        invoke  GetModuleHandle,0
        invoke  DialogBoxParam,eax,37,HWND_DESKTOP,DialogProc,0
        or      eax,eax
        jz      exit
  exit:
        invoke  ExitProcess,0

proc DialogProc,hwnddlg,msg,wparam,lparam
        enter
        push    ebx esi edi
        cmp     [msg],WM_COMMAND
        je      wmcommand
        cmp     [msg],WM_CLOSE
        je      wmclose
        xor     eax,eax
        jmp     finish

  wmcommand:
        cmp     [wparam],ID_Close
        je      wmclose
        jmp     processed
  wmclose:
        invoke  _lclose,[data_file_handle]
        invoke  EndDialog,[hwnddlg],0
  read:
        invoke  OpenFile,data_file,0,OF_READ
        mov     [data_file_handle],eax
  processed:
        mov     eax,1
  finish:
        pop     edi esi ebx
        return
    

this crashes when exited
i think there are lots of imaginary things i have tried here Smile
some help needed ( at least just show me the way )
for example getting one line of code or one character with readfile and putting it into static control will be great
please dont get rid of this newbie Smile


Description:
Download
Filename: chemcal.rar
Filesize: 1011 Bytes
Downloaded: 227 Time(s)

Post 15 Dec 2003, 21:19
View user's profile Send private message ICQ Number Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1137
Location: Russian Federation
comrade
API you use is obsolete. Use CreateFile, ReadFile, WriteFile, CloseHandle.

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 15 Dec 2003, 21:35
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
sina



Joined: 18 Aug 2003
Posts: 132
Location: istanbul turkey
sina
ok i just looked at fresh strlib anf file procs and i am ok now
Post 17 Dec 2003, 22:11
View user's profile Send private message ICQ Number 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.