🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #1553

Re: Accelerator question for the wizards...

#1553
From: Paul Bonneau
Date: Wed, 06 Mar 1991 16:32
39 lines
1653 bytes
In article <1991Mar5.044334.26714@world.std.com> goodearl@world.std.com (Robert Goodearl) writes:
>The answer I got when I queried Online about this was "no".

Even though there is no "official" support for this,
emulating TranslateAccelerator() should not be difficult.
If you maintain in internal table, such as:

tytpedef struct
	{
	WORD	idm;	/* Menu-item id. */
	int	ch;	/* Accelerator character. */
	WORD	fkey;	/* Modifier keys (ie. control).
	} MAT;		/* My Accelerator Table entry. */

MAT	rgmat[MAXIMUM_MY_ACCELERATORS];

#define pmatNull	((MAT *)0)

Then you can write a routine such as:

BOOL FAR *
MyTranslateAcceletor(LPMSG lpmsg)
	{
	MAT *	pmat;

	/* Look up message in table. */
	if ((pmat = PmatInRgmat(lpmsg)) != pmatNull)
		{
		SendMessage(hwndTopLevel, WM_COMMAND, pmat->idm, 0L);
		return 1;
		}
	return 0;
	}

Then just call the routine in a loop.  Shouldn't be too hard
to maintain, and it has the added benefit of not "flashing" the top
level menu item while accelerating.

cheers - Paul Bonneau.
Technical Details
Message-ID: <1991Mar6.163244.21116@hyper.hyper.com>
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!caen!news.cs.indiana.edu!maytag!watmath!hyper.hyper.com!bonneau
References: <1991Mar4.064101.26122@isis.cs.du.edu> <1991Mar4.081221.3709@cec1.wustl.edu> <1991Mar5.044334.26714@world.std.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!caen!news.cs.indiana.edu!maytag!watmath!hyper.hyper.com!bonneau
From: bonneau@hyper.hyper.com (Paul Bonneau)
Newsgroups: comp.windows.ms.programmer
Subject: Re: Accelerator question for the wizards...
Message-ID: <1991Mar6.163244.21116@hyper.hyper.com>
Date: 6 Mar 91 16:32:44 GMT
References: <1991Mar4.064101.26122@isis.cs.du.edu> <1991Mar4.081221.3709@cec1.wustl.edu> <1991Mar5.044334.26714@world.std.com>
Reply-To: bonneau@hyper.UUCP (Paul Bonneau,,)
Organization: HyperCube Inc.
Lines: 39