Article ID: 192693
Article Last Modified on 2/24/2005
THISFORM.AddObject("myctrl","olecontrol","mscomctllib.listviewctrl.2")
Then you build this application into an executable file, create a
distribution with the Setup Wizard or InstallShield Express for Visual FoxPro Edition, and install your application on other
computers, when you attempt to run code similar to the preceding code you
receive an error like the following:
Program Error OLE error code 0x80040112: Appropriate license for this class not found.
PUBLIC oform1
oform1=CREATEOBJECT("form1")
oform1.Show
READ EVENTS
RETURN
DEFINE CLASS form1 AS form
AutoCenter = .T.
cNextKey = "1_"
Name = "Form1"
Caption = "Treeview Demo Form"
ADD OBJECT cmdExit AS commandbutton WITH ;
Top = 204, ;
Left = 276, ;
Height = 27, ;
Width = 84, ;
Caption = "E\<xit"
ADD OBJECT cmdAddLV AS commandbutton WITH ;
Top = 204, ;
Left = 10, ;
Height = 27, ;
Width = 106, ;
Caption = "Add Listview"
ADD OBJECT cmdAddLVClass AS commandbutton WITH ;
Top = 204, ;
Left = 130, ;
Height = 27, ;
Width = 136, ;
Caption = "Add Listview Subclass"
PROCEDURE Destroy
CLEAR EVENTS
ENDPROC
PROCEDURE cmdExit.Click
thisform.release()
ENDPROC
PROCEDURE cmdAddLV.Click
* The following AddObject causes the error.
Thisform.AddObject('Lv1','olecontrol','mscomctllib.listviewctrl.2')
Thisform.SetLVProps()
ENDPROC
PROCEDURE cmdAddLVClass.Click
* The following code shows the workaround. The class OC1 is
* defined in the last 3 lines of this program.
* Alternanely, you could use an object stored in a Visual Class
* library (.vcx) file.
Thisform.NewObject('LV1','OC1')
Thisform.SetLVProps()
ENDPROC
PROCEDURE SetLVProps
thisform.setall('enabled', .F.,'commandbutton')
WITH thisform.LV1
.visible = .t.
.height = 190
.left = 75
.width = 250
.view = 2
.listitems.add(,,"List Item 1",,)
.listitems.add(,,"List Item 2",,)
ENDWITH
thisform.cmdExit.enabled = .t.
thisform.cmdExit.setfocus()
ENDPROC
ENDDEFINE
DEFINE class OC1 as olecontrol
OleClass = 'mscomctllib.listviewctrl.2'
ENDDEFINE
CREATE CLASS
Thisform.NewObject('LV1','OC1', 'OCTest.vcx')
Additional query words: kbVFp600bug kbActiveX kbvfp600
Keywords: kbbug kbpending kbcode KB192693