Go Back  Xtreme Visual Basic Talk > General Discussion > Tech Discussions > Things Every VB Programmer SHOULD know


Reply
 
Thread Tools Display Modes
  #1  
Old 08-17-2004, 05:14 PM
cRazEYgUy cRazEYgUy is offline
Newcomer
 
Join Date: Aug 2004
Posts: 10
Default


Just a quick question: Does Environ() work on all OS's? Also, does it require any specific dll's or ocx's that non-VB users might not have?
Reply With Quote
  #2  
Old 08-18-2004, 07:05 AM
charlie's Avatar
charlie charlie is offline
Senior Contributor
 
Join Date: Jul 2003
Location: Barcelona (SPAIN)
Posts: 1,054
Default

I think so.
About the libraries... if you're gonna distribute some program I recommend you to make an installer. This way you'll be sure it'll work in every computer.
__________________
01000011011010000110000101110010011011000110100101100101
~ En mi vida sólo hay dos días que no me importan: ayer y mañana ~
Reply With Quote
  #3  
Old 08-18-2004, 10:20 AM
blindwig's Avatar
blindwig blindwig is offline
Ultimate Contributor

* Expert *
 
Join Date: Jun 2003
Location: New York, NY
Posts: 1,929
Default

Quote:
Originally Posted by cRazEYgUy
Just a quick question: Does Environ() work on all OS's? Also, does it require any specific dll's or ocx's that non-VB users might not have?
I believe that the Environ() functoin will work on any Win32 OS, however, not every OS will have the same environment variables, so you shouldn't rely on "standard" envirnoment variables.
__________________
"Fortunately, I live in the United States of America, where we are gradually coming to understand that nothing we do is ever our fault, especially if it is really stupid." -Dave Barry
Reply With Quote
  #4  
Old 08-18-2004, 10:22 AM
loquin's Avatar
loquin loquin is offline
Google Hound

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Arizona, USA
Posts: 12,378
Default

Environ does not work on Win 9x platforms; only on NT class machines.

(as was recently discussed here)
__________________
Lou
"I have my standards. They may be low, but I have them!" ~ Bette Middler
"It's a book about a Spanish guy called Manual. You should read it." ~ Dilbert
"To understand recursion, you must first understand recursion." ~ unknown
Reply With Quote
  #5  
Old 08-18-2004, 11:33 AM
charlie's Avatar
charlie charlie is offline
Senior Contributor
 
Join Date: Jul 2003
Location: Barcelona (SPAIN)
Posts: 1,054
Default

Quote:
Originally Posted by loquin
Environ does not work on Win 9x platforms; only on NT class machines.

(as was recently discussed here)
Well, I think paths as Environ("USERPROFILE"), Environ("ALLUSERSPROFILE"), Environ("APPDATA"), etc... don't work under Win9x beacuse THESE are from NT. But the rest Environ("HOMEDRIVE") must work on every Windows... I guess...
__________________
01000011011010000110000101110010011011000110100101100101
~ En mi vida sólo hay dos días que no me importan: ayer y mañana ~
Reply With Quote
  #6  
Old 08-18-2004, 11:58 AM
Agent707 Agent707 is offline
Retired Contributor
 
Join Date: Mar 2002
Posts: 1,829
Default

Quote:
Originally Posted by cRazEYgUy
Just a quick question: Does Environ() work on all OS's? Also, does it require any specific dll's or ocx's that non-VB users might not have?
You lost me on the title of this tread man... What is the meaning of it?
Code:
If Environ("Tread_Title") <> ls_ThreadDiscussion Then MsgBox "So tell me exactly what is is I SHOULD know..." End If
Reply With Quote
  #7  
Old 08-18-2004, 12:09 PM
loquin's Avatar
loquin loquin is offline
Google Hound

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Arizona, USA
Posts: 12,378
Default

Quote:
Originally Posted by charlie
Well, I think paths as Environ("USERPROFILE"), Environ("ALLUSERSPROFILE"), Environ("APPDATA"), etc... don't work under Win9x beacuse THESE are from NT. But the rest Environ("HOMEDRIVE") must work on every Windows... I guess...
My Bad. Environ does work on win9x platforms, however, while my win2K box has some 38 items, a neighbors win98 box had but 15, and of these, only 5 had the same name as on win2K. These 5 were Tmp, Temp, COMSPEC, windir, and PATH.
__________________
Lou
"I have my standards. They may be low, but I have them!" ~ Bette Middler
"It's a book about a Spanish guy called Manual. You should read it." ~ Dilbert
"To understand recursion, you must first understand recursion." ~ unknown

Last edited by loquin; 08-18-2004 at 12:15 PM.
Reply With Quote
  #8  
Old 08-18-2004, 12:25 PM
Agent707 Agent707 is offline
Retired Contributor
 
Join Date: Mar 2002
Posts: 1,829
Default

Environ() only produces 28 items on my 2kbox.

I have an exe on my desktop I use one in a while for quick reference.
Attached Images
File Type: gif Environ.gif (21.7 KB, 16 views)
Reply With Quote
  #9  
Old 08-18-2004, 02:17 PM
blindwig's Avatar
blindwig blindwig is offline
Ultimate Contributor

* Expert *
 
Join Date: Jun 2003
Location: New York, NY
Posts: 1,929
Default

Quote:
Originally Posted by loquin
My Bad. Environ does work on win9x platforms, however, while my win2K box has some 38 items, a neighbors win98 box had but 15, and of these, only 5 had the same name as on win2K. These 5 were Tmp, Temp, COMSPEC, windir, and PATH.
Correct, both OSes have environmental variables. However, WindowsNT generates several of its own (such as HOMEPATH, etc), where Windows 9x (which is really a bundled MS-Win v4.x + MS-DOS v7.x) doesn't have any of it's own variables, so it relies on the under-lying DOS to provide variables. And since DOS doesn't use winNT variables such as HOMEPATH, NUMBER_OF_PROCESSORS, etc, then it doesn't provide these to the GUI (windows 4.x)

The point is still the same:
Yes, the Environ() function will return whatever environmental variables your systems has. But don't rely on a "standard" variable to be there, because not all OSes use/have the same variables.
Quote:
Originally Posted by Agent707
I have an exe on my desktop I use one in a while for quick reference.
nice.
Other ways to view the environment:
From a command prompt: Type SET
From the GUI: My Computer, Properties, Advanced tab, Environment Variables button
__________________
"Fortunately, I live in the United States of America, where we are gradually coming to understand that nothing we do is ever our fault, especially if it is really stupid." -Dave Barry
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->