SAS DATE STEP中调用WIN API例子(转载)

博客给出了Windows FindWindowA、GetSystemMenu和RemoveMenu的示例代码,用于禁用SAS会话的“关闭”菜单项及X图标。代码通过调用user32模块中的相关例程,获取窗口句柄和菜单句柄,进而移除关闭菜单和分隔符。

 

* 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);

  * assume the standard window menu,
  * (that drop down menu shown when upper left icon clicked or
  *  when icon in task bar right clicked)
  * is Restore:Move:Size:Minimize: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;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值