Recent

Author Topic: [SOLVED]Who can really provide the right code...  (Read 17399 times)

BeniBela

  • Hero Member
  • *****
  • Posts: 958
    • homepage
Re: Who can really provide the right code...
« Reply #15 on: October 11, 2012, 11:07:27 am »
Btw there are also my internet tools to download a file:

Code: [Select]
uses bbutils, simpleinternet;
..
strSaveToFileUTF8('c:\where.want.to.save.it.to.html', retrieve('http://www.google.de'));

(this will use wininet on Windows, and synapse on Linux)

Robert W.B.

  • Sr. Member
  • ****
  • Posts: 331
  • Love my Wife, My Kids and Lazarus/Freepascal.
Re: Who can really provide the right code...
« Reply #16 on: October 17, 2012, 05:28:39 pm »
Hi Timewarp.
How can i use Urlmon in Lazarus?
Where can i download Urlmon.pas for Lazarus?

 :(
Rob

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: Who can really provide the right code...
« Reply #17 on: October 17, 2012, 07:19:06 pm »
Hi Timewarp.
How can i use Urlmon in Lazarus?
Where can i download Urlmon.pas for Lazarus?

 :(
There is no UrlMon for lazarus fpc. Most of UrlMon is interface definitions for monikers, callbacks, etc., which are hard to implement with fpc. For what you want to do you don't need this fancy stuff. Here is an easy way of doing what you want with urlmon:

Code: [Select]
function URLDownloadToFile(pCaller: pointer; URL: PChar; FileName: PChar; Reserved: DWORD; lpfnCB : pointer): HResult; stdcall; external 'urlmon.dll' name 'URLDownloadToFileA';

procedure TForm1.Button1Click(Sender: TObject);
var Source, Dest: string;
begin
 Source:='http://lazarus.freepascal.org';
 Dest:='C:\Windows\temp\data.txt';
 if URLDownloadToFile(nil, PChar(Source), PChar(Dest), 0, nil)=0 then
  showmessage('Download ok!')
 else
  showMessage('Error downloading '+Source);
end;

Robert W.B.

  • Sr. Member
  • ****
  • Posts: 331
  • Love my Wife, My Kids and Lazarus/Freepascal.
Re: To Lazarus team
« Reply #18 on: October 18, 2012, 01:55:23 am »
Laksen.It don't work with windows 32 bit ssl either!
It's better that Lazarus developteam implement a solution like Urlmon,directly in Lazarus and take the next step to professionality! Delphi fixed Urlmon in the 1990 so, why must Lazarus be depending of Libraries, from third partners, that is not updated! If I see Lazarus implement a library like Urlmon, I will defently donate.
Rob

Laksen

  • Hero Member
  • *****
  • Posts: 802
    • J-Software
Re: Who can really provide the right code...
« Reply #19 on: October 18, 2012, 02:56:00 am »
Quote
Laksen.It don't work with windows 32 bit ssl either!
Why? Errors? Crashes?

You mention 32 bit. Are you also compiling the program for 32bit?

Quote
It's better that Lazarus developteam implement a solution like Urlmon,directly in Lazarus and take the next step to professionality! Delphi fixed Urlmon in the 1990 so, why must Lazarus be depending of Libraries, from third partners, that is not updated! If I see Lazarus implement a library like Urlmon, I will defently donate.
Given the emphasis on crossplatformity of the Lazarus system, using UrlMon would be a step away from professionality in my opinion. You could even take a look at all the documentation for the DLL(which seems to be part of Internet Explorer), http://msdn.microsoft.com/en-us/library/ms775123(v=vs.85).aspx Especially the part that says "[This documentation is preliminary and is subject to change.]". Seems a little risky, and not very professional :P

If you really need it you can find an urlmon unit somewhere else. Download the newest version of the JEDI WIN32 headers. There it's included as JwaUrlmon.pas, which with minor changes can be used just fine. You can even find a urlmon.pas unit straight by searching on google which compiles if you insert a {$mode delphi}. I don't know the licenses of such headers, but I doubt it's a problem.

I guess the reason why this thing isn't supported by Lazarus is that it strives to be crossplatform. Urlmon is a wrapper over a windows DLL, and hence not very interesting when there are open-source and crossplatform tools such as Synapse and many others available

Timewarp

  • Full Member
  • ***
  • Posts: 144
Re: Who can really provide the right code...
« Reply #20 on: October 18, 2012, 11:31:51 am »
Hi Timewarp.
How can i use Urlmon in Lazarus?
Just check post by ludob, you can use other urlmon functions similar way.
Quote
when there are open-source and crossplatform tools such as Synapse and many others available
When you develop only for Windows, it doesn't make sense to use extra packages / crossplatform solutions, it just adds weigth and not always work (as seen here). I have used urlmon/msxml for networking in Delphi for years, it works well no matter if user has Win98 or Win8 or https

Robert W.B.

  • Sr. Member
  • ****
  • Posts: 331
  • Love my Wife, My Kids and Lazarus/Freepascal.
Re: URLMon.dll [SOLVED]I'm so Happy
« Reply #21 on: October 19, 2012, 02:25:38 pm »
I'm so Bloody happy,you can't Imagine  :D :D :D :D :D :D :D
 LUDOB I got it.   :D

UrlMon.dll is already in Windows. I don't have to mess with no other libraies. It Solved the ssl HTTPS thing and work like in Delphi. Thank You Thank You everybody for the help. Now I got to convert my heaviest program from Delphi and see if it works. Have a great weekend. I'm so happy.
I Love Lazarus and thank You  Lazarus Team.  :D :D :D

The solution:
function URLDownloadToFile(pCaller: pointer; URL: PChar; FileName: PChar; Reserved: DWORD; lpfnCB : pointer): HResult; stdcall; external 'urlmon.dll' name 'URLDownloadToFileA';

procedure TForm1.Button1Click(Sender: TObject);
var Source, Dest: string;
begin
 Source:='http://lazarus.freepascal.org';
 Dest:='C:\Windows\temp\data.txt';
 if URLDownloadToFile(nil, PChar(Source), PChar(Dest), 0, nil)=0 then
  showmessage('Download ok!')
 else
  showMessage('Error downloading '+Source);
end;

Solution from the bugtracker.
http://bugs.freepascal.org/bug_view_advanced_page.php?bug_id=23107&history=1
Best regards
Robbanux  :D
« Last Edit: October 19, 2012, 02:28:12 pm by robbanux »
Rob

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Who can really provide the right code...
« Reply #22 on: October 19, 2012, 02:36:38 pm »
Glad it works.

I think people will appreciate a small sample program in this wiki article for reference:
http://wiki.lazarus.freepascal.org/Windows_Programming_Tips#Code_snippets
Just added it. Please review/correct

PS: Hope more people "pay the wiki tax" if they are helped with code snippets etc. The wiki is becoming a very valuable source of help/information, a bit more structured than the forum/bugtracker ;) That's just my opinion of course (and not specifically directed at the people in this thread, but in general)...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Who can really provide the right code...
« Reply #23 on: October 19, 2012, 02:52:28 pm »
PS: Hope more people "pay the wiki tax" if they are helped with code snippets etc. The wiki is becoming a very valuable source of help/information, a bit more structured than the forum/bugtracker ;) That's just my opinion of course (and not specifically directed at the people in this thread, but in general)...

Personally I find the wiki a bit difficult to use, the search most of the times does not bring up what I'm looking for, I have to dig around various pages to find it, and there is no index that has all the pages that I can browse for interesting information, something like the tree on the left on the chm help files for example. I have more success using google to search than the wiki and that stops me from using it really, I do not know if there is any extension to make it more noob friendly but If I were in the teams position I would be searching for a replacement. When I have some free time I will search for alternatives.

Just my personal experience.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Who can really provide the right code...
« Reply #24 on: October 19, 2012, 03:39:45 pm »
Yep, everybody's different. I dislike searching through the forum ;)

If all else fails, a Google search with site:wiki.lazarus.freepascal.org probably works quite well...

Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

 

TinyPortal © 2005-2018