控件中套控件的奇怪问题!!!(100分)

G

gzyhp

Unregistered / Unconfirmed
GUEST, unregistred user!
我用VC++6做一个Active X控件。用MFC Wizard生成,选中acts as
a sample frame control,然后引入控件Microsoft FlexGrid Control,Version 6.0,
包含其头文件,增加一个该类的对象,然后:
int CC1Ctrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (COleControl::OnCreate(lpCreateStruct) == -1)
return -1;

// TODO: Add your specialized creation code here
//我加入的代码:
m_fgrid.Create(NULL, WS_VISIBLE, CRect(50,50,100,100), this, 0);
m_fgrid.SetCols(2)

m_fgrid.SetRows(10)

m_fgrid.SetTextMatrix(0,0,"序号")

m_fgrid.SetTextMatrix(0,1,"姓名")

//加入的代码结束!
return 0;
}
连接正确,然后用ActiveX control test container测试,结果报“Tstcon32执行了非法操
作”错!我百思不得其解,请各路大侠指点!!!
 
帮你提前一次,以后请自己提前帖子
 
呵呵,如果你的应用程序使用了控件有一段代码初始化,而控件使用控件则没有那段代码,需要
自己添加如下代码
BOOL CContainerApp::InitInstance()
{
AfxEnableControlContainer();
...
}

Add the following to your project’s STDAFX.H header file:
#include <Afxdisp.h>

 
多人接受答案了。
 

Similar threads

S
回复
0
查看
1K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
926
SUNSTONE的Delphi笔记
S
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
顶部