AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Suchfunktion Ergebnis der Suchanfrage

Ergebnis der Suchanfrage


Datum des Suchindex: Heute, 05:32

Parameter dieser Suchanfrage:

Suche in Thema: How to - string in DLL
Suche alle Beiträge, die von "jaenicke" geschrieben wurden
• Suchmethode: "Suche nach allen Begriffen"
• Nach Datum (firstpost) sortiert
• Zeige Treffer als Beiträge
Zeige 7 von insges. 7 Treffern
Suche benötigte 0.005s

Es liegen Ergebnisse in folgenden Bereichen vor:

  • Forum: Object-Pascal / Delphi-Language

    AW: How to - string in DLL

      Delphi
      by jaenicke, 22. Jun 2011
    I think this is a problem with the size parameter.

    You always have to have in mind that one character is one byte in Delphi 7 and two bytes in Delphi 2010.

    How does the code for reserving the memory, ... look like?
  • Forum: Object-Pascal / Delphi-Language

    AW: How to - string in DLL

      Delphi
      by jaenicke, 20. Jun 2011
    Well, for the version with PAnsiChar you append an A, and for PWideChar a W.
    For example the API has ShellExecuteA and ShellExecuteW. Delphi itself maps ShellExecute to ShellExecuteA (Delphi 1 - 2007) or to ShellExecuteW (Delphi 2009+). So you don't see that you call one of the other functions. ;-)

    Yes it is.

    I myself do not want to use it because it relies on OLE and the operating system....
  • Forum: Object-Pascal / Delphi-Language

    AW: How to - string in DLL

      Delphi
      by jaenicke, 20. Jun 2011
    Oh ja, darauf hatte ich gar nicht geachtet... :oops:
  • Forum: Object-Pascal / Delphi-Language

    AW: How to - string in DLL

      Delphi
      by jaenicke, 19. Jun 2011
    What about this:function Foonction(Data: PWideChar; Buffer: PWideChar; lenBuffer: Cardinal): Cardinal; external 'StringDLL.dll';

    var
    Buffer: string;
    BufferSize: DWORD;
    begin
    BufferSize := Foonction('bar', nil, 0);
    if BufferSize > 0 then
    begin
    SetLength(Buffer, BufferSize);
  • Forum: Object-Pascal / Delphi-Language

    AW: Re: How to - string in DLL

      Delphi
      by jaenicke, 19. Jun 2011
    You try to copy lenBuffer Bytes from foo, but it does not have so many Bytes. ;-)

    By the way: I prefer the way most of the API functions work:
    First I ask for the buffer size needed, then I reserve enough memory and ask for the data itself.
  • Forum: Object-Pascal / Delphi-Language

    AW: How to - string in DLL

      Delphi
      by jaenicke, 19. Jun 2011
    One inportant issue first:
    Always use PWideChar or PAnsiChar in DLL interfaces. Otherwise it depends on the Delphi version and what PChar means in it whether your program works or not...

    Regarding your problem:
    I don't see an error handling (you ignore the return value). And where does the exception occur? Inside the DLL function?

    And could you please post the source of the function...
  • Forum: Object-Pascal / Delphi-Language

    AW: How to - string in DLL

      Delphi
      by jaenicke, 17. Jun 2011
    You can use PWideChar or PAnsiChar just as the Windows API internally uses too.

    If you want to return such a value:
    Just give a PWideChar and its size as variable parameter. If the size is not sufficient, you return the size you need. If the size is sufficient you copy the data into the buffer.

    This is the way the API manages it. And it works well.


URL zu dieser Suchanfrage:

https://www.delphipraxis.net/dp_search.php?do=usersearch&search_username=jaenicke&search_exact_username=1&search_sortby=dateline&search_resulttype=post&search_matchmode=0&searchthreadid=161104
Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:41 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz