FileOpen example for Visual Basic

 

Private Sub Command1_Click()
    LEADDlg1.FileDlgFlags!JumpID(`ltdlgocxn.hlp',`FileDlgFlagsproperty') = 0
    LEADDlg1.DialogTitle!JumpID(`ltdlgocxn.hlp',`DialogTitleproperty') = "Open A File"
    LEADDlg1.PreviewEnabled!JumpID(`ltdlgocxn.hlp',`PreviewEnabledproperty') = True
    LEADDlg1.Filter!JumpID(`ltdlgocxn.hlp',`Filterproperty') = "All |*.*|CMP|*.cmp|JPEG|*.jpg"
    LEADDlg1.FilterIndex!JumpID(`ltdlgocxn.hlp',`FilterIndexproperty') = 2 'look for *.cmp first
    LEADDlg1.InitialDir!JumpID(`ltdlgocxn.hlp',`InitialDirproperty') = "f:\images\"
    LEADDlg1.LoadPasses!JumpID(`ltdlgocxn.hlp',`LoadPassesproperty') = 0
    LEADDlg1.LoadRotated!JumpID(`ltdlgocxn.hlp',`LoadRotatedproperty') = True
    LEADDlg1.LoadCompressed!JumpID(`ltdlgocxn.hlp',`LoadCompressedproperty') = COMP_NONE
    LEADDlg1.Bitmap!JumpID(`ltdlgocxn.hlp',`BitmapCDproperty') = 0 'free any existing bitmap reference
    LEADDlg1.UIFlags!JumpID(`ltdlgocxn.hlp',`UIFlagsproperty') = DLG_FO_AUTOPROCESS + _
                           DLG_FO_PROGRESSIVE + _
                           DLG_FO_MULTIPAGE + _
                           DLG_FO_LOADROTATED + _
                           DLG_FO_LOADCOMPRESSED + _
                           DLG_FO_FILEINFO + _
                           DLG_FO_SHOWSTAMP + DLG_FO_SHOWPREVIEW
    LEADDlg1.FileOpen!JumpID(`ltdlgocxn.hlp',`FileOpenmethod') (hWnd)
    'output the results
    LEAD1.RefBitmap!JumpID(`ltocxn.hlp',`RefBitmapProperty') = True 'don't make a copy
    LEAD1.Bitmap!JumpID(`ltocxn.hlp',`BitmapProperty') = LEADDlg1.Bitmap    'send the image to LEAD OCX
    LEAD1.RefBitmap!JumpID(`ltocxn.hlp',`RefBitmapProperty') = False 'reset

    LEAD2.Bitmap = 0
    LEAD2.Bitmap = LEADDlg1.Thumbnail!JumpID(`ltdlgocxn.hlp',`Thumbnailproperty') 'copy thumbnail image to LEAD OCX

    'output the results
    Text1.Text = LEADDlg1.FileName!JumpID(`ltdlgocxn.hlp',`FileNameproperty') 
    Text2.Text = LEADDlg1.PageNumber!JumpID(`ltdlgocxn.hlp',`PageNumberproperty') 
    Text3.Text = LEADDlg1.LoadCompressed!JumpID(`ltdlgocxn.hlp',`LoadCompressedproperty') 
    Text4.Text = LEADDlg1.LoadRotated!JumpID(`ltdlgocxn.hlp',`LoadRotatedproperty') 
    Text5.Text = LEADDlg1.LoadPasses!JumpID(`ltdlgocxn.hlp',`LoadPassesproperty') 
End Sub