I begin with xlib and I would like to know if it is possible with xlib in C to "catch" a window with its PID for be able to move the window, resize it...?
For example ask my program the width and height of firefox's window. I do not know if my question is clearer.
Thank you
I guess you mean the process-id of the (Linux or POSIX) client owning the window.
But your question has no real sense: the X client could be on some operating system without process-ids, or it could be running on a remote machine (different of the one running the X11 server), e.g. with ssh -X
(and then you cannot do much with that pid). Be sure to understand more about the X Window System (and the roles of client, server, window manager).
However, you could study (with pain and care) X11 Window protocols and architecture (include X11 core protocol), the EWMH specifications (and also ICCCM). Look into _NET_WM_PID
& XGetWMClientMachine
(Xlib & all the X protocols are really complex; you would need to read thousands of pages to understand all of them; in 2017 that effort might be obsolete, e.g. because of Wayland; it is preferable to use some higher-level toolkit like Qt or GTK).
If you want to write some X window manager (they are complex beasts, because conventions related to X have become very complex), consider studying the source code of some existing one and adapt it to your needs....