We have a Notes application that uses the notes C API to access the windows user32.dll file to create slick GUI popup menus. This application has worked in 6.x and 7.x Notes platforms. It also works on the 8.x BASIC configuration of Notes.
When we try the application in Notes 8.x eclipse platform, the popup menus do not work. (We’ve tried 8.0.2 and 8.5.1).
Is there a work around for this, or quick fix, instead of recoding our application to work on the Notes 8.x eclipse platform? What happened to backward compatability, Lotus? A resolution should be addressed and incorporated into the next fix release of Notes - PlEASE!
Subject: There could be workaround, but not easy one
If RCP/Eclipse Lotus Notes environment by some reason blocks those user32.dll calls - the only way I think that could be workarounded is to write C-Java bridge, which would actually emulate then your needed popups by calling corresponding RCP Java code, leaving your code unmodified.
While we’ve done our own Lotus Java agents-Lotus Notes plugins bridge (not yet provided by IBM for Notes 8.5.1) for one of our tools (announced this week ToolbarPlus Eclipse) - I think difficulty of this C-Java bridge implementation would be almost the same.
If your demand for this popups functionality is huge and you can’t wait for IBM to workaround/fix that - probably we could help you then. In that case you could email me with more details at a.chaliapinas@infosana.com
Subject: The usage of those calls made assumptions about processes and window parentage that are no longer the case with the Notes 8.x Standard Client.
In investigating the referenced SPR we had found that the usage of those APIs did not supply the expected hWnd (to the Windows API), and as such, the API did not work.
In the documentation, the hWnd is specified as needing to be from the application. Strictly speaking, this means that the hWnd needs to be from the same process (NLNOTES.EXE), and GetActiveWindow will obtain an hWnd from the Notes2.EXE process.
GetActiveWindow from user32.dll This is the problem. In Notes 8 Standard, this will get the top-level window in the Notes2 process. GetFocus should be used instead and supplied to TrackPopupMenuEx
TrackPopupMenuEx from user32.dll This API will fail when the window supplied is from a different process than NLNOTES.EXE By supplying GetActiveWindow to this API, the Windows API call will fail
Subject: Doug: Made changes… still not working, 512 error
Hi Doug -
I recoded these calls to use TrackPopupMenuEx with appropriate parameters (instead of TrackPopupMenu), and I passed it the GetFocus() function (instead of GetActiveWIndow()) for the window handle/pointer. Still no popup menus.
After this call I call GetMessage() w/a MSG structure passed. The return value of GetMessage() is 0 (indicating an error)… and when I retrieve the message value of the MSG structure, it is 512. I can’t find anywhere on MSDN that identifies what 512 means…
Am I trying to make a square peg fit into round hole… am I even on the right track? Or is this a hopeless cause and it’s a total bug that needs resolution by Lotus/IBM. Any help you can provide is appreciated. Thanks!
Thanks Doug for pointing me in the right direction! After lots of testing/recoding I made some changes that work in both 8.5 versions of Notes (eclipse and basic config.)
I replaced the GetActiveWindow calls with GetFocus, and that resolves it!
I tried using TrackPopupMenuEx (instead of TrackPopupMenu) but couldn’t get it to work… but ended up it wasn’t needed.
Sorry - I wasn’t watching this post anymore but I just checked in. Glad you got it resolved. I’m assuming this post will resolve the issue for LOTS of folks as this 3rd party software has been a popular one…