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 How to count all instance in the join for each row?
- Answer How do I write equations with sin in .net Math class?
- Answer I downloaded a 60-day free trial of Office Home and Business 2010 and Outlook 2010 didn't download
- Answer Outlook stops on receiving the last email when 5 seconds left to receive. The send receive window freezes at this point
- Answer How do I know the width/height of a table column?