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...
uses
.... xlib, x, xutil;
....
procedure TForm1.Button1Click(Sender: TObject);
var
dpy: PDisplay;
rootw: TWindow;
myw: TWindow;
parentw: TWindow;
childw: PWindow;
windowattr: TXWindowAttributes;
n, c: PChar;
wname, cname: string;
nwindows: integer;
i, j: integer;
begin
Memo1.Clear;
dpy := XOpenDisplay(nil);
rootw := RootWindow(dpy, DefaultScreen(dpy));
XQueryTree(dpy, rootw, @myw, @parentw, @childw, @nwindows);
for i := 0 to nwindows - 1 do
begin
if XGetWindowAttributes(dpy, childw[i], @windowattr) <> 1 then
continue;
if windowattr.override_redirect = 1 then
continue;
if XFetchName(dpy, childw[i], @n) = 1 then
wname := n
else wname := 'n/a';
if XGetClassHint(dpy, childw[i], @c) = 1 then
cname := c
else cname := 'n/a';
Memo1.Lines.Add(inttostr(i) + ' Name: ' + wname + ' Class: ' + cname);
end;
XFree(childw);
XCloseDisplay(dpy);
end;