Catching "Save..." and "Save As..." from other applications (Office suite)

Hello,
  I would like to create an app with delphi (RadXE) that:
- catch the "save..." and "save as..." from other applications, in particular MS-Office suites (but also other apps)
- get some data from a dialog form before saving etc...
- then going quiescent waiting for the next "save" or "save as..." event...
I thought a way could be launching the external app by my delphi application getting handles to it, but I don't know how to catch events.
Anybody can help me? (I am sure of yes! :)
thanks in advance,
Filippo
__________________
Filippo Forlani
www.filippoforlani.org
0
Filippo
12/14/2010 6:18:05 PM
πŸ“ embarcadero.delphi.win32
πŸ“ƒ 2183 articles.
⭐ 0 followers.

πŸ’¬ 3 Replies
πŸ‘οΈβ€πŸ—¨οΈ 1185 Views


<Filippo Forlani> wrote in message news:314023@forums.embarcadero.com...
>  I would like to create an app with delphi (RadXE) that:
> - catch the "save..." and "save as..." from other applications,
> in particular MS-Office suites (but also other apps)
For apps that use the Win32 API GetSaveFileName() function to display a 
standard OS save dialog, you would have to write a DLL that hooks into every 
running process via the Win32 API SetWindowsHookEx() function, and then the 
DLL can patch the process's PE Imports table to hook into the 
GetSaveFileName() function.
However, Vista introduces new dialogs that are exposed via COM objects 
instead of API functions (in this case, the IFileSaveDialog interface).  To 
hook those dialogs, you would have to change the COM object registration in 
the Registry (which you are likely to be locked out of) to delegate that COM 
object to your custom DLL.  That way, when the COM object is instantiated by 
any app, your DLL is called first, and then it can forward any requests to 
the real IFileSaveDialog dialog as needed.
Lastly, Office does not use standard OS dialogs either way, so you would 
have to hook those dialogs manually using low-level Win32 API tricks, like 
CBT hooks and subclassing.
> - get some data from a dialog form before saving etc...
What kind of data exactly?  Different dialog types expose different kinds of 
data in different ways.
-- 
Remy Lebeau (TeamB)
0
Remy
12/14/2010 9:02:34 PM
Thank you Remy,
I try to explain better what I would like to do, hoping the solution would be simpler! :)
My idea is to catch 'Save' and 'Save as...' of office (and for example AutoCAD...) and then, after saving as the app wants, ask some datas, (revision number, author, state... etc...) to insert into a database... something like an ECM.
Hope I am more clear now, so, for example in Word:
a- I write something
b- I click save
c- word ask me with its dialog (normally), the name of the file
d- I press save from the word's dialog and save the file
e- my app catch the word's "save", then shows a dialog asking me some more datas (author, revision number etc.)
f- my app will send these datas as a record into a database
My problem is to implement point "e"...
thanks in advance,
Filippo
_________________
Filippo Forlani
www.filippoforlani.org

> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> <Filippo Forlani> wrote in message news:314023@forums.embarcadero.com...
> 
> >  I would like to create an app with delphi (RadXE) that:
> > - catch the "save..." and "save as..." from other applications,
> > in particular MS-Office suites (but also other apps)
....
> > - get some data from a dialog form before saving etc...
> 
> What kind of data exactly?  Different dialog types expose different kinds of 
> data in different ways.
> 
> -- 
> Remy Lebeau (TeamB)
0
Filippo
12/15/2010 6:49:55 PM
<Filippo Forlani> wrote in message news:314321@forums.embarcadero.com...
> I try to explain better what I would like to do, hoping
> the solution would be simpler! :)
Sorry, but what you have described does not change my earlier reply.  You 
are looking at a lot of manual hooking to accomplish what you are 
attempting.
-- 
Remy Lebeau (TeamB)
0
Remy
12/18/2010 10:51:07 AM
Reply: