Pages: 1
  Print  
Author Topic: Disable Right click on target HWND  (Read 3080 times)
Offline (Male) time-killer-games
Posted on: January 08, 2015, 10:19:38 pm

Contributor
Location: Virginia Beach
Joined: Jan 2013
Posts: 1178

View Profile Email
I'm creating a partially open source flash extension for the GM marketplace which also works in ENIGMA. I would release the entire source but it relies on embedding a third party flash player. The problem is since I'm embedding it as a child window (which I NEED to do) the right click menu will open windows that can't be closed and can cause the app to crash in a variety of ways requiring the task manager to close everything right.

I need a function like this that is short simple and to the point, easy to impliment from a snippet:
Code: [Select]
DLL double disable_right_click_on_hwnd(HWND target_hwnd)
{
/*
your shit here...
*/
return 0;
}

Thanks.
Logged
Offline (Male) Goombert
Reply #1 Posted on: January 09, 2015, 02:23:09 am

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
Is that the same problem in GM or is just doing that in ENIGMA? The first thing you need to do is find out how the context menu is being shown before you can try to disable it. If you didn't add it, it's probably being shown on a WM_CONTEXT or WM_POPUP or mouse event, in which case you want to block those window messages from delegating to the child windows.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Male) time-killer-games
Reply #2 Posted on: January 09, 2015, 03:26:31 pm

Contributor
Location: Virginia Beach
Joined: Jan 2013
Posts: 1178

View Profile Email
It does this in gms and enigma. The game engine isnt the problem as trying this in a pure C++ in MinGW and visual studio will also do this afaik. Ive looked everywhere on google and just thought to ask here in case if that makes things easier.

I'll send you the source if you want, if that helps.
Logged
Offline (Male) time-killer-games
Reply #3 Posted on: January 11, 2015, 12:05:16 am

Contributor
Location: Virginia Beach
Joined: Jan 2013
Posts: 1178

View Profile Email
Yo everyone I gave robert my source and if you'd like to try and help as well let me know so I can PM you the zip. :D
Logged
Offline (Male) Goombert
Reply #4 Posted on: January 11, 2015, 10:18:59 am

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
After running it in ENIGMA I see how it behaves and works. Your source code for this isn't really important at all, what's important is that you mention specifically what flash embedding extension this is because it likely has a way of disabling the popup. The second is that you shouldn't really worry about this, these settings are meant to be there for a reason, just shut down your flash extension and close it on game_end, I don't see what's wrong with that? Otherwise you need to find out if the extension lets you disable the context menu or else find a way to hack around that which may not go well because that context menu is likely built into the flash player.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Male) time-killer-games
Reply #5 Posted on: January 11, 2015, 05:44:48 pm

Contributor
Location: Virginia Beach
Joined: Jan 2013
Posts: 1178

View Profile Email
It cant be disabled by the player itself that I can tell. It uses "Trong Player 11" and the website is www.trong.tk but there's no info there or anywhere else on the web I can find that shows how to do something like that.

I could probably destroy the menu and free it from memory whenever its attempting to be created, but DestroyMenu() appears to only work with menus attached to menubars at the top of the client area, and this isnt that kind of menu, its a popup.

The problem is I can find the "Window Class Name" of the right click popup menu via GetClass.exe, but how do I use that to get the menus handle to destroy it? It isnt a window, and the only way to get a menu handle is by GetMenu() which uses the parent window's hwnd, which as I said only works with the menubar items at the top of the client.

Argh
« Last Edit: January 11, 2015, 05:47:25 pm by time-killer-games » Logged
Offline (Male) Goombert
Reply #6 Posted on: January 12, 2015, 06:47:17 am

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
TKG, usually the player just has an easy way of letting you disable it. The following question was asked about a VB.NET SWF player.
http://www.codeproject.com/Questions/839571/How-to-disable-Adobe-Flash-Player-context-menu-in

Basically if the API don't offer you'll have to offer some very ugly hacking, which I could pull off if I was dedicated to but I suggest you just find another API, or is that not feasible?

Quote from: TKG
The problem is I can find the "Window Class Name" of the right click popup menu via GetClass.exe, but how do I use that to get the menus handle to destroy it? It isnt a window, and the only way to get a menu handle is by GetMenu() which uses the parent window's hwnd, which as I said only works with the menubar items at the top of the client.
That's because the menu itself might not be a native context, it could in fact be entirely written in Flash just like Java Popups are really JMenu's or ContextMenu's.
« Last Edit: January 12, 2015, 06:49:07 am by Robert B Colton » Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Pages: 1
  Print