缘起:由于原来用D版的Webxtra,用得倒是很开心(呵,这不是好事喽,希望大家尽量用正版软件或插件),后来客户发现不能复制与粘贴,这下惨了,就开始想别的办法了,用Activex控件吧,应该也是可以实现的,
研究:用Activex插入网页,复制粘贴的功能是实现了,但打印功能却没有实现,抓狂啊,于是在网上遍寻这方面的资料,都只找到那些前进后退等的普通的用法,可能是搜索的途径有总题吧,后来在MM网上搜索到一个execWB的语法可以实现打印功能,接着十年兄弟也给我回了短信用ExecWB这个可以实现打印和存盘的功能,但没有提及语法及其它,所以时间有限,只得自己动手啊,
转机:后来发现在网上找到一条ExecWB(sprite 1,"6","6"),的语句实现打印功能,喜出望外,终于实现想要的功能,
深入:我想既然能实现打印功能,其它功能应该也可以实现的,但网上一直没有发现ExecWB的语法方面的资料,我想这个问题一定曾经困惑过不少多媒体程序员的,所以想研究一下,后来直接Google搜索ExecWB,翻了不知多少页后,发现有个程序网站有这ExecWB的语法,是C的语法,
Syntax
object.ExecWB( cmdID As OLECMDID, cmdexecopt As OLECMDEXECOPT, [pvaIn As Variant,] [pvaOut As Variant])
我试着将语法对照,改成DR的语句形式,居然通过了,参数列表也一一能用,哈哈,问题解决就这么容易,呵呵,现在想想,现在网络资源这么丰富,其实只要有心去解决一个问题,用点心和动点脑是不会么困难的一件事啊
我想前进后退其它简单的功能就不用说了
GoBack(sprite 1)
GoForward(sprite 1)
refresh(sprite 1)
...
ExecWB语法:(其实是从应用程序里找到的,改一改就是D的语法了,没想到通用喽)
ExecWB( spriteNum, cmdID , cmdexecopt , [pvaIn As Variant,] [pvaOut As Variant])
cmdID有这些值:
OLECMDID_OPEN = 1,
OLECMDID_NEW = 2,
OLECMDID_SAVE = 3,
OLECMDID_SAVEAS = 4,
OLECMDID_SAVECOPYAS = 5,
OLECMDID_PRINT = 6,
OLECMDID_PRINTPREVIEW = 7,
OLECMDID_PAGESETUP = 8,
OLECMDID_SPELL = 9,
OLECMDID_PROPERTIES = 10,
OLECMDID_CUT = 11,
OLECMDID_COPY = 12,
OLECMDID_PASTE = 13,
OLECMDID_PASTESPECIAL = 14,
OLECMDID_UNDO = 15,
OLECMDID_REDO = 16,
OLECMDID_SELECTALL = 17,
OLECMDID_CLEARSELECTION = 18,
OLECMDID_ZOOM = 19,
OLECMDID_GETZOOMRANGE = 20,
OLECMDID_UPDATECOMMANDS = 21,
OLECMDID_REFRESH = 22,
OLECMDID_STOP = 23,
OLECMDID_HIDETOOLBARS = 24,
OLECMDID_SETPROGRESSMAX = 25,
OLECMDID_SETPROGRESSPOS = 26,
OLECMDID_SETPROGRESSTEXT = 27,
OLECMDID_SETTITLE = 28,
OLECMDID_SETDOWNLOADSTATE = 29,
OLECMDID_STOPDOWNLOAD = 30,
OLECMDID_ONTOOLBARACTIVATED = 31,
OLECMDID_FIND = 32,
OLECMDID_DELETE = 33,
OLECMDID_HTTPEQUIV = 34,
OLECMDID_HTTPEQUIV_DONE = 35,
OLECMDID_ENABLE_INTERACTION = 36,
OLECMDID_ONUNLOAD = 37,
OLECMDID_PROPERTYBAG2 = 38,
OLECMDID_PREREFRESH = 39,
OLECMDID_SHOWSCRIPTERROR = 40,
OLECMDID_SHOWMESSAGE = 41,
OLECMDID_SHOWFIND = 42,
OLECMDID_SHOWPAGESETUP = 43,
OLECMDID_SHOWPRINT = 44,
OLECMDID_CLOSE = 45,
OLECMDID_ALLOWUILESSSAVEAS = 46,
OLECMDID_DONTDOWNLOADCSS = 47,
OLECMDID_UPDATEPAGESTATUS = 48,
OLECMDID_PRINT2 = 49,
OLECMDID_PRINTPREVIEW2 = 50,
OLECMDID_SETPRINTTEMPLATE = 51,
OLECMDID_GETPRINTTEMPLATE = 52
OLECMDID_PAGEACTIONBLOCKED = 55,
OLECMDID_PAGEACTIONUIQUERY = 56,
OLECMDID_FOCUSVIEWCONTROLS = 57,
OLECMDID_FOCUSVIEWCONTROLSQUERY = 58
cmdexecopt 有以下值:
OLECMDEXECOPT_DODEFAULT = 0,
OLECMDEXECOPT_PROMPTUSER = 1,
LECMDEXECOPT_DONTPROMPTUSER = 2,
OLECMDEXECOPT_SHOWHELP = 3
Elements
OLECMDEXECOPT_DODEFAULT
Prompt the user for input or not, whichever is the default behavior.
OLECMDEXECOPT_PROMPTUSER
Execute the command after obtaining user input.
OLECMDEXECOPT_DONTPROMPTUSER
Execute the command without prompting the user. For example, clicking the Print toolbar button causes a document to be immediately printed without user input.
OLECMDEXECOPT_SHOWHELP
Show help for the corresponding command, but do not execute.
以存盘为例,这四种模式存出来的文件名和存的内容就不一样喽,大家试试看
ExecWB( sprite 1 , "4","0")
ExecWB( sprite 1 , "4", "1")
ExecWB( sprite 1 , "4", "2")
ExecWB( sprite 1 , "4", "3")