Concat PChar with string in Delphi
I need to construct a string and send it via
FileName := String_1 + String_2 + String_3; PostMessage(FWndHandle, WM_BLA_BLA, NotifyData^.Action, LParam(FileName));
but something isn't working. Plus, FileName is a PChar. The code looks like this:
var FileName : PChar; Directory_Str : String; AnotherString : String; begin // Get memory for filename and fill it with data GetMem(FileName, NotifyData^.FileNameLength + SizeOf(WideChar)); Move(NotifyData^.FileName, Pointer(FileName)^, NotifyData^.FileNameLength); PWord(Cardinal(FileName) + NotifyData^.FileNameLength)^ := 0; // TODO: Contact string before sending message // FileName := AnotherString + Directory_Str + FileName; PostMessage(FWndHandle, WM_BLA_BLA, NotifyData^.Action, LParam(FileName)); ... end;
Now I need to do contact another string to the variable
FileName before calling
FileName := AnotherString + Directory_Str + FileName; PostMessage(FWndHandle, WM_BLA_BLA, NotifyData^.Action, LParam(FileName));
This would work if FileName was a string, which is not the case here.
Anyone knows how to do that with PChar? I tried these methods, works sometimes but always something breaks at the end:
StrPCopy(FileName, FDirectory + String(FileName));
FileName := PChar(AnotherString + Directory_Str + FileName);
No responses yet. Be the first one!
Can you answer these?
- Answer What Twitter apps work with a Retina display with a focus on low cost?
- Answer regarding unexpected shutdown of my system.
- Answer In trying to set up a homegroup on a PC with windows 7 and a router I get an error message that tells me I need IPV 6. In checking the properties I find both IPV 4 and IPV 6 checked.
- Answer upgrade win 7 to win 8 pro
- Answer deleting backups