I am changing the architecture of a VB 6 scheduling application from serial execution architecture to parallel execution and I need to do this with as little code changes as possible. Basically, the first instance of the .exe will start a defined amount of additional instances.
One of the changes required is to update the job table with the PID of the instance that is executing the job. I have searched but I have not been able to find a way to get this when multiple instances of the same .exe may be running.
How can I get the process ID of the current process?
Put in this into your code:
Declare Function GetCurrentProcessId Lib "kernel32" Alias "GetCurrentProcessId" () As Long
Do it the same way a program in any other language would do it: Call GetCurrentProcessId.
Related
I want to know how to (or can I) parameterize the parm file name in informatica?
little bit of background. I am building a standard map in informatica. Which business users can call directly after selecting the standard filters they want to apply in the map using a GUI.
The parm file name will be given by business users and all the filters that he/she selected will be in parm. The file will be dropped in the parm folder in informatica server.
This is a good case scenario, when only 1 users is using it at 1 point of time.
Also, I want to find out what should I do when multiple users are working on GUI and generating the parm files and invoking the informatica map. How do I get multiple instences of the same map running at the same time?
I hope I am making sense here....
Thanks!!!
You can achieve this by using concurrent execution of the workflow. Read about it and understand how can you implement it.
Once you know how to implement it, use a backend script/code by the gui to assign an instance name to each call through GUI. For each instance name, you can have an individual parameter file. (I believe that there would be a finite set of combination of variable values in your case). You can use below command to call individual instances, (either through you GUI or by any other backend code.
pmcmd %workflow_name% %informatica_folder_name%
-paramfile %paramfilepathandname% -rin %instance_name%
It might sound a bit confusing, but once you understand how concurrent workflows work, you can build on it based on the above input.
It'll be only possible if you call the Informatica from external tool, not the Client tools. One way is described by #Utsav, the other is when you use Informatica WSH to call a Workflow - you can indicate the parameterfile you want to be used with the workflow, as well as desired instance name.
I Think this guide to concurrent workflows May be what you are looking for:
https://kb.informatica.com/howto/6/Pages/17/301264.aspx
This question already has answers here:
How to wait for a shell process to finish before executing further code in VB6
(7 answers)
Closed 8 years ago.
I'm working on a project in which total 5 modules are there like HR, Accounts etc. The software is desingned in such a way that all these 5 modules are created seperately and connected to the main project using shell command. Now, the real problem is, if i first work in HR module and the after closing that i want to work in Accounts; the program control is nt transfering back to the main project from where i called the first shell command. is there any way to get this done. Please help me.
Thanks in advance
There is no "shell command" though VB6 does have a Shell function that can be used to run another program asynchronously.
If this is what you are using, and you have a simple case of program P0 that can spawn programs P1 through P5 and terminate. Each of these additional programs could re-run P0 as part of terminating. In this case you might want P0 to persist some state or that might not be necessary at all. If the required amount of state is minimal P0 through P5 could pass info back and forth as command line strings when they call Shell.
You could perhaps get "whizzier" and have P0 use a shell-and-wait technique and while waiting it could hide itself. Then once the P1, P2, etc. terminates P0 could make itself visible again.
There is also the option of creating P0 as a standard EXE and P1 through P5 as ActiveX EXEs invoked by P0.
There are also several kinds of IPC you might use instead to "federate" these separate programs (not "modules") into a cohesive application.
Is there any reason why there have to be five executables? Some sort of multi-processing? Otherwise, I would simply put each module into a separate DLLs or OCXs. There would be a "master" program which would be there simply to load these components. You could either have the following classes in your DLL:
P1.Connect
P2.Connect
P3.Connect
P4.Connect
P5.Connect
Each one implementing an interface with a Load() method. This method loads the main form of the module.
Alternatively, you can be generic and have forms in the master program which load ActiveX controls from each OCX which contain the module GUI.
You would implement an event or callback from each Connect class so that when the module is closed, the master EXE knows about it.
If you absolutely must have separate EXEs, you could do this by implementing them as ActiveX EXEs, with the same class names as above. As I suggested, your "master EXE" would be responsible for loading each subsiduary module.
As an aside, regardless of which method you use, if you require five separate "start" icons, then you can create five shortcuts which refer to the master EXE, but with different command line parameters. Depending on which command line parameter used, you start a different module.
I need to run a ruby script for one week and check whether it is running for every hour.
Could you please suggest me some way? I need to check this in windows machine.
For ex:- I have script called one_week_script.rb which will run for one week, in between i want to check whether the script is running or not? if it is not running, then running that script from another script
A typical solution is to use a "heartbeat" strategy. The "to be monitored" notifies a "watchdog" process on a regular interval. A simple way of doing this might be to update the contents of some file every so often, and the watchdog simply checks that same file to see if it's got recent data.
The alternative, simply checking if the process is still 'loaded' has some weaknesses, The program could be locked up, even though it's still apparently 'running'. Using the heartbeat/watchdog style means you know that the watched process is operating normally, because you're getting feedback from it.
In a typical scenario, you might just write the current time, and some arbitrary diagnostic data, say the number of bytes processed (whatever that might mean for you).
This is my problem, I've got a batch-script that I can't modify (lets call it foo) and I would like to count how many times/day this script is executed - to keep track of that data.
Preferably, I would like to write the number of executions with date and exit-code to some kind of log file.
So my question is if this is possible and in that case - how? To create a batch-script/something that works in the background and writes every execution of foo to a log.
(I know this would be easy if I could modify foo but I can't. Also, everything is running on WinXP machines.)
You could write a wrapper script that does the logging and calls the existing script. Then use the wrapper in place of the original script
Consider writing a program that interrogates the Task Manager.
See http://www.netomatix.com/ProcDiagnostics.aspx
You could, for example, write a simple Console app which runs on a timer; every 5 seconds it checks that your foo application process exists. If it finds that it does, it assumes that find as the start time of the application; if it doesn't find it, it assumes the application has now closed and logs that information. It wouldn't be accurate to the second by any means, but would give you a rough approximation of when the thing is running and closing.
You might be able to configure Process Monitor
http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx to capture the information you require
I need to obtain the Handle to a process using its
Image Name so that I can use it with TerminateProcess
function.
Any help will be appreciated
Farid
Use CreateToolhelp32Snapshot and Process32First/Next to iterate the running processes. Figuring out which one you'd want to abort if there's more than one instance of the process is of course not really possible.