:Start of SurfXbrowser-GadgetX
![]() | ![]() |
|---|
If you are viewing this script in your browser you can save it as a VDS 5.x source file (*.dsc) to run it.
#
# DragonSphere Software's Home Page
#
# All Source Files for this demo
#
# Original demo by eXtremeSenses Software
# Martin Bellefeuille, Author of VDSSURFX
# This is the same demo found of Martin's VDSSURFX Extension package
# Martin was kind enough to convert the demo to support GadgetX.
# Martin says, "This is simply to show how easy it is to use the power of GadgetX
# and could possibly play the roll of many extensions that are
# available out there. Enjoy!".
TITLE SurfXbrowser-GadgetX DEMO
OPTION SCALE, 96
OPTION DECIMALSEP, "."
If @Greater(@Name(@SYSINFO(DSVER)),4)
External GadgetX.dll,@SYSINFO(DSVER)
# Commands for use with Gadgetx.dll
#DEFINE COMMAND,GADGETX,GADGET,DEFINE,OLE,SETVAR,CALLFUNC,FREEDLL,SETWIN,SETMSG
# functions for use with Gadgetx.dll
#DEFINE FUNCTION,GADGETX,GADGET,SHELLFOLDERMENU,GETVAR,CALLFUNC,ADDROF,OLE,AND,OR,HIWORD,LOWORD,LOADDLL,GETMSG
#DEFINE FUNCTION,SURFX
#DEFINE COMMAND,SURFX
Else
Warn This demo was designed to work with VDS 5.x@CR()http://www.dialogscript.com
Stop
End
:DialogX
# This is just a signature splash screen
DIALOG CREATE,Dialog X,-1,0,200,200,NOTITLE
# Set window Mask to a prebuilt bmp file with transparent sections....
DIALOG ADD,BITMAP,BITMAP2,0,0,168,124,#dragonfly-h100.bmp,,CLICK,HAND
SetWin BackGround,ShapeToBMP,Dialog X,#DRAGONFL
DIALOG SHOW
# Win32 Message ID's
Define Const,WM_KEYDOWN,$100
Define Const,WM_KEYUP,$101
Define Const,WM_COMMAND,$111
Define Const,WM_SETFOCUS,$7
Define Const,WM_SYSCOMMAND,274
Define Const,WM_PAINT,15
Define Const,WM_SIZE,5
Define Const,WM_SIZING,532
Define Const,WM_WINDOWPOSCHANGED,71
Define Const,WM_MOVE,3
Define Const,WM_QUIT,18
Define Const,WM_CLOSE,16
Define Const,WM_SYSKEYDOWN,260
Define Const,WM_SYSKEYUP,261
Define Const,WM_ERASEBKGND,20
Define Const,WM_CHAR,258
Define Const,WM_SYSCHAR,262
Define Const,WM_LBUTTONDOWN,513
Define Const,WM_LBUTTONUP,514
Define Const,WM_KEYFIRST,256
Define Const,WM_KEYLAST,264
# Menu Constants
Define Const,MF_INSERT,$0
Define Const,MF_CHANGE,$80
Define Const,MF_APPEND,$100
Define Const,MF_DELETE,$200
Define Const,MF_REMOVE,$1000
Define Const,MF_BYCOMMAND,$0
Define Const,MF_BYPOSITION,1024
Define Const,MF_SEPARATOR,$800
Define Const,MF_ENABLED,$0
Define Const,MF_GRAYED,$1
Define Const,MF_DISABLED,$2
Define Const,MF_UNCHECKED,$0
Define Const,MF_CHECKED,$8
Define Const,MF_USECHECKBITMAPS,$200
Define Const,MF_STRING,$0
Define Const,MF_BITMAP,$4
Define Const,MF_OWNERDRAW,$100
Define Const,MF_POPUP,$10
Define Const,MF_MENUBARBREAK,$20
Define Const,MF_MENUBREAK,$40
Define Const,MF_UNHILITE,$0
Define Const,MF_HILITE,$80
Define Const,MF_SYSMENU,$2000
Define Const,MF_HELP,$4000
Define Const,MF_MOUSESELECT,$8000
Define Const,MF_END,$80
Define Constant,OLECMDID_OPEN,1
Define Constant,OLECMDID_NEW,2
Define Constant,OLECMDID_SAVE,3
Define Constant,OLECMDID_SAVEAS,4
Define Constant,OLECMDID_SAVECOPYAS,5
Define Constant,OLECMDID_PRINT,6
Define Constant,OLECMDID_PRINTPREVIEW,7
Define Constant,OLECMDID_PAGESETUP,8
Define Constant,OLECMDID_SPELL,9
Define Constant,OLECMDID_PROPERTIES,10
Define Constant,OLECMDID_CUT,11
Define Constant,OLECMDID_COPY,12
Define Constant,OLECMDID_PASTE,13
Define Constant,OLECMDID_PASTESPECIAL,14
Define Constant,OLECMDID_UNDO,15
Define Constant,OLECMDID_REDO,16
Define Constant,OLECMDID_SELECTALL,17
Define Constant,OLECMDID_CLEARSELECTION,18
Define Constant,OLECMDID_ZOOM,19
Define Constant,OLECMDID_GETZOOMRANGE,20
Define Constant,OLECMDID_UPDATECOMMANDS,21
Define Constant,OLECMDID_REFRESH,22
Define Constant,OLECMDID_STOP,23
Define Constant,OLECMDID_HIDETOOLBARS,24
Define Constant,OLECMDID_SETPROGRESSMAX,25
Define Constant,OLECMDID_SETPROGRESSPOS,26
Define Constant,OLECMDID_SETPROGRESSTEXT,27
Define Constant,OLECMDID_SETTITLE,28
Define Constant,OLECMDID_SETDOWNLOADSTATE,29
Define Constant,OLECMDID_STOPDOWNLOAD,30
Define Constant,OLECMDID_ONTOOLBARACTIVATED,31
Define Constant,OLECMDID_FIND,32
Define Constant,OLECMDID_DELETE,33
Define Constant,OLECMDID_HTTPEQUIV,34
Define Constant,OLECMDID_HTTPEQUIV_DONE,35
Define Constant,OLECMDID_ENABLE_INTERACTION,36
Define Constant,OLECMDID_ONUNLOAD,37
Define Constant,OLECMDID_PROPERTYBAG2,38
Define Constant,OLECMDID_PREREFRESH,39
Define Constant,OLECMDID_SHOWSCRIPTERROR,40
Define Constant,OLECMDID_SHOWMESSAGE,41
Define Constant,OLECMDID_SHOWFIND,42
Define Constant,OLECMDID_SHOWPAGESETUP,43
Define Constant,OLECMDID_SHOWPRINT,44
Define Constant,OLECMDID_CLOSE,45
Define Constant,OLECMDID_ALLOWUILESSSAVEAS,46
Define Constant,OLECMDID_DONTDOWNLOADCSS,47
Define Constant,OLECMDID_UPDATEPAGESTATUS,48
Define Constant,OLECMDID_PRINT2,49
Define Constant,OLECMDID_PRINTPREVIEW2,50
Define Constant,OLECMDID_SETPRINTTEMPLATE,51
Define Constant,OLECMDID_GETPRINTTEMPLATE,52
Define Constant,OLECMDID_PAGEACTIONBLOCKED,55
Define Constant,OLECMDID_PAGEACTIONUIQUERY,56
Define Constant,OLECMDID_FOCUSVIEWCONTROLS,57
Define Constant,OLECMDID_FOCUSVIEWCONTROLSQUERY,58
Define Constant,OLECMDID_SHOWPAGEACTIONMENU,59
#
Define Constant,OLECMDEXECOPT_DODEFAULT,0
Define Constant,OLECMDEXECOPT_PROMPTUSER,1
Define Constant,OLECMDEXECOPT_DONTPROMPTUSER,2
Define Constant,OLECMDEXECOPT_SHOWHELP,3
# WM_COMMAND IDs handled by the "Internet Explorer_Server" window
Define Constant,ID_IE_CONTEXTMENU_ADDFAV,2261
Define Constant,ID_IE_CONTEXTMENU_VIEWSOURCE,2139
Define Constant,ID_IE_CONTEXTMENU_REFRESH,6042
# WM_COMMAND IDs handled by the "Shell DocObject View" window:
Define Constant,ID_IE_FILE_SAVEAS,258
Define Constant,ID_IE_FILE_PAGESETUP,259
Define Constant,ID_IE_FILE_PRINT,260
Define Constant,ID_IE_FILE_NEWWINDOW,275
Define Constant,ID_IE_FILE_PRINTPREVIEW,277
Define Constant,ID_IE_FILE_NEWMAIL,279
Define Constant,ID_IE_FILE_SENDDESKTOPSHORTCUT,284
Define Constant,ID_IE_HELP_ABOUTIE,336
Define Constant,ID_IE_HELP_HELPINDEX,337
Define Constant,ID_IE_HELP_WEBTUTORIAL,338
Define Constant,ID_IE_HELP_FREESTUFF,341
Define Constant,ID_IE_HELP_PRODUCTUPDATE,342
Define Constant,ID_IE_HELP_FAQ,343
Define Constant,ID_IE_HELP_ONLINESUPPORT,344
Define Constant,ID_IE_HELP_FEEDBACK,345
Define Constant,ID_IE_HELP_BESTPAGE,346
Define Constant,ID_IE_HELP_SEARCHWEB,347
Define Constant,ID_IE_HELP_MSHOME,348
Define Constant,ID_IE_HELP_VISITINTERNET,349
Define Constant,ID_IE_HELP_STARTPAGE,350
Define Constant,ID_IE_FILE_IMPORTEXPORT,374
Define Constant,ID_IE_FILE_ADDTRUST,376
Define Constant,ID_IE_FILE_ADDLOCAL,377
Define Constant,ID_IE_FILE_NEWPUBLISHINFO,387
Define Constant,ID_IE_FILE_NEWCORRESPONDENT,390
Define Constant,ID_IE_FILE_NEWCALL,395
Define Constant,ID_IE_HELP_NETSCAPEUSER,351
Define Constant,ID_IE_HELP_ENHANCEDSECURITY,375
# Shell Folder ID's
Define Constant,CSIDL_DESKTOP,0
Define Constant,CSIDL_INTERNET,1
Define Constant,CSIDL_PROGRAMS,2
Define Constant,CSIDL_CONTROLS,3
Define Constant,CSIDL_PRINTERS,4
Define Constant,CSIDL_PERSONAL,5
Define Constant,CSIDL_FAVORITES,6
Define Constant,CSIDL_STARTUP,7
Define Constant,CSIDL_RECENT,8
Define Constant,CSIDL_SENDTO,9
Define Constant,CSIDL_BITBUCKET,10
Define Constant,CSIDL_STARTMENU,11
Define Constant,CSIDL_MYDOCUMENTS,12
Define Constant,CSIDL_MYMUSIC,13
Define Constant,CSIDL_MYVIDEO,14
Define Constant,CSIDL_DESKTOPDIRECTORY,16
Define Constant,CSIDL_DRIVES,17
Define Constant,CSIDL_NETWORK,18
Define Constant,CSIDL_NETHOOD,19
Define Constant,CSIDL_FONTS,20
Define Constant,CSIDL_TEMPLATES,21
Define Constant,CSIDL_COMMON_STARTMENU,22
Define Constant,CSIDL_COMMON_PROGRAMS,$0017
Define Constant,CSIDL_COMMON_STARTUP,24
Define Constant,CSIDL_COMMON_DESKTOPDIRECTORY,25
Define Constant,CSIDL_APPDATA,26
Define Constant,CSIDL_PRINTHOOD,27
Define Constant,CSIDL_LOCAL_APPDATA,28
Define Constant,CSIDL_ALTSTARTUP,29
Define Constant,CSIDL_COMMON_ALTSTARTUP,30
Define Constant,CSIDL_COMMON_FAVORITES,31
Define Constant,CSIDL_INTERNET_CACHE,32
Define Constant,CSIDL_COOKIES,33
Define Constant,CSIDL_HISTORY,34
Define Constant,CSIDL_COMMON_APPDATA,35
Define Constant,CSIDL_WINDOWS,36
Define Constant,CSIDL_SYSTEM,37
Define Constant,CSIDL_PROGRAM_FILES,38
Define Constant,CSIDL_MYPICTURES,39
Define Constant,CSIDL_PROFILE,40
Define Constant,CSIDL_SYSTEMX86,41
Define Constant,CSIDL_PROGRAM_FILESX86,42
Define Constant,CSIDL_PROGRAM_FILES_COMMON,43
Define Constant,CSIDL_PROGRAM_FILES_COMMONX86,44
Define Constant,CSIDL_COMMON_TEMPLATES,45
Define Constant,CSIDL_COMMON_DOCUMENTS,46
Define Constant,CSIDL_COMMON_ADMINTOOLS,47
Define Constant,CSIDL_ADMINTOOLS,48
Define Constant,CSIDL_CONNECTIONS,49
Define Constant,CSIDL_COMMON_MUSIC,53
Define Constant,CSIDL_COMMON_PICTURES,54
Define Constant,CSIDL_COMMON_VIDEO,55
Define Constant,CSIDL_RESOURCES,56
Define Constant,CSIDL_RESOURCES_LOCALIZED,57
Define Constant,CSIDL_COMMON_OEM_LINKS,58
Define Constant,CSIDL_CDBURN_AREA,59
Define Constant,CSIDL_COMPUTERSNEARME,61
# enum SHCONTF
Define Constant,SHCONTF_FOLDERS,32
Define Constant,SHCONTF_NONFOLDERS,64
Define Constant,SHCONTF_INCLUDEHIDDEN,128
Define Constant,SHCONTF_INIT_ON_FIRST_NEXT,256
Define Constant,SHCONTF_NETPRINTERSRCH,512
Define Constant,SHCONTF_SHAREABLE,1024
Define Constant,SHCONTF_STORAGE,2048
#end
# Define Variable,SHDocVw As Object
#
# More residue below
# No longer needed but left as an example
# These objects can be used to traverse a shell folder
#
# Define Variable,objShell As Object
# Define Variable,objFolder As Object
# Define Variable,objFolderItems As Object
# Define Variable,colFolderItems As Collection
# Define Variable,objFolderItem As Object
# Define Variable,objShellLink As Object
# Define Variable,ieApp As Object
Define Variable,Object,ShellUIHelper
Define Variable,Object,Document
Define Variable,Variant,vaZoomFactorin
Define Variable,Variant,vaZoomFactorout
Define GUID,DWebBrowserEvents2,{34A715A0-6587-11D0-924A-0020AFC7AC4D}
Define GUID,IShellUIHelper,{64AB4BB7-111E-11D1-8F79-00C04FC2FBE1}
Define Constant,OLE_TRUE,-1
Define Constant,OLE_FALSE,0
Ole Init
#Ole Exceptions,SHOW
# Load the DLL's that we need for the menus
Define Variable,Handle,USER32
SetVar USER32,@LoadDll(user32.dll)
Define Variable,Handle,GDI32
SetVar GDI32,@LoadDll(gdi32.dll)
# Define the funtions we need for sub-menus
Define Function,Integer,USER32,DrawMenuBar,RedrawMenu,Handle|Hwnd
Define Function,Handle,USER32,GetMenu,GetMenu,Handle|Hwnd
Define Function,Handle,USER32,GetSubMenu,GetSubMenu,Handle|hMenu,Integer|nPos
Define Function,Handle,USER32,GetSystemMenu,GetSystemMenu,Handle|Hwnd,Integer|bRevert
Define Function,Integer,USER32,TrackPopupMenu,PopupMenu,Handle|hMenu,DWORD|uFlags,Integer|X,Integer|Y,Integer|nReserved,Handle|Hwnd,Pointer|prcRect
Define Function,Integer,USER32,SetMenuItemInfo,SetMenuItemInfo,Handle|hMenu,DWORD|uItem,Integer|fByPosition,Pointer|lpmii
Define Function,Integer,USER32,GetMenuItemInfo,GetMenuItemInfo,Handle|hMenu,DWORD|uItem,Integer|fByPosition,Pointer|lpmii
Define Function,DWORD,USER32,GetMenuState,GetMenuState,Handle|hMenu,DWORD|uItem,DWORD|fuFlags
Define Function,Integer,USER32,SetMenuItemBitmaps,SetMenuItemBitmaps,Handle|hMenu,DWORD|uItem,DWORD|fuFlags,Handle|hbmUnchecked,Handle|hbmChecked
Define Function,Integer,USER32,ModifyMenu,MoveMenu,Handle|hMenu,DWORD|uPosition,DWORD|uFlags,Handle|uIDNewItem,String|pNewItem
Define Function,Integer,USER32,RemoveMenu,HideMenu,Handle|hMenu,DWORD|uItem,DWORD|fuFlags
Define Function,Integer,USER32,InsertMenu,InsertMenu,Handle|hMenu,DWORD|uPosition,DWORD|uFlags,Handle|uIDNewItem,String|pNewItem
Define Function,Integer,USER32,GetMenuItemCount,GetMenuItemCount,Handle|hMenu
Define Function,DWORD,USER32,CheckMenuItem,CheckMenuItem,Handle|hMenu,DWORD|uIDCheckItem,DWORD|uCheck
Define Function,Integer,USER32,CheckMenuRadioItem,CheckMenuRadioItem,Handle|hMenu,DWORD|idFirst,DWORD|idLast,DWORD|idCheck,DWORD|uFlags
Define Function,Handle,USER32,SetFocus,SetFocus,Handle|hWnd
Define Function,Handle,USER32,GetFocus,GetFocus
#
# You might want to try the
# Mozilla ActiveX control
# Once you have the Mozilla Activex control downloaded and installed
# Just swap the ProgID 'Shell.Explorer.2' below with 'Mozilla.Browser.1'
# Note: some parts in this demo do not work with the Mozilla ActiveX control but most of them do.
#
#SetVar SHDocVw,@Ole(Create,Shell.Explorer.2,Null)
#
# I am using the object below to help manage favorites.
# I am not finished with this part yet since it is a little tricky.
SetVar ShellUIHelper,@Ole(Create,IShellUIHelper,NULL)
#
# More menu residue below
# No longer needed but left as an example
# These objects can be used to traverse a shell folder
#
# Set objShell,@Ole(Create,Shell.Application,NULL)
%%winclass = "#TSURFX"
DIALOG CREATE,SurfXbrowser-GadgetX Web Browser,-1,0,800,600,CLASS TSURFX,RESIZABLE
REM *** Modified by Dialog Designer on 1/30/2007 - 12:02 ***
DIALOG ADD,STYLE,S1,Wingdings,14,C,,BLACK
DIALOG ADD,STYLE,S2,MS Sans Serif,8
DIALOG ADD,MENU,File,Open File,Open URL,-,Save as,Page Setup,Print Preview,Print,-,Emport and Export...,-,Exit
DIALOG ADD,MENU,View,Temp Text Size
DIALOG ADD,MENU,Text Size,Largest,Larger,Medium,Smaller,Smallest
DIALOG ADD,MENU,Favorites,Add To Favorites,-
DIALOG ADD,MENU,Options,Internet Options,Security,Privacy,Content,Connection,Programs,Advance,View Source
DIALOG ADD,MENU,Help,About,-
# Syntax: GadgetX Add,ShellFolderToMenu,{Menu Name to append too},{Window ID},{Shell Folder ID from CSIDL_ constants}
GadgetX ADD,ShellFolderMenu,Favorites,%%winclass,CSIDL_FAVORITES
DIALOG ADD,GROUP,G1,0,0,123,30,,,S1
DIALOG ADD,BITBTN,Backward,2,2,30,26,,@chr(215),Back
DIALOG ADD,BITBTN,Forward,2,32,30,26,,@chr(216),Forward
DIALOG ADD,BITBTN,Stop,2,62,30,26,,@chr(253),Stop Loading page
DIALOG ADD,BITBTN,Refresh,2,92,30,26,,@chr(50),Refresh current page
DIALOG ADD,Text,T1,36,3,,,"Address:",,,S2
DIALOG ADD,COMBO,combo1,32,45,532,20
DIALOG ADD,BUTTON,Go,32,579,40,21,,,DEFAULT
# Add the Browser control to the Dialog
GadgetX ADD,OLE,SHDocVw,%%winclass,55,0,@dlgpos(,W),@Diff(@dlgpos(,H),@Sum(55,19)),Shell.Explorer.2
DIALOG ADD,STATUS,STAT
DIALOG SHOW
:MENUS
DIALOG SET,Stat,Please wait while I am configuring your menus ...
DIALOG CURSOR,WAIT
# Ok we are going to play with our menus
# We first need to get all the handles to all of the menus that we
# have on our Dialog
# Get the Handle to the Menu bar itself
%%mnu_hwnd = @CallFunc(GetMenu,%%winclass)
# Get the Handle to the First sub menu which is called 'File'
%%filemnu_hwnd = @CallFunc(GetSubMenu,%%mnu_hwnd,0)
# Get the Handle to the second sub menu which is called 'View Menu'
%%viewmenu_hwnd = @CallFunc(GetSubMenu,%%mnu_hwnd,1)
# Get the Handle to the third sub menu which is called 'Text Size'
%%textsize_menu = @CallFunc(GetSubMenu,%%mnu_hwnd,2)
# Get the Handle to the forth sub menu which is called 'Favorites'
%%favorites_menu = @CallFunc(GetSubMenu,%%mnu_hwnd,3)
# Ok we want to hide our Sub Menu
# First we need the value of a flag
# MF_BYPOSITION = 1024
%%Ret = @CallFunc(HideMenu,%%mnu_hwnd,2,MF_BYPOSITION)
# Now we will tell our window to redraw the Menu bar.
%%Ret = @CallFunc(RedrawMenu,%%winclass)
# Now we are going to move our Text Size Menu under the Temp Text Size Menu item in the View Menu
# First we need some flags
# MF_BYPOSITION = 1024 + MF_POPUP = 16 + MF_STRING = 0
%%Ret = @CallFunc(ModifyMenu,%%viewmenu_hwnd,0,@Or(MF_BYPOSITION,MF_POPUP,MF_STRING),%%textsize_menu,Text Size)
# Now we will tell our window to redraw the Menu bar.
%%Ret = @CallFunc(RedrawMenu,%%winclass)
# Now we will tell our window to redraw the Menu bar.
%%Ret = @CallFunc(RedrawMenu,%%winclass)
DIALOG CURSOR,
DIALOG Set,Stat,Your menus are ready...
#
# I left the code below to show you it is possible
# to get the information about a shell folder VIA Shell.Application
# but since VDS will only let you go 9 levels deep with GoSubs
# I could not use this code to actually add the menus :-(
# So now GadgetX does all this with the command GadgetX SHELLFOLDERMENU,ADD
#
# List create,2
# List create,3
# List create,4
# List FileList,2,@windir(Favorites),*
# List seek,2,0
# List insert,2,@windir(Favorites)
# %%cnt = 0
# %%count = @count(2)
# %%cmenu = 6
# %%Folders =
# %%MenuItems =
# %%FavPath = @windir(Favorites)
# The loops below will save all the links from the users Favorites
# folder to List 3 with the following format
# @fsep()
# This routine show how to use the Shell.Application object
# to enumerate objects in a folder.
# Repeat
# Loop until there is no more Folders listed in List 2 the @windir(Favorites)
# %%Path = @Item(2,%%cnt)
# Set objFolder,@Ole(CallMethod,objShell,"^o","NameSpace(^B)",%%Path)
# Get the title of the folder
# %%FavTitle = @Ole(GetProperty,objFolder,"^B",Title)
# Get the FolderItems object
# Set objFolderItems,@Ole(GetProperty,objFolder,"^o",Items)
# Call the Filter method to get all Non-Folder objects (ie..Files and links)
# Ole CallMethod,objFolderItems,"Filter(^d,^B)",SHCONTF_NONFOLDERS,"*"
# Enumerate the FolderItems collection object
# Set colFolderItems,@Ole(BeginCollection,objFolderItems)
# Loop until there is no more items in this folder
# Repeat
# Get the next FolderItem object in the collection
# Set objFolderItem,@Ole(GetNextObject,colFolderItems)
# If @Greater(@Gadget(objFolderItem),0)
# Get the type of the item in the collection
# %%Type = @Ole(GetProperty,objFolderItem,"^B",Type)
# Get a name for the item
# %%ItemName = @Ole(GetProperty,objFolderItem,"^B",Name)
# If the item is a link
# If @Equal(@Ole(GetProperty,objFolderItem,"^b",isLink),@Gadget(OLE_TRUE))
# Get the ShellLink object
# Set objShellLink,@Ole(CallMethod,objFolderItem,"^o","GetLink")
# If @Greater(objShellLink,0)
# Get the Path or URL that the link points to
# %%LinkPath = @Ole(GetProperty,objShellLink,"^B",Path)
# End
# End
# Some crazy people use the & character when they name a link so process it.
# %%AMP = @Pos(&,%%ItemName)
# If @Greater(%%AMP,0)
# %%AmpItemName = @Strins(%%ItemName,%%AMP,&)
# %%NoAmpItemName = @Strdel(%%ItemName,%%AMP)
# If the type of file is a Internet Shortcut, Shortcut, or Channel Shortcut
# If @Equal(%%Type,Internet Shortcut)@Equal(%%Type,Shortcut)@Equal(%%Type,Channel Shortcut)
# Display it with the &
# Dialog Set,Stat,%%AmpItemName@fsep()%%LinkPath
# We save in the list without a & just incase we need it to compare to a VDS menu event
# List Add,3,%%NoAmpItemName@fsep()%%LinkPath
# End
# Else
# If the type of file is a Shortcut, Internet Shortcut, or Channel Shortcut
# If @Equal(%%Type,Internet Shortcut)@Equal(%%Type,Shortcut)@Equal(%%Type,Channel Shortcut)
# Display the item
# Dialog Set,Stat,%%ItemName@fsep()%%LinkPath
# Save the item to the list
# List Add,3,%%ItemName@fsep()%%LinkPath
# End
# End
# End
# Until @Not(@Get(objFolderItem))
# %%cnt = @succ(%%cnt)
# Until @Equal(%%cnt,%%count)
# List SaveFile,3,FavoriteItems.txt
# Set the home page
%%HOME_PAGE = http://www.dragonsphere.net
Ole Call,SHDocVw,"Navigate(^B)",%%HOME_PAGE
DIALOG SET,combo1,%%HOME_PAGE
List Add,combo1,%%HOME_PAGE
List seek,combo1,0
# Get the Home Page from combo1
#%%url = @dlgtext(combo1)
#if @not(@null(%%url))
# Navigate to the home page
# wait until the home page is displayed
#Ole CallMethod,SHDocVw,"Navigate(^B)",about:blank
#While @equal(-1,@Ole(Get,SHDocVw,^b,Busy))
# There are other ways to do this but Marty showed us the simplest way first
# I have other parts of this demo show how to use the browser events to give
# your user more concurrent information about what the control is doing.
#%%Stat = @Trim(@Ole(GetProperty,SHDocVw,^B,LocationURL))
#If %%Stat
#Info %%Stat@cr()
#DIALOG SET,Stat,Opening %%Stat
#End
#wait 0.3
# %A = @event()
#Wend
#Ole Call,SHDocVw,GoHome
While @Equal(@Ole(Get,SHDocVw,^b,Busy),-1)
# There are other ways to do this but Marty showed us the simplest way first
# I have other parts of this demo show how to use the browser events to give
# your user more concurrent information about what the control is doing.
#%%Stat = @Trim(@Ole(GetProperty,SHDocVw,^B,LocationURL))
#If %%Stat
#Info %%Stat@cr()
#DIALOG SET,Stat,Opening %%Stat
#End
#wait 0.3
Wend
# Need the Document object to use Ole Command
# This is because the IOleCommandTarget interface is part of the Document object
# not the parent SHDocVw object.
SetVar Document,@Ole(GetProperty,SHDocVw,^o,Document)
#end
#DIALOG SET,Stat,Done
# Set the Titlebar of our window
%%name = @Ole(GetProperty,SHDocVw,^B,LocationName)
DIALOG TITLE,SurfXbrowser-GadgetX Web Browser - %%name - @Ole(GetProperty,SHDocVw,^B,LocationURL)
# Now that we have a document embeded we can grab the window handles needed
%%Next = @window(%%winclass,CHILD)
repeat
%%Next = @window(%%Next,NEXT)
Until @Equal(@winclass(%%Next),Shell Embedding)
%%ShellEmbedding = %%Next
%%ShellDocObjectView = @window(%%Next,CHILD)
%%IEServer = @window(%%ShellDocObjectView,CHILD)
# Set the Text Zoom factor to normal
# vaZoomFactor can be a number between 0 - 4
SetVar vaZoomFactorout,0,^d
Ole Command,Document,Exec,OLECMDID_ZOOM,OLECMDEXECOPT_DONTPROMPTUSER,NULL,vaZoomFactorout
# Set the initial position of the Text Size Menu
# Ok we are going to make these menu items Radio checked
# Like all of the examples in this file we set the uFlags parameter
# to 1024 for MF_BYPOSITION = 1024
%%Ret = @CallFunc(CheckMenuRadioItem,%%textsize_menu,0,4,@sum(4,-@GetVar(vaZoomFactorout)),MF_BYPOSITION)
# Set the status bar with the URL using the browsers LocationURL property.
DIALOG SET,Stat,@Ole(GetProperty,SHDocVw,^B,LocationURL)
# Browser control events
Define EventMap,DWebBrowserEvents2,DocumentComplete,259
Define EventMap,DWebBrowserEvents2,StatusTextChange,102
%%cookie = @Ole(ConnectEvents,SHDocVw,DWebBrowserEvents2)
# Hide the splash screen
DIALOG SELECT,0
DIALOG HIDE
# Show our main dialog
DIALOG SELECT,1
DIALOG SHOW
# Ok lets trap messages from the Web Browser Control
SetMsg trapfor,%%IEServer
# Now watch for the WM_CHAR and WM_SYSCHAR messages...
SetMsg watchfor,%%IEServer,WM_CHAR
# The WM_SYSCHAR message will trap for ALT + Key messages
SetMsg watchfor,%%IEServer,WM_SYSCHAR
# Now tell gadget to set the hook... Gadget will generate an event
# called SHDocVwMSG everytime it see's the message WM_CHAR or WM_SYSCHAR stated above
# for the Web Browser Control....
%%SHDocVwMSGHook = @GetMsg(eventhook,%%winclass,"SHDocVwMSG")
# Get rid of any extra ShellFolderMenu events caused by the menu being redrawn above.
while @event()
%A = @SHELLFOLDERMENU(GET)
wend
# Add a hotkey for the delete key so we can forward the key to the webbrowser.
HOTKEY ADD,DELETEKEY,DEL
:RESIZE
DIALOG SETPOS,Combo1,,,@diff(@dlgpos(,W),96)
DIALOG SETPOS,GO,,@diff(@dlgpos(,W),49)
# Is this sweet or what?
# We can set the position of the browser control almost like the
# VDS elements above. Check it out, simple right?
Ole SetPos,SHDocVw,%%winclass,55,0,@dlgpos(,W),@diff(@dlgpos(,H),@Sum(55,19))
:EVLOOP
WAIT EVENT,0.3
%E = @event()
If %E
goto %E
End
goto evloop
:oldstuff
#
# More menu residue below
# No longer needed but left as an example
#
#%%MenuItem = @SubStr(%E,1,@Pred(@Pos(MENU,%E)))
# Info %E@CR()%%MenuItem
#%%cnt = 0
#Repeat
# PARSE "%%MItem;%%mURL",@Item(3,%%cnt)
# Info %%MenuItem@CR()%%MItem@CR()%%mURL
# If @Equal(%%MItem,%%MenuItem)
# %%IsShortcut = 1
# %%cnt = @Pred(%%count)
# End
# %%cnt = @succ(%%cnt)
#Until @Equal(%%cnt,%%count)
#If @Equal(%%IsShortcut,1)
# Info You clicked a shortcut to@cr()%%MItem
# if %%mURL
# %%IsShortcut = 0
# DIALOG SET,COMBO1,%%mURL
# Ole Call,SHDocVw,"Navigate(^B)",%%mURL
# end
#Else
# goto %E
#End
exit
:TIMER
goto evloop
:HOTKEY
%%HotKey = @Hotkey()
If %%HotKey
goto %%HotKey
End
goto evloop
:DELETEKEY
%%HFocus = @CallFunc(GetFocus)
If @Equal(%%HFocus,%%ShellEmbedding)@Equal(%%HFocus,%%ShellDocObjectView)@Equal(%%HFocus,%%IEServer)
# If the browser has the focus the send the delete key to the browser
Ole ForwardMsg,SHDocVw,WM_KEYDOWN,46
Ole ForwardMsg,SHDocVw,WM_KEYUP,46
Else
# If some other VDS control has the focus then send the delete key to that window.
%A = @Sendmsg(%%HFocus,@GetVar(WM_KEYDOWN),46,0)
%A = @Sendmsg(%%HFocus,@GetVar(WM_KEYUP),46,0)
End
goto evloop
:SHDocVwMSG
# This event is fired every time GadgetX gets a
# WM_CHAR or WM_SYSCHAR destined for the web browser control
List creat,2
List Assign,2,@GetMsg()
%%Win = @Item(2,0)
%%Message = @Item(2,1)
%%WParam = @Item(2,2)
%%LParam = @Item(2,3)
If @Equal(%%Message,@GetVar(WM_CHAR))
If @Equal(%%Wparam,@Asc(@Tab()))
Ole ForwardMsg,SHDocVw,WM_KEYDOWN,%%WParam,%%LParam
Ole ForwardMsg,SHDocVw,WM_KEYUP,%%WParam,%%LParam
End
End
If @Equal(%%Message,@GetVar(WM_SYSCHAR))
Ole ForwardMsg,SHDocVw,WM_SYSKEYDOWN,%%WParam,%%LParam
Ole ForwardMsg,SHDocVw,WM_SYSKEYUP,%%WParam,%%LParam
End
List close,2
goto evloop
:SHELLFOLDERMENUITEM
# This event is fired everytime a ShellFolder Menu item is selected
%%MenuItem = @SHELLFOLDERMENU(GET)
if %%MenuItem
List create,6
List Assign,6,%%MenuItem
%%DisplayName = @Item(6,0)
%%FileName = @Item(6,1)
%%LinkPath = @Item(6,2)
if @Equal(@Ext(%%FileName),url)
%%mURL = %%LinkPath
DIALOG SET,COMBO1,%%mURL
Ole CallMethod,SHDocVw,"Navigate(^B)",%%mURL
else
%%mURL =
Shell Open,%%FileName
end
List clear,6
List close,6
End
goto evloop
:DWebBrowserEvents2NavigateError
# The next lines extract the event parameters
# The parameters are comma separated
# Save the current field separator
%%OldSep = @fsep()
# Change the field separator to a comma
Option FieldSep,@chr(44)
# Use Parse to separate the parameters into VDS variables
Parse "%%pDisp;%%URL;%%Frame;%%StatusCode;%%Cancel",@Ole(EventParamsList,DWebBrowserEvents2NavigateError)
# Now do something really cool with the parameters
Warn Error: %%URL@CR()StatusCode: %%StatusCode
# Change the field separator back to the original
Option FieldSep,%%OldSep
goto evloop
:DWebBrowserEvents2DocumentComplete
# The next lines extract the event parameters
# The parameters are comma separated
# Save the current field separator
%%OldSep = @fsep()
# Change the field separator to a comma
Option FieldSep,@chr(44)
# Use Parse to separate the parameters into VDS variables
Parse "%%pDisp;%%tURL",@Ole(EventParamsList,DWebBrowserEvents2DocumentComplete)
# Now do something really cool with the parameters
# Change the field separator back to the original
Option FieldSep,%%OldSep
# Normally you would just use the parameters from EventParamsList but since
# %%tURL is a Variant we will save a variable or 2 and just pull the URL from
# the property LocationURL.
%%URL = %%tURL
If %%URL
If @Null(@Match(combo1,%%URL))
List seek,combo1,0
List insert,combo1,%%URL
List seek,combo1,0
End
%%name = @Ole(Get,SHDocVw,^B,LocationName)
Dialog TITLE,SurfXbrowser-GadgetX Web Browser - %%name - %%URL
# Need the Document object to use Ole Command
# This is because the IOleCommandTarget interface is part of the Document object
# not the parent SHDocVw object.
SetVar Document,%%pDisp
End
goto evloop
:DWebBrowserEvents2StatusTextChange
:SETSTATUS
%%mystatustext = @Ole(EventParamsList,DWebBrowserEvents2StatusTextChange)
if %%mystatustext
%%mystatustext = @Trim(%%mystatustext)
# Gadget's EventParamsList function returns strings with quotes around them
# so we need to get rid of them or it will look funny on the status bar.
%%mystatustext = @strdel(%%mystatustext,1)
%%mystatustext = @strdel(%%mystatustext,@len(%%mystatustext))
Dialog Set,Stat,%%mystatustext
end
goto evloop
:DRAGDROP
INFO "Add code here to use the drag & dropped file..."
goto EVLOOP
:BackwardBUTTON
Ole CallMethod,SHDocVw,"GoBack"
goto EVLOOP
:ForwardBUTTON
Ole CallMethod,SHDocVw,"GoForward"
goto EVLOOP
:StopBUTTON
Ole CallMethod,SHDocVw,"Stop"
goto EVLOOP
:RefreshBUTTON
Ole CallMethod,SHDocVw,"Refresh"
goto EVLOOP
:GoBUTTON
%%url = @dlgtext(combo1)
if @not(@null(%%url))
Ole CallMethod,SHDocVw,"Navigate(^B)",%%URL
end
goto EVLOOP
:Open FileMENU
%f = @filedlg()
if %f
Ole CallMethod,SHDocVw,"Navigate(^B)",%f
end
goto EVLOOP
:Open URLMENU
%F = @input(Enter URL to open,http://www.)
if @ok()
Ole Call,SHDocVw,"Navigate(^B)",%f
end
goto EVLOOP
:Save asMENU
# Call IE's Save As Command
# Ole CallMethod,SHDocVw,"ExecWB(^d,^d,^p,^p)",OLECMDID_SAVEAS,OLECMDEXECOPT_PROMPTUSER,NULL,NULL
Ole Command,Document,Exec,OLECMDID_SAVEAS,OLECMDEXECOPT_PROMPTUSER,NULL,NULL
goto EVLOOP
:Page SetupMENU
# Call IE's Page Setup Command
# Ole CallMethod,SHDocVw,"ExecWB(^d,^d,^p,^p)",OLECMDID_PAGESETUP,OLECMDEXECOPT_PROMPTUSER,NULL,NULL
Ole Command,Document,Exec,OLECMDID_PAGESETUP,OLECMDEXECOPT_PROMPTUSER,NULL,NULL
goto evloop
:Print PreviewMENU
# Call IE's Print Preview Command
#Ole CallMethod,SHDocVw,"ExecWB(^d,^d,^p,^p)",OLECMDID_PRINTPREVIEW,OLECMDEXECOPT_PROMPTUSER,NULL,NULL
Ole Command,Document,Exec,OLECMDID_PRINTPREVIEW,OLECMDEXECOPT_PROMPTUSER,NULL,NULL
goto evloop
:PrintMENU
# Call IE's Print Command
# Ole CallMethod,SHDocVw,"ExecWB(^d,^d,^p,^p)",OLECMDID_PRINT,OLECMDEXECOPT_PROMPTUSER,NULL,NULL
Ole Command,Document,Exec,OLECMDID_PRINT,OLECMDEXECOPT_PROMPTUSER,NULL,NULL
goto EVLOOP
:Emport and Export...MENU
# Note: Internet Explorer 6 for Microsoft Windows XP Service Pack 2 (SP2) and later. This method is no longer available.
# Ole CallMethod,ShellUIHelper,"ImportExportFavorites(^b,^B)",OLE_FALSE,""
# So we need to do this the old Win32 API way.
# lets send the request straight to the document window's context menu handler
%A = @SendMsg(%%ShellDocObjectView,@GetVar(WM_COMMAND),@Or(@LOWORD(ID_IE_FILE_IMPORTEXPORT),0),0)
goto evloop
:LargestMENU
# Ok we are going to make these items Radio checked
# Like all of the examples in this file we set the uFlags parameter
# to 1024 for MF_BYPOSITION = 1024
%%Ret = @CallFunc(GetMenuState,%%textsize_menu,0,MF_BYPOSITION)
If @Zero(@And(%%Ret,MF_CHECKED))
%%Ret = @CallFunc(CheckMenuRadioItem,%%textsize_menu,0,4,0,MF_BYPOSITION)
SetVar vaZoomFactorin,4,^d
Ole Command,Document,Exec,OLECMDID_ZOOM,OLECMDEXECOPT_DONTPROMPTUSER,vaZoomFactorin,NULL
End
goto evloop
:LargerMENU
# Ok we are going to make these items Radio checked
# Like all of the examples in this file we set the uFlags parameter
# to 1024 for MF_BYPOSITION = 1024
%%Ret = @CallFunc(GetMenuState,%%textsize_menu,1,MF_BYPOSITION)
If @Zero(@And(%%Ret,MF_CHECKED))
%%Ret = @CallFunc(CheckMenuRadioItem,%%textsize_menu,0,4,1,MF_BYPOSITION)
SetVar vaZoomFactorin,3,^d
Ole Command,Document,Exec,OLECMDID_ZOOM,OLECMDEXECOPT_DONTPROMPTUSER,vaZoomFactorin,NULL
End
goto evloop
:MediumMENU
# Ok we are going to make these items Radio checked
# Like all of the examples in this file we set the uFlags parameter
# to 1024 for MF_BYPOSITION = 1024
%%Ret = @CallFunc(GetMenuState,%%textsize_menu,2,MF_BYPOSITION)
If @Zero(@And(%%Ret,MF_CHECKED))
%%Ret = @CallFunc(CheckMenuRadioItem,%%textsize_menu,0,4,2,MF_BYPOSITION)
SetVar vaZoomFactorin,2,^d
Ole Command,Document,Exec,OLECMDID_ZOOM,OLECMDEXECOPT_DONTPROMPTUSER,vaZoomFactorin,NULL
End
goto evloop
:SmallerMENU
# Ok we are going to make these items Radio checked
# Like all of the examples in this file we set the uFlags parameter
# to 1024 for MF_BYPOSITION = 1024
%%Ret = @CallFunc(GetMenuState,%%textsize_menu,3,MF_BYPOSITION)
If @Zero(@And(%%Ret,MF_CHECKED))
%%Ret = @CallFunc(CheckMenuRadioItem,%%textsize_menu,0,4,3,MF_BYPOSITION)
SetVar vaZoomFactorin,1,^d
Ole Command,Document,Exec,OLECMDID_ZOOM,OLECMDEXECOPT_DONTPROMPTUSER,vaZoomFactorin,NULL
End
goto evloop
:SmallestMENU
# Ok we are going to make these items Radio checked
# Like all of the examples in this file we set the uFlags parameter
# to 1024 for MF_BYPOSITION = 1024
%%Ret = @CallFunc(GetMenuState,%%textsize_menu,4,MF_BYPOSITION)
If @Zero(@And(%%Ret,MF_CHECKED))
%%Ret = @CallFunc(CheckMenuRadioItem,%%textsize_menu,0,4,4,MF_BYPOSITION)
SetVar vaZoomFactorin,0,^d
Ole Command,Document,Exec,OLECMDID_ZOOM,OLECMDEXECOPT_DONTPROMPTUSER,vaZoomFactorin,NULL
End
goto evloop
:Internet optionsMENU
RUN rundll32.exe "shell32.dll,Control_RunDLL inetcpl.cpl,,0"
goto evloop
:SecurityMENU
RUN rundll32.exe "shell32.dll,Control_RunDLL inetcpl.cpl,,1"
goto evloop
:PrivacyMENU
RUN rundll32.exe "shell32.dll,Control_RunDLL inetcpl.cpl,,2"
goto evloop
:ContentMENU
RUN rundll32.exe "shell32.dll,Control_RunDLL inetcpl.cpl,,3"
goto evloop
:ConnectionMENU
RUN rundll32.exe "shell32.dll,Control_RunDLL inetcpl.cpl,,4"
goto evloop
:ProgramsMENU
RUN rundll32.exe "shell32.dll,Control_RunDLL inetcpl.cpl,,5"
goto evloop
:AdvanceMENU
RUN rundll32.exe "shell32.dll,Control_RunDLL inetcpl.cpl,,6"
goto evloop
:View SourceMENU
# %%Body = @Ole(Get,SHDocVw,^B,"document.body.outerHTML")
# Info Source code of page:@CR()@CR()%%Body@CR()
# We can send a WM_COMMAND message to the IE Server's context menu handler to show
# the source in notepad or what ever the user has set as their HTML editor
%A = @SendMsg(%%IEServer,@GetVar(WM_COMMAND),@Or(@LOWORD(ID_IE_CONTEXTMENU_VIEWSOURCE),0),0)
goto evloop
:Add To FavoritesMENU
%%name = @Ole(GetProperty,SHDocVw,^B,LocationName)
%%url = @Ole(GetProperty,SHDocVw,^B,LocationURL)
If @both(%%name,%%url)
Ole CallMethod,ShellUIHelper,"AddFavorite(^B,^B)",%%url,%%name
End
goto evloop
:AboutMENU
Info SurfX Browser DEMO by eXtremeSenses Software@cr()Built for GadgetX!
goto evloop
:ExitMENU
:CLOSE
# Remove the deletekey hotkey
HOTKEY REMOVE,DELETEKEY
# Remove the Message hook for the tab key
SetMsg
SetMsg UnHook,%%SHDocVwMSGHook
# Free the ShellUIHelper object
Ole Free,Object,ShellUIHelper
# Disconnect the events
Ole DisConnectEvents,SHDocVw,DWebBrowserEvents2,%%cookie
# Remove the Browser Object
Ole Remove,SHDocVw,%%winclass
# Free the Browser Object
Ole Free,Object,SHDocVw
#Ole Exceptions,OFF
Ole UnInit
FreeDLL USER32
FreeDLL GDI32
EXIT
copyright © DragonSphere Software 2000-2006
Terms and Conditions