I want to open and read a file which has not been saved. I would like to do this in Windows OS with VC++ or by means of a batch file only.
If I open up the file by normal method of fopen or fopen_s, the file is opened in the last saved manner which is not what I want. I want all the data which is present in the file but not yet saved.
I have read something on this in this link. Similar question. But I am unable to follow the scripts. Can someone please convert it into a batch and give it to me?
I believe you mean read the contents from a window or control.
Files are made only after data is saved.
To read contents of a window like the edit control in Notepad, you first have to get a handle to the control. You can do this using
FindWindowto first get the handle of the main window and then use it inFindWindowExto get the handle of the edit control.Once you have the handle of the control, you can send it
WM_GETTEXTmessage usingSendMessageto read the text it contains.Please note that this may not work for all applications. For example, MS-Word uses a rich edit control which had its own methods to fetch text.