VB Script Problem

General HouseBot discussion. Any issues that don't fit into any of the other topics belong here.
Post Reply
oferpeleg
Member
Posts: 8
Joined: Wed Nov 29, 2006 6:30 pm
Location: Tel Aviv, Israel

VB Script Problem

Post by oferpeleg »

Hi,

I'm trying to play a MIDI note using a VB script with the following codes lines:

Private Declare Function midiOutShortMsg Lib "winmm.dll" (ByVal hMidiOut , ByVal dwMsg)
Private Declare Function midiOutOpen Lib "winmm.dll" (lphMidiOut, ByVal uDeviceID, ByVal dwCallback, ByVal dwInstance, ByVal dwFlags)

It seems like "Private Declare Function" is not acceptable,
How can i include win libraries ?
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Post by Osler »

This can not be done from within a script. You will have to wrap the API calls in an ActiveX DLL file (using Visual Basic 6.0 or such). Once this is done, you can acess the ActiveX object from within the script which will then access the API calls.

Osler
Richard Naninck
HouseBot Guru Extraordinaire
Posts: 1121
Joined: Tue Sep 28, 2004 7:49 am
Location: The Netherlands

Post by Richard Naninck »

It is possible to call for dll's from vbscript. Not sure though if this is what you need. A code example below:

OSPOP3 is a registered dll in the system32 directory and can be accessed accordingly.

Code: Select all

Dim objPOP3
Set objPOP3        = CreateObject("OSPOP3.Session")
objPOP3.RaiseError = False

If objPOP3.OpenPOP3(AccountServer(Account), 110, AccountUser(Account), Passwd) Then
						objPOP3.GetMailboxSize
						EMailCountTotal = objPOP3.MessageCount
Post Reply