I am trying to integrate a licensing solution for my software (windows10, Qt MinWG 5.7). The solution asks me to write this line:
result = CallIpEx((PPHWND)GetSafeHwnd(), IP2LIB_FLAGS_NONE, > (LPCSTR)key, (LPCSTR)path, NULL, NULL, NULL, 0, 0, 0);
However, I have this error message:
C:\softwaredev9\main.cpp:51: error: 'GetSafeHwnd' was not declared in this scope result = CallIpEx((PPHWND)GetSafeHwnd(), IP2LIB_FLAGS_NONE, (LPCSTR)key, (LPCSTR)path, NULL, NULL, NULL, 0, 0, 0);
I contacted the licensing software support and here is what they told me. The example they provide is for a MFC example with Visual Studio.
"This is likely because you're not using MFC, so GetSafeHwnd is not available. Qt may have an equivalent you can use in its place so that the licensing dialogs are shown as modal dialogs that must be dismissed before one of your dialogs can be accessed. Alternatively, you can call the CallIpEx function before displaying any of your own dialogs, which allows you to pass NULL for this first argument."
I am not sure to understand what to do in Qt to make this work.
Thank you very much !
returns a HWND
You might just need
HWND hWnd = (HWND)this->winId();
result = CallIpEx((PPHWND)hWnd , xxxx
"This" should be a real window. In QMainwindow, it should work for a modal dialog.
There can be issues as Qt not always use native controls and hence there is no HWND to get.
What support say is that you can call it with NULL for HWND if you do it in main before any GUI is shown
result = CallIpEx((PPHWND)nullptr, IP2LIB_FLAGS_NONE, > (LPCSTR)key, (LPCSTR)path, NULL, NULL, NULL, 0, 0, 0);