* Windows Findwindowa, GetSystemMenu and RemoveMenu Sample Code; * Richard A. Devenezia; * http://www.devenezia.com; ** 6/9/01 * Disable the menu item 'close' (and x icon) of A SAS session; *;
FileName Sascbtbl Catalog 'Work.winaPi.Noxicon.Source';
Data _null_;
File sascbtbl;
INPUT; PUT _INFILE_; Cards4;
routine FindWindowA module = user32 minarg = 2 maxarg = 2 stackpop = called returns = ulong; arg 1 char input byaddr format = $ cstr200 .; * LPCTSTR lpClassName; arg 2 char input byaddr format = $ cstr200 .; * LPCTSTR lpWindowName;
ROUTINE GetSystemMenu module = user32 minarg = 2 maxarg = 2 stackpop = called returns = long; arg 1 num input byvalue format = ib4 .; * HWND hwnd; arg 2 num input byvalue format = ib4 .; * BOOL bRevert;
ROUTINE RemoveMenu module = user32 minarg = 3 maxarg = 3 stackpop = called returns = long; arg 1 num input byvalue format = pib4 .; * HMENU hMenu; arg 2 num input byvalue format = ib4 .; * UINT uPosition; arg 3 num input BYVALUE FORMAT = IB4 .; * uint uflags ;;;;;
Data _null_; WinClass = 'SAS AWS'; Wintitle = 'SAS'; HWNDSAS = Modulen ('FindWindowa', Winclass, Wintitle); HMenusas = Modulen ('getSystemMenu', HWndsas, 0);
* Assumethard Window Menu, * (That Drop Down Menu Shown When Upper LEFT ICON CLICKED OR * WHEN ICON in Task Bar Right Clicked) * Is Restore: MAXIMIZE: SIXIMIZE: MAXIMIZE: SEPARATOR: Close *;
MF_BYPOS = 0400X;
Rc = modulen ('RemoveMenu', HMenusas, 6, Mf_BYPOS); * Remove Close; RC = Modulen ('RemoveMenu', HMenusas, 5, MF_BYPOS); * Remove Separator; Run;