Author Topic: Davis Weatherlink visual basic sample code vb3  (Read 5355 times)

0 Members and 1 Guest are viewing this topic.

Offline cmgaskins

  • Member
  • *
  • Posts: 27
Davis Weatherlink visual basic sample code vb3
« on: October 17, 2007, 08:15:47 PM »
Hello,

 :grin: I have the Davis Weather Wizard III with the Weatherlink.  :-( Davis has sample code for 16-bit vb3, does anyone have a sample for vb6. I have tryed to convert the code but its over my head with API calls.

Offline jaded

  • Member
  • *
  • Posts: 32
    • http://home.comcast.net/~jadeters/Weather.htm
Re: Davis Weatherlink visual basic sample code vb3
« Reply #1 on: October 26, 2007, 02:03:16 AM »
I just put together a simple VB6 example program for you.  It's a small form that opens the weather station when it's started, retrieves and displays the temperature and pressure when you click a button, and then closes the weather station when you're done. 

In order to use it, you'll have to download the Vantage Pro 2 dll from Davis.  After you run the installer, you MUST copy the new VantagePro.dll file to your Windows\System32 folder or else Visual Basic will not be able to find the DLL.

And of course you'll have to close WeatherLink or any other program (such as VWS) you have that accesses your weather station before the sample can run successfully.  Only one program at a time can use the COM port.

I also included a file called VantageProAPI.txt.  It's a text file that you should copy to your  "Program Files\Microsoft Visual Studio\Common\Tools\Winapi\" folder.  It's meant to be loaded in your Microsoft Visual Studio 6.0 \ Microsoft Visual Studio Tools 6.0 \ API Text Viewer program.  If you haven't used the API viewer before, it is an easy way to include functions in your program. 

VantageProAPI.txt contains Visual Basic declarations for every type, function, and constant Davis included in the VantagePro.dll code.  The documentation for the functions is included with the DLL installation package, but it's for C programmers.  My sample program uses a few of each to give you an idea of how to declare and use types, constants and functions.  But I've tested only a few of the functions, so there may still be bugs lurking in my untested declarations.   I apologize in advance if there are any.

You can download the zipped file containing my sample VB 6 program and including the VantageProAPI.TXT file from http://home.comcast.net/~jadeters/TestVantagePro.zip.

Good luck!

Offline cmgaskins

  • Member
  • *
  • Posts: 27
Re: Davis Weatherlink visual basic sample code vb3
« Reply #2 on: October 29, 2007, 07:48:04 AM »
jaded

 :grin: Thanks for your help, I was trying to test your sample program but I get error code 453. I copied the DLL to my System32 folder but still the same. I even tried registering the DLL but get the same error. Any Ideal? The DLL can’t be bad. I downloaded the DLL to my home computer and work computer with the same errors. ](*,)

Offline cmgaskins

  • Member
  • *
  • Posts: 27
Re: Davis Weatherlink visual basic sample code vb3
« Reply #3 on: November 05, 2007, 02:46:54 PM »
Jaded

Thanks for all of your help. Everything is working fine.

Chris 8-)

 

anything