All YOUR Questions Answered at
[sas.answers @ Holland Numerics]
WebRing
Sponsored Links for SAS Software Users
Careers, Jobs and Contracts, Services and Products

Frequently Asked Questions about SAS Software

The following Question & Answer List is based on SAS questions received by the author.

Using Win95 DLLs with SAS Software

Question Answer
How can I make a Windows-style message box, with OK and Cancel buttons, from SAS Software? This code has been tested under Win95 only!
First create a flat file, e.g. C:\WINAPI.TXT, to store the following lines of code:
routine MessageBoxA
   module=USER32
   returns=SHORT
   stackpop=CALLED
   minarg=4
   maxarg=4
   ;
arg 1 input format=pib4. byvalue;
arg 2 input format=$cstr200.;
arg 3 input format=$cstr200.;
arg 4 input format=pib4. byvalue;

This flat file needs to be given a fileref of SASCBTBL, and the message box is created using the MessageBox function:

filename sascbtbl 'c:\winapi.txt';
 
data _null_;
  length rc hWnd style 8 text caption $200;
  hWnd=0;
  text='Text';
  caption='Caption';
  style=(0*4096)+(0*256)+(2*16)+(1*1);
    * 0021 = Question mark icon + OK/Cancel *;
  rc=modulen('*e','MessageBoxA',hWnd,text,caption,style);
  if (rc=0) then put 'ERROR: Cannot create message box';
  put rc=;
run;

The button style values are:
OK=0, OK/Cancel=1, Abort/Retry/Ignore=2, Yes/No/Cancel=3, Yes/No=4, Retry/Cancel=5
The icon style values are:
Stop sign=10, Question mark=20, Exclamation mark=30, Information sign=40
The possible return values are:
Error state=0, OK=1, Cancel=2, Abort=3, Retry=4, Ignore=5, Yes=6, No=7

How can I find out the version of Windows 95 being used from SAS Software? This code has been tested under Win95 only!
First create a flat file, e.g. C:\WINAPI.TXT, to store the following lines of code:
routine GetVersion
   module=KERNEL32
   returns=ULONG
   stackpop=CALLED
   minarg=0
   maxarg=0
   ;

This flat file needs to be given a fileref of SASCBTBL, and the message box is created using the GetVersion function:

filename sascbtbl 'c:\winapi.txt';
 
data _null_;
  length temp 8 winver $5;
  rc=modulen('*e','GetVersion');
  temp=rc;
  winver='  .  ';
  substr(winver,1,2)=put(mod(temp,256),2.);
  temp=int(temp/256);
  substr(winver,4,2)=put(mod(temp,256),z2.);
  put winver=;
run;

     Back to Main FAQ Menu
Number of visitors = Counter (since 15th May 2000)

Email: Phil Holland <phil.holland@bcs.org.uk>

Web Design by Holland Numerics

Valid HTML 4.01!