|
-
Mar 8th, 2007, 04:41 PM
#1
Thread Starter
New Member
Launching an external EXE and Hiding a button
I am pretty new to Visual Basic and I started working with .NET 2005 Express Edition and found that for such a program to run the system must have .NET FW 2.0 installed on it. My application may not necessarily be run on a system that already has FW 2.0 installed on it, so my option is to use VB6, thus eliminating the dependancy on any FW version being installed. This is just a simple program that will be placed on a DVD and autorun when the DVD is inserted in the ODD. This program should launch, determine which buttons to display and based on what button the user clicks what it should do. There is a Cancel Button on it that I have already figured out how to code, but I am running in to problems with the buttons that will launch a seperate progam when clicked, and with determinaning what buttons should be displayed when the program runs. Below is the code that I was able to successfully create that requires FW 2.0 to be installed. I would like to know if anyone knows what changes it takes to port this back to VB6?
Upon loading the form I need it to check if the OS is VISTA and if so it needs to hide Button2. I have the form created with all the buttons, I just need the correct code for the buttons and the form load.
Any assistance would be greatly appreciated.
Code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Close()
Dim a As New ProcessStartInfo("APP1\setup.exe")
Process.Start(a)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
Dim a As New ProcessStartInfo("APP2\setup.exe")
Process.Start(a)
End Sub
Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
Me.Close()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If ((System.Environment.OSVersion.Platform = PlatformID.Win32NT) AndAlso (System.Environment.OSVersion.Version.Major = 6)) Then
'Vista
Me.Button1.Visible = False
End If
End Sub
End Class
-
Mar 8th, 2007, 04:50 PM
#2
Re: Launching an external EXE and Hiding a button
Welcome to VBForums 
First of all.. while VB6 has smaller installation requirements than VB.Net, it still has some - so your program will not work unless somebody else has already installed the files you need. If you are making a very simple program (no extra components or references) then the files you need may be installed already as part of Windows (they are for Vista, there is some debate about XP & 2000, and they are not included before that).
To run a separate program you can simply use Shell, eg:
Code:
Shell "d:\folder\program.exe"
I'm afraid I haven't got a link to code to detect Vista, but there is some around on the forums so a search should find it!
-
Mar 8th, 2007, 05:31 PM
#3
Hyperactive Member
Re: Launching an external EXE and Hiding a button
-
Mar 8th, 2007, 08:19 PM
#4
Re: Launching an external EXE and Hiding a button
I have seen that vbnet code example already and its pre release code. Since the final release of Vista my code will work more accurately with it. Also, detects the version of Vista correctly instead of saying "Vista Plus".
Its .NET but the eval code is practically the same as VB 6. 
http://vbforums.com/showthread.php?t=434149
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|