Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detect .NET framework

Status
Not open for further replies.

skiflyer

Programmer
Sep 24, 2002
2,213
US
So I have a VB 6.0 Application which launches a VB.NET application via the shell command.

I need to be certain the .NET framework is installed (or otherwise supported) before shelling out, or as a way to read the shell out failure, so I can't let them know they need to download and install the .NET framework before they'll have that functionality of my program.

Is there a way I can sense whether or not this is the case in my VB 6.0 code?

-Rob
 

Look in help for the shell command and its return values.

from help...
[tt]
Shell Function


Runs an executable program and returns a Variant (Double) representing the program's task ID if successful, otherwise it returns zero.

Syntax

Shell(pathname[,windowstyle])

The Shell function syntax has these named arguments:

Part Description
pathname Required; Variant (String). Name of the program to execute and any required arguments or command-line switches; may include directory or folder and drive.
windowstyle Optional. Variant (Integer) corresponding to the style of the window in which the program is to be run. If windowstyle is omitted, the program is started minimized with focus.


The windowstyle named argument has these values:

Constant Value Description
vbHide 0 Window is hidden and focus is passed to the hidden window.
vbNormalFocus 1 Window has focus and is restored to its original size and position.
vbMinimizedFocus 2 Window is displayed as an icon with focus.
vbMaximizedFocus 3 Window is maximized with focus.
vbNormalNoFocus 4 Window is restored to its most recent size and position. The currently active window remains active.
vbMinimizedNoFocus 6 Window is displayed as an icon. The currently active window remains active.


Remarks

If the Shell function successfully executes the named file, it returns the task ID of the started program. The task ID is a unique number that identifies the running program. If the Shell function can't start the named program, an error occurs.

Note By default, the Shell function runs other programs asynchronously. This means that a program started with Shell might not finish executing before the statements following the Shell function are executed.

[/tt]

Good Luck

 
I'm going to play with that in a few minutes, but .NET programs don't always fail successfully it appears to me... I'd really rather just avoid the runtime errors on the users screen....

I'm digging into several machines and it seems the common registry entry is...

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy\v1.0

With a value of 3705 = 3321-3705

Now, I'm going to assume v1.0 and 3705 = 3321-3705 are up for change in future versions... so I'm 99% certain I can get away with seeing if

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy

exists, and the use the above post as a backup... is there a way to verify the presence of a registry folder rather than the determine the value of a key?

I'm using the registry class from the faq in this forum by the by.

Thanks much.

-Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top