Confusion Calling DLLs vs Calling Win32
Posted: Sun Nov 18, 2007 4:15 am
Be gentle with me
- this is my first PB excursion into the world of Win32 API and DLLs. I'm confused about calling the Win32 API and other DLLs. In the two examples below I'm calling two different DLLs neither of which has constants that PB recognizes - My first question is why not? Does this mean the constants (and thus the DLLs) are not part of the Win32 API?
My second question is I have to load the Winhttp.dll but not the Wininet.dll my assumption is that something else loaded the Wininet.dll? Also I can use the Func_ method to call the Wininet.dll but have to use the CallFucntion method for the Winhttp.dll.
Is there a way to call the Winhttp.dll. via the Func_ method?
Hope you can follow my ramblings and can offer some insight.
Thanks,
Jeff

My second question is I have to load the Winhttp.dll but not the Wininet.dll my assumption is that something else loaded the Wininet.dll? Also I can use the Func_ method to call the Wininet.dll but have to use the CallFucntion method for the Winhttp.dll.
Is there a way to call the Winhttp.dll. via the Func_ method?
Hope you can follow my ramblings and can offer some insight.
Thanks,
Jeff
Code: Select all
;Requires Winhttp.dll & Wininet.dll
#INTERNET_OPEN_TYPE_DIRECT = $1
;
#WINHTTP_ACCESS_TYPE_NO_PROXY = $1
#WINHTTP_NO_PROXY_NAME = #Null
#WINHTTP_NO_PROXY_BYPASS = #Null
#WINHTTP_FLAG_ASYNC = $10000000
Procedure doPost()
; Example 1 requires Winhttp.dll)
winHTTPlib.l = OpenLibrary(#PB_Any,"Winhttp.dll")
Debug IsLibrary(winHTTPlib)
;WinHttpOpenHandle.l = WinHttpOpen_("User Agent",#WINHTTP_ACCESS_TYPE_NO_PROXY,#WINHTTP_NO_PROXY_NAME.,#WINHTTP_NO_PROXY_BYPASS,#WINHTTP_FLAG_ASYNC)
WinHttpOpenHandle.l = CallFunction(winHTTPlib,"WinHttpOpen","User Agent",#WINHTTP_ACCESS_TYPE_NO_PROXY,#WINHTTP_NO_PROXY_NAME,#WINHTTP_NO_PROXY_BYPASS,0)
Debug WinHttpOpenHandle
CloseLibrary(winHTTPlib)
;
; Example 2 requires Wininet.dll
internetOpenHandle.l = InternetOpen_("User Agent Info Goes Here",#INTERNET_OPEN_TYPE_DIRECT,"","",0)
Debug internetOpenHandle
InternetCloseHandle_(internetOpenHandle)
;
EndProcedure
doPost()