?
Solved

Installing a program using Shell in VB

Posted on 2003-11-26
7
Medium Priority
?
319 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

Introducing Priority Question

Increase expert visibility of your issues by participating in Priority Question, our latest feature for Premium and Team Account holders. Adjust the priority of your question to get emergent issues in front of subject-matter experts for help when you need it most.

Question has a verified solution.

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

This is about my first experience with programming Arduino.
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

771 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