Recent

Author Topic: GetConsoleTitle with pchar as argument ?  (Read 2810 times)

ASerge

  • Hero Member
  • *****
  • Posts: 2140
Re: GetConsoleTitle with pchar as argument ?
« Reply #15 on: July 04, 2023, 08:45:17 pm »
Code: Pascal  [Select][+][-]
  1. var
  2.   Count: DWORD;
  3.   W: array[0..MAX_PATH -1] of WideChar;
  4. begin
  5.   Count := GetConsoleTitleW(@W, SizeOf(W));
  6.   W[Count] := #0;
  7.   Writeln(string(W));
  8.   Readln;
  9. end.
Unsafe. If the title length is longer than the buffer "W[Count] := #0" will mess up the program stack.

 

TinyPortal © 2005-2018