Two questions (Error messages and Windows dir)

BratMokstrof
07-07-2004, 06:28 AM
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?

Peperl
07-07-2004, 07:43 AM
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.

BratMokstrof
07-07-2004, 08:09 AM
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 :(

Peperl
07-07-2004, 08:17 AM
Ummm .. in allapi.net it says that the API works with those SO


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

BratMokstrof
07-07-2004, 08:48 AM
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? :)

Peperl
07-07-2004, 08:59 AM
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

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum