Answered by:
How to save-as currently opened document without saving current document from metro app

Question
-
Hi,
I have requirement where I will save-as currently opened document from text editing applications like NotepadClassic or any other text editing application. My requirement is not to close or change the status (save or unsave) of currently opened document but saving all its content to my local disk without changing the current document, where I can perform some operation on saved file based on some event.
I want to do this from C++ dll which I am planing to load in metro app from which I will save-as that content file. I am not aware of internals of WinRT application, so someone from expert can help me to achieve this then that would be really helpful.
Thanks
Bishnu
Wednesday, December 11, 2013 1:15 PM
Answers
-
There is no supported way to break into other people's apps like this.
--Rob
- Marked as answer by Xiaoliang Chen - MSFTModerator Thursday, December 19, 2013 12:09 PM
Saturday, December 14, 2013 12:10 AMModerator
All replies
-
You cannot modify or control others' apps in this way.
Save as is purely app internal logic. The app could keep track of the current save file and either override it with one chosen with a save picker or save and forget.
--Rob
Wednesday, December 11, 2013 4:35 PMModerator -
Hi Rob, Thanks for your reply.
Actually I am not intended to modify or control other apps. What I want is to without changing any application behavior I want to read all contents(Saved \ unsaved) opened in current application window and save a temp copy of those content without changing the currently opened file in application.
Or In simple words without changing any user experience from the UI, I want to read all data from a application. I am not cornered about format of data so even if application Save As data using their propitiatory format, I just want to read it in the form of binary data which when I write on some temp location will contain all formatting and signature information of that file.
I am planning to load a C++ dll in Application itself so that it will have access to all resources of process.
Is their any Generic low level API which can be used for this purpose, or if their is any sample code that I can use for this purpose.
Thursday, December 12, 2013 6:55 AM -
From a desktop app you could monitor the application data directories, but there is no supported way to inject into an app and manipulate it as you describe.
--Rob
Friday, December 13, 2013 1:04 AMModerator -
Rob, let me try to give you some more info about problem that I wanted to solve using above approach.
Actually I wanted to trace Print event from Metro app and in the event of Print I want to know, what content it is printing. I can achieve this partially by hooking "StartDocPrinter" API, from which I can get the file name which is about to print on printer. But my problem is, In case if user is typing some content on new file and without saving it, if he start printing then this API does not return file name it simply shows "untitled" as file name. That is the reason I was trying to save the content in file. I also tried to read data from "WritePrinter" API but I think data it is writing is not a normal string data, it is specific to printer. Is there any mechanism by which I can convert this "WritePrinter" data to normal text data.
or if you have any other idea about fetching the content by hooking at some other APIs.
Friday, December 13, 2013 4:42 AM -
There is no supported way to break into other people's apps like this.
--Rob
- Marked as answer by Xiaoliang Chen - MSFTModerator Thursday, December 19, 2013 12:09 PM
Saturday, December 14, 2013 12:10 AMModerator