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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

extra API information needed 1

Status
Not open for further replies.

Karl Blessing

Programmer
Feb 25, 2000
2,936
0
0
US
I need to perform a task where I can get a few information about the server the web application(I'm going to make an ActiveX dll to use these APIs)<br><br>I need to determine the web properties that are set on IIS, I need to know the state of the Web Services<br>and I need to know the version of NT and IIS, and the Service packs (I know an API to get the OS version, but the rest I'm having troble with)<br><br>after the server information, I need to be able to get the ODBC settings, like the list of DSN, and the details for each.<br><br>At the moment All I have is a ASP that looks like Windows explorer a bit, and I have it where on the browser, you can click the directorys and change, and being able to see the Version information for the ActiveX exe, ocx, and dlls<br><br>for the curious fews, I am trying to write a Dianostic page to accompany our larger web application, so if they ever have a prob, we dont need to go down there, or we dont need to call them and ask them a bunch of questions. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href= </a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
 
Hey,<br><br>To find the DSN information there is a tool that comes with VB called the ODBCtool.&nbsp;&nbsp;It's very simple ,but it works great!&nbsp;&nbsp;<br><br><br>As for the IIS, I know there are OCX's that exist on VB to do that.&nbsp;&nbsp;You just need to look through references for them. Most likey will be on the web server <p>Clayton T. Paige<br><a href=mailto:cpaige@home.com>cpaige@home.com</a><br><a href= Snail</a><br>Clayton T. Paige<br>
Programmer Extraordinaire <br>
========================================================<br>
"Who General Failure? and Why is he reading my disk drive?
 
ODBCTool is just working great for me... But is there a way to fetch all the tables under a particular DSN ? And all the fields under each table/view ?

Thank you...
RR

 
Here's another technique you can use.
There is a set of API functions in ODBC32.dll.

Private Declare Function SQLDataSources Lib &quot;ODBC32.DLL&quot; _
(ByVal henv As Long, _
ByVal fDirection As Integer, _
ByVal szDSN As String, _
ByVal cbDSNMax As Integer, _
pcbDSN As Integer, _
ByVal szDescription As String, _
ByVal cbDescriptionMax As Integer, _
pcbDescription As Integer) _
As Integer

Private Declare Function SQLAllocEnv% Lib &quot;ODBC32.DLL&quot; (env&)

'I added these 02/12/2004 -- H Stinson
Public Const SQL_MAX_DSN_LENGTH As Integer = 256 'A reasonable buffer length to use.
Public Const SQL_FETCH_FIRST As Integer = 2
Public Const SQL_FETCH_NEXT As Integer = 1
Public Const SQL_SUCCESS As Integer = 0

You first have to call SQLAllocEnv to get an ODBC environment handle (whatever that is).
Dim lEnvHandle As String

If SQLAllocEnv(lEnvHandle) = -1 Then
Err.Raise 144, sSUBR_NAME, _
&quot;Call to Windows API ODBC32.DLL function &quot; _
+ &quot;&quot;&quot;SQLAllocEnv&quot;&quot; failed. Unable to allocate &quot; _
+ &quot;ODBC environment handle to use in getting list &quot; _
+ &quot;of data source names (DSNs).&quot;
End If

lReturnCode = SQLDataSources(lEnvHandle, _
SQL_FETCH_FIRST, _
sBuffer_DSN, _
iBUFFER_LEN__DSN, _
iLengthOf_DSN, _
sBuffer_Descr, _
iBUFFER_LEN__DESCR, _
iLengthOf_Descr)

'---------------------------------------------------------
'LOOP: Process this DSN and then get the next
'---------------------------------------------------------
Do While lReturnCode = SQL_SUCCESS
'CHOP OFF C-STRING TERMINATING NULL CHARS:
'----------------------------------------------
'First, a little sanity check:
Debug.Assert InStr(sBuffer_DSN, Chr$(0)) = iLengthOf_DSN + 1
Debug.Assert InStr(sBuffer_Descr, Chr$(0)) = iLengthOf_Descr + 1

sDSN = Trim$(Left$(sBuffer_DSN, iLengthOf_DSN))
sDescr = Left$(sBuffer_Descr, iLengthOf_Descr)

'ADD THIS DSN TO THE ARRAY:
'If we need the description string, make the array an array of
'UDTs (user defined types -- also known as &quot;struct&quot; in C and in
'VB.NET) instead of a simple array of strings. -- H Stinson
'-------------------------------------------------------------------
ReDim Preserve asDSNs(0 To lNumDSNs)
asDSNs(lNumDSNs) = sDSN

lNumDSNs = lNumDSNs + 1

'--------------------------------------------------
'GET THE NEXT DSN:
'--------------------------------------------------
lReturnCode = SQLDataSources(lEnvHandle, _
SQL_FETCH_NEXT, _
sBuffer_DSN, _
iBUFFER_LEN__DSN, _
iLengthOf_DSN, _
sBuffer_Descr, _
iBUFFER_LEN__DESCR, _
iLengthOf_Descr)
Loop
 
Finally Karl you can finish that Dianostic page. [lol]

&quot;Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top