Article View: borland.public.cppbuilder.nativeapi
Article #2483How do I cast a variable of WMI class Win32_ProcessStartup to a Variant
From: Maurice Anderson
Date: Sat, 24 Feb 2007 18:30
Date: Sat, 24 Feb 2007 18:30
66 lines
3310 bytes
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
Technical Details
Message-ID:
<45e0cf57$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,f4381c79de1c8671,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Maurice Anderson" <mauriceanderson@hotmail.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: How do I cast a variable of WMI class Win32_ProcessStartup to a Variant Date: Sat, 24 Feb 2007 10:30:21 -0800 Lines: 68 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3028 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 64.30.203.223 Message-ID: <45e0cf57$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1172361047 64.30.203.223 (24 Feb 2007 15:50:47 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail