user2522767
user2522767

Reputation: 11

how call dll export function in vb6?

how can call dll export faunction in vb6? CallWindowProc have limtied in paramet. in example how call this fanction ?

Dim lb As Long, pa As Long
lb = LoadLibrary("wininet.dll")
pa = GetProcAddress(lb, "InternetOpen")

Upvotes: 1

Views: 730

Answers (1)

MarkL
MarkL

Reputation: 1771

These definitions are copied from pinvoke.net and modified the variable types for vb6.

I have not tested this code.

Const INTERNET_OPEN_TYPE_PRECONFIG = 0  ' use registry configuration
Const INTERNET_OPEN_TYPE_DIRECT = 1 ' direct to net
Const INTERNET_OPEN_TYPE_PROXY = 3  ' via named proxy
Const INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY = 4 ' prevent using java/script/INS

Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" ( _
    ByVal sAgent As String, _
    ByVal lAccessType As Long, _
    ByVal sProxyName As String, _
    ByVal sProxyBypass As String, _
    ByVal lFlags As Long) As Long

Usage:

Dim hInet As Long
hInet = InternetOpen("HttpAgent", INTERNET_OPEN_TYPE_PRECONFIG, _
  "", "", 0)
If hInet = 0 Then 
  'Return or handle a False return status
End If

Upvotes: 1

Related Questions