user32

Need to activate a window

左心房为你撑大大i 提交于 2019-11-26 21:04:59
问题 I have a situation like this. I have the window handle of an application. I need to activate it. I tried all these functions but is not working always.(most of the time , it doesn't work the first time and I'll have to manually click on it to activate it. Second attempt onwards it works fine) The reason why I am doing this is because I have code written in the Form.Activate event of the form which I need to execute. Application is a single instance application. When a new instance is created

Using SetWindowPos with multiple monitors

▼魔方 西西 提交于 2019-11-26 01:54:39
问题 Using user32.dll and C# I wrote the method that you see below. Using a process handle for a window, it will set the window position at a provided {x,y} location. However, in a multi-monitored environment the code below sets the window position to the primary monitor, only. I would like to be able to select which monitor, too. Can someone please explain how this can be accomplished using SetWindowPos or perhaps a combination with another user32.dll function? [DllImport(\"user32.dll\",