Results 1 to 8 of 8

Thread: Really Curios!?!?!?!?!?!?!?!?!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    240

    Exclamation

    This is strange.........i am taking to classes in college right now...one for qbasic and one for vb....BOTH!! professors say that Visual basic comes with windows 98??
    i have tried too look in my windows 98 and i cant find anything except for what i have already for visual basic (working model edition).Can anyone shed some light on this subject??? if you know what i am talking about????


    Thanks




    NewBee Vbeer6.0()
    Working Model edition has no api listings!!! grrrr
    End Sub

  2. #2
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    To the best of my knowledge, VB does NOT come with Windows 98. However, QBasic comes with Win95/98; it can be found on the Win 9X CD in a directory called "oldmsdos".
    "It's cold gin time again ..."

    Check out my website here.

  3. #3
    Hyperactive Member
    Join Date
    Dec 1999
    Posts
    321

    Smile VB does NOT come with Windows 98

    VB doesn't come with Windows 98 and as far as I know, not with any windows version so your proffesors are wrong.

    However, i'm sure that the computers they got from the computer administrator had vb already installed (which is obvious since they were suposed to go to vb teachers) so they might be confused.

    There's vbscript built in Office but that doesn't come with windows either so.
    Signed, Rodik ([email protected])
    Programmer,usesVB6ED
    ===========================
    Copyright©RodikCo,2002.

    Dont mind this signature ;] Its old

  4. #4
    Hyperactive Member
    Join Date
    May 2000
    Location
    Or
    Posts
    316
    What you professor may have been talking about is the Windows Scripting Host. This is shipped with Win 98, Win2000. What it does is it allows you to write vbscripts and run them on your machine like an exe. If you want to try it, just open the notepad and paste the following code in. Then when you save your file, make sure you use a .vbs extention. This code will return the version properties associated with the Wscript Object. I believe that Win 98 ships with Version 5.0 and Win2000 ships with version 5.1. There isn't much difference, other then a few networking and environmental control additions. I'm not sure how many people on this list use vbscripts as exe's, but I find that they actually work much better then a full blown VB app for certain operations (like file manipulation, printer setup, mapping network drives).

    Code:
    Option Explicit
    
    Dim Message
    Dim Title
    
    ' Show the properties of the WScript object
    ' we start with Host properties
    
    Message = "WScript host properties" & vbCRLF & vbCRLF
    Message = Message & "Application: " & WScript.Application & vbCRLF
    Message = Message & "Name: " & WScript.Name & vbCRLF
    Message = Message & "Version: " & WScript.Version & vbCRLF
    Message = Message & "FullName: " & WScript.FullName & vbCRLF
    Message = Message & "Path: " & WScript.Path & vbCRLF 
    
    ' Get the Interactive-Status
    If (WScript.Interactive) Then
    Message = Message & "Interactive: true" & vbCRLF 
    Else
    Message = Message & "Interactive: false" & vbCRLF 
    End if
    
    ' Get script properties
    Message = Message & vbCRLF 
    Message = Message & "WScript script properties" & vbCRLF & vbCRLF
    Message = Message & "ScriptFullName : " & WScript.ScriptFullName & vbCRLF
    Message = Message & "ScriptName : " & WScript.ScriptName & vbCRLF
    
    ' get the version of the language engine
    Message = Message & vbCRLF & "Script-Engine: " & CStr(ScriptEngine()) & vbCRLF
    Message = Message & "Version: " & CStr(ScriptEngineMajorVersion()) 
    Message = Message & "." + CStr(ScriptEngineMinorVersion()) + vbCRLF
    Message = Message & "Build: " & CStr(ScriptEngineBuildVersion())
    
    ' init title
    Title = "WSH Test " & WScript.ScriptName
    
    MsgBox Message, vbInformation + vbOKOnly, Title
    
    WScript.Quit()
    
    ' End
    Hope this answers your question.

  5. #5
    Addicted Member Dim A's Avatar
    Join Date
    Jul 2000
    Posts
    201
    Originally posted by reeset
    What you professor may have been talking about is the Windows Scripting Host. This is shipped with Win 98, Win2000. What it does is it allows you to write vbscripts and run them on your machine like an exe. I believe that Win 98 ships with Version 5.0 and Win2000 ships with version 5.1. There isn't much difference, other then a few networking and environmental control additions. I'm not sure how many people on this list use vbscripts as exe's, but I find that they actually work much better then a full blown VB app for certain operations (like file manipulation, printer setup, mapping network drives).
    Neat. I never noticed that at all. How viable is this though? Could I write a program that loads forms or dynamically creates them, and calls API's?

    How far can it go?


  6. #6
    Hyperactive Member Paul Warren's Avatar
    Join Date
    Jun 2000
    Location
    UK
    Posts
    282

    VBA

    Your professors could be talking about VBA, which allows you to write VB sort-of programs from within the office programs, such as Word, Excel, etc. But then again this isn't really part of the operating system so maybe they're just trying to impress you with their vast, mysterious knowledge. You'll find lots of people like that out there, who like to keep their little technical secrets to themselves. Thankfully there are not many of them around here.

    reeset -

    That Windows Scripting Hosts stuff is way cool. How did you find out about that ? what else can it do ?
    That's Mr Mullet to you, you mulletless wonder.

  7. #7
    Hyperactive Member
    Join Date
    May 2000
    Location
    Or
    Posts
    316
    The Scripting Host is actually pretty useful. I find myself using it whenever I can, since it doesn't have as much overhead. But there are limitations. As far as I know, you can't create forms or such, but it does have many useful applications.

    For example, reading/writing to the registry is very easy using the Scripting Host.

    Code:
    Dim WSHShell
    Set WSHShell=CreateObject("Wscript.Shell")
    'To read the Reg.
    mvar=WSHShell.RegRead("HKLM\Software\Microsoft\Internet Explorer\Start Page")
    'To Write the Reg.
    WSHShell.RegWrite "HKLM\Software\Microsoft\Internet Explorer\Start Page", "http://mypage.com"
    Or you can map Network Drive

    Code:
    Dim WshNetwork
    
    Set WshNetwork = WScript.CreateObject("WScript.Network")
    WshNetwork.MapNetworkDrive "T:", "\\Reeset\label",true,,"cat"
    But I use it most for simple file manipulation. Since the FileSystemObject is completely exposed to the Scripting Host, I find that it is just less time consuming to write a simple script then a simple vb program. Also, you don't have to write just in VBScript. .js scripts are also supported, so you could also use the filesystemobject in a JScript like this:

    Code:
    
    var y;
    
    y=GetFreeSpace("c:");
    
    var WSHShell = WScript.CreateObject("WScript.Shell");
    
    
    WSHShell.Popup (y);
    
    
    function GetFreeSpace(drvPath) {
    	var fs, d, s;
            
    	fs = new ActiveXObject("Scripting.FileSystemObject");
    	d = fs.GetDrive(fs.GetDriveName(drvPath));
    	s = "Drive " + drvPath + " - " ;
    	s += d.VolumeName;
    	s += " Free Space: " + d.FreeSpace/1024 + " Kbytes";
    	return s;
    }

    But I would mainly say that it comes in handy around the office, especially for those whose computer skills are alittle deficiant. For example, I have a backup utility that backs up a custom set of folders and files for each user. It looks like this:

    Code:
    '********************************************
    'By Terry Reese
    '********************************************
    
    Dim WshNetwork
    Dim fso, sTemp(400), sFolder(400), myFile(2)
    Dim cCount
    
    
    Set WshNetwork=CreateObject("Wscript.Network")
    Set fso=CreateObject("scripting.FileSystemObject")
    Set myFile(0)=fso.GetFile("c:\oclcapps\user.txt")
    Set myFile(1)=myFile(0).OpenAsTextStream(1,-2)
    sUser=myFile(1).ReadLine
    
    	If sUser="terry" then
    		Call UserBackup
    	Else
    		Call UserBackup
    	end if
    
    
    
    
    
    Sub UserBackup()
    
      	Dim f, f1, fc,fs, s, showlist(3), folderspec, CopyFileList, folderlist(), FirstRun
    	
    	FirstRun=False
    
    	Set fileObject=CreateObject("scripting.FileSystemObject")
    	Set myFile(0)=fileObject.GetFile("c:\oclcapps\user.txt")
    	Set myFile(1)=myFile(0).OpenAsTextStream(1,-2)
    	sUser=myFile(1).ReadLine
    	sUser=LCase(sUser)
    		if sUser="kyle" then
    			ReDim folderlist(1)
    			folderlist(0)="s:\"
    			folderlist(1)="p:\"
    		Else 
    			ReDim folderlist(0)
    			
    			folderlist(0)="p:\"
    		End if
      	
    	For i=0 to UBound(folderlist)
    
    		folderspec=folderlist(i)
    		
    		Set fso=CreateObject("scripting.FileSystemObject")
      		Set f = fso.GetFolder(folderspec)
      	
    		Set fc = f.Files
      
      		For Each f1 in fc
        			s = s & f1.path & vbcrlf
      		Next
    
    		ShowFileList = s
            
    		Set f = fso.GetFolder(folderspec)
      		Set sf = f.SubFolders
      
    		For Each f1 in sf
    			
    	     		s=s& f1.path & vbcrlf
    				
      		next
    
    		ShowFileList=s
    	
    
    		If FirstRun=True then
    
    			If fso.FileExists("c:\windows\system\bkSetting.txt")=false then
        
    				fso.CreateTextFile ("c:\windows\system\bkSetting.txt")
    				set showlist(0)=fso.GetFile("c:\windows\system\bkSetting.txt")
    				set showlist(1)=showlist(0).Openastextstream(8,-2)
    				Showlist(1).write ShowFileList
    				Showlist(1).Close
    			Else
    				Set showlist(0)=fso.GetFile("c:\windows\system\bkSetting.txt")
    				Set showlist(1)=showlist(0).OpenAsTextStream(8,-2)
    				ShowList(1).write ShowFileList
    				ShowList(1).close
    			End if
    		Else
    
    			fso.CreateTextFile ("c:\windows\system\bkSetting.txt")
    			set showlist(0)=fso.GetFile("c:\windows\system\bkSetting.txt")
    			set showlist(1)=showlist(0).Openastextstream(8,-2)
    			Showlist(1).write ShowFileList
    			Showlist(1).close
    			FirstRun=True
    
    		End if
    		ShowFilelist=""
    		s=""
    
    	Next
    
    
    Call StartBackup()
    
    End Sub
    
    Sub StartBackup()
    
    Dim sFileSize, oldFileSize
    Dim i, sSize, mySettings, sSettings
    
    
    
    Set fso=CreateObject("scripting.FileSystemObject")
    Set WshShell=CreateObject("Wscript.Shell")
    
    If fso.DriveExists("s:")=true then
    
    
    
    cCount=0	
    	set sSettings=fso.GetFile("c:\windows\system\bkSetting.txt")
    	Set mySettings = sSettings.OpenAsTextStream(1,-2)
    
    		For i=0 to UBound(sFolder)
    			On Error resume Next
    			sFolder(i)=mySettings.ReadLine
    				If Err<>0 then
    					Exit For
    				End if
    			sFolder(i)=Trim(sFolder(i))
    			cCount=cCount + 1	
    			
    		Next
    
    Dim sCheck(3)
    
    	For i=0 to cCount
    		sCheck(0)=Right(sFolder(i),4)
    		sCheck(1)=Left(sCheck(0),1)
    		
    		If sCheck(1)="." then	
    			Set sTemp(i)=fso.GetFile(sFolder(i))
    			
    		Else
    			Set sTemp(i)=fso.GetFolder(sFolder(i))
    			
    		End if
    	Next
    
    
    	For i=0 to cCount
    		sSize=sTemp(i).Size
    		sFileSize=sFileSize + sSize
    	Next
    
    end if
    
    
    
    On Error Resume Next
    oldFileSize=WshShell.RegRead ("HKLM\NetBack")
    	If Err<>0 then
    		WshShell.RegWrite "HKLM\NetBack", sFileSize
    	End if
    
    sPercent=oldFileSize*0.35
    
    If oldFileSize<sFileSize-sPercent then
    	Call myPR()
    else
    	WshShell.RegWrite "HKLM\NetBack" , sFileSize
    	Call Backup()
    end if
    
    
    End sub
    
    Sub myPR()
    
    L_Alert_Text="Suspicious Activity!!  There is a current difference of " & oldFileSize - sFileSize & ".  Do you still with to continue backup?"
    L_Alert_Title_Text="Backup Alert"
    
        Dim intDoIt
    
        intDoIt =  MsgBox(L_Alert_Text,    _
                          vbOKCancel + vbInformation,       _
                          L_Alert_Title_Text )
        If intDoIt = vbCancel Then
            WScript.Quit
        End If
    
    Call Backup()
    
    End Sub
    
    Sub Backup()
    
    	Set fso=CreateObject("scripting.FileSystemObject")
    	If fso.FolderExists("c:\archive\Backup\Network")=False then
    		fso.CreateFolder("c:\archive\Backup\Network")
    	End if
    	
    Dim sCheck(2)
    Dim myMess
    
    	For i=0 to cCount
    		sCheck(0)=Right(sTemp(i).Name,4)
    		sCheck(1)=Left(sCheck(0),1)
    			
    		
    		If sTemp(i).Size=0 then
    			myMess= Msgbox ("The" & sTemp(i).Name & " File/Folder has a size of Zero.  Would like to back up anyway?",vbOKCancel + vbInformation, "File/Folder Alert")
    
    			If myMess=vbCancel then
    				msgbox "Backup terminated."
    				Wscript.Quit
    			End if
    		Else
    			
    			
    			sTemp(i).Copy "c:\archive\Backup\Network\" & sTemp(i).Name
    		
    		end if
    		
    	Next
    	
    
    end sub

    The last thing that I will say is that you can manipulate the API to a point (though I will admit that if I am going to do that type of work, I will probably make a program.). To use the API though, you have to call the Rundll32.exe. Here is a short example of what I mean. It is my shutdown script.

    Code:
    
    L_Welcome_Text="Are you sure you want to ShutDown your computer now?"
    L_Welcome_Title_Text="System Shutdown"
    
    Dim WshShell
    
    
    
    Set WshShell=Wscript.CreateObject("wscript.Shell")
    
    
    Dim intDoIt
    
        	intDoIt =  MsgBox(L_Welcome_Text,    _
                          vbOKCancel + vbInformation,       _
                          L_Welcome_Title_Text )
    
        			If intDoIt = vbCancel Then
    				msgbox "Shutdown Canceled"
            		      	Wscript.Quit
       			Else
    'For Win 9x
    				'WshShell.Run "%windir%\RunDll32.exe user,ExitWindows",1,-1
    'For Win 98		
    		WshShell.Run "rundll32.exe shell32.dll,SHExitWindowsEx 6"
    				Wscript.Quit()
    		end if
    
    'To exit Windows NT workstation
    
    'WshShell.Run ("SHUTDOWN [/R] [/T:xx] [/C]")
    
    '/R  Specifies that the machine should reboot after shutdown
    '/T:xx Sets the timer for system shutdown. [20 seconds default]
    '/C  Forces running applications to close
    
    'Forces the Windows NT Workstation to reboot in 5 seconds
    'WshShell.Run("SHUTDOWN /R /R:5")
    
    'The Following are the parameters used to exit from Windows 98 machines only
    
    'WshShell.Run("rundll32.exe shell32.dll, SHExitWindowsEx n")
    
    'Where n is one, or a combination of one of the following numbers:
    
    '-0- Logoff.  Shuts down all running process, then logs the user off
    '-1- Shutdown. Shuts down the system to a point at which it is safe to turn the power off
    '-2- Reboot. Shuts down the system and then restarts the system.
    '-4- Force.  Forces processes to terminate
    '-8- Poweroff. Shuts down the system and turns off the power.  
    
    'The above values options can be combined into one value to achieve different results.
    'example:
    'WshShell.Run("rundll32.exe shell32.dll, SHExitWindowsEx 6")
    
    'The Following parameter should be used to shutdown a system from Windows 95
    
    'WshShell.Run "%windir%\RunDll32.exe user,ExitWindows",1,-1

    Anyway, I hope that give you an idea of what you can do. I know that microsoft does document it, just not very well. Which is really too bad.



    [Edited by reeset on 07-13-2000 at 07:51 PM]

  8. #8
    Hyperactive Member Paul Warren's Avatar
    Join Date
    Jun 2000
    Location
    UK
    Posts
    282

    MSDN blurb

    Dim A

    Here's what the MSDN CD blurb contains in the the Windows Scripting Host Reference :

    Overview of the Windows Scripting Host Object Model
    The Windows Scripting Host object model provides two main categories of ActiveX interfaces:

    Script execution and troubleshooting: Properties and methods that are directly related to script execution. This set of interfaces allows scripts to manipulate Windows Scripting Host, display messages on the screen, and perform basic functions such as CreateObject and GetObject.


    Helper functions: Properties and methods that map network drives, connect to printers, retrieve and modify environment variables, and manipulate registry keys. These functions are provided so administrators can use Windows Scripting Host to create simple logon scripts.
    In addition to the object interfaces provided by Windows Scripting Host, administrators can use any ActiveX controls that expose Automation interfaces to perform various tasks on the Windows platform. For example, administrators can write scripts that use the Active Directory to manage the Windows NT Directory Service.

    Looks interesting !
    That's Mr Mullet to you, you mulletless wonder.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width