Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Installing a program using Shell in VB

Posted on 2003-11-26
7
Medium Priority
?
322 Views
Last Modified: 2011-09-20
I have an anti-virus program and set up files are in folder called c:\anti-virus

I can install that program typing c:\anti-virus\setup.exe

I want to call this program from my vb application. This is what i am doing in my program

dim strCommand as string
strCommand =
"c|windows\system32\cmd.exe c:\anti-virus\setup.exe"
shell strCommand, vbHide

I can run this and install the program, but i keep getting 'unsupported operation..." message. I am using Windows 2000. Using Win XP i don't have any problem, it installs smooth.

Can anyone help?






0
Comment
Question by:siva_manikoth
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 10

Expert Comment

by:D_M_D
ID: 9826090
Try removing the cmd part...

Shell "C:\anti-virus\setup.exe", vbHide


--------
D_M_D
0
 

Expert Comment

by:jcran
ID: 9828608


Private Sub ExecAndWait(strAppName)
     Dim hProcessID&, hProcess&
     Dim lngExitCode

     hProcessID = Shell(strAppName, vbNormalFocus)
     hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, hProcessID)
End Sub

see: http://beta.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/VB_Controls/Q_20711948.html
0
 
LVL 9

Expert Comment

by:bhagyesht
ID: 9829552
pass a parameter to the cmd.exe /c modified as below

otherwise ignore cmd.exe totally


option 1

dim strCommand as string
strCommand =
"c|windows\system32\cmd.exe /c c:\anti-virus\setup.exe"
shell strCommand, vbHide


option 2
shell "c:\anti-virus\setup.exe" , vbHide
0
 

Author Comment

by:siva_manikoth
ID: 9842142
I have figured out that this error occures when used with CreateProcessWithLogonW () Windows API function. Let me elaborate.

I have a VB program, let us say A.exe, which is deployed in a Windows 2000 Domain Server. When a user (Win2K client) logs in, A.EXE is executed. A.EXE calls another program, let us say, B.EXE using CreateProcessWithLogonW() Win API call. I am using CreateProcessWithLogonW() to passon admin privileage to B.EXE, since log-in user is not an administrator. B.EXE calls the anti-virus set-up program.

When the anti-virus software is installed I keep getting "An unsupported operation was attempted" message, though after keep pressing "OK" button, I can install the software.

If B.EXE is called directly, instead of calling from A.EXE, I can install the software without any  problem. So the problem is with CreateProcessWithLogonW(). But I can not do away with CreateProcessWithLogonW() since log-in user does not have the rights to install the anti-virus program
0
 

Accepted Solution

by:
ee_ai_construct earned 0 total points
ID: 10982411
PAQed, with points refunded (125)

ee_ai_construct - (re-order part number #xm34)
Community Support Moderator
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Starting up a Project

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question