×

Loading...
Ad by
Ad by

An ActiveX control created with a user interface, or it can be invisible. You can indicate this option in the Control Settings page .

A timer control is an example of an ActiveX control that you would want to be invisible.
Report

Replies, comments and Discussions:

  • 工作学习 / 专业技术讨论 / 现在有一个ActiveX(我们没有源代码),
    我只需要用其中的一个Function (全部是数学计算), 不需要它在UI上显示任何东西, 然后我们的一个Windows Services 要用这个Function, 但是在Create 这个ActiveX的时候发生错误, 因为Windows Services 是 WindowLess 的, 比如说没有UI Resources ( eg Dialog ...), 但是Create ActiveX 的时候要求有一个Windows Window, 具体的说 CWnd 的 m_hWnd is NULL, Create 就发生错误。 做一个MFC的Dialog就没有这个问题, 哪位大侠知道如何解决这个问题?
    • You can create window to host ActiveX in service, even you cannot see the window.
      • 谢谢回复, 我也是这个想法,但是应该如果具体实施? MFC我从没有用过, 实在不熟悉。 是否要建立一个DIALOG, 然后让它HIDDEN?
        有啥比较简单的办法, 因为现存的东西很大了, 怕加了这个东西影响它, 我的目的就是让CWnd 的 m_hWnd is NOT NULL。 多谢。
    • An ActiveX control created with a user interface, or it can be invisible. You can indicate this option in the Control Settings page .
      A timer control is an example of an ActiveX control that you would want to be invisible.
    • Try creating a hiden window.
      • I tried thisdlg.ShowWindow(SW_HIDE); NO LUCK.
        • Try ATL AxWindow, create the AxWndow and host the control, but keep the window hiden.
    • C# SAMPLE CODE
      假设ACTIVX 的类名为 AXTTest,
      1. 创建一个FORM (frmTest)

      public class frmTest : System.Windows.Forms.Form
      {
      private AXTest m_axTest;
      public AXTest AxTest { get { return m_axTest;}}

      public frmTAPI()
      {
      InitializeComponent();
      this.CreateControl();
      }

      private void InitializeComponent()
      {
      System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmTest));
      this.m_axTest = new AXTest();
      ((System.ComponentModel.ISupportInitialize)(this.m_axTest)).BeginInit();
      this.SuspendLayout();

      //init m_axTest
      this.m_axTest.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("m_axTest.OcxState")));
      .....

      this.Controls.Add(this.m_axTest);
      ((System.ComponentModel.ISupportInitialize)(this.m_axTest)).EndInit();
      this.ResumeLayout(false);

      }
      }

      2.在外部程序创建frmTest 实例(m_frmTest)
      3. 使用Activex , m_frmTest.AXTest