Jump to content


Disabling standard Windows menu items in an application


  • Please log in to reply
4 replies to this topic

#1 GJan

GJan
  • Guests

Posted 22 July 2012 - 03:55 PM

I like to disable some menu items in an application. Unfortunately these items (names/id's etc.) cannot be found with Window Spy.
I also have tried to find specific messages/parameters with Winspector to 'catch' them with OnMessage(). It seems not to work, but in this I am not an expert.

How can this be done?

GJan

#2 Pulover

Pulover
  • Members
  • 1240 posts

Posted 23 July 2012 - 06:14 PM

I found this thread: <!-- l --><a class="postlink-local" href="http://www.autohotkey.com/community/viewtopic.php?t=60315">viewtopic.php?t=60315</a><!-- l -->
Couldn't get the guest' script to work here though... maybe you'll have more luck.

#3 OnlyHuman

OnlyHuman
  • Members
  • 280 posts

Posted 23 July 2012 - 06:22 PM

If you don't mind, please post a screenshot of the application and menus. Also what is the name of the app? If it's downloadable (Trial, free, etc.) I'll give it a try :)

#4 Guests

  • Guests

Posted 24 July 2012 - 01:59 PM

Thanks guys for your reply. First I will look at the thread posted by Pulover. Looks pretty interesting.

Onlyhuman:
This is the downloadlink: <!-- m -->http://www.basissoft...t.aspx?tabid=36<!-- m --> (button "Klik hier voor een DEMO Versie van LEDENBasis")
It is a Dutch program/website but not too difficult to understand I think.

Background
What I like to find out: is it possible to disable all the features which can cause alteration to the database? In other words: I like to make a 'read only version' for my collegues who are only allowed to check the database.

This far I managed to disable most of the fields, buttons and frames. Had to be done in a Timer-loop, because clicking on differing tabs causes re-enabling some fields.
Maybe it is not the most brilliant solution, but is works fine. But any suggestions are welcome.

It was impossible for me to handle the menuitems likewise because I couldn't discover any 'handles'.

Again, thanks and have a good try.
GJan

#5 OnlyHuman

OnlyHuman
  • Members
  • 280 posts

Posted 03 August 2012 - 02:08 AM

Here is a work-around I've used before. Basically the script loops checking if the program window is active, then it check to see if the mouse is near a menu item, if yes the script moves the mouse to the center of the users screen. The user can click anything BUT the menu items. I'm sure there's a better way but this will work :-).

#Persistent
#SingleInstance force
DetectHiddenText, On
DetectHiddenWindows, On
SetTitleMatchMode, 2
SendMode Input

Loop
{
	IfWinActive, ahk_class ThunderRT6MDIForm  ; check if active
	{
		MouseGetPos, X, Y  ; get mouse coords
                [color=#00BF40]; below checks if the mouse is on any menu item X, Y range[/color]
		if (X >= 4) AND (X <= 409) AND (Y >= 20) AND (Y <= 44)
		{
			Xpos := A_ScreenWidth/2  ; basically center screen position
			Ypos := A_ScreenHeight/2
			MouseMove, Xpos, Ypos, 0
		}
	}
}
return