wininet

How do I figure out the correct argument structure for an unmanaged dll?

淺唱寂寞╮ 提交于 2019-11-27 04:07:30
问题 I was loading in some old VB functions from VBA, and mostly got everything updated to VB.NET, but there are function declarations for functions in "wininet.dll" which don't seem to match up correctly. The Error I'm getting is: Exception Thrown: Managed Debugging Assistant, 'PInvokeStackImbalance':... The long and short of it is that the length of the declared arguments needs to be explicit and it isn't matching up to the real functions in the dll. I looked this up and I can get by just

Using WinInet to identify total file size before downloading it

我们两清 提交于 2019-11-27 02:49:29
问题 I got the source below from a third-party site explaining how to download a file from the internet using WinInet . I'm not too familiar with API, and I took at look at the WinInet unit but did not see any API calls like what I need. What I'm doing is adding the ability to report back progress of downloading a file. This procedure I've already wrapped inside of a TThread and everything works fine. However, just one missing piece: Finding the total size of the source file before downloading.

Detect an internet connection activation with Delphi

霸气de小男生 提交于 2019-11-26 13:08:28
问题 I\'ve been using a 3G wireless card for a while and every time I connect, my anti-virus fires up the updates. I\'m wondering what is the Win32 API set of functions that I can use to, either, get notified or query about the event of an Internet Connection coming up? And is there already a set of ported headers for Delphi? 回答1: I worked on a project to run a user's logon script whenever they connected our network over VPN. To do this, I wrote a helper unit that retrieves adapter info and stores

How to send a HTTP Post Request in Delphi 2010 using WinInet [duplicate]

北城余情 提交于 2019-11-26 12:47:42
问题 This question already has answers here : How to send a HTTP POST Request in Delphi using WinInet api (3 answers) Closed 6 years ago . I want to send a HTTP Post Request in Delphi 2010 using WinInet, but my script doesn\'t work ;/ It\'s my Delphi script: uses WinInet; procedure TForm1.Button1Click(Sender: TObject); var hNet,hURL,hRequest: HINTERNET; begin hNet := InternetOpen(PChar(\'User Agent\'),INTERNET_OPEN_TYPE_PRECONFIG or INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0); if Assigned(hNet)

How to send a HTTP POST Request in Delphi using WinInet api

懵懂的女人 提交于 2019-11-26 09:09:00
问题 I am trying to make HTTP Requests from Delphi using the WinInet functions. So far I have: function request:string; var hNet,hURL,hRequest: HINTERNET; begin hNet := InternetOpen(PChar(\'User Agent\'),INTERNET_OPEN_TYPE_PRECONFIG or INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0); if Assigned(hNet) then begin try hURL := InternetConnect(hNet,PChar(\'http://example.com\'),INTERNET_DEFAULT_HTTP_PORT,nil,nil,INTERNET_SERVICE_HTTP,0,DWORD(0)); if(hURL<>nil) then hRequest := HttpOpenRequest(hURL, \'POST\