Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Two questions (Error messages and Windows dir)


Reply
 
Thread Tools Display Modes
  #1  
Old 07-07-2004, 06:28 AM
BratMokstrof BratMokstrof is offline
Newcomer
 
Join Date: Feb 2004
Posts: 9
Default Two questions (Error messages and Windows dir)


Question 1:
As I create a program for example using Winsock, but the computer hasn't installed Winsock, it gives an error when starting up.
Is it possible to suspress that error?
It doesn't matter if the program starts or not, I just don't want it to show the error message.

Question 2:
How can I find the current Windows Directory on a machine? In Windows XP it can be found in the registry, however, in Windows 98 I wasn't able to found the same key. Are there possibilities for finding it any other way?
Reply With Quote
  #2  
Old 07-07-2004, 07:43 AM
Peperl's Avatar
Peperl Peperl is offline
Senior Contributor
 
Join Date: Apr 2003
Location: Cartagena, Spain
Posts: 1,371
Default

If you have created a app that uses any OCX or DLL file, you have to install and register those OCX in the computer where you're going to install your app.

To make this, the better way is to create an installation program with tools like InnoSetup, in the forum you can find some examples of this program

To answer your second question, i think there's an API called GetWindowsDirectory that gets that dir for you

I hope this is that you were asking for.
__________________
Pri Oh Persia
Reply With Quote
  #3  
Old 07-07-2004, 08:09 AM
BratMokstrof BratMokstrof is offline
Newcomer
 
Join Date: Feb 2004
Posts: 9
Default

Quote:
Originally Posted by Peperl
If you have created a app that uses any OCX or DLL file, you have to install and register those OCX in the computer where you're going to install your app.

To make this, the better way is to create an installation program with tools like InnoSetup, in the forum you can find some examples of this program

To answer your second question, i think there's an API called GetWindowsDirectory that gets that dir for you

I hope this is that you were asking for.
Thanks for your reply

However, I just want to suspress the error, because I want to detect if the API is installed or not.
And it is ugly if it genartes creates the error message while testing.

The GetWindowsDirectory api I heard only works for 2000+ so that doesn't really solve the problem
Reply With Quote
  #4  
Old 07-07-2004, 08:17 AM
Peperl's Avatar
Peperl Peperl is offline
Senior Contributor
 
Join Date: Apr 2003
Location: Cartagena, Spain
Posts: 1,371
Default

Ummm .. in allapi.net it says that the API works with those SO

Quote:
The GetWindowsDirectory function retrieves the path of the Windows directory. The Windows directory contains such files as Windows-based applications, initialization files, and Help files.
VB4-32,5,6
Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

Operating Systems Supported
Requires Windows NT 3.1 or later; Requires Windows 95 or later
I suposse it's only try it each SO to see if works


I am sorry, but to the other question I cannot answer you, 'cos i don't know how to avoid that error
__________________
Pri Oh Persia
Reply With Quote
  #5  
Old 07-07-2004, 08:48 AM
BratMokstrof BratMokstrof is offline
Newcomer
 
Join Date: Feb 2004
Posts: 9
Default

Quote:
Originally Posted by Peperl
Ummm .. in allapi.net it says that the API works with those SO



I suposse it's only try it each SO to see if works


I am sorry, but to the other question I cannot answer you, 'cos i don't know how to avoid that error
You're right!
It does work! Thanks a LOT!

So only question one remains
Anyone?
Reply With Quote
  #6  
Old 07-07-2004, 08:59 AM
Peperl's Avatar
Peperl Peperl is offline
Senior Contributor
 
Join Date: Apr 2003
Location: Cartagena, Spain
Posts: 1,371
Default

ey BratMokstrof. a idea (I am not saying that is a good idea) but as the same way you're detecting what's the windows dir, you could detect what's the windows system dir and comprobate if that OCX exists.

The error it has to appear when you're trying to open the form, but if you comprobate that before load that form ...

for example, if you're program uses only a form, or the first form gots that OCX create a new module with a Sub Main () and comprobate here.

as I said .. it's only an idea
__________________
Pri Oh Persia
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
 
 
-->