Hello Everyone
How do you save text in one edit box to the name of the path in another editbox ? ? ?
I got this text in hwndedit2 edit box:. . . . . . . Call Mom Today
I got the pathname that I want to save the text to in hwndedit1: C:\MyFile.txt
I Tried This............................................
invoke CreateFile,addr hwndedit1,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0
mov FHandle,eax
invoke WriteFile,FHandle,addr hwndedit2,16,addr NumBytesWritten,0
invoke CloseHandle,FHandle
IT DID NOT WORK FOR ME SO I TRIED BUFFERS .................
invoke lstrcpy,ADDR hwndEdit2,ADDR buffer2 ; to a buffer
invoke lstrcpy,ADDR hwndEdit1,ADDR buffer1 ; to a buffer
invoke CreateFile, addr buffer2, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0
mov hfile, eax
invoke WriteFile, hfile, addr buffer1, 7, addr NumBytesWritten, 0
invoke CloseHandle,hfile
THIS DID NOT WORK EITHER .................................
Could someone tell me how to save text to a file by using the path name out of an edit box. I know you can do it from an 0 Teminated string written in the app but how about this way.....also the above example could be backwards because it seems like i tried a 100 diffrence ways with no success and got confussed.
Thanks
How do you save text in one edit box to the name of the path in another editbox ? ? ?
I got this text in hwndedit2 edit box:. . . . . . . Call Mom Today
I got the pathname that I want to save the text to in hwndedit1: C:\MyFile.txt
I Tried This............................................
invoke CreateFile,addr hwndedit1,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0
mov FHandle,eax
invoke WriteFile,FHandle,addr hwndedit2,16,addr NumBytesWritten,0
invoke CloseHandle,FHandle
IT DID NOT WORK FOR ME SO I TRIED BUFFERS .................
invoke lstrcpy,ADDR hwndEdit2,ADDR buffer2 ; to a buffer
invoke lstrcpy,ADDR hwndEdit1,ADDR buffer1 ; to a buffer
invoke CreateFile, addr buffer2, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0
mov hfile, eax
invoke WriteFile, hfile, addr buffer1, 7, addr NumBytesWritten, 0
invoke CloseHandle,hfile
THIS DID NOT WORK EITHER .................................
Could someone tell me how to save text to a file by using the path name out of an edit box. I know you can do it from an 0 Teminated string written in the app but how about this way.....also the above example could be backwards because it seems like i tried a 100 diffrence ways with no success and got confussed.
Thanks
cmax,
The problem is you are not 'getting' the 'text' from the editbox,
try this...
use the same method to get the string you want to write to the file.
The problem is you are not 'getting' the 'text' from the editbox,
try this...
LOCAL textlength:DWORD
LOCAL buffer[256]:BYTE ;set buffer to largest size you might ever use
invoke SendMessage,hwndedit1,WM_GETTEXTLENGTH,0,0
mov textlength,eax
;WM_GETTEXTLENGTH does not count terminating zero
inc textlength
invoke SendMessage,hwndedit1,WM_GETTEXT,textlength,addr buffer
;buffer now contains zero terminated 'path' (C:\MyFile.txt)
invoke CreateFile,addr buffer,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_
ATTRIBUTE_NORMAL,0
use the same method to get the string you want to write to the file.
I will try it now. It read like it will work. Thanks for saving me many more days of looking in the wrong direction.
That it. Short and Sweet