WinId issue with Qt?



  • Hello,

    I've a QMainWindow.

    For certain reasons, mostly to do with registration of messages to another application, I need to register with the winID, of this QMainWindow.

    Now when I call this function, let's say..

    @
    RegisterMultipleMmiPgm (_T("P14CondView"), mainWin->winId() , MMIOPT_ALLOW_MULTIPLE_INST);
    @

    Here, when I see the properties of mainWin ( which is derived from QMainWindow), I see the WinId, as some negative number and it says it is unused...

    Is that usual? Because I'm not getting the expected behaviour with this, and the application seemingly fails to register with the external application.

    Could anyone tell me whether this is expected, i.e. whether winId should be a negative number and marked "unused" in VS2010.

    Thanks...


  • Moderators

    On Windows winId() is actually a HWND, which is defined as void*, and since there's no such thing as a negative address, probably for some reason you're interpreting it as a signed type, which it is not.

    As to why it doesn't work - I don't know but what is the expected parameter type of the RegisterMultipleMmiPgm? If it's something like 'int' then it's probably it - it's doing a cast from a pointer to a signed integer.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.