cancel
Showing results for 
Search instead for 
Did you mean: 

vb6 dblocate shell call or better

Former Member
0 Kudos
3,889

After looking and reading for a while, I am posting the question.

VB6, I want to do a pop up window showing the servers found on a network. Then of course allow the user to select. I can use dblocate from cmd prompt. I have not been able to find the command to do this as the "FIND" option does in ISQL-10 .

Can someone be kind enough to point me in the right direction. I seem to be overlooking it. I can use a shell call, but that does not seem clean. Am I just overlooking it.

Thanks

George

Accepted Solutions (0)

Answers (1)

Answers (1)

VolkerBarth
Contributor

"I can use a shell call, but that does not seem clean."

What exactly do you mean? Do you generally want to avoid a shell call, or does it not work as expected?

AFAIK, Calvin's hint to the DBTools API won't work, as there is no according DBLocate() function (or at least I'm not aware of one).

The DBLOCATE tool itself uses a dblibX.dll function, see the discussion in this FAQ on dblocate vs. dbping.

FWIW, the according function is called db_locate_servers_ex function. As this (like the DBTools API functions) is a C-based API, I don't know how difficult it is to call this (including the needed callback function) from VB6.

IMHO, calling the external DBLOCATE utility (with the -o and -q options, I recommend) and parsing the according message log file (as specified by -o) would seem much easier.

Former Member
0 Kudos

Glad I didn't put that as an answer then 🙂

jeff_albion
Product and Topic Expert
Product and Topic Expert
0 Kudos

I don't know how difficult it is to call this (including the needed callback function) from VB6.

Not difficult if you have knowledge of both C and VB6, and have compile environments set up for both. Many VB6 programmers are very used to making external DLL calls over COM. I have even seen VB6 programs calling into .NET environments (which is even crazier, IMHO. 🙂

There are also samples available in the SQL Anywhere directory on how to compile C code for ESQL programs (%SQLANYSAMP10%\\SQLAnywhere\\ESQL*) - these create .exe files by default, but if you add "/DLL" to the compile line, you can get a .DLL outputted instead. To create the export links from C to VB, You'll gave to create an export .def file, or add "__declspec()" calls to the C code.