Advertisement
WarPie90

XLib - GetWindowTitle & SetWindowTitle

Sep 22nd, 2014
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.72 KB | None | 0 0
  1. function GetWindowTitle(handle:TWindow): String;
  2. var
  3.   title: TXTextProperty;
  4. begin
  5.   title.value    := nil;
  6.   title.encoding := XA_STRING;
  7.   title.format   := 8;
  8.   title.nitems   := 0;
  9.                        
  10.   XGetWMName(display, handle, @title);
  11.   if (title.value <> nil) and (title.nitmems <> 0) then
  12.   begin
  13.     SetLength(Result, title.nitems);
  14.     Move(title.value^[0], Result[1], title.nitems);
  15.   end;
  16. end;
  17.  
  18. procedure SetWindowTitle(handle:TWindow; Text:String);
  19. var
  20.   title: TXTextProperty;
  21. begin
  22.   title.value    := PChar(Text);
  23.   title.encoding := XA_STRING;
  24.   title.format   := 8;
  25.   title.nitems   := Length(Text);
  26.                        
  27.   XSetWMName(display, handle, @title);
  28.   XFlush(display);
  29. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement