Lescasse Consulting
 Home    Company    News    Prices    Download    Buy    Forums   
Read Me
Buy
Forums
Resume
AntiSpam 1.2
wBackup 1.11
NetAccess 2.0
Visual APL 1.0 
APL+Win 8.0 
APL+Win Products 
APL+Win Objects™ 
APL+Win Training 
APL+Web Services
APL+Web Component 
APL+ History
Dyalog.Net Tutorial
Conferences 
Powerpoint
White Papers
Web Hosting
References
Links
 
APL+Win Objects™ 6.0

TADO5
TADO5 Tutorial
TAPLDraw5
TAPLEdit5
TAPLSession5
TAbale5
TAboutBox5
TAccess5
TAgent5
TBlatMail5
TButton5
TCDO5
TCRC5
TCancelButton5
TCheck5
TCheckGroup5
TChildForm5
TChooseColor5
TChooseFont5
TClipBoard5
TClock5
TCodeStats5
TColors5
TCombo5
TComboDrive5
TComboFilter5
TComboList5
TComboTree5
TCommandBar5
TCommandButton5
TControlClass5
TCueCard5
TDHTML5
TDHTMLEditor5
TDateTime5
TDateTimeFr5
TDates5
TDemoHandlers5
TDisplay5
TDOS5
TDualSelect5
TEdit5
TEditAmount5
TEditDir5
TEditEnter5
TEditFile5
TEditGrid5
TEditList5
TEditListview5
TEditMenu5
TEditNum5
TEditSelect5
TEditSpin5
TEmail5
TError5
TExampleForm5
TExcel5
TExcel5 Tutorial
TFindReplace5
TFOne5
TFTP5
TFTP5 Tutorial
TFileCompare5
TFileMenu5
TFileMenuDef5
TFlatButton5
TForm5
TFormClass5
TFormEditor5
TFrame5
TGetDir5
TGif5
TGifForm5
TGifWb5
TGoMenu5
TGraphX5
TGrid5
TGridDisplay5
TGridPrint5
TGUID5
THLine5
THTML5
THTML5 Tutorial
THTTP5
THelp5
THelpMenu5
TImagelist5
TInfo5
TIniFile5
TInstall5
TInternet5
TJpg5
TJpgWb5
TLabel5
TList5
TListview5
TLock5
TLogs5
TMAPI5
TMath5
TMDIForm5
TMSOutlook5
TMaskEdit5
TMedia5
TMenu5
TMessage5
TModalCall5
TMsgBox5
TNavigator5
TNetwork5
TNonVisualClass5
TODBC5
TOKButton5
TObject5
TOpenFile5
TOption5
TOptionGroup5
TOutlook5
TOutlookMail5
TOWCSpread5
TPDF5
TPFKeys5
TPage5
TPassword5
TPicture5
TPing5
TPopupMenu5
TPowerpoint5
TPowerpoint5 Tutorial
TPrinter5
TProgress5
TProgressDlg5
TQuestion5
TRegistry5
TRegistryKey5
TResource5
TRichEdit5
TSPX5
TSQLDMO5
TScheduler5
TScroll5
TSelector5
TSpinner5
TSplitter5
TStatus5
TStopWatch5
TTest5
TTestError5
TTextFile5
TTimer5
TTip5
TTipForm5
TTLI5
TToolBar5
TToolbox5
TToolsMenu5
TTrackbar5
TTranslate5
TTree5
TVLine5
TViewMenu5
TWebBrowser5
TWebServer5
TWebSite5
TWebSiteNet5
TWinMenu5
TWord5
TYesNo5
    Visits:  1723 (22 on line) Last Update: Dec 4, 2003  
    []WCALL    Printer Friendly  


Many APL+Win users have been asking for this for a long while... it's finally here.

Here are 2 examples illustrating how to now pass API structures to Windows calls.  Assume the definitions are the following in the APLW.INI file:


[Call]
CreateFontIndirectArray=H(*LOGFONT_ARRAY) ALIAS CreateFontIndirectA
GetClientRectArray=(HW,>L[4]) ALIAS GetClientRect
[Type]
LOGFONT_ARRAY={L,L,L,L,L,Y,Y,Y,Y,Y,Y,Y,Y,C[LF_FACESIZE]}

 

We use the convention (for the purpose of this example) of appending "array" to the end of function and type names.  So we've created GetClientRectArray as a way to call GetClientRect but with the argument specified using array notation.  The >L[4] means a returned pointer to a four element array of 32-bit integers.  In practice the INI/ADF files are modified to specify things like LOGFONT using array notation but without renaming it as we've done here.

In the LOGFONT_ARRAY type, we've used C[LF_FACESIZE] rather than {C,C,C,...repeated 32 times....,C,C,C}.

Here are some examples executed in APL using these definitions:


      Œwcall 'CreateFontIndirectArray' (20 0 0 0 0 0 0 0 0 0 0 0 0 'Arial')

3620

      Œwcall 'GetClientRectArray' hwnd Ð
10 10 300 600

      Œwcall 'GetClientRectArray' hwnd (0 0 0 0)
10 10 300 600

      Œwcall 'GetClientRectArray' 0 (0 0 0 0 0 0)
ŒWCALL CONVERSION ERROR: LENGTH ERROR
      Œwcall 'GetClientRectArray' 0 (0 0 0 0 0 0)
      ^
 

The last call failed because the array was specified to only hold four elements... six elements is not legal.

Note that in the CreateFontIndirectArray call, we have passed the fontname argument (Arial) as a five element vector.  You might expect that we'd have to pass a 32-element vector here because the structure it maps into specifies a 32-element mapping.  But the new structure argument features now allow you to specify any structure using a smaller number of elements... the omitted elements are mapped into the structure as zeros (0x00 not '0') or as the default value (using =value following the type declaration).  So, if we don't care about the font facename, we could also have called:


      Œwcall 'CreateFontIndirectArray' (20 0 0 0 0 0 0 0 0 0 0 0 0)
or,
      Œwcall 'CreateFontIndirectArray' (20 0)
or,
      Œwcall 'CreateFontIndirectArray' (,20)

but NOT as,

      Œwcall 'CreateFontIndirectArray' 20
 

That last one is a quiz... do you know why it would cause problems???

Here are some rules you'll want to know about array notation:

  1. If you use array notation in an argument list, it must be in combination with a pointer-prefix
    (* or >).  You cannot use inline structures in an argument list.   Array notation does NOT require a pointer prefix when used in a structure.  It is mapped inline without a pointer prefix and by-reference (by pointer) if a prefix is specified.
     
  2. You cannot use multiple levels of array dimensions on a type.  For example, you CANNOT specify C[3][5].
     
  3. Empty or non-finite bounds are not permitted.  So you cannot specify C[] or C[0].  If you want a pointer to an un-bounded array just use pointer notation (* or > prefix) without specifying any array dimension following the type.
     
  4. The value specified inside the array brackets can be any constant you could specify as an argument to the W_Const built-in function.
     
  5. The bracket-enclosed list must immediately follow the type name before any field name, default value, etc.  So you can specify:
        C[10] TenChars
    but not
        C TenChars[10].
     
  6. When you specify a pointer prefix and an array suffix for the same type, you are defining a pointer to an array rather than an array of pointers.  Therefore *C[7] means a pointer to a 7 element character array rather than an array of 7 pointers to characters.
     
  7. An array is NOT always the same as a structure containing the same number of elements.  When the type of element in the array is simple they are equivalent.  That's the case in the LOGFONT_ARRAY example.  The C[LF_FACESIZE] is the same as a structure of 32-C elements.  However, when the type is complex they are not the same at all.  For example, RECT[3] and {RECT,RECT,RECT} both map the same data but they must be specified differently in the APL array used to define them.  In the first case you can specify the three instances of rectangle data as a shape 12 vector, a shape 3 4 matrix, and empty vector, or a shape n m matrix (where n is less than or equal to 3 and m is less than or equal to 4).  In the second case you can specify the data as a 3 item nested array where each item contains a 4 element vector.  But a shape 12 vector, etc would not be accepted as a valid argument. 
 This entire Web site has been dynamically generated by APL+Win Objects™ 6.0
 For all questions contact:  info@lescasse.com
 Copyright © 2003-2005 Lescasse Consulting. All rights reserved.