🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
1 messages
1 total messages Started by Maurice Anderson Sat, 24 Feb 2007 18:30
How do I cast a variable of WMI class Win32_ProcessStartup to a Variant
#2483
Author: Maurice Anderson
Date: Sat, 24 Feb 2007 18:30
66 lines
3310 bytes
Hello,

I have customized the create method of Win32_Process by a series of 
functions.  And for the most part is works.  The create function is defined 
as:

    Create(string CommandLine, string CurrentDirectory,
           Win32_ProcessStartup ProcessStartupInformation, uint32 
ProcessId);

For the most part I use a series of Variants for the arguments of which I 
then pass to a custom function call ExecuteTheMethod(className, methodName, 
Arguments, Var).  ExecuteTheMethod contains code to GetMethod, 
SpawnInstance, extract the arguments and the variant data and put them into 
the Create function and so on.  That much works.

My only problem is that I don't know how to use the Win32_ProcessStartup 
class which is the ProcessStartupInformation argument in the create 
function.  The class is defines as:

         class Win32_ProcessStartup : Win32_MethodParameterClass
        {
          uint32 CreateFlags;
          string EnvironmentVariables[];
          uint16 ErrorMode;
          uint32 FillAttribute;
          uint32 PriorityClass;
          uint16 ShowWindow;
          string Title;
          string WinstationDesktop;
          uint32 X;
          uint32 XCountChars;
          uint32 XSize;
          uint32 Y;
          uint32 YCountChars;
          uint32 YSize;
        };

I've got the other variables down pat, but I because I don't know how use 
Win32_ProcessStartup to say set the ShowWindow, my process starts but does 
not appear on the target screen.  It just shows up in 'task manager'.

Right now I pass a '0' into the Variant that represents 
ProcessStartupInformation to get it going.  Something like:

    Arguments->Add("CommandLine");
    Arguments->Add("CurrentDirectory");
    Arguments->Add("ProcessStartupInformation");
    Arguments->Add("ProcessId");

    Variant varValue;
    varValue = 0;

    Var[0].vt = VT_BSTR;                Var[0] = Variant(CommandLine);
    Var[1].vt = VT_BSTR;                Var[1] = Variant(CurrentDirectory);
    Var[2].vt = VT_UNKNOWN;    Var[2] = varValue;         <------------HERE
    Var[3].vt = VT_I4;                      Var[3].uintVal = ProcessId;

    BSTR methodName = SysAllocString(L"Create");

    retcode = ExecuteTheMethod(className, methodName, Arguments, Var);

How do I set ProcessStartupInformation as a Variant so I can pass it to my 
function ExecuteTheMethod?

Thanks
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads