Results 1 to 8 of 8
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    stand alone exe save interceptor (VB6)

    Not VBA, I know, but a quick question for those who code VB and VBA:

    Is it reasonable to write a stand-alone VB6 program, compiled to an EXE file, a standalone utility, that would be loaded during Windows Startup, to intercept all file Save/saveAs events, decide which (files) were worthy of pre-processing and pass those "save requests" to a previously-written application?

    I have an existing Word/Excel project that happily intercepts save/saveas/close events and enhances the path and name of the file before effecting the save. I can easily (?) migrate the code to PPT, Project etc, I suppose, but what if I wanted to intercept Paintbrush, Notepad, Corel WordPerfect, Lotus-123 and so on? In the first instance I would want to intercept the save/saveas/close event, determine whether the file type/application was on the required list, and if so, pass this request to my existing code.

    I already do this with Lotus Notes; we hired a Lotus Notes programmer to write interceptor code within Lotus Notes. When the user saves attachments, the files are passed to my MSWord application which tags those files prior to effecting the save. Quite obviously we can't/won't hire a Notepad or Paintbrush programmer. So I thought of a small standalone interceptor, and figured VB6 *.EXE.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: stand alone exe save interceptor (VB6)

    Only a small subset of all programs has events you can intercept. If you want to intercept all file save operations, you'll probably have to hook into Windows at a low level.

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: stand alone exe save interceptor (VB6)

    > Only a small subset of all programs has events you can intercept.
    Right; but i don't want to program intercepts within the programs themselves.
    I want to be outside the programs, intercepting the calls to Windows.
    I suspect it is time to start reading more about the API interface.
    I miss DOS and good old Int21 (was it?)

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: stand alone exe save interceptor (VB6)

    I suspect you want the <code>SetWindowsHookEx</code> function to intercept window messages and implement a callback function of your own. I suggest you back up your machine fully before you start experimenting with it... <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: stand alone exe save interceptor (VB6)

    To answer your original question as to whether it is reasonable to do this: no, not in my opinion!
    Regards,
    Rory

    Microsoft MVP - Excel

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: stand alone exe save interceptor (VB6)

    Rory, thanks for the comments.
    In the end, client economics will govern my experiiiiits, or not, as the case may be.

    I recall wandering to the fringe of SetWindowsHookEx a couple of years ago. Maybe the time is right to begin some generic coding.

    >I suggest you back up your machine fully
    What is "fully"? Each morning my Big Beige Box backs up my laptop drive C and my Big Beige Box drive C to a 300GB removable disk. Then the Big Beige Box backs up the 300G to a 400GB removable. Then the Big Beige Box shuts down, I store the 300 & 400 in a fire-proof closet, and then start work.
    Should I purchase another large drive(grin!).

    (but see also this post)

  7. #7
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: stand alone exe save interceptor (VB6)

    That ought to be enough! <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    It was a slightly tongue-in-cheek comment, meant more to indicate that messing around with such things can mess up your system. A reboot usually cures it though (it's just if you start intercepting mouse and keyboard commands, you can end up having to do an abrupt reboot via the power button...)
    Regards,
    Rory

    Microsoft MVP - Excel

  8. #8
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: stand alone exe save interceptor (VB6)

    > you can end up having to do an abrupt reboot via the power button..

    Oh yeah.
    That.
    I think I have that little batch file scheduled on the hour every hour (grim grin!)<pre>REM XPRestart.BAT Christopher Greaves Thursday Dec 9th 2004
    ShutDown.exe -r -t 00
    REM End of XPRestart.BAT </pre>


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •