Recent

Author Topic: Window sendmessage howto ?  (Read 3037 times)

vfiuchcikicshuusrch

  • Newbie
  • Posts: 1
    • Sugar Electronics
Window sendmessage howto ?
« on: July 30, 2016, 06:39:36 pm »
Hi. Sorry for my english.

Windows has GetNextWindow, GetClassName etc.. methods.

I found xlib methods, like XQueryTree, XGetClassHint etc..
but XGetClassHint return string like XFetchName or empty.

so..
I need to get THandle of my window and SenMessage to it.

please help me how to do it ?

this is my trying code..
but wrong windows count... don't know why...

Code: Pascal  [Select][+][-]
  1. uses
  2. .... xlib, x, xutil;
  3. ....
  4. procedure TForm1.Button1Click(Sender: TObject);
  5. var
  6.   dpy: PDisplay;
  7.   rootw: TWindow;
  8.   myw: TWindow;
  9.   parentw: TWindow;
  10.   childw: PWindow;
  11.   windowattr: TXWindowAttributes;
  12.   n, c: PChar;
  13.   wname, cname: string;
  14.   nwindows: integer;
  15.   i, j: integer;
  16. begin
  17.   Memo1.Clear;
  18.   dpy := XOpenDisplay(nil);
  19.   rootw := RootWindow(dpy, DefaultScreen(dpy));
  20.   XQueryTree(dpy, rootw, @myw, @parentw, @childw, @nwindows);
  21.  
  22.   for i := 0 to nwindows - 1 do
  23.   begin
  24.     if XGetWindowAttributes(dpy, childw[i], @windowattr) <> 1 then
  25.       continue;
  26.     if windowattr.override_redirect = 1 then
  27.       continue;
  28.  
  29.     if XFetchName(dpy, childw[i], @n) = 1 then
  30.       wname := n
  31.     else wname := 'n/a';
  32.     if XGetClassHint(dpy, childw[i], @c) = 1 then
  33.       cname := c
  34.     else cname := 'n/a';
  35.  
  36.     Memo1.Lines.Add(inttostr(i) + ' Name: ' + wname + ' Class: ' + cname);
  37.   end;
  38.   XFree(childw);
  39.   XCloseDisplay(dpy);
  40. end;
  41.  
« Last Edit: July 30, 2016, 06:50:03 pm by vfiuchcikicshuusrch »

 

TinyPortal © 2005-2018