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 Why won't thumbnails show up?
- Answer amdsbs.sys bluescreen need to replace files but system wont let me
- Answer Eject buttons stopped working on my laptop, how do I fix it?
- Answer Upgrade xp home to win 7 home using OEM system builder Pack
- Answer I recently went to the correct location in the control panel to uninstall something...