Can i use windows API in Qt?
If yes, does it will work in all platform which Qt support or only windows?
3 replies
Qt is built on top of native system APIs (Windows SDK, Carbon, Cacao, …). Each of these APIs use their own types of identifiers (HWND, HIViewRef, NSView, …), whereas Qt provides a platform-independent identifier (QWidget*).
If you now want to use platform-specific API you will have to use a platform-specific identifier – this it what QWidget::winId() does. It returns a platform-specific identifier (HWND on Windows, HIViewRef or NSView on Mac OS X, …).
As long as you pass this platform-specific identifier to platform-independent functions like QWidget::find() your application will remain portable. As soon as you pass it to a platform-specific function, for example GetWindowText(), your application is no longer platform-independent as the GetWindowText() function is part of the Windows SDK which is only available on Windows (but not on Mac OS X, …).
You must log in to post a reply. Not a member yet? Register here!

