Mlad3n
Mlad3n

Reputation: 143

TrackPopupMenu - Issue with displaying popup

I am struggling with this for some time now and cannot find working solution.

This is desktop application and when it was build and used as 32bit app, everything worked fine. When we switched it to 64bit app (Any CPU), this contextMenu just stopped working. Here is definition of method:

    [DllImport("user32.dll",SetLastError = true, EntryPoint = "TrackPopupMenu", CharSet = CharSet.Ansi)]
    public static extern bool TrackPopupMenu(uint Param1, uint Param2, int Param3, int Param4, int Param5, IntPtr Param6, ushort Param7);

When this method is called from code, return value is 0 which indicates that there was some error, and with GetLastError method i get following one:

ERROR_INVALID_WINDOW_HANDLE 1400 (0x578) Invalid window handle.

I also tried to fix this with SetForegroundWindow, but didn't work. Also, i googled about this and found some examples, but couldn't make this work. I keep getting same error. Also tried with TrackPopupMenuEx, and same thing...

Any ideas why this is not working on 64bit build?

Upvotes: 1

Views: 63

Answers (0)

Related Questions