xj qian
2024-07-01 2ae36e271599ea723348132dd7c8a7e139162d18
update print preview
已添加5个文件
已修改20个文件
2464 ■■■■ 文件已修改
jrj/.vscode/settings.json 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/ext-jrj/ext-jrj.vcxproj 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/ext-jrj/ext-jrj.vcxproj.filters 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/printview/Maint.Template.PrintEx.cpp 204 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/printview/Template.Print.Dialog.cpp 1019 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/printview/Template.Print.ViewEx.cpp 518 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kexcel.hpp 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/khtml.hpp 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kutil.hpp 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/system/base.hpp 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/vbusiness/vframe/frame.vframe.vbusiness.hpp 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/vbusiness/vframe/listex.vframe.vbusiness.hpp 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/vbusiness/vframe/responsewin.vframe.vbusiness.hpp 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/vbusiness/vutil/publiccode.vutil.vbusiness.hpp 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/win32/win.hpp 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/win32/xfile.hpp 73 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xbase.hpp 169 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xcontrol.hpp 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xobject.hpp 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xutil.hpp 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xwin.hpp 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/xcontrol/xcombobox.hpp 168 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/xcontrol/xexcel.hpp 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/xcontrol/xhtml.hpp 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/xcontrol/xtreeview.hpp 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/.vscode/settings.json
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,5 @@
{
    "files.associations": {
        "xstring": "cpp"
    }
}
jrj/ext-jrj/ext-jrj.vcxproj
@@ -116,7 +116,7 @@
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>_DEBUG;EXTJRJ_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <PreprocessorDefinitions>_DEBUG;EXTJRJ_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_XWIN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
      <PrecompiledHeader>NotUsing</PrecompiledHeader>
      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
@@ -126,7 +126,7 @@
      <SubSystem>Windows</SubSystem>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <EnableUAC>false</EnableUAC>
      <AdditionalDependencies>xarch.shape.lib;xarch.base.lib;xarch.util.lib;xarch.network.lib;xarch.xframe.lib;xarch.xcontrol.lib;xoffice.xcell.lib;xoffice.xgrid.lib;xoffice.xreport.lib;shlwapi.lib;xoffice.xflow.lib;%(AdditionalDependencies);$(CoreLibraryDependencies)</AdditionalDependencies>
      <AdditionalDependencies>xarch.shape.lib;xarch.base.lib;xarch.util.lib;xarch.network.lib;xarch.xframe.lib;xarch.xcontrol.lib;xoffice.xcell.lib;xoffice.xgrid.lib;xoffice.xreport.lib;shlwapi.lib;xoffice.xflow.lib;comsuppw.lib;%(AdditionalDependencies);$(CoreLibraryDependencies)</AdditionalDependencies>
      <AdditionalLibraryDirectories>D:\xclient64</AdditionalLibraryDirectories>
    </Link>
    <PostBuildEvent>
@@ -179,7 +179,9 @@
    <ClInclude Include="..\xframe\kobject\kdwpages.hpp" />
    <ClInclude Include="..\xframe\kobject\kdwtable.hpp" />
    <ClInclude Include="..\xframe\kobject\kdwview.hpp" />
    <ClInclude Include="..\xframe\kobject\kexcel.hpp" />
    <ClInclude Include="..\xframe\kobject\kflowchart.hpp" />
    <ClInclude Include="..\xframe\kobject\khtml.hpp" />
    <ClInclude Include="..\xframe\kobject\klayersheet.hpp" />
    <ClInclude Include="..\xframe\kobject\knode.hpp" />
    <ClInclude Include="..\xframe\kobject\kpage.hpp" />
@@ -224,7 +226,9 @@
    <ClInclude Include="..\xframe\xcontrol\xdwgrid.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xdwpages.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xdwtable.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xexcel.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xflowchart.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xhtml.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xlayersheet.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xreport.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xshtml.hpp" />
@@ -333,27 +337,47 @@
    <ClCompile Include="..\project\business\Supplier3.list.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\asklist.Owner.Supplier.cpp" />
    <ClCompile Include="..\project\business\Supplier\Inspection.Supplie.cpp" />
    <ClCompile Include="..\project\business\Supplier\list.Owner.Supplier.cpp" />
    <ClCompile Include="..\project\business\Supplier\maint.Document.Supplier.cpp" />
    <ClCompile Include="..\project\business\Supplier\maint.Document.SupplierEx.cpp" />
    <ClCompile Include="..\project\business\Supplier\maint.Document.SupplierSD.cpp" />
    <ClCompile Include="..\project\business\Supplier\maint.Owner.Supplier.cpp" />
    <ClCompile Include="..\project\business\Supplier\maintex.Owner.Supplier.cpp" />
    <ClCompile Include="..\project\business\Supplier\paymen.Supplie.cpp" />
    <ClCompile Include="..\project\business\Supplier\SupplierSource.cpp" />
    <ClCompile Include="..\project\business\Supplier\asklist.Owner.Supplier.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\Inspection.Supplie.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\list.Owner.Supplier.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\maint.Document.Supplier.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\maint.Document.SupplierEx.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\maint.Document.SupplierSD.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\maint.Owner.Supplier.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\maintex.Owner.Supplier.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\paymen.Supplie.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\SupplierSource.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\printview\Maint.Template.PrintEx.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\printview\Template.Print.Dialog.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\printview\Template.Print.ViewEx.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\start.vframe.vbusiness.cpp" />
    <ClCompile Include="..\project\viewobject\view.base.hpp" />
jrj/ext-jrj/ext-jrj.vcxproj.filters
@@ -291,6 +291,18 @@
    <ClInclude Include="..\xframe\kobject\kflowchart.hpp">
      <Filter>xframe\kobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\kobject\khtml.hpp">
      <Filter>xframe\kobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\xcontrol\xhtml.hpp">
      <Filter>xframe\xcontrol</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\kobject\kexcel.hpp">
      <Filter>xframe\kobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\xcontrol\xexcel.hpp">
      <Filter>xframe\xcontrol</Filter>
    </ClInclude>
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="dllmain.cpp">
jrj/project/printview/Maint.Template.PrintEx.cpp
@@ -2,125 +2,125 @@
#include <xcontrol/xtreeview.hpp>
#include <xcontrol/xdwgrid.hpp>
#include <xcontrol/xlayersheet.hpp>
#include <xcontrol/xcell.hpp>
#include "vbusiness/vframe/maint.vframe.vbusiness.hpp"
#include "viewobject/view.base.hpp"
using xml = KXMLDOMDocument;
class __declspec(dllexport) MaintTemplatePrintWin :  public xframe
class __declspec(dllexport) MaintTemplatePrintWin : public xframe
{
public:
    xcell cell;
    xnode    m_agentNode;    //Agent Condition
    xstring args;
public:
    MaintTemplatePrintWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
public:
    static MaintTemplatePrintWin* CreateInstance(void* implPtr, void* hWnd)
    {
    public:
        xcell cell;
        xnode    m_agentNode;    //Agent Condition
        xstring args;
    public:
        MaintTemplatePrintWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
    public:
        static MaintTemplatePrintWin* CreateInstance(void* implPtr, void* hWnd)
        MaintTemplatePrintWin* pWin = new MaintTemplatePrintWin(implPtr, (HWND)hWnd);
        return pWin;
    }
    int SetAgent()
    {
        xstring xfNodeAgentArea = L"agentarea";
        xnode anode = GetAgentNode(xfNodeAgentArea);
        if (m_agentNode)
        {
            MaintTemplatePrintWin* pWin = new MaintTemplatePrintWin(implPtr, (HWND)hWnd);
            return pWin;
            SetAgentNode(anode, m_agentNode);
        }
        int SetAgent()
        else
        {
            xstring xfNodeAgentArea  = L"agentarea";
            xnode anode = GetAgentNode(xfNodeAgentArea);
            if(m_agentNode)
            KXMLDOMElement xframeElement = GetElement();
            KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*");
            if (agent)
            {
                SetAgentNode (anode,m_agentNode);
                xstring s = agent.xml();
                m_agentNode = SetAgentNode(anode, s);
            }
            else
            {
                KXMLDOMElement xframeElement =  GetElement();
                KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/"+xfNodeAgentArea+L"[1]/*");
                if(agent)
                {
                    xstring s = agent.xml();
                    m_agentNode =  SetAgentNode (anode,s);
                }
            }
            return 1;
        }
        return 1;
    }
        //焦点激活处理函数
        int OnSetFocus(TEvent* evt, LPARAM p)
        {
            //重置工具条
            SetAgent();
            return 1;
        }
}
    //焦点激活处理函数
    int OnSetFocus(TEvent* evt, LPARAM p)
    {
        //重置工具条
        SetAgent();
        return 1;
    }
        int SendCtrlCmd(xcontrol xc, xstring cmd)
        {
            win32::SendMessage(xc.GetId(),0x401,cmd,0);
            return 1;
        }
    int SendCtrlCmd(xcontrol xc, xstring cmd)
    {
        SendMessage(xc.GetHWND(), 0x401, (WPARAM)cmd.c_str(), 0);
        return 1;
    }
        //命令发布函数
        int OnCmdDispatch(xstring comdid)
    //命令发布函数
    int OnCmdDispatch(xstring comdid)
    {
        if (comdid.left(3) == L"IK_")
        {
            if(comdid.left(3) == L"IK_")
            {
                xstring cmd = comdid.mid(3, comdid.length());
                SendCtrlCmd(GetControl(L"cell"),cmd);
                return 1;
            }
            else if(comdid==L"xmFileOpen")
            {
                cell.OpenFile();
                cell.Redraw();
                return 1;
            }
            else if(comdid==L"xmFileSave")
            {
                cell.SaveFile();
                return 1;
            }
            else if(comdid==L"xmFileSaveAs")
            {
                cell.SaveFileAs();
                return 1;
            }
            return 0;
        }
        //命令处理事件
        int OnXCommand(TEvent* evt, LPARAM p)
        {
            return OnCmdDispatch(evt->xcommand.pStrID);
        }
        int OnAttachEvent()
        {
            //绑定工具条点击事件
            AttachEvent(L"WM_XCOMMAND", (FEvent)&MaintTemplatePrintWin::OnXCommand);
            //获取焦点事件,用于重置工具条
            AttachEvent(L"WM_SETFOCUS", (FEvent)&MaintTemplatePrintWin::OnSetFocus);
        }
        int onload()
        {
            cell = GetControl(L"cell");
            SetAgent();
            OnAttachEvent();
            if(GetWinParam())
            {
                args = GetParamString();
                cell.openUrl(L"/sale/data/SysPrintTemplate/getdevxsl",args);
            }
            else
                args =L"";
            xstring cmd = comdid.mid(3, comdid.length());
            SendCtrlCmd(cell.GetHWND(), cmd);
            return 1;
        }
        int onloaded()
        else if (comdid == L"xmFileOpen")
        {
            cell.OpenFile();
            cell.Redraw();
            return 1;
        }
        }
        else if (comdid == L"xmFileSave")
        {
            cell.SaveFile();
            return 1;
        }
        else if (comdid == L"xmFileSaveAs")
        {
            cell.SaveFileAs();
            return 1;
        }
        return 0;
    }
    //命令处理事件
    int OnXCommand(TEvent* evt, LPARAM p)
    {
        return OnCmdDispatch(evt->xcommand.pStrID);
    }
    int OnAttachEvent()
    {
        //绑定工具条点击事件
        AttachEvent(L"WM_XCOMMAND", (FEvent)&MaintTemplatePrintWin::OnXCommand);
        //获取焦点事件,用于重置工具条
        AttachEvent(L"WM_SETFOCUS", (FEvent)&MaintTemplatePrintWin::OnSetFocus);
    }
    int onload()
    {
        cell = GetControl(L"cell");
        SetAgent();
        OnAttachEvent();
        if (GetWinParam())
        {
            args = GetParamString();
            cell.openUrl(L"/sale/data/SysPrintTemplate/getdevxsl", args);
        }
        else
            args = L"";
        return 1;
    }
    int onloaded()
    {
        return 1;
    }
};
jrj/project/printview/Template.Print.Dialog.cpp
@@ -4,603 +4,519 @@
#include <xcontrol/xlayersheet.hpp>
#include "vbusiness/vframe/maint.vframe.vbusiness.hpp"
#include "vbusiness/vframe/maint.vframe.vbusiness.hpp"
#include "vbusiness/vframe/responsewin.vframe.vbusiness.hpp"
#include "viewobject/view.base.hpp"
using xml = KXMLDOMDocument;
class __declspec(dllexport) TemplatePrintDialog : public responsewin
DeclWinObject_(TemplatePrintDialog, responsewin)
{
    CreateWinObject_(TemplatePrintDialog, responsewin)
public:
        xaserverarg arg_param;
        xstring m_EntityName;
        xstring m_EntityID;
        xstring m_EntityNo;
        xstring m_Dir;
        xstring m_filePath;
        xstring strNode;
        xdwgrid  dw_list;
        xdwgrid  dw_doclist;
        xole ole_1;
        bool bupdate;
    xaserverarg arg_param;
    xstring m_EntityName;
    xstring m_EntityID;
    xstring m_EntityNo;
    xstring m_Dir;
    xstring m_filePath;
    xstring strNode;
    xdwgrid    dw_list;
    xdwgrid    dw_doclist;
    bool bupdate;
public:
    TemplatePrintDialog(void* implPtr, HWND hWnd) :maint(implPtr, hWnd) {}
    TemplatePrintDialog(void* implPtr, HWND hWnd) :responsewin(implPtr, hWnd) {}
public:
    static TemplatePrintDialog* CreateInstance(void* implPtr, void* hWnd)
    {
        TemplatePrintDialog* pWin = new TemplatePrintDialog(implPtr, (HWND)hWnd);
        return pWin;
        return new TemplatePrintDialog(implPtr, (HWND)hWnd);
    }
        int OnHtml()
public:
    int OnRetrieve()
    {
        xstring username = publiccode::GetUser()->name;
        if (username != L"admin" && m_Dir != username)
        {
            xstring s1=L"<catalog>"+
             "   <book id='bk101'>"+
             "     <author>Gambardella, Matthew</author>"+
             "     <title>XML Developer's Guide</title>"+
             "     <genre>Computer</genre>"+
             "     <price>44.95</price>"+
             "     <publish_date>2000-10-01</publish_date>"+
             "     <description>An in-depth look at creating applications "+
             "     with XML.</description>"+
             "  </book>"+
             "  <book id='bk102'>"+
             "     <author>Ralls, Kim</author>"+
             "     <title>Midnight Rain</title>"+
             "     <genre>Fantasy</genre>"+
             "     <price>5.95</price>"+
             "     <publish_date>2000-12-16</publish_date>"+
             "     <description>A former architect battles corporate zombies, L"+
             "     an evil sorceress, and her own childhood to become queen "+
             "     of the world.</description>"+
             "  </book>"+
             "  </catalog>";
            xml x = new xml;
            x.setNativePointer(xml::CreateInstance());
            x.LoadXml(s1);
//trace(x.GetXml());
            bupdate = false;
        }
        else
        {
            bupdate = true;
        }
        xml x;
            //xstring s2=L"<?xml version='1.0'?>"+
            xstring s2=
            "<xsl:stylesheet version='1.0'"+
            "                xmlns:xsl='http://www.w3.org/1999/XSL/Transform' >"+
            "<xsl:output method='xml' indent='yes'/>"+
            "<xsl:template match='catalog'>"+
            "<HTML>"+
            " <HEAD>"+
            "   <TITLE>Books catalog - listing for Books.xml</TITLE>"+
            " </HEAD>"+
            " <BODY><FONT FACE='Verdana'>"+
            " <H3>My Books Catalog</H3>"+
            " <TABLE CELLPADDING='5' CELLSPACING='2'>"+
            "   <xsl:for-each select='book'>"+
            "   <TR>"+
            "      <TD ALIGN='LEFT'><FONT SIZE='2'><B>ID:</B>&#160;&#160;<xsl:value-of select='@id'/><BR/>"+
            "      <B>Author:</B>&#160;&#160;<xsl:value-of select='author'/><BR/>"+
            "      <B>Title:</B>&#160;&#160;<xsl:value-of select='title'/><BR/>"+
            "      <B>Genre:</B>&#160;&#160;<xsl:value-of select='genre'/><BR/>"+
            "      <B>Price:</B>&#160;&#160;<xsl:value-of select='price'/><BR/>"+
            "      <B>Published on:</B>&#160;&#160;<xsl:value-of select='publish_date'/><BR/>"+
            "      <B>Description:</B>&#160;&#160;<xsl:value-of select='description'/></FONT></TD>"+
            "   </TR>"+
            "   </xsl:for-each>"+
            "</TABLE>"+
            "</FONT>"+
            "</BODY>"+
            "</HTML>"+
            "</xsl:template>"+
            "</xsl:stylesheet>" ;
            xml xsl = new xml;
            xsl.setNativePointer(xml::CreateInstance());
            xsl.LoadXml(s2);
//trace(xsl.GetXml());
        xaserverarg arg;
            xstring strHtml = x.GetXmlDoc().transformNode(xsl.GetXmlDoc());
            //strHtml = str.mid(21,99999);
            ole_1.LoadHtml(strHtml);
            //html_1.SetContent(strHtml);
            //alert(strHtml);
        arg.AddArg(L"Entity", m_EntityName);
        arg.AddArg(L"Dir", m_Dir);
        dw_list.Reset();
        if (xurl::get(L"/sale/data/SysPrintTemplate/listDialog", arg.GetString(), x) != 1)
        {
            trace(x.text());
            return -1;
        }
        else
        {
            xstring s = x.xml();
            dw_list.Retrieve(x);
        }
        dw_list.Redraw();
        //dw_list.SetReadOnly(true);
        if (dw_list.GetRowCount() > 0)
            dw_list.SelectRow(1, true);
        return 1;
    }
            return 0;
        }
        int OnRetrieve()
        {
            xstring username = publiccode::GetUser().name;
            if(username != L"admin" && m_Dir != username )
            {
                bupdate = false;
            }else
            {
                bupdate = true;
            }
            xml x;
            xaserverarg arg;
            arg.AddArg(L"Entity",m_EntityName);
            arg.AddArg(L"Dir",m_Dir);
            dw_list.Reset();
            if (xurl::get(L"/sale/data/SysPrintTemplate/listDialog",arg.GetString(),x) != 1)
            {
                trace(x.text());
                return -1;
            }else
            {
                xstring s = x.xml();
                dw_list.Retrieve(x);
            }
            dw_list.Redraw();
            //dw_list.SetReadOnly(true);
            if (dw_list.GetRowCount()>0)
                dw_list.SelectRow(1,true);
            return 1;
        }
        int OnNewTempl()
        {
            OpenWindow(L"dev:xpage[Maint.Template.Print.vx]");
            return 1;
        }
        int OnMaintTempl()
        {
            int row =  dw_list.GetRow();
            if(row<0 || row>dw_list.GetRowCount())
            {
                alert(L"请选择要维护的模板!");
                return 1;
            }
            else
            {
                KXMLDOMElement ele = dw_list.GetRowElement(row);
                xstring sguid = ele.selectSingleNode(L"ID").text();
                xstring sTemplName = ele.selectSingleNode(L"TemplName").text();
                //xstring sFile = m_filePath + sguid+L".xsl";
                xstring sFile = m_filePath + ele.selectSingleNode(L"urlPath").text();
                arg_param.AddArg(L"xsl",sFile);
                arg_param.AddArg(L"return",L"cancel");
                OpenWindow(L"dev:xpage[Maint.Template.Print.vx]",cast(arg_param.GetString() as int));
                CloseWindow();
            }
            return 1;
        }
        int OnAddDir()
        {
            return 0;
        }
        int OnAddTempl()
        {
            if (m_Dir==L"")
            {
                alert(L"请选择模板目录!");
                return 0;
            }
            xstring sguid = publiccode::GetGuid();
            xstring sname= sguid +L".xsl";
            xstring suri= L"rpttemplate"+L"\\"+m_EntityName; //rpttemplate\SO
            //suri = L"supplier00";
            xstring ret = xaserver::UploadFile(suri, sname, this.GetHWND(),L"",false);
            if (ret == L"-1")
            {
                alert(L"上传的文件没选择!");
                return 1;
            }
            else
            {
                xml x=new xml;
                x.setNativePointer(xml::CreateInstance());
                xaserverarg args = new xaserverarg;
                args.setNativePointer(args.CreateInstance());
                args.AddArg(L"sID",sguid);
                args.AddArg(L"sEntity",m_EntityName);
                args.AddArg(L"sDir",m_Dir);
                args.AddArg(L"urlPath", sname);
                //alert(m_Dir);
                while(ret.find(L"\\",0)>=0)
                    ret = ret.mid(ret.find(L"\\",0) + 1,9999);
                args.AddArg(L"sTemplName",ret);
                //trace(args.GetString());
                if (url::get(L"/sale/data/SysPrintTemplate/Save",args.GetString(),x) != 1)
                {
                    trace(L"error:"+x.GetXml());
                    alert(L"保存出错了!");
                    return 1;
                }
                else
                {
                    alert(L"上传模板成功!");
                    OnRetrieve();
                }
            }
            return 1;
        }
        int OnDelTempl()
        {
            int row =  dw_list.GetRow();
            if(row<0 || row>dw_list.GetRowCount())
            {
                alert(L"请选择要删除的模板!");
                return 0;
            }
            else
            {
                if (win32::MessageBox(GetHWND(),L"确定要删除选中的模板?",L"提示",1) == 2)
                    return 0;
                KXMLDOMElement ele = dw_list.GetRowElement(row);
                xstring sguid = ele.selectSingleNode(L"ID").text;
                xml x=new xml;
                x.setNativePointer(xml::CreateInstance());
                xaserverarg args = new xaserverarg;
                args.setNativePointer(args.CreateInstance());
                args.AddArg(L"sID",sguid);
                if (url::get(L"/sale/data/SysPrintTemplate/Delete",args.GetString(),x) != 1)
                {
                    trace(L"error:"+x.GetXml());
                    alert(L"删除出错了!");
                    return 0;
                }
                else
                {
                    alert(L"删除成功!");
                    OnRetrieve();
                }
            }
            return 0;
        }
        int OnDocListDoubleClicked(ref TNotifyEvent evt,int p)
        {
            int  hCursor = xutil::SetCursorWait();
            OnOpenDocument();
            xutil::RestoreCursor(hCursor);
            return 1;
        }
        int OnDoubleClicked(ref TNotifyEvent evt,int p)
        {
            int  hCursor = xutil::SetCursorWait();
            OnOk();
            xutil::RestoreCursor(hCursor);
            return 1;
        }
    int OnNewTempl()
    {
        OpenWindow(L"dev:xpage[Maint.Template.Print.vx]");
        return 1;
    }
        int OnOpenDocument()
    int OnMaintTempl()
    {
        int row = dw_list.GetRow();
        if (row<0 || row>dw_list.GetRowCount())
        {
            if(dw_doclist.GetRowCount() < 1) return 1;
            xstring documentid = dw_doclist.GetRowElement(dw_doclist.GetRow()).getAttribute(L"guid");
            //xstring billid = dw_docList
            arg_param.AddArg(L"DocumentID",documentid);
            arg_param.AddArg(L"return",L"ok");
            arg_param.AddArg(L"action",L"open");
            alert(L"请选择要维护的模板!");
            return 1;
        }
        else
        {
            KXMLDOMElement ele = dw_list.GetRowElement(row);
            xstring sguid = ele.selectSingleNode(L"ID").text();
            xstring sTemplName = ele.selectSingleNode(L"TemplName").text();
            //xstring sFile = m_filePath + sguid+L".xsl";
            xstring sFile = m_filePath + ele.selectSingleNode(L"urlPath").text();
            arg_param.AddArg(L"xsl", sFile);
            arg_param.AddArg(L"return", L"cancel");
            OpenWindow(L"dev:xpage[Maint.Template.Print.vx]", arg_param);
            CloseWindow();
            return 1;
        }
        int OnOk()
        return 1;
    }
    int OnAddDir()
    {
        return 0;
    }
    int OnAddTempl()
    {
        if (m_Dir == L"")
        {
            int row =  dw_list.GetRow();
            if(row<0 || row>dw_list.GetRowCount())
            {
                alert(L"请选择要打印的模板!");
                return 1;
            }
            else
            {
                KXMLDOMElement ele = dw_list.GetRowElement(row);
                trace(L"\r\n---------------");
                trace(ele.xml);
                xstring sguid = ele.selectSingleNode(L"ID").text;
                xstring pre = L"";
                if(ele.selectSingleNode(L"TemplPre")) pre = ele.selectSingleNode(L"TemplPre").text;
                xstring sTemplName = ele.selectSingleNode(L"TemplName").text;
                //xstring sFile = m_filePath + sguid+L".xsl";
                trace(sTemplName);
                xstring sFile = m_filePath + ele.selectSingleNode(L"urlPath").text;
                arg_param.AddArg(L"xsl",sFile);
                arg_param.AddArg(L"return",L"ok");
                arg_param.AddArg(L"template-name",sTemplName);
                arg_param.AddArg(L"template-guid",sguid);
                arg_param.AddArg(L"template-pre",pre);
                arg_param.AddArg(L"action",L"new");
                trace(arg_param.GetString());
                CloseWindow();
                /*xaserver::CreateDirectory(L"C:/Temp");
                int openRet = xaserver::DownLoadFile(GetServerUrl(),m_filePath+file,sTemplName,L"C:/Temp/"+sTemplName);
                if(openRet < 0)
                {
                    alert(L"文件打开失败!");
                    return 0;
                }
                int GENERIC_READ = 0x80000000;
                int GENERIC_WRITE = 0x40000000;
                int FILE_SHARE_READ = 0x00000001;
                int FILE_SHARE_WRITE = 0x00000002;
                int OPEN_EXISTING = 3;
                int FILE_ATTRIBUTE_ARCHIVE =0x00000020;
                int hFile = xwin::CreateFile(L"C:/Temp/"+sTemplName,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,0,OPEN_EXISTING,0,0);
                if (hFile >0)
                {
                    //int GMEM_MOVEABLE=0x0002;
                    //int GMEM_ZEROINIT=0x0040;
                    //int MEMSIZE;
                    //int hMemory = GlobalAlloc(GMEM_MOVEABLE|GMEM_ZEROINIT,MEMSIZE);
                    //int pMemory = GlobalLock(hMemory);
                    //int SizeReadWrite;
                    //xwin::ReadFile(hFile,pMemory,MEMSIZE - 1,SizeReadWrite,0);
                    int filesize = xwin::GetFileSize(hFile,0);
                trace(L"filesize = %d",filesize);
                    xstring buffer = L"".space(filesize+1);
                    int readsize = new int;
                    xwin::ReadFile(hFile,buffer,filesize,readsize,0);
                    trace(buffer);
                    xwin::CloseHandle(hFile);
                    //GlobalUnlock(pMemory);
                    //GlobalFree(hMemory);
                }    */
                /*openRet = xwin::ShellExecute(0,L"open",L"C:/Temp/"+sTemplName,L"",L"",5);
                if(openRet < 32)
                {
                    alert(L"文件打开失败2!");
                    return 0;
                }*/
            }
            alert(L"请选择模板目录!");
            return 0;
        }
        int OnSave()
        xstring sguid = publiccode::GetGuid();
        xstring sname = sguid + L".xsl";
        xstring suri = L"rpttemplate\\" + m_EntityName; //rpttemplate\SO
        //suri = L"supplier00";
        xstring ret = xaserver::UploadFile(suri, sname, GetHWND(), L"", false);
        if (ret == L"-1")
        {
            dw_list.AcceptText();
            xml x = new xml;
            x.setNativePointer(xml::CreateInstance());
            dw_list.DwUpdateAllToEx(x.GetXmlDoc());
            xaserverarg arg = new xaserverarg;
            arg.setNativePointer(xaserverarg::CreateInstance());
            arg.AddArg(L"content",x.GetXml());
            if (url::get(L"/sale/data/SysPrintTemplate/updateinfo",arg.GetString(),x) != 1)
            alert(L"上传的文件没选择!");
            return 1;
        }
        else
        {
            xml x;
            xaserverarg args;
            args.AddArg(L"sID", sguid);
            args.AddArg(L"sEntity", m_EntityName);
            args.AddArg(L"sDir", m_Dir);
            args.AddArg(L"urlPath", sname);
            //alert(m_Dir);
            while (ret.find(L"\\", 0) >= 0)
                ret = ret.mid(ret.find(L"\\", 0) + 1, 9999);
            args.AddArg(L"sTemplName", ret);
            //trace(args.GetString());
            if (xurl::get(L"/sale/data/SysPrintTemplate/Save", args.GetString(), x) != 1)
            {
                trace(L"error:"+x.GetXml());
                trace((xstring)L"error:" + x.xml());
                alert(L"保存出错了!");
                return 1;
            }
            }
            else
            {
                dw_list.ResetUpdateStatus();
                alert(L"保存成功!");
            }
            return 1;
        }
        int PreOnCmdDispatch(xstring comdid)
        {
            //返回0——不在执行以下代码;返回其他——执行以下代码。
            if(comdid.left(8) == L"xmPanel:"){
                xstring no = comdid.mid(8, 99);
                //int id = no.toInt();
                xml x = new xml;
                x.setNativePointer(xml::CreateInstance());
                x.LoadXml(strNode);
                KXMLDOMDocument doc= x.GetXmlDoc();
                KXMLDOMElement e = doc.documentElement;
                xstring slable =e.selectSingleNode(L"//xtoolbutton[@name='"+comdid+L"']/@caption").text;
                m_Dir = slable;
                OnRetrieve();
                return 1;
            }
            if (comdid==L"xmAddDir") return OnAddDir();
            if (comdid==L"xmAddTempl" && bupdate) return OnAddTempl();
            if (comdid==L"xmDelTempl" && bupdate) return OnDelTempl();
            if (comdid==L"xmMaintTempl" && bupdate) return OnMaintTempl();
            if (comdid==L"xmNewTempl" && bupdate) return OnNewTempl();
            if (comdid==L"xmHtml") return OnHtml();
            if (comdid==L"xmOk") return OnOk();
            if (comdid==L"xmSave") return OnSave();
            if(comdid==L"xmOpen") return OnOpenDocument();
            else if (comdid==L"xmCancel")
            {
                arg_param.AddArg(L"return",L"cancel");
                CloseWindow();
                return 1;
                alert(L"上传模板成功!");
                OnRetrieve();
            }
        }
        return 1;
    }
    int OnDelTempl()
    {
        int row = dw_list.GetRow();
        if (row<0 || row>dw_list.GetRowCount())
        {
            alert(L"请选择要删除的模板!");
            return 0;
        }
        int PostOnAttachEvent()
        else
        {
            //AttachEvent(L"dw_list",L"DWV_ROWFOCUSCHANGED",OnRowChanged);
            //AttachEvent(L"dw_list",L"DWV_CLICKED",OnClicked);
            //AttachEvent(L"dw_list",L"DWV_RCLICKED",OnRClicked);
            //AttachEvent(L"dw_list",L"DWV_ITEMCHANGED",OnItemChanged);
            //AttachEvent(L"dw_list",L"DWV_CHILDCONTENT",OnChildContent);
            AttachEvent(L"dw_doclist",L"DWV_DOUBLECLICKED",OnDocListDoubleClicked);
            AttachEvent(L"dw_list",L"DWV_DOUBLECLICKED",OnDoubleClicked);
            return 1;
        }
        int SetAgent()
        {
            PUser puser = new PUser;
            puser =  publiccode::GetUser();
            xstring susername = puser.name;
            if (susername !=L"admin")
            if (MessageBox(GetHWND(), L"确定要删除选中的模板?", L"提示", 1) == 2)
                return 0;
            KXMLDOMElement ele = dw_list.GetRowElement(row);
            xstring sguid = ele.selectSingleNode(L"ID").text();
            xml x;
            xaserverarg args;
            args.AddArg(L"sID", sguid);
            if (xurl::get(L"/sale/data/SysPrintTemplate/Delete", args.GetString(), x) != 1)
            {
                xstring xfNodeAgentArea  = L"DirButton";
                xnode anode = GetAgentNode(xfNodeAgentArea);
                KXMLDOMElement xframeElement =  GetElement();
                xstring tools=L"<vbox name='DirButton' height='48' />";
                SetAgentNode(anode, tools);
            }
            return 1;
        }
        int CreateDir()
        {
            PUser puser = new PUser;
            puser =  publiccode::GetUser();
            xstring susername = puser.name;
            xml x = new xml;
            x.setNativePointer(xml::CreateInstance());
            xaserverarg arg = new xaserverarg;
            arg.setNativePointer(arg.CreateInstance());
            arg.AddArg(L"EntityName",m_EntityName,L"");
            arg.AddArg(L"EntityID",m_EntityID,L"");
            arg.AddArg(L"susername",susername,L""); //
            if (url::get(L"/sale/data/SysPrintTemplate/Dir",arg.GetString(),x) != 1)
            {
                trace(x.GetXmlDoc().text);
                return -1;
            }else
            {
                xstring s = x.GetXml();
            }
            KXMLDOMNodeList  nlist = x.GetXmlDoc().selectNodes(L"//Entity");
            int i;
            int nlen = nlist.length;
            xstring toolStr = L"<vbox name='Dir'>";
            xstring deptName= publiccode::GetUser().deptname;
            if(deptName==L"跟单部" && m_EntityName==L"GDN3"){
                for(i=2;    i<nlen;    i++)
                {
                    KXMLDOMElement e1 = nlist.item(i);
                    xstring sDir1 = e1.selectSingleNode(L"@Dir").text;
                    xstring str1 = L"<xtoolbutton image='15' caption='"+sDir1+L"' height='24' name='xmPanel:"+i.toString()+L"' style='background-color:none #ceecce none #ffffff'/>";
                    toolStr += str1;
                    if (i==2)
                        m_Dir = sDir1;
                }
            }else if(deptName.find(L"业务")>=0 && m_EntityName==L"GDN3"  )
            {
                for(i=1;    i<2;    i++)
                {
                    KXMLDOMElement e2 = nlist.item(i);
                    xstring sDir2 = e2.selectSingleNode(L"@Dir").text;
                    xstring str2 = L"<xtoolbutton image='15' caption='"+sDir2+L"' height='24' name='xmPanel:"+i.toString()+L"' style='background-color:none #ceecce none #ffffff'/>";
                    toolStr += str2;
                    if (i==1)
                        m_Dir = sDir2;
                }
                for(i=4;    i<nlen;    i++)
                {
                    KXMLDOMElement e3 = nlist.item(i);
                    xstring sDir3 = e3.selectSingleNode(L"@Dir").text;
                    xstring str3 = L"<xtoolbutton image='15' caption='"+sDir3+L"' height='24' name='xmPanel:"+i.toString()+L"' style='background-color:none #ceecce none #ffffff'/>";
                    toolStr += str3;
                }
            }else{
                for(i=0;    i<nlen;    i++)
                {
                    KXMLDOMElement e = nlist.item(i);
                    xstring sDir = e.selectSingleNode(L"@Dir").text;
                    xstring str = L"<xtoolbutton image='15' caption='"+sDir+L"' height='24' name='xmPanel:"+i.toString()+L"' style='background-color:none #ceecce none #ffffff'/>";
                    toolStr += str;
                    if (i==0)
                        m_Dir = sDir;
                }
            }
            toolStr += L"</vbox>";
            strNode = toolStr;
            //trace(toolStr);
            xnode anode = GetAgentNode(L"Dir");
            xwin::SetAgentNode(anode,toolStr) ;
            OnRetrieve();
            return 1;
        }
        int OnInit()
        {
            SetAgent();
            dw_list = this.GetControl(L"dw_list");
            dw_list.openUrl(L"/sale/view/view.base/template/PrintView/listDialog");
            dw_list.SetReadOnly(true);
            dw_list.SetSelectionMode(4);
            dw_list.SetColumnState(L"ID",false);
            dw_doclist = GetControl(L"dw_doclist");
            dw_doclist.openUrl(L"/sale/view/GDN/template/doclist");
            xstring sUrl = GetServerUrl();
            sUrl = sUrl.mid(0, sUrl.length() - 19);
            m_filePath = L"/business/rpttemplate";
            arg_param = new xaserverarg;
            if (GetParam())
            {
                int p = GetParam();
                arg_param.setNativePointer(p);
                m_EntityName = arg_param.GetArgString(L"EntityName");
                m_EntityID = arg_param.GetArgString(L"EntityID");
                m_EntityNo = arg_param.GetArgString(L"EntityNo");
                xaserverarg arg = new xaserverarg;
                arg.setNativePointer(xaserverarg::CreateInstance());
                arg.AddArg(L"EntityName", m_EntityName);
                arg.AddArg(L"EntityID", m_EntityID);
                arg.AddArg(L"EntityNo", m_EntityNo);
                xml x =new xml;
                x.setNativePointer(xml::CreateInstance());
                if(url::get(L"/sale/data/DocumentList3/bill/doclist", arg.GetString(),x)!=1)
                {
                    xstring error = x.GetXmlDoc().text;
                    trace(error);
                }else
                {
                    dw_doclist.Retrieve(x);
                    dw_doclist.SetReadOnly(true);
                }
                trace((xstring)L"error:" + x.xml());
                alert(L"删除出错了!");
                return 0;
            }
            else
            {
                arg_param.setNativePointer(arg_param.CreateInstance());
                m_EntityName = L"SO";
                m_EntityID =L"00000000-0000-0000-0000-000000000000";
                alert(L"删除成功!");
                OnRetrieve();
            }
        }
            m_Dir = L"";
            m_filePath = m_filePath + L"/" + m_EntityName+L"/";
            //trace(m_filePath);
            CreateDir();
        return 0;
    }
    int OnDocListDoubleClicked(TEvent * evt, int p)
    {
        HCURSOR  hCursor = xutil::SetCursorWait();
        OnOpenDocument();
        xutil::RestoreCursor(hCursor);
        return 1;
    }
    int OnDoubleClicked(TEvent * evt, int p)
    {
        HCURSOR hCursor = xutil::SetCursorWait();
        OnOk();
        xutil::RestoreCursor(hCursor);
        return 1;
    }
    int OnOpenDocument()
    {
        if (dw_doclist.GetRowCount() < 1) return 1;
        xstring documentid = dw_doclist.GetRowElement(dw_doclist.GetRow()).getAttribute(L"guid");
        //xstring billid = dw_docList
        arg_param.AddArg(L"DocumentID", documentid);
        arg_param.AddArg(L"return", L"ok");
        arg_param.AddArg(L"action", L"open");
        CloseWindow();
        return 1;
    }
    int OnOk()
    {
        int row = dw_list.GetRow();
        if (row<0 || row>dw_list.GetRowCount())
        {
            alert(L"请选择要打印的模板!");
            return 1;
        }
    int onload()
    {
        responsewin::onload();
        /*if (GetParam())
        else
        {
            xstring action = arg_param.GetArgString(L"action");
            if(action==L"open" || (action==L"" && dw_doclist.GetRowCount() > 0))
                SwitchLayer(L"sheet2",L"frame");
            KXMLDOMElement ele = dw_list.GetRowElement(row);
            trace(L"\r\n---------------");
            trace(ele.xml());
            xstring sguid = ele.selectSingleNode(L"ID").text();
            xstring pre = L"";
            if (ele.selectSingleNode(L"TemplPre")) pre = ele.selectSingleNode(L"TemplPre").text();
            xstring sTemplName = ele.selectSingleNode(L"TemplName").text();
            //xstring sFile = m_filePath + sguid+L".xsl";
            trace(sTemplName);
            xstring sFile = m_filePath + ele.selectSingleNode(L"urlPath").text();
            arg_param.AddArg(L"xsl", sFile);
            arg_param.AddArg(L"return", L"ok");
            arg_param.AddArg(L"template-name", sTemplName);
            arg_param.AddArg(L"template-guid", sguid);
            arg_param.AddArg(L"template-pre", pre);
            arg_param.AddArg(L"action", L"new");
            trace(arg_param.GetString());
            CloseWindow();
            /*xaserver::CreateDirectory(L"C:/Temp");
            int openRet = xaserver::DownLoadFile(GetServerUrl(),m_filePath+file,sTemplName,L"C:/Temp/"+sTemplName);
            if(openRet < 0)
            {
                alert(L"文件打开失败!");
                return 0;
            }
            int GENERIC_READ = 0x80000000;
            int GENERIC_WRITE = 0x40000000;
            int FILE_SHARE_READ = 0x00000001;
            int FILE_SHARE_WRITE = 0x00000002;
            int OPEN_EXISTING = 3;
            int FILE_ATTRIBUTE_ARCHIVE =0x00000020;
            int hFile = xwin::CreateFile(L"C:/Temp/"+sTemplName,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,0,OPEN_EXISTING,0,0);
            if (hFile >0)
            {
                //int GMEM_MOVEABLE=0x0002;
                //int GMEM_ZEROINIT=0x0040;
                //int MEMSIZE;
                //int hMemory = GlobalAlloc(GMEM_MOVEABLE|GMEM_ZEROINIT,MEMSIZE);
                //int pMemory = GlobalLock(hMemory);
                //int SizeReadWrite;
                //xwin::ReadFile(hFile,pMemory,MEMSIZE - 1,SizeReadWrite,0);
                int filesize = xwin::GetFileSize(hFile,0);
            trace(L"filesize = %d",filesize);
                xstring buffer = L"".space(filesize+1);
                int readsize = new int;
                xwin::ReadFile(hFile,buffer,filesize,readsize,0);
                trace(buffer);
                xwin::CloseHandle(hFile);
                //GlobalUnlock(pMemory);
                //GlobalFree(hMemory);
            }    */
            /*openRet = xwin::ShellExecute(0,L"open",L"C:/Temp/"+sTemplName,L"",L"",5);
            if(openRet < 32)
            {
                alert(L"文件打开失败2!");
                return 0;
            }*/
        }
        */
        return 0;
    }
    int OnSave()
    {
        dw_list.AcceptText();
        xml x;
        dw_list.DwUpdateAllToEx(x);
        xaserverarg arg;
        arg.setNativePointer(xaserverarg::CreateInstance());
        arg.AddArg(L"content", x.xml());
        if (xurl::get(L"/sale/data/SysPrintTemplate/updateinfo", arg.GetString(), x) != 1)
        {
            trace((xstring)L"error:" + x.xml());
            alert(L"保存出错了!");
            return 1;
        }
        else
        {
            dw_list.ResetUpdateStatus();
            alert(L"保存成功!");
        }
        return 1;
    }
    int onloaded()
    int PreOnCmdDispatch(xstring comdid)
    {
        //responsewin::onload();
        //返回0——不在执行以下代码;返回其他——执行以下代码。
        if (comdid.left(8) == L"xmPanel:") {
            xstring no = comdid.mid(8, 99);
            //int id = no.toInt();
            xml x;
            x.loadXML(strNode);
            KXMLDOMDocument doc = x;
            KXMLDOMElement e = doc.documentElement();
            xstring slable = e.selectSingleNode(L"//xtoolbutton[@name='" + comdid + L"']/@caption").text();
            m_Dir = slable;
            OnRetrieve();
            return 1;
        }
        if (comdid == L"xmAddDir") return OnAddDir();
        if (comdid == L"xmAddTempl" && bupdate) return OnAddTempl();
        if (comdid == L"xmDelTempl" && bupdate) return OnDelTempl();
        if (comdid == L"xmMaintTempl" && bupdate) return OnMaintTempl();
        if (comdid == L"xmNewTempl" && bupdate) return OnNewTempl();
        //if (comdid==L"xmHtml") return OnHtml();
        if (comdid == L"xmOk") return OnOk();
        if (comdid == L"xmSave") return OnSave();
        if (comdid == L"xmOpen") return OnOpenDocument();
        else if (comdid == L"xmCancel")
        {
            arg_param.AddArg(L"return", L"cancel");
            CloseWindow();
            return 1;
        }
        return 0;
    }
    int PostOnAttachEvent()
    {
        //AttachEvent(L"dw_list",L"DWV_ROWFOCUSCHANGED",OnRowChanged);
        //AttachEvent(L"dw_list",L"DWV_CLICKED",OnClicked);
        //AttachEvent(L"dw_list",L"DWV_RCLICKED",OnRClicked);
        //AttachEvent(L"dw_list",L"DWV_ITEMCHANGED",OnItemChanged);
        //AttachEvent(L"dw_list",L"DWV_CHILDCONTENT",OnChildContent);
        AttachEvent(L"dw_doclist", L"DWV_DOUBLECLICKED", (FEvent)&TemplatePrintDialog::OnDocListDoubleClicked);
        AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&TemplatePrintDialog::OnDoubleClicked);
        return 1;
    }
    int SetAgent()
    {
        PUser& puser = *publiccode::GetUser();
        xstring susername = puser.name;
        if (susername != L"admin")
        {
            xstring xfNodeAgentArea = L"DirButton";
            xnode anode = GetAgentNode(xfNodeAgentArea);
            KXMLDOMElement xframeElement = GetElement();
            xstring tools = L"<vbox name='DirButton' height='48' />";
            SetAgentNode(anode, tools);
        }
        return 1;
    }
    int CreateDir()
    {
        PUser& puser = *publiccode::GetUser();
        xstring susername = puser.name;
        xml x;
        xaserverarg arg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg(L"EntityName", m_EntityName, L"");
        arg.AddArg(L"EntityID", m_EntityID, L"");
        arg.AddArg(L"susername", susername, L""); //
        if (xurl::get(L"/sale/data/SysPrintTemplate/Dir", arg.GetString(), x) != 1)
        {
            trace(x.text());
            return -1;
        }
        else
        {
            xstring s = x.xml();
        }
        KXMLDOMNodeList  nlist = x.selectNodes(L"//Entity");
        int i;
        int nlen = nlist.length();
        xstring toolStr = L"<vbox name='Dir'>";
        xstring deptName = publiccode::GetUser()->deptname;
        if (deptName == L"跟单部" && m_EntityName == L"GDN3") {
            for (i = 2; i < nlen; i++)
            {
                KXMLDOMElement e1 = nlist.item(i);
                xstring sDir1 = e1.selectSingleNode(L"@Dir").text();
                xstring str1 = L"<xtoolbutton image='15' caption='" + sDir1 + L"' height='24' name='xmPanel:" + xstring(i) + L"' style='background-color:none #ceecce none #ffffff'/>";
                toolStr += str1;
                if (i == 2)
                    m_Dir = sDir1;
            }
        }
        else if (deptName.find(L"业务") >= 0 && m_EntityName == L"GDN3")
        {
            for (i = 1; i < 2; i++)
            {
                KXMLDOMElement e2 = nlist.item(i);
                xstring sDir2 = e2.selectSingleNode(L"@Dir").text();
                xstring str2 = L"<xtoolbutton image='15' caption='" + sDir2 + L"' height='24' name='xmPanel:" + xstring(i) + L"' style='background-color:none #ceecce none #ffffff'/>";
                toolStr += str2;
                if (i == 1)
                    m_Dir = sDir2;
            }
            for (i = 4; i < nlen; i++)
            {
                KXMLDOMElement e3 = nlist.item(i);
                xstring sDir3 = e3.selectSingleNode(L"@Dir").text();
                xstring str3 = L"<xtoolbutton image='15' caption='" + sDir3 + L"' height='24' name='xmPanel:" + xstring(i) + L"' style='background-color:none #ceecce none #ffffff'/>";
                toolStr += str3;
            }
        }
        else {
            for (i = 0; i < nlen; i++)
            {
                KXMLDOMElement e = nlist.item(i);
                xstring sDir = e.selectSingleNode(L"@Dir").text();
                xstring str = L"<xtoolbutton image='15' caption='" + sDir + L"' height='24' name='xmPanel:" + xstring(i) + L"' style='background-color:none #ceecce none #ffffff'/>";
                toolStr += str;
                if (i == 0)
                    m_Dir = sDir;
            }
        }
        toolStr += L"</vbox>";
        strNode = toolStr;
        //trace(toolStr);
        xnode anode = GetAgentNode(L"Dir");
        xwin::SetAgentNode(anode, toolStr);
        OnRetrieve();
        return 1;
    }
    int OnInit()
    {
        SetAgent();
        dw_list = GetControl(L"dw_list");
        dw_list.openUrl(L"/sale/view/view.base/template/PrintView/listDialog");
        dw_list.SetReadOnly(true);
        dw_list.SetSelectionMode(4);
        dw_list.SetColumnState(L"ID", false);
        dw_doclist = GetControl(L"dw_doclist");
        dw_doclist.openUrl(L"/sale/view/GDN/template/doclist");
        xstring sUrl = GetServerUrl();
        sUrl = sUrl.mid(0, sUrl.length() - 19);
        m_filePath = L"/business/rpttemplate";
        arg_param;
        if (GetWinParam())
        {
            arg_param = GetArg();
            m_EntityName = arg_param.GetArgString(L"EntityName");
            m_EntityID = arg_param.GetArgString(L"EntityID");
            m_EntityNo = arg_param.GetArgString(L"EntityNo");
            xaserverarg arg;
            arg.setNativePointer(xaserverarg::CreateInstance());
            arg.AddArg(L"EntityName", m_EntityName);
            arg.AddArg(L"EntityID", m_EntityID);
            arg.AddArg(L"EntityNo", m_EntityNo);
            xml x = new xml;
            if (xurl::get(L"/sale/data/DocumentList3/bill/doclist", arg.GetString(), x) != 1)
            {
                xstring error = x.text();
                trace(error);
            }
            else
            {
                dw_doclist.Retrieve(x);
                dw_doclist.SetReadOnly(true);
            }
        }
        else
        {
            arg_param.setNativePointer(arg_param.CreateInstance());
            m_EntityName = L"SO";
            m_EntityID = L"00000000-0000-0000-0000-000000000000";
        }
        m_Dir = L"";
        m_filePath = m_filePath + L"/" + m_EntityName + L"/";
        //trace(m_filePath);
        CreateDir();
        return 1;
    }
    int onload()
    {
        SetArg();
        responsewin::onload();
        /*if (GetParam())
        {
            xstring action = arg_param.GetArgString(L"action");
@@ -608,6 +524,7 @@
                SwitchLayer(L"sheet2",L"frame");
        }
        */
        return 1;
    }
};
jrj/project/printview/Template.Print.ViewEx.cpp
@@ -1,13 +1,31 @@
#include <guiddef.h>
#include <exdisp.h>        // Defines of stuff like IWebBrowser2. This is an include file with Visual C 6 and above
#include <mshtml.h>        // Defines of stuff like IHTMLDocument2. This is an include file with Visual C 6 and above
#include <mshtmhst.h>    // Defines of stuff like IDocHostUIHandler. This is an include file with Visual C 6 and above
#include <Shlwapi.h>
#include <Windows.h>
#include <comutil.h>
#undef _XWIN
#include <wobject/xstring.hpp>
#include <xcontrol/xtreeview.hpp>
#include <xcontrol/xdwgrid.hpp>
#include <xcontrol/xlayersheet.hpp>
#include <xcontrol/xhtml.hpp>
#include <wobject/xutil.hpp>
#include "vbusiness/vframe/maint.vframe.vbusiness.hpp"
#include "viewobject/view.base.hpp"
#include <xcontrol/xcell.hpp>
#include <xcontrol/xexcel.hpp>
#include <xcontrol/xhtml.hpp>
#include <win32/xfile.hpp>
using xml = KXMLDOMDocument;
#if 0
namespace _excel for ole "Excel.Application,{00020813-0000-0000-C000-000000000046}";
namespace _mshtml for ole "MSHtml,{3050F1C5-98B5-11CF-BB82-00AA00BDCE0B}";
@@ -22,45 +40,13 @@
    void SaveToFile(xstring filename) alias "?SaveToFile@CExcelApplication@@QAEXQA_W@Z";
    void Quit() alias "?Quit@CExcelApplication@@QAEXXZ";
};
struct MYOPENFILENAMEW
{
   unsigned int    lStructSize;
   unsigned int   hwndOwner;
   unsigned int   hInstance;
   xstring                 lpstrFilter;
   xstring               lpstrCustomFilter;
   unsigned int   nMaxCustFilter;
   unsigned int        nFilterIndex;
   xstring                    lpstrFile;
   unsigned int        nMaxFile;
   xstring                    lpstrFileTitle;
   unsigned int        nMaxFileTitle;
   xstring      lpstrInitialDir;
   xstring                  lpstrTitle;
   unsigned int       Flags;
   unsigned short   nFileOffset;
   unsigned short   nFileExtension;
   xstring      lpstrDefExt;
   unsigned int   lCustData;
   unsigned int     lpfnHook;
   xstring      lpTemplateName;
    //_WIN32_WINNT >= 0x0500
   unsigned int         pvReserved;
   unsigned int        dwReserved;
   unsigned int        FlagsEx;
    // (_WIN32_WINNT >= 0x0500)
};
#endif
    
class  __declspec(dllexport) TemplatePrintViewEx : public xframe
DeclWinObject_(TemplatePrintViewEx, xframe)
{    
    CreateWinObject_(TemplatePrintViewEx, xframe)
public:
    xole ole_print;
    xhtml ole_print;
    xcell cell;
    xstring m_EntityName;
    xstring m_EntityID;
@@ -70,7 +56,6 @@
    bool updated;
    xstring   htmlStr;
    cexcel   excel;
    bool        editing;
    xstring  billName ;
@@ -82,49 +67,26 @@
    //bool showgrid;
    bool PaperPrint;
#if 0
    cexcel   excel;
    static stdcall int GetModuleFileName(int hModule ,xstring lpFileName ,int nSize ) native from "kernel32.dll" alias "GetModuleFileNameW";
    static stdcall int PathRemoveFileSpec(xstring lpFileName ) native from "shlwapi.dll" alias "PathRemoveFileSpecW";
    static stdcall int DeleteFile(xstring lpFileName) native from "kernel32.dll" alias "DeleteFileW";    
    static stdcall bool GetSaveFileName(ref MYOPENFILENAMEW)native from "comdlg32.dll" alias "GetSaveFileNameW"; 
#endif
public:
    TemplatePrintViewEx(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
public:
    static TemplatePrintViewEx* CreateInstance(void* implPtr, void* hWnd)
    {
        TemplatePrintViewEx* pWin = new TemplatePrintViewEx(implPtr, (HWND)hWnd);
        return pWin;
    }
    xstring GetModulePath()
    {
        xstring str =L"";
        str = str.space(255);
        GetModuleFileName(0,str,250);
        PathRemoveFileSpec(str);
        return str;
    }
    xstring GetModuleTmpPath()
    {
        xstring str =L"";
        str = str.space(255);
        GetModuleFileName(0,str,250);
        PathRemoveFileSpec(str);
        xstring tmp = str + L"\\Temp";
        xaserver::CreateDirectory(tmp);
        return tmp;
    }
    xstring GetSaveFileName(xstring initFileName, xstring filter, xstring ext)
    {
        char[]  szFileName = new char[255] ;
        char[]  szPath =  new char[255];
        wchar_t  szFileName[255];
        wchar_t  szPath[255];
        szFileName[0] = 0;
        szPath[0] = 0;
        
        if(initFileName !=L"")
        {
            int len = initFileName.length();
            char[] tmp = initFileName;
            const wchar_t* tmp = initFileName;
            for(int i=0; i<len+1;i++)
            {
                //szFileName[i] = tmp[i];
@@ -133,7 +95,7 @@
        }
        
        int     nFilterIndex = 1;
        ref MYOPENFILENAMEW ofn = new MYOPENFILENAMEW;
        OPENFILENAMEW ofn;
        ofn.lStructSize = 88;//sizeof(ofn);
        ofn.hwndOwner = 0;
@@ -157,14 +119,13 @@
        ofn.lpTemplateName = 0;
        //debugbreak();
        if(GetSaveFileName(ofn))
        if(xfile::GetSaveFileNameW(ofn))
        {
            delete ofn;
            return szPath;
        }
        else
        {
            return "";
            return L"";
        }
    }
            
@@ -178,21 +139,19 @@
            if(m_EntityName==L"GDN3")pre=L"INV";
        }
        xstring file1 =  GetSaveFileName(pre+m_EntityNo+L".xlsx",
            "Excel1文件(*.xlsx)\0*.xlsx;*.xls\0Excel97文件(*.xls)\0*.xls\0PDF文件(*.pdf)\0*.pdf\0",
            "xlsx");
            L"Excel1文件(*.xlsx)\0*.xlsx;*.xls\0Excel97文件(*.xls)\0*.xls\0PDF文件(*.pdf)\0*.pdf\0",
            L"xlsx");
        if(file1 ==L"") return 1;
        
        if(win32::PathFileExists(file1))
        if(PathFileExists(file1))
        {
            int res = win32::MessageBox(this.GetHWND(), L"文件已经存在,是否覆盖?",L"提示",4);
            int res = MessageBox(GetHWND(), L"文件已经存在,是否覆盖?",L"提示",4);
            if(res != 6) return 1;
        }
        
        trace(L"\r\n link excel");
        excel = new cexcel;
        int hexcel = cexcel::CreateInstance();
        excel.setNativePointer(hexcel);
        if(hexcel == 0)
        xexcel excel;
        if(!excel.GetNativePtr())
        {
            alert(L"不能连接Excel");
            return 1;
@@ -200,64 +159,62 @@
        xstring gid =  publiccode::GetGuid();
        xstring filename= pre+m_EntityNo+L"_.htm";
        xutil::SaveToFile(GetModuleTmpPath() + L"\\"+ filename, htmlStr,L"",L"",L"");
        xutil::SaveToFile(xutil::GetModuleTmpPath() + L"\\"+ filename, htmlStr,NULL,NULL);
        trace(L"\r\n excel to open");
        excel .OpenDocument(GetModuleTmpPath() + L"\\"+ filename);
        excel .OpenDocument(xutil::GetModuleTmpPath() + L"\\"+ filename);
        trace(L"\r\n trans shape");
        //excel .put_Visible(true);
        excel.TransShape();
        trace(L"\r\n save to tmp excel file");
        if(file1.find(L".xls"))
        {
            if(win32::PathFileExists(GetModuleTmpPath() + L"\\"+ pre+m_EntityNo+L"_.xls"))
                DeleteFile(GetModuleTmpPath() + L"\\"+ pre+m_EntityNo+L"_.xls");
            excel.SaveToFile(GetModuleTmpPath() + L"\\"+ pre+m_EntityNo+L"_.xls");
            if(PathFileExists(xutil::GetModuleTmpPath() + L"\\"+ pre+m_EntityNo+L"_.xls"))
                DeleteFile(xutil::GetModuleTmpPath() + L"\\"+ pre+m_EntityNo+L"_.xls");
            excel.SaveToFile(xutil::GetModuleTmpPath() + L"\\"+ pre+m_EntityNo+L"_.xls");
            //alert(GetModuleTmpPath() + L"\\"+ pre+m_EntityNo+L"_.xls");
        }
        else 
        {
            if(win32::PathFileExists(GetModuleTmpPath() + L"\\"+ pre+m_EntityNo+L"_.xlsx"))
                DeleteFile(GetModuleTmpPath() + L"\\"+ pre+m_EntityNo+L"_.xlsx");
            excel.SaveToFile(GetModuleTmpPath() + L"\\"+ pre+m_EntityNo+L"_.xlsx");
            if(PathFileExists(xutil::GetModuleTmpPath() + L"\\"+ pre+m_EntityNo+L"_.xlsx"))
                DeleteFile(xutil::GetModuleTmpPath() + L"\\"+ pre+m_EntityNo+L"_.xlsx");
            excel.SaveToFile(xutil::GetModuleTmpPath() + L"\\"+ pre+m_EntityNo+L"_.xlsx");
        }
        
        trace(L"\r\n save to excel file");
        if(win32::PathFileExists(file1)) //GetModuleTmpPath() + L"\\"+ pre+m_EntityNo+L"_.xlsx"))
        if(PathFileExists(file1)) //GetModuleTmpPath() + L"\\"+ pre+m_EntityNo+L"_.xlsx"))
            DeleteFile(file1);
        excel.SaveToFile(file1);
        
        excel.Quit();
        excel.Release(excel.ptr_native_);
        //excel.Release(excel.ptr_native_);
        return 1;
    }
    
    int OntoExcel() //תΪExcel
    {
        excel = new cexcel;
        excel.setNativePointer(cexcel::CreateInstance());
        xexcel  excel;
        xstring gid =  publiccode::GetGuid();
        xstring pre = m_EntityName;
        if(m_EntityName==L"SaleOrder") pre=L"PI";
        if(m_EntityName==L"GDN3")pre=L"INV";
        xstring filename= pre+m_EntityNo+L".htm";
        xstring filenameex= pre+m_EntityNo+L".xlsx";
        xutil::SaveToFile(GetModuleTmpPath() + L"\\"+ filename, htmlStr,L"",L"",L"");
        excel .OpenDocument(GetModuleTmpPath() + L"\\"+ filename);
        xutil::SaveToFile(xutil::GetModuleTmpPath() + L"\\"+ filename, htmlStr,NULL,NULL);
        excel .OpenDocument(xutil::GetModuleTmpPath() + L"\\"+ filename);
        //excel.put_Visible(true);
        excel.TransShape();
        if(win32::PathFileExists(GetModuleTmpPath() + L"\\"+ filenameex))
            DeleteFile(GetModuleTmpPath() + L"\\"+ filenameex);
        excel.SaveToFile(GetModuleTmpPath() + L"\\"+ filenameex);
        if(PathFileExists(xutil::GetModuleTmpPath() + L"\\"+ filenameex))
            DeleteFile(xutil::GetModuleTmpPath() + L"\\"+ filenameex);
        excel.SaveToFile(xutil::GetModuleTmpPath() + L"\\"+ filenameex);
        excel.put_Visible(true);
        excel.Release(excel.ptr_native_);
        //excel.Release(excel.ptr_native_);
        return 1;
    }
    xstring getfilePath()
    {
        xstring path=GetModulePath()+L"\\resource\\image";
        xstring path= xutil::GetModulePath()+L"\\resource\\image";
        xstring filename=L"contract.jpg";
        filename=L"sign.png";
        filename=L"jrj_maersk.png";
@@ -281,7 +238,7 @@
        xstring right=L"";
        xstring tag=L"";
        
        len = L"[$element:".length();
        len = ((xstring)L"[$element:").length();
        while(true)
        {
            pos = str.find(L"[$element:");
@@ -305,7 +262,7 @@
        
        str = pre + str;
        pre = L"";
        len = L"[/$element:".length();
        len = ((xstring)L"[/$element:").length();
        while(true)
        {
            pos = str.find(L"[/$element:");
@@ -336,16 +293,16 @@
        str = replaceInnerElement(str);
        return str;
    }
#if 0
    xstring DownLoadSKUNoPic(xstring SKUNo,xstring CustomerID=L"",xstring CustomerItemNo=L"")
    {
        
        if(SKUNo.length()>20) return DownLoadPaperPic(SKUNo);
        
        xml x = new xml;
        x.setNativePointer(xml::CreateInstance());
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        xml x;
        xaserverarg arg;
        arg.AddArg(L"SKUNo",SKUNo);
        
        xstring src =L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo";
@@ -356,49 +313,47 @@
            src =L"/sale/data/ProductLibrary3/pref/picture/customer/imagelistSKUNo";
        }
        //trace(L"SKUNo=L"+SKUNo);//要有展示图片查询条件内必定要skuno
        if(url::get(src,arg.GetString(),x)!=1)
        if(xurl::get(src,arg.GetString(),x)!=1)
        {
            trace(L"error for download skuno pic!");
            return "";
            return L"";
        }
        
        xstring spath = L"";
        xstring path =GetModuleTmpPath();
        xstring path = xutil::GetModuleTmpPath();
        xstring ext = L"jpg";
        if(x.GetXmlDoc().selectSingleNode(L"//FileExt[1]"))
        if(x.selectSingleNode(L"//FileExt[1]"))
        {
            ext = x.GetXmlDoc().selectSingleNode(L"//FileExt[1]").text;
            ext = x.selectSingleNode(L"//FileExt[1]").text();
        }else if(CustomerID !=L"")
        {
            src =L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo";
            if(url::get(src,arg.GetString(),x)!=1)
            if(xurl::get(src,arg.GetString(),x)!=1)
            {
                trace(L"error for download skuno pic!");
                return "";
                return L"";
            }
            if(x.GetXmlDoc().selectSingleNode(L"//FileExt[1]"))
                ext = x.GetXmlDoc().selectSingleNode(L"//FileExt[1]").text;
            if(x.selectSingleNode(L"//FileExt[1]"))
                ext = x.selectSingleNode(L"//FileExt[1]").text();
        }
            
        xstring filename = SKUNo + L"." + ext;
        if(x.GetXmlDoc().selectSingleNode(L"//PicPath[1]"))
            spath = x.GetXmlDoc().selectSingleNode(L"//PicPath[1]").text;
        if(x.selectSingleNode(L"//PicPath[1]"))
            spath = x.selectSingleNode(L"//PicPath[1]").text();
        if(spath != L"")
        {
             xaserver::DownLoadFile(GetServerUrl(),spath,L"",path+L"/"+filename);
        }
        return "file://"+ path+L"/"+filename;
        return (xstring)L"file://"+ path+L"/"+filename;
    }
#endif
    xstring DownLoadSKUNoPic(xstring SKUNo,xstring CustomerID=L"",xstring CustomerItemNo=L"")
    {
        
        if(SKUNo.length()>20) return DownLoadPaperPic(SKUNo);
        
        xml x = new xml;
        x.setNativePointer(xml::CreateInstance());
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        xml x;
        xaserverarg arg;
        arg.AddArg(L"SKUNo",SKUNo);
        
        xstring src =L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo";
@@ -409,99 +364,97 @@
            src =L"/sale/data/ProductLibrary3/pref/picture/customer/imagelistSKUNo";
        }
        //trace(L"SKUNo=L"+SKUNo);//要有展示图片查询条件内必定要skuno
        if(url::get(src,arg.GetString(),x)!=1)
        if(xurl::get(src,arg.GetString(),x)!=1)
        {
            trace(L"error for download skuno pic!");
            return "";
            return L"";
        }
        
        xstring spath = L"";
        xstring path =GetModuleTmpPath();
        xstring path = xutil::GetModuleTmpPath();
        xstring ext = L"jpg";
        if(x.GetXmlDoc().selectSingleNode(L"//FileExt[1]"))
        if(x.selectSingleNode(L"//FileExt[1]"))
        {
            ext = x.GetXmlDoc().selectSingleNode(L"//FileExt[1]").text;
            ext = x.selectSingleNode(L"//FileExt[1]").text();
        }else if(CustomerID !=L"")
        {
            src =L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo";
            if(url::get(src,arg.GetString(),x)!=1)
            if(xurl::get(src,arg.GetString(),x)!=1)
            {
                trace(L"error for download skuno pic!");
                return "";
                return L"";
            }
            if(x.GetXmlDoc().selectSingleNode(L"//FileExt[1]"))
                ext = x.GetXmlDoc().selectSingleNode(L"//FileExt[1]").text;
            if(x.selectSingleNode(L"//FileExt[1]"))
                ext = x.selectSingleNode(L"//FileExt[1]").text();
        }
            
        xstring filename = SKUNo + L"." + ext;
        if(x.GetXmlDoc().selectSingleNode(L"//PicPath[1]"))
            spath = x.GetXmlDoc().selectSingleNode(L"//PicPath[1]").text;
        if(x.selectSingleNode(L"//PicPath[1]"))
            spath = x.selectSingleNode(L"//PicPath[1]").text();
        if(spath != L"")
        {
             xaserver::DownLoadFile(GetServerUrl(),spath,L"",path+L"/"+filename);
        }
        return "file://"+ path+L"/"+filename;
        return L"file://"+ path+L"/"+filename;
    }
        
    xstring GetImageUrl(xstring id)
    {
        xml xp=new xml;
        xp.setNativePointer(xml::CreateInstance());
        xaserverarg arg_pic=new xaserverarg;
        arg_pic.setNativePointer(arg_pic.CreateInstance());
        xml xp;
        xaserverarg arg_pic;
        arg_pic.AddArg(L"id",id);
        
        xstring res = L"/sale/data/productlibrary3/image/url";
        if(url::get(res,arg_pic.GetString(),xp)!=1)
        if(xurl::get(res,arg_pic.GetString(),xp)!=1)
        {
            xp.GetXml();
            xp.xml();
            return 1;
        }else
        {
            xstring path = xp.GetXmlDoc().text;
            xstring path = xp.text();
            if(path !=L"") return path;
        }
        
        return "/business/products/chanpin/"+id.left(2)+L"/"+ id+L".jpg";
        return L"/business/products/chanpin/"+id.left(2)+L"/"+ id+L".jpg";
    }
    
    xstring DownLoadPaperPic(xstring guid)
    {
        
        xstring path =GetModuleTmpPath();
        xstring path = xutil::GetModuleTmpPath();
        xstring ext = L"jpg";
        xstring filename = guid + L"." + ext;
        xstring spath = GetImageUrl(guid);
        //alert(spath);
        xaserver::DownLoadFile(GetServerUrl(),spath,L"",path+L"/"+filename);
        return "file://"+ path+L"/"+filename;
        return (xstring)L"file://"+ path+L"/"+filename;
    }
            
    xstring DownLoadPaperPic1(xstring guid)
    {
        xstring path =GetModuleTmpPath();
        xstring path = xutil::GetModuleTmpPath();
        xstring ext = L"jpg";
        xstring filename = guid + L"." + ext;
        xstring str = guid.mid(0,2);
        xstring spath = L"/business/products/chanpin/"+str+L"/"+guid+L".jpg";
        xaserver::DownLoadFile(GetServerUrl(),spath,L"",path+L"/"+filename);
        return "file://"+ path+L"/"+filename;
        return (xstring)L"file://"+ path+L"/"+filename;
    }
    
    xstring DownLoadUrlPic(xstring src)
    {
        xstring guid =  publiccode::GetGuid();
        xstring path =GetModuleTmpPath();
        xstring path = xutil::GetModuleTmpPath();
        xstring ext = L"jpg";
        xstring filename = guid + L"." + ext;
        xstring spath = src;
        xaserver::DownLoadFile(GetServerUrl(),spath,L"",path+L"/"+filename);
        return "file://"+ path+L"/"+filename;
        return (xstring)L"file://"+ path+L"/"+filename;
    }
    
    int OnHtml(xaserverarg arg)
    {
        int hCursor = xutil::SetCursorWait();
        HCURSOR hCursor = xutil::SetCursorWait();
        xstring sEntityName = arg.GetArgString(L"EntityName");
        xstring sEntityID = arg.GetArgString(L"EntityID");
@@ -513,13 +466,12 @@
        if(!m_dataset)
        {
            xml x0 = new xml;
            x0.setNativePointer(xml::CreateInstance());
            if (url::get(dataUrl,arg.GetString(),x0) != 1)
            if (xurl::get(dataUrl,arg.GetString(),x0) != 1)
            {
                alert(L"数据集出错了!");
                return 0;
            }
            trace(x0.GetXml());
            trace(x0.xml());
            m_dataset = x0;
        }
            
@@ -528,23 +480,22 @@
        arg.AddArg(L"sPath",sPath);
        m_spath = sPath;
        
        xml xsl = new xml;
        xsl.setNativePointer(xml::CreateInstance());
        if (url::get(L"/sale/data/SysPrintTemplate/getxsl",arg.GetString(),xsl) != 1)
        xml xsl;
        if (xurl::get(L"/sale/data/SysPrintTemplate/getxsl", arg.GetString(), xsl) != 1)
        {
            alert(L"数据模板错误!");
            return 0;
        }
        
        xstring xslStr = xsl.GetXml();
        xstring xslStr = xsl.xml();
        
        xslStr = adjustXsl(xslStr,sPath);
        xsl.LoadXml(xslStr);
        xsl.loadXML(xslStr);
        
        //trace(m_dataset.GetXml());
        trace(L"\r\n--------\r\n"+xslStr);
        
        m_strHtml = m_dataset.GetXmlDoc().transformNode(xsl.GetXmlDoc());
        m_strHtml = m_dataset.transformNode(xsl);
        xstring aspace = m_strHtml.replace(L"[空]",L"&nbsp;",0);
        aspace = aspace.replace(L"[line]",L"<br/>",0);
        xstring scontent = aspace.replace(L"<?xml version=\"1.0\"?>",L"",0);
@@ -555,7 +506,7 @@
        int pos = tail.find(L"src=\"item-picture:");
        while(pos > 0)
        {
            int spos = pos+L"src=\"item-picture:".length();
            int spos = pos+((xstring)L"src=\"item-picture:").length();
            int pos1 = tail.find(L"\"",spos+1);
            xstring skuno = tail.mid(spos,pos1 - spos ).trim();
            xstring CustomerID=L"";
@@ -582,7 +533,7 @@
        int position = tail.find(L"src=\"paper-picture:");
        while(position > 0)
        {
            int sposition = position+L"src=\"paper-picture:".length();
            int sposition = position+ ((xstring)L"src=\"paper-picture:").length();
            int position1 = tail.find(L"\"",sposition+1);
            xstring guid = tail.mid(sposition,position1 - sposition ).trim();
            xstring src2 =  DownLoadPaperPic(guid);
@@ -597,10 +548,10 @@
        position = tail.find(L"src=\"src-picture:");
        while(position > 0)
        {
            sposition = position+L"src=\"src-picture:".length();
            position1 = tail.find(L"\"",sposition+1);
            guid = tail.mid(sposition,position1 - sposition ).trim();
            src2 =  DownLoadUrlPic(guid);
            int sposition = position+((xstring)L"src=\"src-picture:").length();
            int position1 = tail.find(L"\"",sposition+1);
            xstring guid = tail.mid(sposition,position1 - sposition ).trim();
            xstring src2 =  DownLoadUrlPic(guid);
            head += tail.left(position) + L"src=\"" + src2;
            tail = tail.mid(position1,999999999);
            position = tail.find(L"src=\"src-picture:");
@@ -611,8 +562,7 @@
        htmlStr = scontent;    
        ole_print.LoadHtml(scontent);    
        
        xml x1 = new xml;
        x1.setNativePointer(xml ::CreateInstance());
        xml x1;
        //xstring xcontent = m_strHtml.replace(L"&nbsp;",L"[空]",0);
        xstring xcontent = m_strHtml.replace(L"[空]",L" ",0);
        int pos0 = xcontent.find(L"<xml");
@@ -622,15 +572,15 @@
            xstring str = xcontent.left(pos0)+ xcontent.mid(pos2+6,9999999);
            xcontent = str;
        }
        x1.LoadXml(xcontent);
        if(x1.GetXmlDoc())
        x1.loadXML(xcontent);
        if(x1)
        {
            /*if(!showgrid)
            {
                SendCtrlCmd(cell,L"xmFormatShowGrid");
                showgrid = true;
            }*/
            cell.LoadTemplate(x1.GetXmlDoc());
            cell.LoadTemplate(x1);
            cell.Redraw();
        }
@@ -641,40 +591,60 @@
        
    int updateHtml()
    {
        _mshtml::IHTMLDocument3 doc = ole_print.GetHtmlDocument();
        _mshtml::IHTMLElementCollection rows = doc.getElementsByTagName(L"tr");
        _mshtml::IHTMLElementCollection rows2 = doc.getElementsByTagName(L"td");
        int len = rows.length;
        int len2 = rows2.length;
        IHTMLDocument3* doc = (IHTMLDocument3 * )ole_print.GetHtmlDocument();
        IHTMLElementCollection* rows;
        doc->getElementsByTagName((BSTR)L"tr",&rows);
        IHTMLElementCollection* rows2;
        doc->getElementsByTagName((BSTR)L"td",&rows2);
        long len;
        rows->get_length(&len);
        long len2;
        rows2->get_length(&len2);
        for(int i=0; i < len - 1;i++)
        {
            _mshtml::IHTMLElement e = rows.item(i,i);
            e.style.setAttribute(L"height",e.offsetHeight,0);
            e.Release();
            _variant_t var;
            IHTMLElement* e=0;
            IHTMLStyle* pstyle=0;
            long offsetHeight=0;
            rows->item((_variant_t)i, (_variant_t)i,(IDispatch**) & e);
            e->get_style(&pstyle);
            e->get_offsetHeight(&offsetHeight);
            pstyle->setAttribute((BSTR)L"height",(_variant_t)offsetHeight, 0);
            e->Release();
            pstyle->Release();
        }
        for( i=0; i < len2 - 1;i++)
        for( int i=0; i < len2 - 1;i++)
        {
            _mshtml::IHTMLElement e2 = rows2.item(i,i);
            e2.style.setAttribute(L"width",e.offsetWidth,0);
            e2.Release();
            IHTMLElement* e = 0;
            IHTMLStyle* pstyle = 0;
            long offsetWidth=0;
            rows->item((_variant_t)i, (_variant_t)i, (IDispatch**)&e);
            e->get_style(&pstyle);
            e->get_offsetHeight(&offsetWidth);
            pstyle->setAttribute((BSTR)L"width", (_variant_t)offsetWidth, 0);
            e->Release();
            pstyle->Release();
        }
        rows.Release();
        doc.release();
        htmlStr = doc.documentElement.outerHtml;
        rows->Release();
        doc->Release();
        //IHTMLElement* e = 0;
        //doc->get_documentElement(&e);
        //BSTR bstrHtml=0;
        //e->get_outerHTML(&bstrHtml);
        return 1;
    }
    
    int OnOpenDocument()
    {
        if(GetParam())
        if(GetWinParam())
        {
            xaserverarg arg = new xaserverarg;
            arg.setNativePointer(GetParam());
            int p = arg.ptr_native_;
            xaserverarg arg=GetArg();
            arg.AddArg(L"action",L"open");
            arg.AddArg(L"DocumentID",L"");
            arg.AddArg(L"ok",L"");
            openUrl(L"/sale/view/view.dlg/xpage/Template/PrintDialog", p);
            openUrl(L"/sale/view/view.dlg/xpage/Template/PrintDialog", &arg);
            xstring ret = arg.GetArgString(L"return");
            xstring action = arg.GetArgString(L"action");
            if (ret ==L"ok") 
@@ -682,24 +652,24 @@
                if(action ==L"open")
                {
                    m_DocumentID = arg.GetArgString(L"DocumentID");
                    xml x = new xml;
                    x.setNativePointer(xml::CreateInstance());
                    xml x;
                    xstring prestr = m_DocumentID.mid(0,2);
                    prestr = prestr.upper();
                    prestr = prestr.toUpper();
                    xaserver::LoadUrl(GetServerUrl(),L"/business/data/bill/"+prestr+L"/"+ m_DocumentID+L".jpg",L"",x);
                    if(x.GetXml()!=L"")
                    if((xstring)x.xml()!=L"")
                    {
                        if(x.GetXmlDoc())
                        if(x)
                        {
                            /*if(!showgrid)
                            {
                                SendCtrlCmd(cell,L"xmFormatShowGrid");
                                showgrid = true;
                            }*/
                            cell.LoadTemplate(x.GetXmlDoc());
                            cell.LoadTemplate(x);
                            cell.Redraw();
                        }
                        ole_print.LoadHtml(x.GetXml());
                        ole_print.LoadHtml(x.xml());
                    }else
                    {
                        ole_print.LoadHtml(L"<html><body>未找到对应的文档</body></html>");
@@ -709,7 +679,7 @@
                else
                {
                    xstring templateName = arg.GetArgString(L"template-name");
                    win32::SetWindowText(GetHWND(),templateName);
                    SetWindowText(GetHWND(),templateName);
                    billName = templateName;
                    billPre = arg.GetArgString(L"template-pre");
                    billID = arg.GetArgString(L"template-guid");
@@ -728,13 +698,11 @@
        
    int OnPrintDialog()
    {        
        if(GetParam())
        if(GetWinParam())
        {
            xaserverarg arg = new xaserverarg;
            arg.setNativePointer(GetParam());
            int p = arg.ptr_native_;
            xaserverarg arg=GetArg();
            arg.AddArg(L"ok",L"");
            openUrl(L"/sale/view/view.dlg/xpage/Template/PrintDialog", p);
            openUrl(L"/sale/view/view.dlg/xpage/Template/PrintDialog", &arg);
            xstring ret = arg.GetArgString(L"return");
            xstring action = arg.GetArgString(L"action");
            if (ret ==L"ok") 
@@ -743,23 +711,23 @@
                if(action ==L"open")
                {
                    m_DocumentID = arg.GetArgString(L"DocumentID");
                    xml x = new xml;
                    x.setNativePointer(xml::CreateInstance());
                    xml x;
                    xstring prestr = m_DocumentID.mid(0,2);
                    prestr = prestr.upper();
                    prestr = prestr.toUpper();
                    xaserver::LoadUrl(GetServerUrl(),L"/business/data/bill/"+prestr+L"/"+ m_DocumentID+L".jpg",L"",x);
                    if(x.GetXml()!=L"")
                    if((xstring)x.xml()!=L"")
                    {
                        
                        xstring content = L"";
                        if(x.GetXmlDoc().documentElement.tagName==L"Bill")
                        if((xstring)x.documentElement().tagName() == L"Bill")
                        {
                            content = x.GetXmlDoc().documentElement.text;
                            content = x.documentElement().text();
                            content = content.replace(L"[空]",L"&nbsp",0);
                            ole_print.LoadHtml(content);
                            ole_print.LoadHtml((LPTSTR)content.c_str());
                        }else
                        {
                            if(x.GetXmlDoc())
                            if(x)
                            {
                                /*if(!showgrid)
                                {
@@ -767,28 +735,28 @@
                                    showgrid = true;
                                }*/
                                xml x1 = new xml;
                                x1.setNativePointer(xml::CreateInstance());
                                xstring content1 = x.GetXml();
                                xstring content1 = x.xml();
                                content1 = content1.replace(L"[空]",L" ",0);
                                //trace(content1);
                                x1.LoadXml(content1);
                                cell.LoadTemplate(x1.GetXmlDoc());
                                x1.loadXML(content1);
                                cell.LoadTemplate(x1);
                                cell.Redraw();
                            }
                            content = x.GetXml();
                            content = x.xml();
                            content = content.replace(L"[空]",L"&nbsp",0);
                            ole_print.LoadHtml(content);
                        }
                    }else
                    {
                        ole_print.LoadHtml(L"<html><body>未找到对应的文档</body></html>");
                        ole_print.LoadHtml((LPTSTR)L"<html><body>未找到对应的文档</body></html>");
                        //cell.LoadHtml(L"<html><body>未找到对应的文档</body></html>");
                    }
                }
                else
                {
                    xstring templateName = arg.GetArgString(L"template-name");
                    win32::SetWindowText(GetHWND(),templateName);
                    SetWindowText(GetHWND(),templateName);
                    billName = templateName;
                    billPre = arg.GetArgString(L"template-pre");
                    billID = arg.GetArgString(L"template-guid");
@@ -817,22 +785,22 @@
        xstring tools=L"<hbox class=''>";
        if(agent)
        {
            nlist = agent.SelectNodes(L".//xtoolbutton");
            nlen = nlist.length;
            nlist = agent.selectNodes(L".//xtoolbutton");
            nlen = nlist.length();
            for(index=0;index<nlen;index++)
            {
                ele  =  nlist.item(index);
                xstring name = ele.selectSingleNode(L"@name").text;
                xstring label  =  ele.selectSingleNode(L"@caption").text;
                xstring name = ele.selectSingleNode(L"@name").text();
                xstring label  =  ele.selectSingleNode(L"@caption").text();
                xstring image;
                xstring src = L"";
                if(ele.selectSingleNode(L"@image"))
                    image = ele.selectSingleNode(L"@image").text;
                    image = ele.selectSingleNode(L"@image").text();
                else
                    image = L"0 22";
                
                if(ele.selectSingleNode(L"@src"))
                    src = ele.selectSingleNode(L"@src").text;
                    src = ele.selectSingleNode(L"@src").text();
                
                int strLen = label.length();
                int width = 60 + (strLen - 2) * 10;
@@ -850,7 +818,7 @@
    }
    //焦点激活处理函数
    int OnSetFocus(ref TNotifyEvent evt,int p)
    int OnSetFocus(TEvent * evt,int p)
    {
        //重置工具条
        SetAgent();
@@ -887,17 +855,18 @@
    }
    int PrintPaper() //打印
    {
        //ole_print.GetHtmlDocument();
#ifdef shouldFinish    //ole_print.GetHtmlDocument();
        //return 1;
        _mshtml::IHTMLDocument3 doc = ole_print.GetHtmlDocument();
        _mshtml::IHTMLElementCollection rows = doc.getElementsByTagName(L"tr");
        IHTMLDocument3* doc = (IHTMLDocument3 * )ole_print.GetHtmlDocument();
        IHTMLElementCollection* rows = doc->getElementsByTagName(L"tr");
        
        int len = rows.length;
        long len;
        rows->get_length(&len);
        for(int i=0; i < len - 1;i++)
        {
            //oleobject v = rows.item(i,i);
            _mshtml::IHTMLElement e = rows.item(i,i);
            _mshtml::IHTMLElement2 e1 = e;
            IHTMLElement* e = rows->item(i,i);
            IHTMLElement2* e1 = e;
            //e.setAttribute(L"height",e1.clientHeight,0);
            e.setAttribute(L"height",300,0);
            e.Release();
@@ -905,6 +874,7 @@
        }
        rows.Release();
        doc.Release();
#endif
        /*
        if(PaperPrint == false)
        {
@@ -955,7 +925,7 @@
        xstring guid = publiccode::GetGuid();
        
        xstring prestr = guid.mid(0,2);
        prestr = prestr.upper();
        prestr = prestr.toUpper();
        
        
        content = content.replace(L"gb2312",L"utf-16",0);
@@ -963,10 +933,9 @@
        content = content.replace(L"&",L"",0);
        
        xml x0 = new xml;
        x0.setNativePointer(xml::CreateInstance());
        x0.LoadXml(L"<Bill/>");
        x0.GetXmlDoc().documentElement.text = content;
        content = x0.GetXml();
        x0.loadXML(L"<Bill/>");
        x0.documentElement().settext(content);
        content = x0.xml();
        int ret= xaserver::UploadData(L"bill"+prestr, guid+L".jpg", content);
        if(ret < 0) trace(L"error upload");
@@ -979,20 +948,20 @@
        ls_xml += L"<BillName>"+ billName + L"</BillName>";
        ls_xml += L"</DocumentList>";
        
        xml x = new xml;
        x.setNativePointer(xml::CreateInstance());
        x.LoadXml(ls_xml);
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(xaserverarg::CreateInstance());
        arg.AddArg(L"content",x.GetXml());
        xml x;
        
        if(url::get(L"/sale/data/DocumentList3/bill/update", arg.GetString(),x)!=1)
        x.loadXML(ls_xml);
        xaserverarg arg;
        arg.setNativePointer(xaserverarg::CreateInstance());
        arg.AddArg(L"content", x.xml());
        if(xurl::get(L"/sale/data/DocumentList3/bill/update", arg.GetString(),x)!=1)
        {
            xstring error = x.GetXmlDoc().text;
            xstring error = x.text();
            alert(L"err:"+error);
            return 1;
        }
        xstring str = x.GetXmlDoc().documentElement.getAttribute(L"text");
        xstring str = x.documentElement().getAttribute(L"text");
        if(str == L"true")
        {
            alert(L"保存成功!"); 
@@ -1007,16 +976,15 @@
    
    int SendCtrlCmd(xcontrol xc, xstring cmd)
    {
        win32::SendMessage(xc.GetId(),0x401,cmd,0);
        SendMessage(xc.GetHWND(), 0x401, (WPARAM)cmd.c_str(), 0);
        return 1;
    }
    
    int OnRefreshData()
    {
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(GetParam());
        xaserverarg arg;
        xstring templateName = arg.GetArgString(L"template-name");
        win32::SetWindowText(GetHWND(),templateName);
        SetWindowText(GetHWND(),templateName);
        OnHtml(arg);
        billName = templateName;
        billPre = arg.GetArgString(L"template-pre");
@@ -1032,7 +1000,7 @@
    {
        if(comdid==L"xmSort")
        {
            OpenWindow(L"dev:xpage[DataSort.dialog.vx]",cast(m_dataset as int));
            //OpenWindow(L"dev:xpage[DataSort.dialog.vx]",cast(m_dataset as int));
            return 1;
        }
        if(comdid==L"print:PrintImmediate") 
@@ -1068,13 +1036,12 @@
        {    
            if(updated)
            {
                int res = win32::MessageBox(this.GetHWND(), L"单据已制作,是否保存?",L"提示",4);
                int res = MessageBox(GetHWND(), L"单据已制作,是否保存?",L"提示",4);
                if(res == 6)OnCmdDispatch(L"print:AddToDocumentList");
            }
            if(GetParam())
            if(GetWinParam())
            {
                xaserverarg arg1 = new xaserverarg;
                arg1.setNativePointer(GetParam());
                xaserverarg arg1 = GetArg();
                arg1.AddArg(L"action",L"new");
                OnPrintDialog();
                arg1.AddArg(L"action",L"");
@@ -1126,37 +1093,37 @@
            return 1;
                alert(L"xxx");
                    xml x1 = new xml;
            x1.setNativePointer(xml::CreateInstance());
            xaserver::ExecXQuery(GetServerUrl(), L"[xsl.getdevobj.xq]",L"<args/>",x1);
        }
        
        if(comdid == L"xxx") 
        {
            xml x = new xml;
            x.setNativePointer(xml::CreateInstance());
            xaserverarg arg = new xaserverarg;
            arg.setNativePointer(arg.CreateInstance());
            xml x;
            xaserverarg arg;
            arg.AddArg(L"strHtml",m_strHtml);
            if (url::get(L"/sale/data/SysPrintTemplate/WebBrowser",arg.GetString(),x) != 1)
            if (xurl::get(L"/sale/data/SysPrintTemplate/WebBrowser",arg.GetString(),x) != 1)
            {
                alert(L"数据集出错了!");
                return 0;
            }
            xstring strHtml = x.GetXml();
            xstring strHtml = x.xml();
            ole_print.LoadHtml(strHtml);        
        }
        return 0;
    }
    int OnXCommand(ref TXCommandEvent evt,int p)
    int OnXCommand(TEvent* evt,int p)
    {
        return OnCmdDispatch(evt.pStrID);
        return OnCmdDispatch(evt->xcommand.pStrID);
    }
        
    int OnAttachEvent()
    {
        AttachEvent(L"WM_XCOMMAND",OnXCommand);
        AttachEvent(L"WM_SETFOCUS",OnSetFocus);
        AttachEvent(L"WM_XCOMMAND",(FEvent)& TemplatePrintViewEx::OnXCommand);
        AttachEvent(L"WM_SETFOCUS", (FEvent)&TemplatePrintViewEx::OnSetFocus);
        //AttachEvent(L"WM_CLOSE",OnCloseOwnerWindow);
        
        return 0;
@@ -1171,11 +1138,11 @@
    {
        if(!updated) return 1;
        
        int MB_YESNOCANCEL = 3;
        int IDYES = 6;
        int IDNO = 7;
        int IDCANCEL  = 2;
        int re = win32::MessageBox(this.GetHWND(), L"单据已制作,是否保存?",L"提示:",MB_YESNOCANCEL);
        //int MB_YESNOCANCEL = 3;
        //int IDYES = 6;
        //int IDNO = 7;
        //int IDCANCEL  = 2;
        int re = MessageBox(GetHWND(), L"单据已制作,是否保存?",L"提示:",MB_YESNOCANCEL);
        if(re==IDCANCEL) return -1;
        if(re==IDNO) return 1;
        OnCmdDispatch(L"print:AddToDocumentList");
@@ -1206,10 +1173,10 @@
    int onloaded()
    {
        updated = false;
        if(GetParam())
        SetArg();
        if(GetWinParam())
        {
            xaserverarg arg = new xaserverarg;
            arg.setNativePointer(GetParam());
            xaserverarg arg= GetArg();
            xstring templateName = arg.GetArgString(L"template-name");
            if(templateName ==L"")
            {
@@ -1218,7 +1185,7 @@
                
            else
            {
                win32::SetWindowText(GetHWND(),templateName);
                SetWindowText(GetHWND(),templateName);
                OnHtml(arg);
                billName = templateName;
                billPre = arg.GetArgString(L"template-pre");
@@ -1232,5 +1199,6 @@
            OnPrintDialog();
        return 1;
    }
};
};
#define _XWIN
jrj/xframe/kobject/kexcel.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
#pragma once
#include "kcontrol.hpp"
class     CExcelApplication
{
public:
    void Release(CExcelApplication * t); //alias "?Release@CExcelApplication@@QAEXPAV1@@Z";
    static CExcelApplication* CreateInstance(); //alias "?CreateInstance@CExcelApplication@@SAPAV1@XZ";
public:
    void put_Visible(BOOL newValue); //alias "?put_Visible@CExcelApplication@@QAEXH@Z";
    bool get_Visible(); //alias "?get_Visible@CExcelApplication@@QAEHXZ";
    void OpenDocument(const LPTSTR FileName); //alias "?OpenDocument@CExcelApplication@@QAEXQA_W@Z";
    void TransShape(); //alias "?TransShape@CExcelApplication@@QAEXXZ";
    void SaveToFile(const LPTSTR FileName);// alias "?SaveToFile@CExcelApplication@@QAEXQA_W@Z";
    void Quit(); //alias "?Quit@CExcelApplication@@QAEXXZ";
    //LPDISPATCH GetApplication();
};
jrj/xframe/kobject/khtml.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
#pragma once
#include "kcontrol.hpp"
class IHTMLDocument2;
namespace Hxsoft {    namespace XFrame {
class     xcOleControlContain : public xcontrol
{
public:
    int LoadHtml(LPTSTR); //alias "?LoadHtml@xcOleControlContain@XFrame@Hxsoft@@QAEHPA_W@Z";
    int ExecWB(int cmdID, int cmdexecopt); //alias "?ExecWB@xcOleControlContain@XFrame@Hxsoft@@QAEHHH@Z";
    int LoadText(LPTSTR);  //alias "?LoadText@xcOleControlContain@XFrame@Hxsoft@@QAEHPA_W@Z";
    IHTMLDocument2* GetHtmlDocument(); //alias "?GetHtmlDocument@xcOleControlContain@XFrame@Hxsoft@@QAEPAUIHTMLDocument2@@XZ" ;
};
}}
jrj/xframe/kobject/kutil.hpp
@@ -1,9 +1,11 @@
#pragma once
#include "kbase.hpp"
#ifdef _XWIN
typedef struct HICON__{}*HICON;
typedef HICON HCURSOR;
#endif
namespace Hxsoft{ namespace XFrame
{
    class IXFUtil
jrj/xframe/system/base.hpp
@@ -30,11 +30,14 @@
typedef const wchar_t* string;
#ifdef _XWIN
typedef long LONG;
typedef struct HWND__ {} * HWND;
typedef struct HMENU__ {} * HMENU;
typedef struct HDC__ {} * HDC;
typedef void *  HINSTANCE;
typedef struct HINSTANCE_ {}* HINSTANCE;
typedef struct HMODULE_ {}* HMODULE;
typedef short HFILE;
typedef wchar_t wchar;
typedef wchar* BSTR;
@@ -105,6 +108,8 @@
    LONG        cy;
} SIZE, *PSIZE, *LPSIZE;
#endif
jrj/xframe/vbusiness/vframe/frame.vframe.vbusiness.hpp
@@ -483,13 +483,13 @@
        if (content ==L"") return 1;
        if (content.find(L"update.modify", 0) > 0 || content.find(L"update.delete", 0) > 0)
        {
            int MB_YESNOCANCEL = 3;
            int IDYES = 6;
            int IDNO = 7;
            int IDCANCEL = 2;
            int re = MessageBoxW(GetHWND(),L"数据已经修改,是否保存?",L"提示:", MB_YESNOCANCEL);
            if (re == IDCANCEL) return -1;
            if (re == IDNO) return 1;
            int MB_YESNOCANCEL_ = 3;
            int IDYES_ = 6;
            int IDNO_ = 7;
            int IDCANCEL_ = 2;
            int re = MessageBoxW(GetHWND(),L"数据已经修改,是否保存?",L"提示:", MB_YESNOCANCEL_);
            if (re == IDCANCEL_) return -1;
            if (re == IDNO_) return 1;
            if (DoUpdate(false) == 1) return 1;
            return -1;
        }
jrj/xframe/vbusiness/vframe/listex.vframe.vbusiness.hpp
@@ -268,15 +268,15 @@
        }
        else if (str == L"userid")
        {
            ret = publiccode::GetUser().id;
            ret = publiccode::GetUser()->id;
        }
        else if (str == L"userno")
        {
            ret = publiccode::GetUser().no;
            ret = publiccode::GetUser()->no;
        }
        else if (str == L"username")
        {
            ret = publiccode::GetUser().name;
            ret = publiccode::GetUser()->name;
        }
        return ret;
    }
jrj/xframe/vbusiness/vframe/responsewin.vframe.vbusiness.hpp
@@ -0,0 +1,14 @@
#pragma once
#include <wobject/xwin.hpp>
#include <wobject/xurl.hpp>
#include <wobject/xapp.hpp>
class responsewin : public xwin
{
public:
    responsewin(void* impl, HWND hWnd) :xwin(impl, hWnd) {}
    int onload()
    {
        return 1;
    }
};
jrj/xframe/vbusiness/vutil/publiccode.vutil.vbusiness.hpp
@@ -46,7 +46,7 @@
    }
    //取当前用户
    static PUser GetUser(xstring id)
    static PUser* GetUser(xstring id)
    {
        string userno = xaserver::GetUserNo();
        //trace(userno);
@@ -89,9 +89,9 @@
            if (e.selectSingleNode(L"电话"))    p.tel = e.selectSingleNode(L"电话").text();
        }
        return p;
        return &p;
    }
    static PUser GetUser()
    static PUser* GetUser()
    {
        return GetUser(L"");
    }
jrj/xframe/win32/win.hpp
@@ -2,6 +2,7 @@
#include "system/base.hpp"
#ifdef _XWIN
typedef struct _GUID {
    unsigned long  Data1;
    unsigned short Data2;
@@ -32,9 +33,9 @@
extern "C"
{
    void WINAPI SysFreeString(BSTR str);//OleAut32.dll
    void *  WINAPI  LoadLibraryW(const wchar_t* lpText);
    HMODULE  WINAPI  LoadLibraryW(const wchar_t* lpText);
    bool  WINAPI FreeLibrary(void *  hModule);
    void *  WINAPI  GetProcAddressW(void* hModule, const char* lpText);
    void *  WINAPI  GetProcAddressW(HMODULE hModule, const char* lpText);
    LPARAM WINAPI  GetPropW(HWND  hWnd,string  lpString);
        
@@ -104,8 +105,8 @@
    HWND WINAPI FindWindowW(string lpClassName, string lpWindowName);//native from "user32.dll" alias "FindWindowW";    
    
    int WINAPI GetTempPathW(int NAME_LEN,string & OutPath) ;//native from "kernel32.dll" alias "GetTempPathW";
    int WINAPI GetModuleHandleW(string lpModuleName) ;//native from "kernel32.dll" alias "GetModuleHandleW";
    int WINAPI GetModuleFileNameW(int hModule ,string lpFileName, int nSize);//native from "kernel32.dll" alias "GetModuleFileNameW";
    HMODULE WINAPI GetModuleHandleW(string lpModuleName) ;//native from "kernel32.dll" alias "GetModuleHandleW";
    int WINAPI GetModuleFileNameW(HMODULE hModule ,string lpFileName, int nSize);//native from "kernel32.dll" alias "GetModuleFileNameW";
    void WINAPI GetLocalTime(SYSTEMTIME& lpSystemTime) ;//native from "kernel32.dll" alias "GetLocalTime";
    int WINAPI PathRemoveFileSpecW(string lpFileName);// native from "shlwapi.dll" alias "PathRemoveFileSpecW";
@@ -119,6 +120,7 @@
#define PathRemoveFileSpec PathRemoveFileSpecW
#define SetWindowText SetWindowTextW
#define GetWindowText GetWindowTextW
#endif
#if 0
namespace win32
@@ -195,7 +197,7 @@
    HWND FindWindowW(string lpClassName, string lpWindowName);//native from "user32.dll" alias "FindWindowW";    
    
    int GetTempPathW(int NAME_LEN,string & OutPath) ;//native from "kernel32.dll" alias "GetTempPathW";
    int GetModuleHandleW(string lpModuleName) ;//native from "kernel32.dll" alias "GetModuleHandleW";
    HMODULE GetModuleHandleW(string lpModuleName) ;//native from "kernel32.dll" alias "GetModuleHandleW";
    int GetModuleFileName(int hModule ,string & lpFileName ,int nSize ) ;//native from "kernel32.dll" alias "GetModuleFileName";
    void GetLocalTime(SYSTEMTIME& lpSystemTime) ;//native from "kernel32.dll" alias "GetLocalTime";
jrj/xframe/win32/xfile.hpp
@@ -3,6 +3,7 @@
#include "system/base.hpp"
#include "win.hpp"
#if _XWIN
#define CALLBACK    __stdcall
#define MAX_PATH    260
@@ -72,81 +73,83 @@
} WIN32_FIND_DATAW;
extern "C"
{
    namespace win32
    {
        bool  WINAPI GetSaveFileNameW(OPENFILENAMEW&);//native from "comdlg32.dll" alias "GetSaveFileNameW";
        bool  WINAPI GetOpenFileNameW(OPENFILENAMEW&);//native from "comdlg32.dll" alias "GetOpenFileNameW";
    //namespace win32
    //{
        bool  WINAPI GetSaveFileNameW(OPENFILENAMEW*);//native from "comdlg32.dll" alias "GetSaveFileNameW";
        bool  WINAPI GetOpenFileNameW(OPENFILENAMEW*);//native from "comdlg32.dll" alias "GetOpenFileNameW";
        HANDLE WINAPI FindFirstFileW(const WCHAR* lpFileName, WIN32_FIND_DATAW& lpFindFileData); //native from "kernel32.dll" alias "FindFirstFileW";    //根据文件名查找文件,一旦不再需要,应该用FindClose函数关闭这个句柄
        HANDLE WINAPI FindNextFileW(HANDLE hFindFile, WIN32_FIND_DATAW& lpFindFileData); //native from "kernel32.dll" alias "FindNextFileW";    //继续查找FindFirstFile函数搜索后的文件 ,HANDLE hFindFile搜索的文件句柄 å‡½æ•°æ‰§è¡Œçš„æ—¶å€™æœç´¢çš„æ˜¯æ­¤å¥æŸ„的下一文件。非零表示成功,零表示失败。如不再有与指定条件相符的文件,会将GetLastError设置成ERROR_NO_MORE_FILES
        HANDLE WINAPI FindFirstFileW(const WCHAR* lpFileName, WIN32_FIND_DATAW* lpFindFileData); //native from "kernel32.dll" alias "FindFirstFileW";    //根据文件名查找文件,一旦不再需要,应该用FindClose函数关闭这个句柄
        BOOL WINAPI FindNextFileW(HANDLE hFindFile, WIN32_FIND_DATAW* lpFindFileData); //native from "kernel32.dll" alias "FindNextFileW";    //继续查找FindFirstFile函数搜索后的文件 ,HANDLE hFindFile搜索的文件句柄 å‡½æ•°æ‰§è¡Œçš„æ—¶å€™æœç´¢çš„æ˜¯æ­¤å¥æŸ„的下一文件。非零表示成功,零表示失败。如不再有与指定条件相符的文件,会将GetLastError设置成ERROR_NO_MORE_FILES
        bool  WINAPI FindClose(HANDLE hFindFile); //native from "kernel32.dll" alias "FindClose";    //关闭由FindFirstFile函数创建的一个搜索句柄。返回非零表示成功,零表示失败。会设置GetLastError 
        int  WINAPI CreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile); //native from "kernel32.dll" alias "CreateFileW";
        int  WINAPI  OpenFile(LPCSTR lpFileName, OFSTRUCT lpReOpenBuff, UINT wStyle); //native from "kernel32.dll" alias "OpenFile";
        HANDLE  WINAPI CreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile); //native from "kernel32.dll" alias "CreateFileW";
        HFILE  WINAPI  OpenFile(LPCSTR lpFileName, OFSTRUCT* lpReOpenBuff, UINT wStyle); //native from "kernel32.dll" alias "OpenFile";
        int  WINAPI SetFilePointer(HANDLE hFile, LONG lDistanceToMove, LONG* lpDistanceToMoveHigh, DWORD dwMoveMethod); //native from "kernel32.dll" alias "SetFilePointer";
        int  WINAPI ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped); //native from "kernel32.dll" alias "ReadFile";
        int  WINAPI WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped); //native from "kernel32.dll" alias "ReadFile";
        int  WINAPI CloseHandle(HANDLE hFile); //native from "kernel32.dll" alias "CloseHandle";
        int  WINAPI GetFileSize(HANDLE hFile, int lpFileSizeHigh); //native from "kernel32.dll" alias "GetFileSize";
    }
        int  WINAPI GetFileSize(HANDLE hFile, DWORD* lpFileSizeHigh); //native from "kernel32.dll" alias "GetFileSize";
    //}
}
#endif
class xfile
{
public:
    static bool  WINAPI GetSaveFileName(OPENFILENAMEW& OpenFileName)
    static bool  GetSaveFileName(OPENFILENAMEW& OpenFileName)
    {
        return win32::GetSaveFileNameW(OpenFileName);
        return ::GetSaveFileNameW(&OpenFileName);
    }
    static bool  WINAPI GetOpenFileName(OPENFILENAMEW& SaveFileName)
    static bool GetOpenFileName(OPENFILENAMEW& SaveFileName)
    {
        return win32::GetOpenFileNameW(SaveFileName);
        return ::GetOpenFileNameW(&SaveFileName);
    }
    static HANDLE WINAPI FindFirstFile(const WCHAR* lpFileName, WIN32_FIND_DATAW& lpFindFileData)
    static HANDLE FindFirstFile(const WCHAR* lpFileName, WIN32_FIND_DATAW& lpFindFileData)
    {
        return win32::FindFirstFileW(lpFileName, lpFindFileData);
        return ::FindFirstFileW(lpFileName, &lpFindFileData);
    }
    static HANDLE WINAPI FindNextFile(HANDLE hFindFile, WIN32_FIND_DATAW& lpFindFileData)
    static BOOL FindNextFile(HANDLE hFindFile, WIN32_FIND_DATAW& lpFindFileData)
    {
        return win32::FindNextFileW(hFindFile, lpFindFileData);
        return ::FindNextFileW(hFindFile, &lpFindFileData);
    }
    static bool  WINAPI FindClose(HANDLE hFindFile)
    static bool FindClose(HANDLE hFindFile)
    {
        return win32::FindClose(hFindFile);
        return ::FindClose(hFindFile);
    }
    static int  WINAPI CreateFile(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
    static HANDLE  CreateFile(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
    {
        return win32::CreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
        return ::CreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
    }
    static int  WINAPI  OpenFile(LPCSTR lpFileName, OFSTRUCT lpReOpenBuff, UINT wStyle)
    static HFILE  OpenFile(LPCSTR lpFileName, OFSTRUCT& lpReOpenBuff, UINT wStyle)
    {
        return win32::OpenFile(lpFileName, lpReOpenBuff, wStyle);
        return ::OpenFile(lpFileName, &lpReOpenBuff, wStyle);
    }
    static int  WINAPI SetFilePointer(HANDLE hFile, LONG lDistanceToMove, LONG* lpDistanceToMoveHigh, DWORD dwMoveMethod)
    static int  SetFilePointer(HANDLE hFile, LONG lDistanceToMove, LONG* lpDistanceToMoveHigh, DWORD dwMoveMethod)
    {
        return win32::SetFilePointer(hFile, lDistanceToMove, lpDistanceToMoveHigh, dwMoveMethod);
        return ::SetFilePointer(hFile, lDistanceToMove, lpDistanceToMoveHigh, dwMoveMethod);
    }
    static int  WINAPI ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped)
    static int  ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped)
    {
        return win32::ReadFile(hFile, lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead, lpOverlapped);
        return ::ReadFile(hFile, lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead, lpOverlapped);
    }
    static int  WINAPI WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped)
    static int  WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped)
    {
        return win32::WriteFile(hFile, lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead, lpOverlapped);
        return ::WriteFile(hFile, lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead, lpOverlapped);
    }
    static int  WINAPI CloseHandle(HANDLE hFile)
    static int  CloseHandle(HANDLE hFile)
    {
        return  win32::CloseHandle(hFile);
        return  ::CloseHandle(hFile);
    }
    static int  WINAPI GetFileSize(HANDLE hFile, int lpFileSizeHigh)
    static int  GetFileSize(HANDLE hFile, DWORD& lpFileSizeHigh)
    {
        return win32::GetFileSize(hFile, lpFileSizeHigh);
        return ::GetFileSize(hFile, &lpFileSizeHigh);
    }
};
jrj/xframe/wobject/xbase.hpp
@@ -38,7 +38,13 @@
    NMHDR*  pNMHDR;
};
*/
struct xstruct
{
};
#ifdef _XWIN
typedef unsigned int UINT;
    
typedef struct NMHDR
@@ -48,67 +54,9 @@
    int code;
} * LPNMHDR;
    
typedef struct tagEvent
{
    HWND    hWnd;
    DWORD    message;
    WPARAM    wParam;
    LPARAM    lParam;
    DWORD    time;
    POINT    pt;
    union
    {
        struct {
            int wmId    ;
            int wmEvent ;
            HWND hCtrl ;
        }command;
        struct
        {
            LPTSTR pStrID;
            void * pCmdFrom;
        }xcommand;
        struct {
            UINT nFlags;
            POINT point;
        } mouse;
        struct {
            UINT nFlags;
            POINT point;
        } size;
        struct {
            UINT nChar;
            UINT nRepCnt;
            UINT nFlags;
        }key;
        struct {
            HDC hdc;
        }paint;
        struct {
            HWND    hWnd ;
            UINT    nHitTest;
            UINT    mouseMsg;
        }cursor;
        struct {
            UINT nSBCode;
            UINT nPos;
            HWND hWndCtl;
        }scroll;
        struct {
            POINT point;
            UINT_PTR fwKeys;
            short zDelta;
        }wheel;
        struct {
            int idCtrl;
            LPNMHDR pnmh;
        }notify;
    };
    void * pSrcObject;
    LPARAM    dwRet;
} TEvent;
typedef TEvent TNotifyEvent;
//typedef TEvent TNotifyEvent;
/*
struct TEvent
{
@@ -189,27 +137,6 @@
};    
*/
struct    IMGNNMHDR :  public NMHDR
{
   string path;
   string text;
   int nIndex;
};
struct     PAGENMHDR :  public NMHDR
{
    int max;
    int cur;
};
struct     LYSNMHDR : public NMHDR
{
    int nSheet;
};
struct xstruct
{
};
typedef struct _OVERLAPPED {
    ULONG_PTR Internal;
    ULONG_PTR InternalHigh;
@@ -234,6 +161,24 @@
    WORD Reserved2;
    CHAR szPathName[OFS_MAXPATHNAME];
} OFSTRUCT;
#endif
struct    IMGNNMHDR : public NMHDR
{
    string path;
    string text;
    int nIndex;
};
struct     PAGENMHDR : public NMHDR
{
    int max;
    int cur;
};
struct     LYSNMHDR : public NMHDR
{
    int nSheet;
};
struct     CELLNMHDR : public NMHDR
{
@@ -274,4 +219,66 @@
    LPTSTR pStr;
};
typedef struct tagEvent
{
    HWND    hWnd;
    DWORD    message;
    WPARAM    wParam;
    LPARAM    lParam;
    DWORD    time;
    POINT    pt;
    union
    {
        struct {
            int wmId;
            int wmEvent;
            HWND hCtrl;
        }command;
        struct
        {
            LPTSTR pStrID;
            void* pCmdFrom;
        }xcommand;
        struct {
            UINT nFlags;
            POINT point;
        } mouse;
        struct {
            UINT nFlags;
            POINT point;
        } size;
        struct {
            UINT nChar;
            UINT nRepCnt;
            UINT nFlags;
        }key;
        struct {
            HDC hdc;
        }paint;
        struct {
            HWND    hWnd;
            UINT    nHitTest;
            UINT    mouseMsg;
        }cursor;
        struct {
            UINT nSBCode;
            UINT nPos;
            HWND hWndCtl;
        }scroll;
        struct {
            POINT point;
            UINT_PTR fwKeys;
            short zDelta;
        }wheel;
        struct {
            int idCtrl;
            LPNMHDR pnmh;
        }notify;
    };
    void* pSrcObject;
    LPARAM    dwRet;
} TEvent;
typedef TEvent TNotifyEvent;
//typedef int FEvent(TEvent * evt, int p);
jrj/xframe/wobject/xcontrol.hpp
@@ -24,8 +24,8 @@
    int SetReadOnlyEx(const bool )
    {
        int EM_SETREADONLY = 0x00CF;
        return SendMessage(GetHWND(),EM_SETREADONLY,0,0);
        int EM_SETREADONLY_ = 0x00CF;
        return SendMessage(GetHWND(),EM_SETREADONLY_,0,0);
    }
    int EnableWindow(bool abled)
@@ -35,14 +35,14 @@
    
    int GetTextLength()
    {
        int WM_GETTEXTLENGTH = 0x000E;
        int WM_GETTEXTLENGTH_ = 0x000E;
        int nLen = ::GetWindowTextLengthW(GetHWND());
        return nLen;
    }
    xstring GetText()
    {
        int WM_GETTEXT = 0x000D;
        int WM_GETTEXT_ = 0x000D;
        int nLen = GetTextLength();
        
        xstring xs;
@@ -52,7 +52,7 @@
    
    int SetText(string value)
    {
        int WM_SETTEXT = 0x000C;
        int WM_SETTEXT_ = 0x000C;
        ::SetWindowTextW(GetHWND(),value);
        return 1;
    }
jrj/xframe/wobject/xobject.hpp
@@ -5,11 +5,4 @@
class xobject
{
public:
    void * GetFuncPtr(const wchar_t* dll, const char * name)
    {
        void * fnAttachEvent = nullptr;
        void * hModule = LoadLibraryW(dll);
        if(hModule)fnAttachEvent = GetProcAddressW(hModule,name);
        return fnAttachEvent;
    }
};
jrj/xframe/wobject/xutil.hpp
@@ -6,6 +6,9 @@
#include "win32/win.hpp"
using kutil = Hxsoft::XFrame::IXFUtil;
extern "C" {
    void* WINAPI  GetProcAddressW(HMODULE hModule, const char* lpText);
}
class xutil
{
public:
@@ -34,9 +37,9 @@
        return kutil::CacheUrlData((LPWSTR)url,(LPWSTR)data);
    }
    static int SaveToFile(const LPTSTR pFile,const LPTSTR pData,const LPTSTR ext, const LPTSTR pFilter, const LPTSTR pFileName=NULL)
    static int SaveToFile(xstring pFile,xstring pData,xstring ext, xstring pFilter, const LPTSTR pFileName=NULL)
    {
        return kutil::SaveToFile((LPWSTR)pFile,(LPWSTR)pData,(LPWSTR)ext,(LPWSTR)pFileName);
        return kutil::SaveToFile((LPWSTR)pFile.c_str(), (LPWSTR)pData.c_str(), (LPWSTR)ext.c_str(), (LPWSTR)pFileName);
    }
    static LPWSTR MD5(const wchar_t* pStr)
    {
@@ -59,7 +62,7 @@
    static xstring GetModulePath()
    {
        wchar_t buf[255];
        GetModuleFileName(0, buf, 255);
        ::GetModuleFileNameW(nullptr, buf, 255);
        PathRemoveFileSpec(buf);
        return xstring(buf);
    }
@@ -71,4 +74,11 @@
        return tmp;
    }
    static void* GetFuncPtr(const wchar_t* dll, const char* name)
    {
        void* fnAttachEvent = nullptr;
        HMODULE hModule = LoadLibraryW(dll);
        if (hModule)fnAttachEvent = ::GetProcAddressW(hModule, name);
        return fnAttachEvent;
    }
};
jrj/xframe/wobject/xwin.hpp
@@ -11,6 +11,16 @@
using kcontrol = Hxsoft::XFrame::IXFControl;
using knode = Hxsoft::XFrame::IXNode;
#define DeclWinObject_(ty,pty) class __declspec(dllexport) ty :  public pty
#define CreateWinObject_(ty,pty) \
public:\
    ty(void* impl,HWND hWnd):pty(impl,hWnd){}\
public:\
    ty * CreateInstance(void* impl,void* hWnd)\
    {\
        return new ty(impl,(HWND)hWnd);\
    }
class xwin: public xview
{
public:
@@ -69,16 +79,16 @@
    xwin* OpenWindow(string url)
    {
        int WS_OVERLAPPEDWINDOW = 0x00cf0000 ;
        kwin* w = kwin::OpenWindow(GetServerUrl(),url,getKWin(),0/*param*/,0/*CmdWind*/,0,WS_OVERLAPPEDWINDOW,0);
        int WS_OVERLAPPEDWINDOW_ = 0x00cf0000 ;
        kwin* w = kwin::OpenWindow(GetServerUrl(),url,getKWin(),0/*param*/,0/*CmdWind*/,0,WS_OVERLAPPEDWINDOW_,0);
        if(!w) return 0; //response
        return (xwin*)GetPropW(w->GetHWND(),L"AttachObject");
    }
    
    xwin* OpenWindow(string url,LPARAM p)
    {
        int WS_OVERLAPPEDWINDOW = 0x00cf0000;
        kwin* w= kwin::OpenWindow(GetServerUrl(),url,getKWin(),p,0/*CmdWind*/,0/*dwStyleEx*/,WS_OVERLAPPEDWINDOW,0);
        int WS_OVERLAPPEDWINDOW_ = 0x00cf0000;
        kwin* w= kwin::OpenWindow(GetServerUrl(),url,getKWin(),p,0/*CmdWind*/,0/*dwStyleEx*/,WS_OVERLAPPEDWINDOW_,0);
        if(!w) return 0; //response
        return (xwin*)GetPropW(w->GetHWND(),L"AttachObject");
    }
jrj/xframe/xcontrol/xcombobox.hpp
@@ -18,133 +18,133 @@
public:
    int GetCurSel()
    {
        int CB_GETCURSEL  = 0x0147;
        return SendMessage(GetHWND(),CB_GETCURSEL,0,0);
        int CB_GETCURSEL_  = 0x0147;
        return SendMessage(GetHWND(),CB_GETCURSEL_,0,0);
    }
    int SetCurSel( int nIndex)
    {
        int CB_SETCURSEL  = 0x014E;
        return SendMessage(GetHWND(),CB_SETCURSEL,nIndex,0);
        int CB_SETCURSEL_  = 0x014E;
        return SendMessage(GetHWND(),CB_SETCURSEL_,nIndex,0);
    }
            
    int GetCount()
    {
        int CB_GETCOUNT = 0x0146;
        return SendMessage(GetHWND(),CB_GETCOUNT,0,0);
        int CB_GETCOUNT_ = 0x0146;
        return SendMessage(GetHWND(),CB_GETCOUNT_,0,0);
    }
            
   string GetLBText(int nIndex)
    {
        int CB_GETLBTEXT     =  0x0148;
        int CB_GETLBTEXTLEN  =  0x0149;
        int nLen = SendMessage(GetHWND(),CB_GETLBTEXTLEN ,nIndex,0);
        int CB_GETLBTEXT_     =  0x0148;
        int CB_GETLBTEXTLEN_  =  0x0149;
        int nLen = SendMessage(GetHWND(),CB_GETLBTEXTLEN_ ,nIndex,0);
        string str = new wchar_t[nLen+1];
        SendMessage(GetHWND(),CB_GETLBTEXT ,nIndex, (LPARAM)str);
        SendMessage(GetHWND(),CB_GETLBTEXT_ ,nIndex, (LPARAM)str);
        return str;
    }
   string GetLBText()
    {
        int CB_GETLBTEXT     =  0x0148;
        int CB_GETLBTEXTLEN  =  0x0149;
        int CB_GETLBTEXT_     =  0x0148;
        int CB_GETLBTEXTLEN_  =  0x0149;
        int nIndex = GetCurSel();
        int nLen = SendMessage(GetHWND(),CB_GETLBTEXTLEN ,nIndex,0);
        int nLen = SendMessage(GetHWND(),CB_GETLBTEXTLEN_ ,nIndex,0);
         string str = new wchar_t[nLen+1];
        SendMessage(GetHWND(),CB_GETLBTEXT ,nIndex, (LPARAM)str);
        SendMessage(GetHWND(),CB_GETLBTEXT_ ,nIndex, (LPARAM)str);
        return str;
    }
    int SetItemIndex(int nIndex)
    {
        int CB_SETCURSEL = 0x014E;
        return SendMessage(GetHWND(),CB_SETCURSEL ,nIndex, 0);
        int CB_SETCURSEL_ = 0x014E;
        return SendMessage(GetHWND(),CB_SETCURSEL_ ,nIndex, 0);
    }
            
   int AddItem(string str)
    {
        int CB_ADDSTRING =  0x0143;
        return SendMessage(GetHWND(),CB_ADDSTRING  ,(WPARAM)0,(LPARAM)str);
        int CB_ADDSTRING_ =  0x0143;
        return SendMessage(GetHWND(),CB_ADDSTRING_  ,(WPARAM)0,(LPARAM)str);
    }
            
   int FindString(string str)
    {
        int CB_FINDSTRINGEXACT = 0x0158;
        return SendMessage(GetHWND(),CB_FINDSTRINGEXACT,0,(LPARAM)str);
        int CB_FINDSTRINGEXACT_ = 0x0158;
        return SendMessage(GetHWND(),CB_FINDSTRINGEXACT_,0,(LPARAM)str);
    }
   int DeleteItem(int nIndex)
    {
        int CB_DELETESTRING = 0x0144;
        return SendMessage(GetHWND(),CB_DELETESTRING,nIndex,0);
        int CB_DELETESTRING_ = 0x0144;
        return SendMessage(GetHWND(),CB_DELETESTRING_,nIndex,0);
    }
   int SelectString( int nIndex,string str) 
    {
        int CB_SELECTSTRING  = 0x014D;
        return SendMessage(GetHWND(),CB_SELECTSTRING,nIndex,(LPARAM)str);
        int CB_SELECTSTRING_  = 0x014D;
        return SendMessage(GetHWND(),CB_SELECTSTRING_,nIndex,(LPARAM)str);
    }
   int InsertString( int nIndex,string str) 
    {
        int CB_INSERTSTRING  = 0x014A;
        return SendMessage(GetHWND(),CB_INSERTSTRING,nIndex,(LPARAM)str);
        int CB_INSERTSTRING_  = 0x014A;
        return SendMessage(GetHWND(),CB_INSERTSTRING_,nIndex,(LPARAM)str);
    }
   int InsertString( string str) 
    {
        int CB_INSERTSTRING  = 0x014A;
        return SendMessage(GetHWND(),CB_INSERTSTRING,0,(LPARAM)str);
        int CB_INSERTSTRING_  = 0x014A;
        return SendMessage(GetHWND(),CB_INSERTSTRING_,0,(LPARAM)str);
    }
   int ResetContent() 
    {
        int CB_RESETCONTENT  =  0x014B;
        return SendMessage(GetHWND(),CB_RESETCONTENT,0,0);
        int CB_RESETCONTENT_  =  0x014B;
        return SendMessage(GetHWND(),CB_RESETCONTENT_,0,0);
    }
   int SetItemData(int nIndex, LPARAM p) 
    {
        int CB_SETITEMDATA  =   0x0151;
        return SendMessage(GetHWND(),CB_SETITEMDATA,nIndex,p);
        int CB_SETITEMDATA_  =   0x0151;
        return SendMessage(GetHWND(),CB_SETITEMDATA_,nIndex,p);
    }
   int GetItemData() 
    {
        int CB_GETITEMDATA  =   0x0150;
        int CB_GETITEMDATA_  =   0x0150;
        int nIndex = GetCurSel();
        if(nIndex < 0) 
        return -1;
        else
        return SendMessage(GetHWND(),CB_GETITEMDATA,nIndex,0);
        return SendMessage(GetHWND(),CB_GETITEMDATA_,nIndex,0);
    }
   LPARAM GetItemData(int nIndex) 
    {
        int CB_GETITEMDATA  =   0x0150;
        return SendMessage(GetHWND(),CB_GETITEMDATA,nIndex,0);
        int CB_GETITEMDATA_  =   0x0150;
        return SendMessage(GetHWND(),CB_GETITEMDATA_,nIndex,0);
    }
   int AddItem(string str, int p)
    {
        int CB_ADDSTRING =  0x0143;
        int h = SendMessage(GetHWND(),CB_ADDSTRING  ,0,(LPARAM)str);
        int CB_ADDSTRING_ =  0x0143;
        int h = SendMessage(GetHWND(),CB_ADDSTRING_  ,0,(LPARAM)str);
        SetItemData( h, p);
        return h;
    }
   
   int AddItem(string str, string p)
    {
        int CB_ADDSTRING =  0x0143;
        int h = SendMessage(GetHWND(),CB_ADDSTRING  ,0,(LPARAM)str);
        int CB_ADDSTRING_ =  0x0143;
        int h = SendMessage(GetHWND(),CB_ADDSTRING_  ,0,(LPARAM)str);
        SetItemData( h, (LPARAM)p);
        return h;
    }
   int InsertString( string str, LPARAM p) 
    {
        int CB_INSERTSTRING  = 0x014A;
        int h =  SendMessage(GetHWND(),CB_INSERTSTRING,0,(LPARAM)str);
        int CB_INSERTSTRING_  = 0x014A;
        int h =  SendMessage(GetHWND(),CB_INSERTSTRING_,0,(LPARAM)str);
    
        SetItemData( h, p);
        return h;
@@ -154,133 +154,133 @@
   /////
   static int GetCurSel(HWND hWnd)
   {
       int CB_GETCURSEL = 0x0147;
       return SendMessage(hWnd, CB_GETCURSEL, 0, 0);
       int CB_GETCURSEL_ = 0x0147;
       return SendMessage(hWnd, CB_GETCURSEL_, 0, 0);
   }
   static int SetCurSel(HWND hWnd,int nIndex)
   {
       int CB_SETCURSEL = 0x014E;
       return SendMessage(hWnd, CB_SETCURSEL, nIndex, 0);
       int CB_SETCURSEL_ = 0x014E;
       return SendMessage(hWnd, CB_SETCURSEL_, nIndex, 0);
   }
   static int GetCount(HWND hWnd)
   {
       int CB_GETCOUNT = 0x0146;
       return SendMessage(hWnd, CB_GETCOUNT, 0, 0);
       int CB_GETCOUNT_ = 0x0146;
       return SendMessage(hWnd, CB_GETCOUNT_, 0, 0);
   }
   static string GetLBText(HWND hWnd,int nIndex)
   {
       int CB_GETLBTEXT = 0x0148;
       int CB_GETLBTEXTLEN = 0x0149;
       int nLen = SendMessage(hWnd, CB_GETLBTEXTLEN, nIndex, 0);
       int CB_GETLBTEXT_ = 0x0148;
       int CB_GETLBTEXTLEN_ = 0x0149;
       int nLen = SendMessage(hWnd, CB_GETLBTEXTLEN_, nIndex, 0);
       string str = new wchar_t[nLen + 1];
       SendMessage(hWnd, CB_GETLBTEXT, nIndex, (LPARAM)str);
       SendMessage(hWnd, CB_GETLBTEXT_, nIndex, (LPARAM)str);
       return str;
   }
   static string GetLBText(HWND hWnd)
   {
       int CB_GETLBTEXT = 0x0148;
       int CB_GETLBTEXTLEN = 0x0149;
       int CB_GETLBTEXT_ = 0x0148;
       int CB_GETLBTEXTLEN_ = 0x0149;
       int nIndex = GetCurSel(hWnd);
       int nLen = SendMessage(hWnd, CB_GETLBTEXTLEN, nIndex, 0);
       int nLen = SendMessage(hWnd, CB_GETLBTEXTLEN_, nIndex, 0);
       string str = new wchar_t[nLen + 1];
       SendMessage(hWnd, CB_GETLBTEXT, nIndex, (LPARAM)str);
       SendMessage(hWnd, CB_GETLBTEXT_, nIndex, (LPARAM)str);
       return str;
   }
   static int SetItemIndex(HWND hWnd,int nIndex)
   {
       int CB_SETCURSEL = 0x014E;
       return SendMessage(hWnd, CB_SETCURSEL, nIndex, 0);
       int CB_SETCURSEL_ = 0x014E;
       return SendMessage(hWnd, CB_SETCURSEL_, nIndex, 0);
   }
   static int AddItem(HWND hWnd,string str)
   {
       int CB_ADDSTRING = 0x0143;
       return SendMessage(hWnd, CB_ADDSTRING, (WPARAM)0, (LPARAM)str);
       int CB_ADDSTRING_ = 0x0143;
       return SendMessage(hWnd, CB_ADDSTRING_, (WPARAM)0, (LPARAM)str);
   }
   static int FindString(HWND hWnd,string str)
   {
       int CB_FINDSTRINGEXACT = 0x0158;
       return SendMessage(hWnd, CB_FINDSTRINGEXACT, 0, (LPARAM)str);
       int CB_FINDSTRINGEXACT_ = 0x0158;
       return SendMessage(hWnd, CB_FINDSTRINGEXACT_, 0, (LPARAM)str);
   }
   static int DeleteItem(HWND hWnd,int nIndex)
   {
       int CB_DELETESTRING = 0x0144;
       return SendMessage(hWnd, CB_DELETESTRING, nIndex, 0);
       int CB_DELETESTRING_ = 0x0144;
       return SendMessage(hWnd, CB_DELETESTRING_, nIndex, 0);
   }
   static int SelectString(HWND hWnd,int nIndex, string str)
   {
       int CB_SELECTSTRING = 0x014D;
       return SendMessage(hWnd, CB_SELECTSTRING, nIndex, (LPARAM)str);
       int CB_SELECTSTRING_ = 0x014D;
       return SendMessage(hWnd, CB_SELECTSTRING_, nIndex, (LPARAM)str);
   }
   static int InsertString(HWND hWnd,int nIndex, string str)
   {
       int CB_INSERTSTRING = 0x014A;
       return SendMessage(hWnd, CB_INSERTSTRING, nIndex, (LPARAM)str);
       int CB_INSERTSTRING_ = 0x014A;
       return SendMessage(hWnd, CB_INSERTSTRING_, nIndex, (LPARAM)str);
   }
   static int InsertString(HWND hWnd,string str)
   {
       int CB_INSERTSTRING = 0x014A;
       return SendMessage(hWnd, CB_INSERTSTRING, 0, (LPARAM)str);
       int CB_INSERTSTRING_ = 0x014A;
       return SendMessage(hWnd, CB_INSERTSTRING_, 0, (LPARAM)str);
   }
   int ResetContent(HWND hWnd)
   {
       int CB_RESETCONTENT = 0x014B;
       return SendMessage(hWnd, CB_RESETCONTENT, 0, 0);
       int CB_RESETCONTENT_ = 0x014B;
       return SendMessage(hWnd, CB_RESETCONTENT_, 0, 0);
   }
   static int SetItemData(HWND hWnd,int nIndex, LPARAM p)
   {
       int CB_SETITEMDATA = 0x0151;
       return SendMessage(hWnd, CB_SETITEMDATA, nIndex, p);
       int CB_SETITEMDATA_ = 0x0151;
       return SendMessage(hWnd, CB_SETITEMDATA_, nIndex, p);
   }
   static int GetItemData(HWND hWnd)
   {
       int CB_GETITEMDATA = 0x0150;
       int CB_GETITEMDATA_ = 0x0150;
       int nIndex = GetCurSel(hWnd);
       if (nIndex < 0)
           return -1;
       else
           return SendMessage(hWnd, CB_GETITEMDATA, nIndex, 0);
           return SendMessage(hWnd, CB_GETITEMDATA_, nIndex, 0);
   }
   static LPARAM GetItemData(HWND hWnd,int nIndex)
   {
       int CB_GETITEMDATA = 0x0150;
       return SendMessage(hWnd, CB_GETITEMDATA, nIndex, 0);
       int CB_GETITEMDATA_ = 0x0150;
       return SendMessage(hWnd, CB_GETITEMDATA_, nIndex, 0);
   }
   static int AddItem(HWND hWnd,string str, int p)
   {
       int CB_ADDSTRING = 0x0143;
       int h = SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)str);
       int CB_ADDSTRING_ = 0x0143;
       int h = SendMessage(hWnd, CB_ADDSTRING_, 0, (LPARAM)str);
       SetItemData(hWnd,h, p);
       return h;
   }
   static int AddItem(HWND hWnd,string str, string p)
   {
       int CB_ADDSTRING = 0x0143;
       int h = SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)str);
       int CB_ADDSTRING_ = 0x0143;
       int h = SendMessage(hWnd, CB_ADDSTRING_, 0, (LPARAM)str);
       SetItemData(hWnd,h, (LPARAM)p);
       return h;
   }
   static int InsertString(HWND hWnd,string str, LPARAM p)
   {
       int CB_INSERTSTRING = 0x014A;
       int h = SendMessage(hWnd, CB_INSERTSTRING, 0, (LPARAM)str);
       int CB_INSERTSTRING_ = 0x014A;
       int h = SendMessage(hWnd, CB_INSERTSTRING_, 0, (LPARAM)str);
       SetItemData(hWnd,h, p);
       return h;
jrj/xframe/xcontrol/xexcel.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,44 @@
#pragma once
#include "wobject/xcontrol.hpp"
#include "kobject/kexcel.hpp"
using kexcel = CExcelApplication;
class xexcel : public xcontrol
{
public:
    xexcel() :xcontrol(kexcel::CreateInstance()) {}
    ~xexcel(){
        GetKExcel()->Release(GetKExcel());
    }
public:
    kexcel* GetKExcel()
    {
        return (kexcel*)this->GetNativePtr();
    }
public:
    void put_Visible(BOOL newValue) //alias "?put_Visible@CExcelApplication@@QAEXH@Z";
    {
        return GetKExcel()->put_Visible(newValue);
    }
    bool get_Visible() //alias "?get_Visible@CExcelApplication@@QAEHXZ";
    {
        return GetKExcel()->get_Visible();
    }
    void OpenDocument(xstring FileName) //alias "?OpenDocument@CExcelApplication@@QAEXQA_W@Z";
    {
       return GetKExcel()->OpenDocument((const LPTSTR)FileName.c_str());
     }
    void TransShape() //alias "?TransShape@CExcelApplication@@QAEXXZ";
    {
      return GetKExcel()->TransShape();
    }
    void SaveToFile(xstring FileName)// alias "?SaveToFile@CExcelApplication@@QAEXQA_W@Z";
    {
       GetKExcel()->SaveToFile((const LPTSTR)FileName.c_str());
    }
    void Quit() //alias "?Quit@CExcelApplication@@QAEXXZ";
    {
       GetKExcel()->Quit();
    }
};
jrj/xframe/xcontrol/xhtml.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,37 @@
#pragma once
#include "wobject/xcontrol.hpp"
#include "kobject/khtml.hpp"
using khtml = Hxsoft::XFrame::xcOleControlContain;
class xhtml : public xcontrol
{
public:
    xhtml(void* impl = nullptr) :xcontrol(impl) {}
public:
    khtml* GetKHtml()
    {
        return (khtml*)this->GetNativePtr();
    }
    int LoadHtml(xstring content)
    {
        return GetKHtml()->LoadHtml((LPTSTR)content.c_str());
    }
    int ExecWB(int cmdID, int cmdexecopt)
    {
        return GetKHtml()->ExecWB(cmdID, cmdexecopt);
    }
    int LoadText(xstring content)
    {
        return GetKHtml()->LoadText((LPTSTR)content.c_str());
    }
    IHTMLDocument2* GetHtmlDocument()
    {
        return GetKHtml()->GetHtmlDocument();
    }
    int innerHTML(KXMLDOMDocument srcTree, KXMLDOMDocument xsltTree, KXMLDOMDocument resTree)
    {
        return 1;
    }
};
jrj/xframe/xcontrol/xtreeview.hpp
@@ -49,6 +49,7 @@
 #define TV_FIRST 0x1100 
#ifdef XWIN
struct SCROLLINFO 
{
    int cbSize;
@@ -59,6 +60,8 @@
    int  nPos;
    int  nTrackPos;
};
#endif
struct tvitem 
{
@@ -520,13 +523,13 @@
    void SetLineAtRoot(bool value)
    {
        int GWL_STYLE = -16;
        int TVS_LINESATROOT = 0x0004;
        int style = GetWindowLong(GetHWND(), GWL_STYLE);
        int GWL_STYLE_ = -16;
        int TVS_LINESATROOT_ = 0x0004;
        int style = GetWindowLong(GetHWND(), GWL_STYLE_);
        if (value)
            SetWindowLong(GetHWND(), GWL_STYLE, style | TVS_LINESATROOT);
            SetWindowLong(GetHWND(), GWL_STYLE_, style | TVS_LINESATROOT_);
        else
            SetWindowLong(GetHWND(), GWL_STYLE, style & ~TVS_LINESATROOT);
            SetWindowLong(GetHWND(), GWL_STYLE_, style & ~TVS_LINESATROOT_);
    }
};