Page 1 of 1

VB Script Problem

Posted: Sat Feb 10, 2007 1:16 pm
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 ?

Posted: Sat Feb 10, 2007 2:50 pm
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

Posted: Sun Feb 11, 2007 7:02 am
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