现在需要完成这样的功能:
1、在C/S框架的一个对话框上完成B/S的一些功能,也就是使用CWebBrowser2显示网页。
2、当网页里点击提交按钮时,能够获得输入框里的内容。
3、当IIS那边得到消息回复响应时,能够得到返回的内容。
请大家帮我,怎样完成上面的需求?
谢谢!

解决方案 »

  1.   

    1、用CWebBrowser控件就可以了
    2、3都是asp/jsp的问题
      

  2.   

    不全是asp/jsp的问题,软件需要把发送和接收的部分数据(关键字描述的)保存在本地.
      

  3.   

    可以的,查一下IHTMLDocument2以及相关接口
      

  4.   

    IHTMLDocument2::AttachEvent
    继承IDispathc接口,实现Invoke方法VC中的示例:删除了VC自动生成的注释  
      class   CDHTMLEventSink   :   public   CCmdTarget  
      {  
      DECLARE_DYNCREATE(CDHTMLEventSink)  
      CDHTMLEventSink();                       //   protected   constructor   used   by   dynamic   creation  
      public:  
      void   OnBDblClick(IHTMLEventObj   *pEvtObj);  
      CWnd*   m_pWnd;  
      void   SetParent(CWnd*   objWnd);  
      void   OnBClick(IHTMLEventObj   *pEvtObj);  
      STDMETHOD(Invoke)(DISPID   dispIdMember,   REFIID,   LCID,   WORD,   DISPPARAMS*   pDisp,   VARIANT*   test,   EXCEPINFO   *,   UINT   *);  
       
      //   Overrides  
      //   ClassWizard   generated   virtual   function   overrides  
      //{{AFX_VIRTUAL(CDHTMLEventSink)  
      public:  
      virtual   void   OnFinalRelease();  
      //}}AFX_VIRTUAL  
       
      //   Implementation  
      protected:  
      virtual   ~CDHTMLEventSink();  
      DECLARE_MESSAGE_MAP()  
      DECLARE_DISPATCH_MAP()  
      DECLARE_INTERFACE_MAP()  
      };  
       
      //.cpp  
      IMPLEMENT_DYNCREATE(CDHTMLEventSink,   CCmdTarget)  
       
      CDHTMLEventSink::CDHTMLEventSink()  
      {  
      EnableAutomation();  
      }  
       
      //然后就是实现了Invoke函数  
       
      调用  
      void   CMshtmlhookDlg::ConnectButton1(IHTMLButtonElement*   pButtonElem)  
      {  
      HRESULT   hr   =   0;          
      IConnectionPointContainer*   pCPC   =   NULL;          
      IConnectionPoint*   pCP   =   NULL;          
      IUnknown*   pUnk   =   NULL;  
      DWORD   dwCookie;  
              //   Check   that   this   is   a   connectable   object.  
              hr   =   pButtonElem->QueryInterface(IID_IConnectionPointContainer,   (void**)&pCPC);  
              if   (hr   ==   S_OK)  
              {                  
      //AfxMessageBox("ConnectionPointContainer");  
      //   Find   the   connection   point.  
                      hr   =   pCPC->FindConnectionPoint(DIID_HTMLButtonElementEvents2,   &pCP);                  
      if   (hr   ==   S_OK)  
                      {                          
      //AfxMessageBox("Find   connection   point   ");  
      //   Advise   the   connection   point.  
                              //   pUnk   is   the   IUnknown   interface   pointer   for   your   event   sink  
                               
      CDHTMLEventSink*   pSink   =   new   CDHTMLEventSink;    
                              pSink->SetParent(this);  
      IUnknown*   pUnk   =   pSink->GetInterface(&IID_IUnknown);  
      hr   =   pCP->Advise(pUnk,   &dwCookie);  
      pCP->Release();  
                      }  
                      pCPC->Release();  
              }  
      }   
    然后通过IHTMLDocument2的接口得到你要的那个页面元素,把value取出来关于3,取这个信息的目的是什么?如果是读cookie,那IHTMLDocument2本身就可以做查一下MSDN,这几步应该都不复杂
      

  5.   

    IHTMLDocument2::AttachEvent
    继承IDispathc接口,实现Invoke方法 这是用来截获页面事件的.