Jump to content

rvk

Members
  • Content Count

    126
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by rvk


  1. Looking at the source, each time you press the OK button a private variable FAttempt is increased. When it goes over the AttemptNumber a Cancel is automatically triggered. So the Login will fail.

     

    procedure TJvLoginForm.OkBtnClick(Sender: TObject);
    begin
      Inc(FAttempt);
      if Assigned(FOnOkClick) then
        FOnOkClick(Self)
      else
        ModalResult := mrOk;
      if (ModalResult <> mrOk) and (FAttempt >= AttemptNumber) then
        ModalResult := mrCancel;
    end;


     


  2. 4 hours ago, Ian Branch said:

    It runs immediately the App is started and seemingly before the application's Form is created.

    That depends on where you put the TJvLoginDialog.

     

    If you have a DataModule, ideally the TJvLoginDialog goes on the TDataModule and you'll execute it in the DataModuleCreate() after connecting to the TDatabase. Set Active to false at designtime so you can do this yourself in the DataModuleCreate().

    Login.Active := true;
    if not Login.Execute then
    begin
      // inform the user and exit
      Application.Terminate;
    end;

     

    In the OnCheckUser you can check the database if the user has entered valid credentials.

     

    If you have the TDatabase component on a TForm and you initialize it there, then you'll need to put the TJvLoginDialog there too (in FormCreate() and after the initialization of the TDatabase-component).


  3. On 9/14/2019 at 9:24 AM, Stéphane Wierzbicki said:

    If not, is there any free library available?

    Like I stated before, you can do it with Synapse (from Ararat) and libssh2.dll. There is a SimpleSFTP.pas in the demo-directory. But that one uses cryptlib.dll which isn't free distributable. But there are version which can also use libssh2.dll (which is free). I have one for FPC but not ported to Delphi.

     

    There are also versions which use plain winsock in combination with libssh2.dll (no need for Synapse).

    For example: https://github.com/pult/libssh2_delphi (and like others on github)

     

    Using the searchwords libssh2 and delphi in Google will get you a lot of results too.

    For the Synapse version you can just search for SimpleSFTP.pas and libssh2 and you can search for the latest working with libssh2.dll.

     

    If you have any problems let us know.

     

    • Like 1
    • Thanks 1

  4. You can do it with Synapse in combination with cryptlib, or better libssh2.dll, for free.

     

    There is some source out there (I think sftp_2000) for Delphi.

     

    If you can't find it I could convert the example I have from FPC/Lazarus back to Delphi (will need some time for that).

     

     


  5. 49 minutes ago, pcplayer99 said:

    I can not get plain text that user can read at all.

    You can use TWebBrowser.WebBrowser1DocumentComplete() and read out WebBrowser1.Document.documentElement.outerHTML;

    (like discussed above)

    You can strip out any script tags and html tags and you end up with the plain text.

    (you should add line breaks on div en br tags though otherwise you have text on one line.)

     

    Or you might look for HTML2TEXT function which does all that work for you.

    But the readable text is there in the .outerHTML.

     


  6. 1 hour ago, David Schwartz said:

    Thanks, you created a trivial example to prove YOUR case, not what I'm dealing with. BRAVO!

    You might want to dial down the sarcasme. I'm trying to help you here and with that attitude I'm feeling less and less inclined to do so.

     

    With my example I retrieved your search result and got this (this is a snippet just to show you the content is there).

     

    <div class="I6vAHd h5RoYd ads-creative">Dr. Lazer is a <b>Baltimore Dentist</b> Dedicated To Quality <b>Dental</b> Care. Financing Available. Patient Focused <b>Dentistry</b>. Top <b>Baltimore Dentists</b>. Advanced Training. Services: Cosmetic <b>dentistry</b>, General <b>dentistry</b>, Porcelain veneers, Teeth whitening, <b>Dental</b> implants, Cosmetic dentures, <b>Dental</b> crowns.</div><ul class="OkkX2d"><li><a class="V0MxL" onmousedown="return google.f[this.getAttribute('data-mousedown')](this)" ontouchstart="return google.f[this.getAttribute('data-touchstart')](this)" href="https://www.cosmeticdentistbaltimore.com/our-office/ed-lazer-dds/?TrackNum=410-753-2005" data-ved="2ahUKEwj7o4KsiIPkAhVEJlAKHYQZDhMQpigoAHoECA8QBA" data-touchstart="bez1fd" data-mousedown="LmvwCb" data-arwt="//www.googleadservices.com/pagead/aclk?sa=L&ai=DChcSEwia64isiIPkAhVH5HcKHQCGCzoYABABGgJlZg&ohost=www.google.com&cid=CAASE-RoDCdUQXMX66yba6ZIKqfKGC0&sig=AOD64_0RkT0b2u8xR9l7_LEQw9VUouKjzQ&adurl=&rct=j&q=">Meet Dr. Ed Lazer</a></li><li><a class="V0MxL" onmousedown="return google.f[this.getAttribute('data-mousedown')](this)" ontouchstart="return google.f[this.getAttribute('data-touchstart')](this)" href="https://www.cosmeticdentistbaltimore.com/for-patients/special-offers/?TrackNum=410-753-2005" data-ved="2ahUKEwj7o4KsiIPkAhVEJlAKHYQZDhMQpigoAXoECA8QBQ" data-touchstart="bez1fd" data-mousedown="LmvwCb" data-arwt="//www.googleadservices.com/pagead/aclk?sa=L&ai=DChcSEwia64isiIPkAhVH5HcKHQCGCzoYABACGgJlZg&ohost=www.google.com&cid=CAASE-RoDCdUQXMX66yba6ZIKqfKGC0&sig=AOD64_2gU3L1cLsoIxMZDy60AJIwH1-G4w&adurl=&rct=j&q=">Special Offers</a></li><li><a class="V0MxL" onmousedown="return google.f[this.getAttribute('data-mousedown')](this)" ontouchstart="return google.f[this.getAttribute('data-touchstart')](this)" href="https://www.cosmeticdentistbaltimore.com/smile-gallery/?TrackNum=410-753-2005" data-ved="2ahUKEwj7o4KsiIPkAhVEJlAKHYQZDhMQpigoAnoECA8QBg" data-touchstart="bez1fd" data-mousedown="LmvwCb" data-arwt="//www.googleadservices.com/pagead/aclk?sa=L&ai=DChcSEwia64isiIPkAhVH5HcKHQCGCzoYABADGgJlZg&ohost=www.google.com&cid=CAASE-RoDCdUQXMX66yba6ZIKqfKGC0&sig=AOD64_0Eq9nb4XnF90RRE1Ik35kT7kFBQQ&adurl=&rct=j&q=">Smile Gallery</a></li><li><a class="V0MxL" onmousedown="return google.f[this.getAttribute('data-mousedown')](this)" ontouchstart="return google.f[this.getAttribute('data-touchstart')](this)" href="https://www.cosmeticdentistbaltimore.com/request-appointment/?TrackNum=410-753-2005" data-ved="2ahUKEwj7o4KsiIPkAhVEJlAKHYQZDhMQpigoA3oECA8QBw" data-touchstart="bez1fd" data-mousedown="LmvwCb" data-arwt="//www.googleadservices.com/pagead/aclk?sa=L&ai=DChcSEwia64isiIPkAhVH5HcKHQCGCzoYABAEGgJlZg&ohost=www.google.com&cid=CAASE-RoDCdUQXMX66yba6ZIKqfKGC0&sig=AOD64_2N4qM3fV1hZgFsH22ko3zEIjVzFQ&adurl=&rct=j&q=">Schedule Appointment</a></li><li><a class="V0MxL" onmousedown="return google.f[this.getAttribute('data-mousedown')](this)" ontouchstart="return google.f[this.getAttribute('data-touchstart')](this)" href="https://www.cosmeticdentistbaltimore.com/contact/?TrackNum=410-753-2005" data-ved="2ahUKEwj7o4KsiIPkAhVEJlAKHYQZDhMQpigoBHoECA8QCA" data-touchstart="bez1fd" data-mousedown="LmvwCb" data-arwt="//www.googleadservices.com/pagead/aclk?sa=L&ai=DChcSEwia64isiIPkAhVH5HcKHQCGCzoYABAFGgJlZg&ohost=www.google.com&cid=CAASE-RoDCdUQXMX66yba6ZIKqfKGC0&sig=AOD64_0sMvnrhd-h49qKlc3LKos0K2h67w&adurl=&rct=j&q=">Contact Us</a></li></ul></li><li class="ads-ad" data-hveid="CBAQAA" data-bg="1"><div class="ad_cclk"><a id="n1s0p2c0" style="display: none;" href="https://www.googleadservices.com/pagead/aclk?sa=L&ai=DChcSEwia64isiIPkAhVH5HcKHQCGCzoYABAGGgJlZg&ohost=www.google.com&cid=CAASE-RoDCdUQXMX66yba6ZIKqfKGC0&sig=AOD64_38aJbvxP_v7qoqtk0s9Byp6f8NQw&rct=j&q=&ved=2ahUKEwj7o4KsiIPkAhVEJlAKHYQZDhMQ0Qx6BAgQEAE&adurl="></a><a class="V0MxL r-ieStqovnU5rk" id="vn1s0p2c0" onmousedown="return google.arwt(this)" ontouchstart="return google.arwt(this)" href="https://www.aspendental.com/dentist/md/dundalk/1401-merritt-blvd" jsl="$t t-r1glFWqNI5A;$x 0;"><h3 class="sA5rQ">Official Aspen Dental | Affordable dentistry‎</h3><br><div class="ads-visurl">

    You see that text: Dr. Lazer is a <b>Baltimore Dentist</b> Dedicated To Quality <b>Dental</b> Care. Financing Available.

     

    Is that what you are after? (this is from the outerHTML)

    Yes, it's riddled with javascript and lots of tags. But it's valid HTML with the content provided on screen of the user.

     

    If it's not, please provide some text that you did expect.

     

    BTW, You do need to read out outerHTML in WebBrowser1DocumentComplete() because the javascript needs time to run. But I assumed you already knew this.

     

     

     

    • Like 3

  7. On 8/13/2019 at 3:48 PM, David Schwartz said:

    Try it on a Google search or on some news sites, and let me know what you find.

    Why should I try it????

    But alright... I tried and it works.

     

    With this source file

    Test
    <div id=content>
    Some other content
    </div>
    
    <script type = "text/JavaScript">
    document.getElementById("content").innerHTML = "Changed content";
    </script>

    I got this in Delphi for 

    var
      d: OleVariant;
    begin
      d := WebBrowser1.Document;
      Memo1.Lines.Text := d.documentElement.outerHTML;
    end;

     

    <HTML><HEAD></HEAD>
    <BODY>Test 
    <DIV id=content>Changed content</DIV>
    <SCRIPT type=text/JavaScript>
    document.getElementById("content").innerHTML = "Changed content";
    </SCRIPT>
    </BODY></HTML>

    Note the "Changed content" between the divs of id=content !!

     

    The javascript itself obviously stays there because it's part of the source but the content itself is the way it is represented to the end-user after executing the javascript. The DOM even places the missing HTML, HEAD and BODY tags in there.

     

     

     

     


  8. If you can put together an example and the virtual channels work the same on RDP on win10, I can take a look.

     

    I take it this should do the same as TSScan and RemoteDesktopTwain but then directly from your own local utility program.

     

     


  9. Ah. But it does not not crap out :classic_biggrin:

    There is definitely some alignment problem.

     

    You say "RDS" DLL. How is that DLL different?

    Is there something done with the calls?

    Could you share the code?

     

    Maybe if that problem is fixed, the other method with ttmNative is fixed automatically too.

     

     


  10. 45 minutes ago, Dave Nottage said:

    Yes, it's non-zero.

    So the call gives a TWRC_XFERDONE (successful) but the handle could still be invalid.

     

    The handle (hNative) is a TW_UINT32 (which is a Cardinal/32bit). I wonder if it shouldn't be a TW_Handle (which should be a NativeUInt and UInt64 on 64 bit). At least GlobalLock expects a THandle (which is UInt64 on 64 bit).

     

    Doesn't seem really wise to stuff a handle in an Cardinal/32bit on 64 bit (which like David already mentioned, could be just a simple 32/64 bit truncation error).

     

    Strange this worked locally on the machine itself but fails on RDP. Maybe the handle-numbers are much larger and it fails.

     

    • Like 1

  11. Are your connecting client, the used mstsc.exe and RDP-session (including your app) ALL 64 bit?

    (If not, you can't rely on the Virtual Channel Client DLL)

     

    Did you check the numerical value of hNative (i.e. not being 0)?

     


  12. 27 minutes ago, Dave Nottage said:

    As above, the DLL is on the same machine as the Twain driver. RDS loads the DLL when a session is started to the remote application, which communicates to the virtual channel client DLL via RDS.

    So, the drivers are not loaded on the server itself?

     

    I'm not familiar with Virtual Channels in RDP, but I think this would mean you have the DLL on the local client and want the application, which runs on the server side in RDP, have access to the local scanner through the Virtual Channels-technology? Just like a Redirected Printer uses Virtual Channels.

     

    That's a whole lot of places where things can go wrong (that's why I asked if the scanner and drivers and DLL where locally on the server side in the RDP session itself).

     

    What was the value of the return-code on this line (in TTwainSource.TransferImages for TransferMode ttmNative):

    rc := Owner.TwainProc(AppInfo, @Structure, DG_IMAGE, DAT_IMAGENATIVEXFER, MSG_GET, @hNative);

    That seems to be where hNative gets its value (which fails).

    It seems the value is not checked for success there ( if rc <> TWRC_SUCCESS then ... should give error )


  13. On 6/27/2019 at 9:05 AM, CarloM said:

    How can I sign digitally my *.exe with a SSL EV ?

    ...

    I would like use a cert like this 

    https://www.digicert.com/code-signing/

    It is expensive, any recommendation?

     

    YIKES. $474/year for a Code signing certificate ?????

    Shouldn't be any more than $100/Year or so via some Sectigo reseller.

    Examples here and here.

    You'll need a Code signing certificate ("SSL" EV won't do and I've never needed an EV Code certificate).

     

    I also never seen the icon disappear. What tool do you use to sign and what command line options?

     

    • Like 1

  14. Are you using a redirected scanner in WTS? Or is the scanner-software (and 64bit driver) directly installed on the WTS machine?

     

    Does the DelphiTwainDemo2 example work in WTS?

     

    1 hour ago, Dave Nottage said:

    The code is inside a DLL written for Windows Terminal Services. The same code works fine in a DLL that is just loaded via a plain application, so perhaps it has something to with WTS?

    Not sure what you mean by this? In Windows Terminal Services (now called Remote Desktop Services, RDS) you also just run plain applications, don't you?

    Or do you mean it's running under Windows Services? (which is hugely different)

     


  15. 4 hours ago, Dave Nottage said:

    Next issue is: when it is used in a DLL, the app locks up after the scan has completed.

    Hard to say what could be the cause without example-source of DLL and calling procedure.

     


  16. On 64 bit it worked for me but I did't have any scan-sources.

    WIA sources are 32-bit and not visible in 64 bit for me.

    Installing the VueScan gave me a 64 bit source.

     

    What Delphi version do you use?

    Are you using VLC of FMX?

    Did you try the DelphiTwain\examples\VCL2\DelphiTwainDemo2 example? (which worked for me on 64 bit)

     


  17. On 6/13/2019 at 9:03 AM, Dave Nottage said:

    Which returns a result of TWRC_FAILURE. The corresponding condition code is TWCC_BADVALUE

    So you provided a "bad value" :classic_blink:

     

    Here it works fine with VueScan as 64 bit scan-sourcedriver.

     

    What/which scannerdriver did you try/use?

     


  18. 2 hours ago, Kryvich said:
    • Remove "Members"

    But that's how we recognize the administrators 😁

    (although that information is also under the avatar-hoover.)

     

    Quote
    • Optionally remove the reputation and posts number, we can see this information by hovering mouse over the icon.

    I find that information useful to see in one glance. Hovering over the avatar hides it too much for me.

     

    +1 for the other suggestions although I wonder how much the layout can be changed from the default via themes (because this is based on standard forumsoftware).

     

    Ah well, there is always greasemonkey :classic_biggrin:

×