C+ Help if you could!

Permabanned
Joined
17 Jan 2006
Posts
1,971
Location
Haskins
Hi all,

Could do with some help if possible.

I have these to code files which run kick scripts for a program. Listed here they are prodinput and prodoutput respecitvely.

Code:
int InitService() {
        int result;

        GetStartupInfo(&procSU);
        result = CreateProcess(NULL, "C:\\Progra~1\\Kix32\\Kix32.exe \\\\ukbrafax2\\kix\\input.scr $log=both $IniFile=\\\\ukbrafax2\\kix\\eflow.ini", NULL, NULL, TRUE, 0, NULL, NULL, &procSU, &fgProc);

        return(result);

and

Code:
int InitService() {
        int result;
        GetStartupInfo(&procSU);
        result = CreateProcess(NULL, "C:\\Progra~1\\Kix32\\Kix32.exe \\\\ukbrafax2\\kix\\output.scr $log=both $iniFile=\\\\ukbrafax2\\kix\\eflow.ini", NULL, NULL, TRUE, 0, NULL, NULL, &procSU, &fgProc);

        return(result);

I'd like to change the locations to a registry key and check it works before running the script on a production server.

What do i need to change here?

Thanks
 
CreateProcess just executes a new process (I.e an application).

Your int InitService() is just returning a value, which shows if your process has spawned correctly, so you can use this return value to check.

So an example...

currentUser = Registry::CurrentUser;
// Open the Software key
softwareKey = currentUser->OpenSubKey(S"Software");
// Request all subkeys from the Software key
String* subkeys[] = softwareKey->GetSubKeyNames();

You want to do something like that, then change your lpCommandLine param of CreateProcess to this string.

Obviously you can write a few lines of code to check to see if the string is the one you expected.

Likewise you need using namespace Microsoft::Win32;

This page is helpful http://www.windowsitlibrary.com/Content/595/1.html
 
Last edited:
Back
Top Bottom