Windows Task-Scheduler: can one start an application whenever another one gets started? - windows

I am seeking a possibility to always trigger a second application whenever another application gets started (ideally: right before the latter gets started but probably more or less "at the same time" will suffice).
The issue at hand is, that our company's IT folks for some to me unexplicable reason insist on constantly "adjusting" some Windows registry entries. One of those entries is the flag to memorize the passwords for the mail servers that Outlook keeps polling. Having to re-enter these passwords over and over again is driving me nuts and so meanwhile I also figured out which entries I have to revert to stop this nonsense. I thus now have a .reg file that I always "apply" to the registry right before starting Outlook and that helps me to maintain mental health.
But it is of course tedious to always have to click TWO icons in sequence, when opening my mail app. (Outlook). So, while I could certainly replace all Outlook "shortcuts" with shortcuts to a script file first applying the registry patch and only then starting Outlook I was wondering whether there wouldn't be a more elegant solution.
My question thus: is there an option or tool (e.g. in Windows' task-scheduler) to trigger the start of an application 'B' whenever a specific application 'A' gets is (or is about to be) started?

Related

How is it called the feature of persisting process images in OSX?

How do you call the feature of OSX being able to restart, but persisting each process state, in a way that after restating is finished it can restore each one of these processes exactly how they where previously?
For example a movie would still be paying in the same part, a text document would still have half of the sentence written even if I didn't save the txt file to disk, the browser would still have the same tabs opened and the same amount of scroll done, etc.
People call it in many different ways but "Application persistence" and "State Restoration" seem to be the most "official" ones.

Prevent any action until code finishes in vb6

I mean preventing any action closing-unloading-terminating they all should be prevented until the code finishes working..
Esspecially termination should be canceled until code finishes working..
I want to do this to create a very important .log file and with it moving some files between folders so i must prevent the guy that thouches everything in server without knowing a thing about and being called as system administrator from stopping this action just cause he doesnt like it to run in the background (if u got what i mean). Cause im having log about that server and moving files which can cause data loss. Im pretty sure most of the programmers lives trough such unnecessary thrust problems with old people and i need help to deal with this situation.
So how can i achive that in vb6?
You probably need to redesign your application logic to allow terminating your process at any stage - move files by rename_src-copy-rename_tgt-delete_src operations, close log file after each event written etc etc. Ideally you should be able always identify which operations are done purely on info, provided by file system (file names etc).
There are cases when terminating process is required, after all.
Otherwise, if your application has visible window, you can track Form_QueryUnload events and just cancel unload. Of course this doesn't prevent killing your app from task manager processes view.
While you can stop the user from trying to close the application by handling the QueryUnload event (assuming you call DoEvents periodically) there is nothing you can do to stop someone with full admin rights killing your process outright.

put application in startup

I am planning to start my application whenever the user starts the computer. ASFA I know, there are two options available to me:
put the application link to startup folder
Keep a the startup-registry location updated with application path
However, the problem is, AVs like Kasperesky reports the registry paths (if added by an app) as keyloggers. Just wanted to hear from you people, which is better? Adding a shortcut to startup folder or using the registry way.
I really would prefer that you didn't force my app to start whenever I reboot. So, if you really insist, then please put it in the Startup folder and don't hide it in the Windows registry where I will never be able to find it. There may be times when I need this thing not to start up every time, so please let me do the choosing by putting the shortcut where I can see it and manage it. Otherwise, if it gives me too much trouble, I may just start up Control Panel > Add or Remove Programs, and you really don't want that, do you?

Sharing data between users with the Windows 7 registry

I have a program that was written on XP. What I've found out is that it doesn't work properly on Win7 because HLKM is no longer writable by non-admins.
Essentially, when you register the program, the licensing information is supposed to go into the registry. That information is valid for everyone on the computer, not just the one user, so I don't want to put it in HKCU. But any copy of the program needs to be able to edit that registry (even if it's a non-admin running it), because there are certain situations when it's going to go get updated license information from my web server (for example, if the registry data is lost or damaged, or if your current license is expired and it needs to see if we've applied an extension).
It's not horrible if it goes out to the web server for every unique user who starts up the program, but it causes some annoying issues, so I'd rather it continue to work the way it did in XP. Is there a way to store data in the registry and still have it shared under Win7, or am I going to have to start looking at storing an INI file on the drive?
Here is how I would architect it: your setup runs elevated and sets up the key. Then if their licensing gets corrupted or whatnot, you enable a button or menu item that has text like "fix license" or "update license". You put a shield on that button or menu item. When they click it, you launch a separate exe using ShellExecute. That exe has a manifest that requires elevation. It can then write to the protected area of the registry. The rest of the app can have a manifest with asInvoker.
If you want it to be completely invisible, either the whole app must always run elevated (annoying) or sometimes the app will just launch another exe that asks for elevation without warning - in which case the smart users will say no. A little less invisibility is a good thing imo.
Could you get the installer to make your particular area of the registry to be writeable by everyone? The installer will need to be run with elevated privileges anyway, I'd expect - so this would seem an ideal approach.

Active windows in Windows and QWidget::activateWindow()

The Qt documentation for QWidget::activateWindow() states:
On Windows, if you are calling this
when the application is not currently
the active one then it will not make
it the active window. It will change
the color of the taskbar entry to
indicate that the window has changed
in some way. This is because Microsoft
does not allow an application to
interrupt what the user is currently
doing in another application.
However, Skype appears to defy this rule. If Skype is running but is not the active application, I can launch it from the start menu and it brings the existing instance to the foreground, activates it and grabs input focus.
And how can I do this?
(NOTE: This is specific to how QtSingleApplication works)
The solution is stupidly simple for my issue. Simply call AllowSetForegroundWindow(ASF_ANY); at the beginning of the application, and the original process will thus be allowed to bring itself to the foreground by use of SetForegroundWindow(). No strange hacks, just one line of code to add and no need to modify QtSingleApplication either.
I don't think you can do it reliably with the Qt API alone.
There are multiple solutions for windows. E.g. here, and here, and here.
The method I've used before is to declare a shared memory section, and write the application's window handle there. Later, when a second instance of your program is started, you can find the window handle of the first and activate it.
I don't think you have the issue of windows preventing you from doing this in this case, because your second instance is the active application, so it is allowed to 'pass focus' to other windows.
Use Single Application in Qt Solutions
For some applications it is useful or
even critical that they are started
only once by any user. Future attempts
to start the application should
activate any already running instance,
and possibly perform requested
actions, e.g. loading a file, in that
instance.
you can set the setWindowOpacity from 0 to 1 .the only thing is you may open it all the time

Resources