![]() |
Fehlerhafte String auswertung
Delphi-Quellcode:
type
PSOP64 = ^TSOP64; TSOP64 = record plugin: array[0..MAX_PATH] of AnsiChar; end;
Delphi-Quellcode:
var
gCDS: COPYDATASTRUCT; gSOP: TSOP64;
Delphi-Quellcode:
gSOP.plugin ist als AnsiChar definiert und wird korrekt gefüllt.
procedure SOP_SetPlugin(Plugin: PWideChar);
begin if (gp.hSOPlugin <> 0) then begin FillChar(gSOP.plugin, 0, MAX_PATH); WideCharToMultiByte(CP_ACP, 0, Plugin, -1, gSOP.plugin, MAX_PATH, nil, nil); gCDS.dwData := 2; gCDS.cbData := SizeOf(gSOP); gCDS.lpData := @gSOP; SendMessage(gp.hSOPlugin, WM_COPYDATA, WPARAM(gP.MainHandle), LPARAM(@gCDS)); end; end; Nach dem senden der Message ist aber in der anderen Exe der String Fehlerhaft. Jemand eine Idee woran es liegt? Beide Records sind gleich. Hier sind die Daten falsch.
Delphi-Quellcode:
EDIT:
pSOP := @pCDS.lpData;
if (InitVisDll(pSOP.plugin)) then // <<<<< pSOP.plugin ist nicht der gleiche String Ok.. Hat sich erledigt. Sorry Die Lösung!
Delphi-Quellcode:
pSOP := @pCDS.lpData;
@ ist nicht gleich Pointer So geht's.
Delphi-Quellcode:
pSOP := Pointer(pCDS.lpData);
|
AW: Fehlerhafte String auswertung
Wenn "plugin" als
Delphi-Quellcode:
definiert ist
array[0..MAX_PATH] of AnsiChar;
müsste es m.E. mit
Delphi-Quellcode:
gelöscht werden, weil sonst der letzte AnsiChar nicht gelöscht wird.
FillChar(gSOP.plugin, 0, MAX_PATH+1);
|
AW: Fehlerhafte String auswertung
Zitat:
|
AW: Fehlerhafte String auswertung
Zitat:
Doch, Beide sind Pointer. * ein Zeiger auf die Variable (was du nicht wolltes) * ein Zeiger, auf den die Variable zeigt (was du wolltest) Aber sicher, dass die Definition stimmt? Zitat:
Delphi-Quellcode:
array[0..MAX_PATH-1] of AnsiChar;
oder
Delphi-Quellcode:
array[1..MAX_PATH] of AnsiChar;
|
AW: Fehlerhafte String auswertung
Zitat:
Werde mir den Unterschied merken. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:49 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz