zoukankan      html  css  js  c++  java
  • VB.net和c#利用IOleCommandTarget接口实现Html编辑器的Glyphs(原创)

    Glyphs是当我们像DreamWeaver一样编辑网页时,会显示出每个html标签的图标,点中图片选择htmlelement,可以用来结构化编辑区,实现对非可见区域的编辑,比如编辑script等
    VB.net code
    'showGlyph ,start add by alice ,2005-5-17
                Dim ct As htmlinterface.IOleCommandTarget = m_doc
                
    Dim pguidCmdGroup As Guid = New Guid("DE4BA900-59CA-11CF-9592-444553540000")
                
    If showGlyph Then
                    
    Dim length As Integer = 17
                    
    Dim pvaIn(length) As Object
                    
    Dim i As Integer = 0
                    
    Dim s As String
                    s 
    = Replace(Application.StartupPath, "\""/"& "/glyphs/"
                    pvaIn(0= "%%p^^%%" & s & "pbgn.gif^^%%0^^%%3^^%%3^^%%4^^%%20^^%%15^^%%20^^%%15^^**"
                    pvaIn(1= "%%p^^%%" & s & "pend.gif^^%%1^^%%3^^%%3^^%%4^^%%20^^%%15^^%%20^^%%15^^**"
                    pvaIn(2= "%%anchor^^%%" & s & "anchor.gif^^%%0^^%%3^^%%3^^%%4^^%%20^^%%15^^%%20^^%%15^^**"
                    pvaIn(3= "%%br^^%%" & s & "br.gif^^%%0^^%%3^^%%3^^%%4^^%%20^^%%15^^%%20^^%%15^^**"
                    pvaIn(4= "%%comment^^%%" & s & "comment.gif^^%%0^^%%3^^%%3^^%%4^^%%20^^%%15^^%%20^^%%15^^**"
                    pvaIn(5= "%%div^^%%" & s & "divbgn.gif^^%%0^^%%3^^%%3^^%%4^^%%20^^%%15^^%%20^^%%15^^**"
                    pvaIn(6= "%%div^^%%" & s & "divend.gif^^%%1^^%%3^^%%3^^%%4^^%%20^^%%15^^%%20^^%%15^^**"
                    pvaIn(7= "%%form^^%%" & s & "formbgn.gif^^%%0^^%%3^^%%3^^%%4^^%%20^^%%15^^%%20^^%%15^^**"
                    pvaIn(8= "%%form^^%%" & s & "formend.gif^^%%1^^%%3^^%%3^^%%4^^%%20^^%%15^^%%20^^%%15^^**"
                    pvaIn(9= "%%h3^^%%" & s & "h3bgn.gif^^%%0^^%%3^^%%3^^%%4^^%%20^^%%15^^%%20^^%%15^^**"
                    pvaIn(10= "%%h3^^%%" & s & "h3end.gif^^%%1^^%%3^^%%3^^%%4^^%%20^^%%15^^%%20^^%%15^^**"
                    pvaIn(11= "%%script^^%%" & s & "script.gif^^%%0^^%%3^^%%3^^%%4^^%%20^^%%15^^%%20^^%%15^^**"
                    pvaIn(12= "%%span^^%%" & s & "spanbgn.gif^^%%0^^%%3^^%%3^^%%4^^%%20^^%%15^^%%20^^%%15^^**"
                    pvaIn(13= "%%span^^%%" & s & "spanend.gif^^%%1^^%%3^^%%3^^%%4^^%%20^^%%15^^%%20^^%%15^^**"
                    pvaIn(14= "%%style^^%%" & s & "style.gif^^%%0^^%%3^^%%3^^%%4^^%%20^^%%15^^%%20^^%%15^^**"
                    pvaIn(15= "%%table^^%%" & s & "table.gif^^%%0^^%%3^^%%3^^%%4^^%%20^^%%15^^%%20^^%%15^^**"
                    pvaIn(16= "%%trans^^%%" & s & "trans.gif^^%%0^^%%3^^%%3^^%%4^^%%20^^%%15^^%%20^^%%15^^**"
                    For i = 0 To length - 1
                        ct.Exec(pguidCmdGroup, Convert.ToUInt32(
    2337), Convert.ToUInt32(0), pvaIn(i), Nothing)
                    
    Next
                
    Else
                    ct.Exec(pguidCmdGroup, Convert.ToUInt32(
    2336), Convert.ToUInt32(0), NothingNothing)
                
    End If
                
    'showGlyph end

    c# code

             d4htmlinterface.htmlinterface.IOleCommandTarget ct= (d4htmlinterface.htmlinterface.IOleCommandTarget)EditOcx.DOM;
                   Guid pguidCmdGroup 
    = new Guid("DE4BA900-59CA-11CF-9592-444553540000");
                            
    object[] pvaIn; 
                           
    int length=2;
                          
    int i=0;
                        pvaIn 
    = new object[length];
                         
    string s;
                         s 
    = "G:/d4b/ocx_demo/htmleditdemo/glyphs/";
                         pvaIn[
    0= "%%p^^%%" + s + "pbgn.gif^^%%0^^%%3^^%%3^^%%4^^%%20^^%%15^^%%20^^%%15^^**";
                         pvaIn[
    1= "%%P^^%%" + s + "pend.gif^^%%1^^%%3^^%%3^^%%4^^%%20^^%%15^^%%20^^%%15^^**";
             
    object o=null;
                         
    for(i=0;i<length;i++)ct.Exec(ref pguidCmdGroup, 23370ref pvaIn[i], ref o);
  • 相关阅读:
    VxWorks固件分析方法总结
    WebGoat系列实验Injection Flaws
    WebGoat系列实验Cross-Site Scripting (XSS)
    WebGoat系列实验Denial of Service & Insecure Communication
    WebGoat系列实验Buffer Overflows & Code Quality & Concurrency
    WebGoat系列实验Authentication Flaws
    WebGoat系列实验Access Control Flaws
    20155224 聂小益 《基于Arm实验箱的接口测试和应用》 课程设计报告
    实验补交的链接
    2017-2018-2 20155224『网络对抗技术』Exp4:恶意代码分析
  • 原文地址:https://www.cnblogs.com/alice/p/188648.html
Copyright © 2011-2022 走看看