Home > Software engineering >  Is there an existing COM interface for simple window operations?
Is there an existing COM interface for simple window operations?

Time:04-04

I was wondering if there is any existing, predefined COM interface representing a window, with simple methods like MoveWindow(LPRECT prc), ShowWindow(INT nCmdShow), DestroyWindow(), etc.

I was looking at the IOleWindow-derived interfaces, for example, but they don't appear to offer stuff like that.

I understand it would be easy to define my own, but I didn't want to reinvent the wheel if something already exists. Thanks for any input.

CodePudding user response:

The closest I can think of would be UIA's IWindowProvider and ITransformProvider/ITransformProvider2, but UIA provider interfaces are not meant to be used directly by clients.

If you are doing something like creating a scriptible program you will likely be stuck creating and implementing a custom interface. I bring up this point because without a client of some kind going the COM interface route is a bit silly.

CodePudding user response:

You'd need to use raw Windows API functions on top of the IOleWindow interface. For example, the MoveWindow function changes the position and dimensions of the specified window. The ShowWindow function sets the specified window's show state.

  • Related