Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
I'm a digital photographer and have absolutely no use for BMP files but we have hundreds of thousands of JPGs lying around that would be great to be able to load and view in a dialog.
I've been searching, but have come up empty so far.
Just put some images in the directory with these files or change the Image_Path variable.
IMAGE_VIEWER.WBT
Home_Path = DirScript() DirChange(Home_Path) GoSub Load_Routines on_top = 0 IntControl(49,1,0,0,0) itemplate = StrCat(Home_Path,"iview_template.htm") ;################################# Image_Path = Home_Path image_list = FileItemize(StrCat(Image_Path,"*.jpg")) icnt = ItemCount(image_list,@TAB) ihtm = FileGet(itemplate) ;################################# hinit=BrowserInit() If hinit==0 message("Error","Unable to initialize atl lib.") Exit EndIf Call("image_viewer.wdl","") browserfree(hinit,obrowser) :Load_Routines #DefineSubRoutine IView_Sub(IVi_Handle,DMsg,DCID,resvd4,resvd5) Switch (DMsg) Case msg_init ; Dialog Initialization DialogProcOptions(IVi_Handle, msg_closevia49,1) ; Close selected (IntControl(49....) (1-On, 0-Off). DialogProcOptions(IVi_Handle, msg_buttonpushed,1) ; PushButton/PictureButton. DialogProcOptions(IVi_Handle, msg_checkbox,1) ; CheckBox. cb_IVi_on_top = 1 pb_IVi_Back = 2 pb_IVi_Forward = 3 st_IVi_ipos = 4 ipos = 1 If on_top == 1 Then IntControl(54,"Image Viewer",1,0,0) Else IntControl(54,"Image Viewer",0,0,0) EndIf ;################################## ;BROWSER CONTROL ;################################## browsercreate(IVi_Handle, 5,28,617,410) ;get object handle obrowser=BrowserGetObject() obrowser.navigate("About:Blank",0,'','','') ihtmp = StrReplace(ihtm,"{IMAGEFILE}",FileFullName(ItemExtract(ipos,image_list,@TAB))) obrowser.document.writeln(ihtmp) obrowser.refresh() ;################################## Break Case msg_closevia49 ; Close Return -1 Break Case msg_checkbox ; Check Box Switch(DCID) Case cb_IVi_on_top on_top = DialogControlGet(IVi_Handle,cb_IVi_on_top,dc_checkbox) If on_top == 1 Then IntControl(54,"Image Viewer",1,0,0) Else IntControl(54,"Image Viewer",0,0,0) EndIf Break EndSwitch Break Case msg_buttonpushed ; PushButtion Switch(DCID) Case pb_IVi_Forward ipos = ipos + 1 If ipos > icnt Then ipos = 1 ihtmp = StrReplace(ihtm,"{IMAGEFILE}",FileFullName(ItemExtract(ipos,image_list,@TAB))) obrowser.document.writeln(ihtmp) obrowser.refresh() Break Case pb_IVi_Back ipos = ipos - 1 If ipos == 0 Then ipos = icnt ihtmp = StrReplace(ihtm,"{IMAGEFILE}",FileFullName(ItemExtract(ipos,image_list,@TAB))) obrowser.document.writeln(ihtmp) obrowser.refresh() Break EndSwitch Break EndSwitch WinTitle("Image Viewer",StrCat("Image Viewer -- ",ItemExtract(ipos,image_list,@TAB))) DialogControlSet(Ivi_Handle,st_IVi_ipos,dc_title,StrCat(ipos," of ",icnt)) Return -2 #EndSubRoutine ;WebBrowser control ;11/02 Guido ;-------------------------------------------------------------------------------; ;BrowserInit : Initializes the browser functions,it must be called ; ; at the beginning ; ;-------------------------------------------------------------------------------; ;Returns : a handle to be used with BrowserFree or 0 If it fails ; ;-------------------------------------------------------------------------------; #DefineFunction BrowserInit() errormode(@off) atl=dllload(strcat(dirwindows(1),"atl.dll")) errormode(@on) If atl<>0 If dllcall(atl,long:"AtlAxWinInit") then Return atl Else Return 0 Else Return 0 EndIf #EndFunction ;--------------------------------------------------------------------------------; ;BrowserFree : Finishes the browser functions, it must be called always after ; ; the dialog has vanished. ; ;--------------------------------------------------------------------------------; ;hinit : handle returned by BrowserInit ; ;hbrowser : handle returned by BrowserGetObject ; ;Returns : always 0 ; ;--------------------------------------------------------------------------------; #DefineFunction BrowserFree(hinit,hbrowser) objectclose(hbrowser) Return dllfree(hinit) #EndFunction ;--------------------------------------------------------------------------------; ;BrowserCreate : Creates a webbrowser control. ; ;--------------------------------------------------------------------------------; ;handle : dialog handle ; ;x : browser x position inside dialog ; ;y : browser y position inside dialog ; ;w : browser width ; ;h : browser height ; ;url : initial url If any ; ;Returns: browser handle ; ;--------------------------------------------------------------------------------; ;API EXStyle : WS_EX_CLIENTEDGE ; ; Style : WS_CHILD|WS_VISIBLE ; ;--------------------------------------------------------------------------------; #DefineFunction browsercreate(IVi_Handle,x,y,w,h) user32=strcat(dirwindows(1),"user32.dll") hinst=dllhinst("") Return dllcall(user32,long:"CreateWindowExA",long:512,lpstr:"AtlAxWin",lpstr:"Shell.Explorer.1",long:1073741824|268435456,long:x,long:y,long:w,long:h,long:IVi_Handle,long:0,long:hinst,long:0) #EndFunction ;--------------------------------------------------------------------------------; ;BrowserGetObject : Gets the object handle of the previously created webbrowser ; ; control. ; ;--------------------------------------------------------------------------------; ;Returns : A object handle to be used when referring to the object ; ;--------------------------------------------------------------------------------; #DefineFunction BrowserGetObject() oShellApp=Objectaccess("Shell.Application",1) oWindows=oShellApp.Windows() count=oWindows.Count obrowser=oWindows.Item(count-1) objectclose(oShellApp) Return obrowser #EndFunction ;DialogprocOptions Constants MSG_INIT=0 ; The one-time initilization MSG_TIMER=1 ; Timer event MSG_BUTTONPUSHED=2 ; Pushbutton or Picturebutton MSG_RADIOPUSHED=3 ; Radiobutton clicked MSG_CHECKBOX=4 ; Checkbox clicked MSG_EDITBOX=5 ; Editbox or Multilinebox MSG_FILESELECT=6 ; Filelistbox MSG_ITEMSELECT=7 ; Itembox MSG_COMBOCHANGE=8 ; Combobox/Droplistbox MSG_CALENDAR=9 ; Calendar date change MSG_SPINNER=10 ; Spinner number change MSG_CLOSEVIA49=11 ; Close clicked (Enabled via Intcontrol 49) MSG_FILEBOXDOUBLECLICK=12 ; Get double-click message on a FileListBox MSG_ITEMBOXDOUBLECLICK=13 ; Get double-click message on an ItemBox DPO_DISABLESTATE=1000 ; codes -1=GetSetting 0=EnableDialog 1=DisableDialog DPO_CHANGEBACKGROUND=1001 ; -1=GetSetting otherise bitmap or color string ;DialogControlState Constants DCSTATE_SETFOCUS=1 ; Give Control Focus DCSTATE_QUERYSTYLE=2 ; Query control's style DCSTATE_ADDSTYLE=3 ; Add control style DCSTATE_REMOVESTYLE=4 ; Remove control style DCSTATE_GETFOCUS=5 ; Get control that has focus DCSTYLE_INVISIBLE=1 ; Set Control Invisible DCSTYLE_DISABLED=2 ; Set Control Disabled DCSTYLE_NOUSERDATA=4 ; Note: Setable via DialogControlState function ONLY SPINNER control only DCSTYLE_READONLY=8 ; Sets control to read-only (user cannot type in data) EDITBOX MULTILINEBOX SPINNER DCSTYLE_PASSWORD=16 ; Sets 'password mode' where only *'s are displayed EDITBOX DCSTYLE_DEFAULTBUTTON=32 ; Sets a button as a the default button PUSHBUTTON PICTUREBUTTON DCSTYLE_DIGITSONLY=64 ; Set edit box to accept digits only EDITMOX MULTILINEBOX DCSTYLE_FLAT=128 ; Makes a 'flat' hyperlink-looking button PUSHBUTTON PICTUREBUTTON DCSTYLE_HEIGHT=256 ; Turns off automatic height adjustment on ItemBoxes and FileListBoxes DCSTYLE_CENTER=512 ; Center Text in VARYTEXT and STATICTEXT Controls DCSTYLE_RIGHT=1024 ; Right Justify Text in VARYTEXT and STATICTEXT Controls ;DialogControlSet / DialogControlGet Constants DC_CHECKBOX=1 ; CHECKBOX DC_RADIOBUTTON=2 ; RADIOBUTTON DC_RADIOBUTTONPUSHED=16 ; RADIOBUTTON PUSHED DC_EDITBOX=3 ; EDITBOX MULTILINEBOX DC_TITLE=4 ; PICTURE RADIOBUTTON CHECKBOX PICTUREBUTTON VARYTEXT STATICTEXT GROUPBOX PUSHBUTTON DC_ITEMBOXCONTENTS=5 ; ITEMBOX FILELISTBOX DROPLISTBOX DC_ITEMBOXSELECT=6 ; ITEMBOX FILELISTBOX DROPLISTBOX DC_CALENDAR=7 ; CALENDAR DC_SPINNER=8 ; SPINNER DC_MULTITABSTOPS=9 ; MULTILINEBOX DC_ITEMSCROLLPOS=10 ; ITEMBOX FILELISTBOX DC_BACKGROUNDCOLOR=11 ; RADIOBUTTON CHECKBOX VARYTEXT STATICTEXT GROUPBOX PUSHBUTTON ITEMBOX FILELISTBOX DROPLISTBOX SPINNER EDITBOX MULTILINEBOX DC_PICTUREBITMAP=12 ; PICTURE PICTUREBUTTON DC_TEXTCOLOR=13 ; RADIOBUTTON CHECKBOX VARYTEXT STATICTEXT GROUPBOX PUSHBUTTON ITEMBOX FIELLISTBOX DROPLISTBOX SPINNER EDITBOX MULTILINEBOX DC_ITEMBOXADD=14 ; ITEMBOX FILELISTBOX DROPLISTBOX DC_ITEMBOXREMOVE=15 ; ITEMBOX FILELISTBOX DROPLISTBOX Return
IVIEW_TEMPLATE.HTM
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>New Page 1</title> </head> <body> <p align="center"> </p> <p align="center"><img border="0" src="{IMAGEFILE}" width="429" height="322"></p> </body> </html>
IMAGE_VIEWER.WDL
ImageViewerFormat=`WWWDLGED,6.1` ImageViewerCaption=`Image Viewer` ImageViewerX=-01 ImageViewerY=-01 ImageViewerWidth=316 ImageViewerHeight=225 ImageViewerNumControls=004 ImageViewerProcedure=`IView_Sub` ImageViewerFont=`DEFAULT` ImageViewerTextColor=`DEFAULT` ImageViewerBackground=`DEFAULT,DEFAULT` ImageViewerConfig=0 ImageViewer001=`269,001,042,012,CHECKBOX,on_top,"&Keep On Top",1,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ImageViewer002=`079,001,026,012,PUSHBUTTON,DEFAULT,"Back",2,4,DEFAULT,DEFAULT,DEFAULT,"217|217|217"` ImageViewer003=`189,001,026,012,PUSHBUTTON,DEFAULT,"Forward",3,5,DEFAULT,DEFAULT,DEFAULT,"217|217|217"` ImageViewer004=`107,003,080,010,STATICTEXT,DEFAULT,"ipos",DEFAULT,10,512,"Microsoft Sans Serif|6656|170|34","0|0|0",DEFAULT` ButtonPushed=Dialog("ImageViewer")
Article ID: W16949
File Created: 2007:07:03:14:27:08
Last Updated: 2007:07:03:14:27:08