Exportfile for AOT version 1.0 or later
Formatversion: 1

***Element: FRM

; Microsoft Business Solutions-Axapta Forms unloaded at Friday 01/12/2006
; --------------------------------------------------------------------------------
FRMVERSION 5

FORM #SDB_DLL_Call_Example
  PROPERTIES
    Name                #SDB_DLL_Call_Example
  ENDPROPERTIES
  
  METHODS
    Version: 3
    SOURCE #classDeclaration
      #public class FormRun extends ObjectRun
      #{
      #    // DLL file handles
      #    DLL shellDLL;   // shell32.dll
      #    DLL userDLL;    // user32.dll
      #
      #    // Function call handles
      #    DLLFunction extractAssociatedIconFunc;
      #    DLLFunction destroyIconFunc;
      #    DLLFunction drawIconFunc;
      #
      #    // Our icon handle, for the attachment
      #    int hIcon;
      #
      #    // These are from the windows headers
      #    #define.DI_MASK(0x01)
      #    #define.DI_IMAGE(0x02)
      #    #define.DI_COMPAT(0x04)
      #}
    ENDSOURCE
    SOURCE #changeFile
      #public void changeFile(Filename filename)
      #{
      #    Binary binary;
      #    ;
      #
      #    //  If we already have an icon handle, destroy it
      #    if (hIcon) {
      #        destroyIconFunc.call(hIcon);
      #    }
      #
      #    /* We need to build a binary item for two bytes (a short), since windows
      #     * has an "in/out" pointer for the icon information. Axapta will handle
      #     * this as a pointer internally. Think of Binary:: as a malloc()/free()
      #     * wrapper for raw bytes. You can use this to create or break down
      #     * structures too.
      #     */
      #    binary = new Binary(2); // 2 bytes = short
      #
      #    // Call the ExtractAssociatedIcon() function
      #    hIcon = extractAssociatedIconFunc.call(NULL,
      #                                           filename,
      #                                           binary);
      #
      #    // Make sure we got an icon (we should, if the file exists)
      #    if (!hIcon) {
      #        throw error("Unable to get hIcon");
      #    }
      #
      #    // Do the initial drawing of the icon
      #    this.drawIcon();
      #}
    ENDSOURCE
    SOURCE #close
      #public void close()
      #{
      #    ;
      #
      #    // If we have an icon handle, we need to clean up
      #    if (hIcon) {
      #        destroyIconFunc.call(hIcon);
      #    }
      #
      #    // Close the form
      #    super();
      #}
    ENDSOURCE
    SOURCE #drawIcon
      #public void drawIcon()
      #{
      #    ;
      #
      #    // Lock the device context of the window so we can use it
      #    Icon.lockDC();
      #
      #    // Paint the icon (we'll use the window size to determine the icon size)
      #    drawIconFunc.call(Icon.hDC(), 0, 0, hIcon,
      #                      Icon.widthValue(),
      #                      Icon.heightValue(),
      #                      0, NULL,
      #                      (#DI_IMAGE | #DI_MASK | #DI_COMPAT));
      #
      #    // Unlock the device context of the window
      #    Icon.unlockDC();
      #}
    ENDSOURCE
    SOURCE #fileNameLookupFilename
      #str fileNameLookupFilename()
      #{
      #    ;
      #
      #    return "";
      #}
    ENDSOURCE
    SOURCE #fileNameLookupFilter
      ##File
      #container fileNameLookupFilter()
      #{
      #    ;
      #
      #    return ["@SYS27373", #AllFiles];
      #}
    ENDSOURCE
    SOURCE #fileNameLookupInitialPath
      #str fileNameLookupInitialPath()
      #{
      #    ;
      #
      #    return "";
      #}
    ENDSOURCE
    SOURCE #fileNameLookupTitle
      #str fileNameLookupTitle()
      #{
      #    return "@SYS54807";
      #}
    ENDSOURCE
    SOURCE #init
      #public void init()
      #{
      #    ;
      #
      #    // Initialise the form first
      #    super();
      #
      #    // Create our handles to the DLL files we need
      #    shellDLL = new DLL("shell32.dll");
      #    userDLL = new DLL("user32.dll");
      #
      #    // Set up our call for ExtractAssociatedIcon()
      #    extractAssociatedIconFunc =
      #        new DLLFunction(shellDLL, "ExtractAssociatedIconA");
      #    extractAssociatedIconFunc.returns(ExtTypes::DWord); // HICON
      #    extractAssociatedIconFunc.arg(ExtTypes::DWord,      // HINSTANCE hInst
      #                                  ExtTypes::String,     // LPTSTR lpIconPath
      #                                  ExtTypes::Pointer);   // LPWORD lpiIcon
      #
      #    // We also need a function to destroy the icon handle once we've used it
      #    destroyIconFunc = new DLLFunction(userDLL, "DestroyIcon");
      #    destroyIconFunc.returns(ExtTypes::DWord);           // BOOL
      #    destroyIconFunc.arg(ExtTypes::DWord);               // HICON hIcon
      #
      #    // This is our call for drawing the icon onto a window
      #    drawIconFunc = new DLLFunction(userDLL, "DrawIconEx");
      #    drawIconFunc.returns(ExtTypes::DWord);  // BOOL
      #    drawIconFunc.arg(ExtTypes::DWord,       // HDC hDC
      #                     ExtTypes::DWord,       // int xLeft
      #                     ExtTypes::DWord,       // int yTop
      #                     ExtTypes::DWord,       // HICON hIcon
      #                     ExtTypes::DWord,       // int cxWidth
      #                     ExtTypes::DWord,       // int cyWidth
      #                     ExtTypes::DWord,       // uint istepIfAniCur
      #                     ExtTypes::DWord,       // HBRUSH hbrFlickerFreeDraw
      #                     ExtTypes::DWord);      // UINT diFlags
      #}
    ENDSOURCE
  ENDMETHODS
  OBJECTBANK
  ENDOBJECTBANK
  
  JOINS
  ENDJOINS
  
  DESIGN
    PROPERTIES
      Left                #Auto (left)
      Top                 #Auto
      Width               #Auto
      Height              #Auto
      Visible             #Yes
      Caption             #DLL call example
      TitleDatasource     #
      Frame               #Standard
      WindowResize        #Auto
      WindowType          #Standard
      SaveSize            #No
      AlwaysOnTop         #No
      HideToolbar         #No
      SetCompany          #Yes
      ColorScheme         #Default
      CssClass            #
      ShowWebHelp         #Default
      BackgroundColor     #Button face (3D)
      ImageName           #
      ImageResource       #0
      Imagemode           #Normal (preserve pict. attributes)
      Mode                #Watch
      SubmitMethod        #Auto
      SupportReload       #No
      LocalWebMenu        #
      AllowDocking        #No
      Font                #
      FontSize            #0
      Italic              #No
      Underline           #No
      Bold                #Default
      CharacterSet        #0
      LabelFont           #
      LabelFontSize       #0
      LabelItalic         #No
      LabelUnderline      #No
      LabelBold           #Default
      LabelCharacterSet   #0
      DataSource          #
      TopMargin           #Auto
      BottomMargin        #Auto
      LeftMargin          #Auto
      RightMargin         #Auto
      ArrangeWhen         #Default
      ArrangeMethod       #Vertical
      Columns             #2
      Columnspace         #Auto
      ArrangeGuide        
        ARRAY INDEX Columns 
          #0
          #0
        ENDARRAY
      HideIfEmpty         #Yes
      AlignChildren       #Yes
      AlignChild          #Yes
      AllowUserSetup      #Yes
      NeededAccessLevel   #NoAccess
    ENDPROPERTIES
    
    CONTAINER
      CONTROL WINDOW
        ;==== controlId:12289, containerId: 0, containerdata: 0   
        ;----------------------------------------------------------
        PROPERTIES
          Name                #Icon
          AutoDeclaration     #Yes
          Visible             #Yes
          AllowEdit           #Yes
          Left                #Auto (left)
          Top                 #Auto
          Width               #32
          Height              #32
          VerticalSpacing     #Auto
          Enabled             #Yes
          Skip                #No
          AlignControl        #Yes
          HelpText            #
          ConfigurationKey    #
          SecurityKey         #
          DragDrop            #None
          ImageName           #
          ImageResource       #0
          Imagemode           #Normal (preserve pict. attributes)
          ColorScheme         #Default
          BackStyle           #Opaque
          BackgroundColor     #Menu background
          ForegroundColor     #Window text
          LabelForegroundColor #Window text
          ShowLabel           #No
          Label               #
          LabelFont           #
          LabelFontSize       #0
          LabelItalic         #No
          LabelUnderline      #No
          LabelBold           #Default
          LabelCharacterSet   #0
          LabelWidth          #Auto
          LabelHeight         #Auto
          LabelPosition       #Left
          LabelAlignment      #Right
          DataSource          #
          DataField           #
          DataMethod          #
        ENDPROPERTIES
        
        METHODS
          Version: 3
          SOURCE #paint
            #public int paint()
            #{
            #    int ret;
            #    ;
            #
            #    // Paint the window first
            #    ret = super();
            #
            #    // Draw the icon
            #    element.drawIcon();
            #
            #    return ret;
            #}
          ENDSOURCE
        ENDMETHODS
      ENDCONTROL 
      
      CONTROL STRINGEDIT
        ;==== controlId:12291, containerId: 0, containerdata: 0   
        ;----------------------------------------------------------
        PROPERTIES
          Name                #File
          AutoDeclaration     #Yes
          Visible             #Yes
          AllowEdit           #Yes
          Left                #Auto (left)
          Top                 #Auto
          Width               #Auto
          Height              #Auto
          VerticalSpacing     #Auto
          Enabled             #Yes
          Skip                #No
          AlignControl        #Yes
          HelpText            #
          ConfigurationKey    #
          SecurityKey         #
          DragDrop            #None
          LookupButton        #Auto
          ReplaceOnLookup     #Yes
          LimitText           #Auto
          DisplayLength       #Auto
          DisplayHeight       #Auto
          Border              #Auto
          Text                #
          PasswordStyle       #No
          Alignment           #Auto
          ChangeCase          #Auto
          MultiLine           #No
          ColorScheme         #Default
          BackStyle           #Opaque
          BackgroundColor     #Window background
          ForegroundColor     #Window text
          Font                #
          FontSize            #0
          Italic              #No
          Underline           #No
          Bold                #Default
          CharacterSet        #0
          LabelForegroundColor #Window text
          ShowLabel           #Yes
          Label               #
          LabelFont           #
          LabelFontSize       #0
          LabelItalic         #No
          LabelUnderline      #No
          LabelBold           #Default
          LabelCharacterSet   #0
          LabelWidth          #Auto
          LabelHeight         #Auto
          LabelPosition       #Left
          LabelAlignment      #Right
          DataSource          #
          DataField           #
          Mandatory           #No
          ExtendedDataType    
            ARRAY 
              #FilenameOpen
              #
            ENDARRAY
          ArrayIndex          #0
          DataMethod          #
          SearchMode          #None
        ENDPROPERTIES
        
        METHODS
          Version: 3
          SOURCE #modified
            #public boolean modified()
            #{
            #    boolean ret;
            #    ;
            #
            #    // Change the text
            #    ret = super();
            #
            #    // Change the file and the icon
            #    element.changeFile(this.valueStr());
            #
            #    return ret;
            #}
          ENDSOURCE
        ENDMETHODS
      ENDCONTROL 
      
    ENDCONTAINER
    
  ENDDESIGN
  
ENDFORM


***Element: PRN

; Microsoft Business Solutions-Axapta Project : SDB_DLL_Call_Example unloaded at Friday 01/12/2006
; --------------------------------------------------------------------------------
  PROJECTVERSION 2
  
  PROJECT #SDB_DLL_Call_Example
   SHARED
  PROPERTIES
    Name                #SDB_DLL_Call_Example
  ENDPROPERTIES
  
    GROUP #Forms
      PROPERTIES
        Name                #Forms
        ProjectGroupType    #Forms
        GroupMask           #
        PreventEditProperties #No
      ENDPROPERTIES
      
      BEGINNODE
        FILETYPE 0
        UTILTYPE 11
        UTILOBJECTID 0
        NODETYPE 201
        NAME #SDB_DLL_Call_Example
      ENDNODE
      ENDGROUP
      
  ENDPROJECT
  

***Element: END
