我写了一个控件(TSXXX = class(TComponent)),在Application时,在Form上可以使用,但是在ActivxForm上却提示我
"Invalid class typecast",怎么搞的???
是不是在我的类里面使用了ActiveX不识别的类,怎么改呢?
大家帮帮忙啊,我在线等待......

解决方案 »

  1.   

    ActiveX 有什么类是无效的?
      

  2.   

    我知道原因了:
    constructor TSXXX.Create(AOwner: TComponent);
    begin
      inherited Create(AOwner);
      with AOwner as TActiveForm do TSXXXMainWnd := Handle; 
    end;
    在ActiveFormX中,TForm是非法的,但我不知该如何去取主窗体的句柄......请高手指教.
      

  3.   

    上面错了是:
    constructor TSXXX.Create(AOwner: TComponent);
    begin
      inherited Create(AOwner);
      with AOwner as TForm do TSXXXMainWnd := Handle; 
    end;