WMI in VC++.

Want to run an event using WMI in vc++.

Page 1 of 1

2 Replies - 646 Views - Last Post: 06 January 2011 - 08:17 AM Rate Topic: -----

#1 NIKHIL977  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 38
  • Joined: 02-November 10

WMI in VC++.

Posted 06 January 2011 - 07:30 AM

Hi,
I am coding my application in vc++, and a very new ti WMI. I have a script writtem which initiates a ieexplore file with one argument in it on a call to a method in which it is initiated. The code for my script is,
Const SW_NORMAL = 1
strComputer = "."
strCommand = "C:\\Program Files\\Internet Explorer\\iexplore.exe http://www.google.com" 
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" _
    & strComputer & "\root\cimv2")

' Configure the Notepad process to show a window
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = SW_SHOWMAXIMIZED

' Create Notepad process
Set objProcess = objWMIService.Get("Win32_Process")
intReturn = objProcess.Create _
    (strCommand, Null, objConfig, intProcessID)


It is working all fine. but now i want to hard code this task in my vc++ programme using WMI.

Please help me it is very much urgent.

Thanks,
Nikhil.

MOD EDIT: When posting code...USE CODE TAGS!!!

:code:

This post has been edited by JackOfAllTrades: 06 January 2011 - 08:14 AM


Is This A Good Question/Topic? 0
  • +

Replies To: WMI in VC++.

#2 Salem_c  Icon User is offline

  • void main'ers are DOOMED
  • member icon

Reputation: 2129
  • View blog
  • Posts: 4,196
  • Joined: 30-May 10

Re: WMI in VC++.

Posted 06 January 2011 - 08:11 AM

> The code for my script is,
"Your" script?
Seems to me you just "found" it here and just replaced notepad with iexploder

> Please help me it is very much urgent.
http://www.catb.org/...ons.html#urgent

Is it urgent enough for you to at least have a go at implementing it in C++, as opposed to trying to palm off someone else's VB code on us?
Was This Post Helpful? 0
  • +
  • -

#3 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6245
  • View blog
  • Posts: 24,013
  • Joined: 23-August 08

Re: WMI in VC++.

Posted 06 January 2011 - 08:17 AM

We're not an urgent (why are so many requests for this type of thing URGENT, anyway?) code-writing/code-porting service!

Closed.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1