The title is partially static with an variable suffix. For example \"Window Title {- user_id}\".
How can I get the handle without knowing the exact title?
Get by class name and parent window handle. For example: get start button handle using win32api. First you know parent window class name using spyxx tool.
[DllImport("user32.dll")]
public static extern IntPtr FindWindowEx(IntPtr handleParent, IntPtr handleChild, string className, string WindowName);
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string className, string windowTitle);
Usage:
IntPtr handle = FindWindowEx(FindWindow("Shell_TrayWnd",null), new IntPtr(0), "Button", null);