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

来源:互联网 发布:音频压缩算法公式 编辑:程序博客网 时间:2024/04/29 12:00

 

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

原创粉丝点击