rundmv Posted August 5, 2008 Share Posted August 5, 2008 I am trying to call a function called URLDownloadToFile(), in urlmon.dll. Here is the function:HRESULT URLDownloadToFile( LPUNKNOWN pCaller, LPCTSTR szURL, LPCTSTR szFileName, DWORD dwReserved, LPBINDSTATUSCALLBACK lpfnCB );MSDN's reference for it can be found here: http://msdn.microsoft.com/en-us/library/ms775123.aspx. My CallFunc() is returning @error = 2, which is "invalid return type". I am using str return type for the LPCTSTR's, and dword for DWORD. I'm not sure what to use for the others, and have been trying different things, but I keep getting the error. Anyone have experience calling API functions that can help me out? Here's my attempt to call it: $test = DllCall(@SystemDir & "\urlmon.dll", "ulong", "URLDownloadToFile", "none", "", "str", $url, "str", "C:\TSE\TEST111.xml", "dword", 0, "int", 0) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 5, 2008 Moderators Share Posted August 5, 2008 Something wrong with InetGet()? I think I ran into a problem once with this myself, but for the life of me can't remember what the solution was I found if any. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
ProgAndy Posted August 5, 2008 Share Posted August 5, 2008 ini parameters, you mustn't use "none", just use "ptr" instead *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
rundmv Posted August 5, 2008 Author Share Posted August 5, 2008 Thanks. I got it working. DllCall(@SystemDir & "\urlmon.dll", "long", "URLDownloadToFile", "long", "0", "str", $url, "str", $filename, "long", 16, "long", 0) Link to comment Share on other sites More sharing options...
-Ultima- Posted August 5, 2008 Share Posted August 5, 2008 (edited) DllCall("urlmon.dll", "ptr", "URLDownloadToFile", "ptr", "0", "str", $url, "str", $filename, "dword", 0, "ptr", 0) 1. Pointers aren't necessarily identical in size to longs. If you're not sure of the exact pointer type, use "ptr" instead. 2. dwReserved should be 0... not sure why you'd send it 16. Edited August 5, 2008 by -Ultima- [ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now