Rev 87 | Rev 95 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 87 | Rev 92 | ||
---|---|---|---|
Line 44... | Line 44... | ||
44 | function UD2_SetThreadErrorMode(dwNewMode: DWORD; lpOldMode: LPDWORD): BOOL; |
44 | function UD2_SetThreadErrorMode(dwNewMode: DWORD; lpOldMode: LPDWORD): BOOL; |
45 | 45 | ||
46 | implementation |
46 | implementation |
47 | 47 | ||
48 | uses |
48 | uses |
49 | WinInet, Forms; |
49 | idhttp, Forms; |
50 | 50 | ||
51 | function SplitString(const aSeparator, aString: string; aMax: Integer = 0): TArrayOfString; |
51 | function SplitString(const aSeparator, aString: string; aMax: Integer = 0): TArrayOfString; |
52 | // http://stackoverflow.com/a/2626991/3544341 |
52 | // http://stackoverflow.com/a/2626991/3544341 |
53 | var |
53 | var |
54 | i, strt, cnt: Integer; |
54 | i, strt, cnt: Integer; |
Line 287... | Line 287... | ||
287 | {$IFNDEF PREFER_SHELLEXECUTEEX_MESSAGES} |
287 | {$IFNDEF PREFER_SHELLEXECUTEEX_MESSAGES} |
288 | if not CheckLastOSCall(false) then ExitCode := EXITCODE_RUN_FAILURE; |
288 | if not CheckLastOSCall(false) then ExitCode := EXITCODE_RUN_FAILURE; |
289 | {$ENDIF} |
289 | {$ENDIF} |
290 | end; |
290 | end; |
291 | 291 | ||
292 | function GetHTML(AUrl: string): string; |
292 | function GetHTML(const url: string): string; |
293 | // http://www.delphipraxis.net/post43515.html |
- | |
294 | // Modificated by ViaThinkSoft |
- | |
295 | var |
293 | var |
296 | databuffer : array[0..4095] of char; |
- | |
297 | ResStr : string; |
294 | idhttp :Tidhttp; |
298 | hSession, hfile: hInternet; |
- | |
299 | dwindex,dwcodelen,dwread,dwNumber: cardinal; |
- | |
300 | dwcode : array[1..20] of char; |
- | |
301 | res : pchar; |
- | |
302 | Str : pchar; |
- | |
303 | begin |
295 | begin |
304 | ResStr := ''; |
- | |
305 | if system.pos('http://',lowercase(AUrl)) = 0 then |
- | |
306 | begin |
- | |
307 | AUrl:='http://'+AUrl; |
296 | idhttp := Tidhttp.Create(nil); |
308 | end; |
297 | try |
309 | - | ||
310 | // [ViaThinkSoft] Added |
- | |
311 | Application.ProcessMessages; |
- | |
312 | - | ||
313 | hSession:=InternetOpen('InetURL:/1.0', |
- | |
314 | INTERNET_OPEN_TYPE_PRECONFIG, |
- | |
315 | nil, |
- | |
316 | nil, |
- | |
317 | 0); |
- | |
318 | if assigned(hsession) then |
- | |
319 | begin |
- | |
320 | // [ViaThinkSoft] Added |
- | |
321 | Application.ProcessMessages; |
- | |
322 | - | ||
323 | hfile := InternetOpenUrl(hsession, |
- | |
324 | pchar(AUrl), |
- | |
325 | nil, |
- | |
326 | 0, |
- | |
327 | INTERNET_FLAG_RELOAD, |
- | |
328 | 0); |
- | |
329 | dwIndex := 0; |
- | |
330 | dwCodeLen := 10; |
- | |
331 | - | ||
332 | // [ViaThinkSoft] Added |
- | |
333 | Application.ProcessMessages; |
- | |
334 | - | ||
335 | HttpQueryInfo(hfile, |
- | |
336 | HTTP_QUERY_STATUS_CODE, |
- | |
337 | @dwcode, |
- | |
338 | dwcodeLen, |
- | |
339 | dwIndex); |
- | |
340 | res := pchar(@dwcode); |
298 | result := idhttp.Get(url); |
341 | dwNumber := sizeof(databuffer)-1; |
- | |
342 | if (res ='200') or (res ='302') then |
- | |
343 | begin |
299 | finally |
344 | while (InternetReadfile(hfile, |
- | |
345 | @databuffer, |
- | |
346 | dwNumber, |
- | |
347 | DwRead)) do |
- | |
348 | begin |
- | |
349 | - | ||
350 | // [ViaThinkSoft] Added |
- | |
351 | Application.ProcessMessages; |
- | |
352 | - | ||
353 | if dwRead =0 then |
- | |
354 | break; |
300 | idhttp.Free; |
355 | databuffer[dwread]:=#0; |
- | |
356 | Str := pchar(@databuffer); |
- | |
357 | resStr := resStr + Str; |
- | |
358 | end; |
- | |
359 | end |
- | |
360 | else |
- | |
361 | ResStr := 'Status:'+res; |
- | |
362 | if assigned(hfile) then |
- | |
363 | InternetCloseHandle(hfile); |
- | |
364 | end; |
301 | end; |
365 | - | ||
366 | // HinzugefĆ¼gt |
- | |
367 | Application.ProcessMessages; |
- | |
368 | - | ||
369 | InternetCloseHandle(hsession); |
- | |
370 | Result := resStr; |
- | |
371 | end; |
302 | end; |
372 | 303 | ||
373 | procedure VTS_CheckUpdates(VTSID, CurVer: string); |
304 | procedure VTS_CheckUpdates(VTSID, CurVer: string); |
374 | resourcestring |
305 | resourcestring |
375 | (* |
306 | (* |