ComctlLib; compiler error: User-defined type not defined 
Author Message
 ComctlLib; compiler error: User-defined type not defined

I new to VB and trying to learn as I go; looking at examples.  I'm trying to
build an "Explorer" style treeview control.  I'm using, or trying to use the
ComctlLib object in an example from Francesco Balena's Programming Microsoft
Visual Basic 6.0.  How I solve this compiler error problem?  Is there a
property I need to set?  I sure could use some help.

TIA,
Ken Erickson



Mon, 26 Jan 2004 08:35:41 GMT  
 ComctlLib; compiler error: User-defined type not defined
Ken
    This may be the cause to your problem:

I had a recent experience using VB6 in a project, I've been working on here
and there for the past 2 years.  I thought I'd pass on my experience, since
I have found articles and news groups to be of help to me in the past.

My project has been expanding in scope (nothing new here, right) for quite a
while, I had created forms using various VB embedded and Microsoft provided,
and third party  custom controls.  Specifically the common controls...  To
be more precise the comctl32.ocx, comct232.ocx without any specific
problems...  Enter Visual Studio service packs five in total.  I've
installed these without noticing any specific problems until I began working
with a new form recently.  On this form I used the ListView and TreeView
controls which I'm certain alot of us have used before.  However, I noticed
now my toolbox included two copies of several of these custom control icons.
Ok, I didn't know why at first but I continued my work.  I needed to find a
node in the treeview, previously created...  So I chose to use a for loop to
accomplish this task, below is some simple code:

dim nodx as Node

for each nodx in TreeView1.Nodes
     ' do something meanful
next nodx

We've all used this hundreds of times.  This time it wouldn't run, it failed
with an error message stating a type definition error, on the DIM statement!
That didn't make any sense to me at the time.  I found just yesterday that
when I installed service pack 5 for visual studio two new custom controls
were added: MSCOMCTL.OCX and MSCOMCT2.OCX.  These libraries duplicate
controls who's functionality found in: COMCTL32.OCX and COMCT232.OCX.  I
found these came with Visual Studio Service pack 2.  This duplication caused
my error.

Now how did I fix it...

Well, I don't recommend it to anyone working on a project.  But it worked
for me.  Save a copy of your project, just in case you totally bollux it!

First I edited my project's .vbp file this near the top lists all of the
objects (custom control's selected for this project).  Below is what
mine said:

Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; COMDLG32.OCX
Object={6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0; COMCTL32.OCX
Object={FE0065C0-1B7B-11CF-9D53-00AA003C9CB6}#1.1#0; COMCT232.OCX
Object={BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0; TABCTL32.OCX
Object={C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0; MSMASK32.OCX
Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCTL.OCX
Object={86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCT2.OCX
ok I removed references to COMCTL32.OCX and COMCT232.OCX from this file.  I
did this in notepad.  I went through each .frm file doing a search and
replace for: " ComctlLib" and replaced with " MSComCtlLib" (this was for
control's that were created from COMCTL32.OCX and the replacement forced
them to be created
from MSCOMCTL.OCX) . Lastly I did a search and replace on " ComCtl2." and
replaced it with " MSComCtl2."

Also I removed the references to each control in the top of each .frm file.
Here's what what of mine looked like
before I started:

VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Object = "{FE0065C0-1B7B-11CF-9D53-00AA003C9CB6}#1.1#0"; "COMCT232.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"

And when I finished:

VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"

Doing this effectively removed all references to the custom controls:
COMCTL32.OCX and COMCT232.OCX
replacing it with references to: MSCOMCTL.OCX and MSCOMCT2.OCX.

Now the dicey part would the .frx files and the offsets listed in the .frm
files for images, et al still work.  And would the somewhat different
property lists also work.  I loaded VB6, opened my project and everything
looked ok.  I removed the old version of the custom controls, by right
clicking the toolbox and selecting "Components" unselected the entries for
these.  Saved my project and my simple code now works.

End of Story...

I hope this helps someone else.

Steve Schaff


Quote:
> I new to VB and trying to learn as I go; looking at examples.  I'm trying
to
> build an "Explorer" style treeview control.  I'm using, or trying to use
the
> ComctlLib object in an example from Francesco Balena's Programming
Microsoft
> Visual Basic 6.0.  How I solve this compiler error problem?  Is there a
> property I need to set?  I sure could use some help.

> TIA,
> Ken Erickson



Mon, 26 Jan 2004 09:39:18 GMT  
 ComctlLib; compiler error: User-defined type not defined
You mentioned 2 key words:  "VB6" and "ComctlLib".  This makes me tend to
believe that either you or the book is using the VB5 version of the Treeview
while the other is using the VB6 version of the TreeView.

This is because "ComctlLib" is the library name for the VB5 version and the
library name for the VB6 version is "MSComctlLib".  You would get this kind
of error (for example) if you added the VB6 version, but the code used the
library name "ComctlLib".

Mike


Quote:
> I new to VB and trying to learn as I go; looking at examples.  I'm trying
to
> build an "Explorer" style treeview control.  I'm using, or trying to use
the
> ComctlLib object in an example from Francesco Balena's Programming
Microsoft
> Visual Basic 6.0.  How I solve this compiler error problem?  Is there a
> property I need to set?  I sure could use some help.

> TIA,
> Ken Erickson



Mon, 26 Jan 2004 09:51:53 GMT  
 ComctlLib; compiler error: User-defined type not defined
Mike,
    I wish what you stated were true.  Unfortunately vb6 sp2 included
"ComctlLib" and "ComCtl2"
VB 6 sp 5 included the others: "MSComCtlLib" and "MSComCtl2", you may not
have both versions
of these controls if you only installed SP5 or 6 on top of a fresh Visual
Studio install.

Steve


Quote:
> You mentioned 2 key words:  "VB6" and "ComctlLib".  This makes me tend to
> believe that either you or the book is using the VB5 version of the
Treeview
> while the other is using the VB6 version of the TreeView.

> This is because "ComctlLib" is the library name for the VB5 version and
the
> library name for the VB6 version is "MSComctlLib".  You would get this
kind
> of error (for example) if you added the VB6 version, but the code used the
> library name "ComctlLib".

> Mike



> > I new to VB and trying to learn as I go; looking at examples.  I'm
trying
> to
> > build an "Explorer" style treeview control.  I'm using, or trying to use
> the
> > ComctlLib object in an example from Francesco Balena's Programming
> Microsoft
> > Visual Basic 6.0.  How I solve this compiler error problem?  Is there a
> > property I need to set?  I sure could use some help.

> > TIA,
> > Ken Erickson



Mon, 26 Jan 2004 10:01:41 GMT  
 ComctlLib; compiler error: User-defined type not defined
MikeD,

Thanks for the info.  I changed the library name from ComctlLib to
MSComctlLib and the compiler is happy now.

PS. is there any good shareware/freeware Explorer style libraries out there?

Thanks again,
Ken Erickson


Quote:
> You mentioned 2 key words:  "VB6" and "ComctlLib".  This makes me tend to
> believe that either you or the book is using the VB5 version of the
Treeview
> while the other is using the VB6 version of the TreeView.

> This is because "ComctlLib" is the library name for the VB5 version and
the
> library name for the VB6 version is "MSComctlLib".  You would get this
kind
> of error (for example) if you added the VB6 version, but the code used the
> library name "ComctlLib".

> Mike



> > I new to VB and trying to learn as I go; looking at examples.  I'm
trying
> to
> > build an "Explorer" style treeview control.  I'm using, or trying to use
> the
> > ComctlLib object in an example from Francesco Balena's Programming
> Microsoft
> > Visual Basic 6.0.  How I solve this compiler error problem?  Is there a
> > property I need to set?  I sure could use some help.

> > TIA,
> > Ken Erickson



Mon, 26 Jan 2004 10:34:59 GMT  
 ComctlLib; compiler error: User-defined type not defined
Mike & Steve,

I should have stated my current configuration:

    Win2000 w/ SP1
    Visual Studios w/ SP4

VB app:

    Microsoft Common Dialog Control 6.0 (SP3)
    Microsoft Windows Common Controls 6.0 (SP4)

I have the treeview control working but with 1 question.  I noticed the
treelines are about twice as long as the ones in the Windows Explorer app.
Any ideas as to what I need to do to make it look like the "normal" treeview
control?

Thanks for the fast response,
Ken Erickson


Quote:
> Mike,
>     I wish what you stated were true.  Unfortunately vb6 sp2 included
> "ComctlLib" and "ComCtl2"
> VB 6 sp 5 included the others: "MSComCtlLib" and "MSComCtl2", you may not
> have both versions
> of these controls if you only installed SP5 or 6 on top of a fresh Visual
> Studio install.

> Steve



> > You mentioned 2 key words:  "VB6" and "ComctlLib".  This makes me tend
to
> > believe that either you or the book is using the VB5 version of the
> Treeview
> > while the other is using the VB6 version of the TreeView.

> > This is because "ComctlLib" is the library name for the VB5 version and
> the
> > library name for the VB6 version is "MSComctlLib".  You would get this
> kind
> > of error (for example) if you added the VB6 version, but the code used
the
> > library name "ComctlLib".

> > Mike



> > > I new to VB and trying to learn as I go; looking at examples.  I'm
> trying
> > to
> > > build an "Explorer" style treeview control.  I'm using, or trying to
use
> > the
> > > ComctlLib object in an example from Francesco Balena's Programming
> > Microsoft
> > > Visual Basic 6.0.  How I solve this compiler error problem?  Is there
a
> > > property I need to set?  I sure could use some help.

> > > TIA,
> > > Ken Erickson



Mon, 26 Jan 2004 11:06:10 GMT  
 ComctlLib; compiler error: User-defined type not defined
Steve & Mike,

I should have stated my current system configuration:
Win2000 with SP1
Visual Studio 2 with SP4
VB project controls:
Microsoft Common Dialog Control 6.0 (SP3)
Microsoft Windows Common Controls 6.0 (SP4)

I have the treeview control working - traversing the "My Computer" path.
One thing that I noticed with this control: the treelines appear to be twice
as long as the ones in the Windows Explorer app.  What gives?

Thanks again for the fast response.  I've been racking my brains trying to
figure out how to get the control to work.

Ken Erickson


Quote:
> MikeD,

> Thanks for the info.  I changed the library name from ComctlLib to
> MSComctlLib and the compiler is happy now.

> PS. is there any good shareware/freeware Explorer style libraries out
there?

> Thanks again,
> Ken Erickson



> > You mentioned 2 key words:  "VB6" and "ComctlLib".  This makes me tend
to
> > believe that either you or the book is using the VB5 version of the
> Treeview
> > while the other is using the VB6 version of the TreeView.

> > This is because "ComctlLib" is the library name for the VB5 version and
> the
> > library name for the VB6 version is "MSComctlLib".  You would get this
> kind
> > of error (for example) if you added the VB6 version, but the code used
the
> > library name "ComctlLib".

> > Mike



> > > I new to VB and trying to learn as I go; looking at examples.  I'm
> trying
> > to
> > > build an "Explorer" style treeview control.  I'm using, or trying to
use
> > the
> > > ComctlLib object in an example from Francesco Balena's Programming
> > Microsoft
> > > Visual Basic 6.0.  How I solve this compiler error problem?  Is there
a
> > > property I need to set?  I sure could use some help.

> > > TIA,
> > > Ken Erickson



Mon, 26 Jan 2004 10:59:47 GMT  
 ComctlLib; compiler error: User-defined type not defined
You can change that via the Indentation property.

Mike


Quote:

> I have the treeview control working - traversing the "My Computer" path.
> One thing that I noticed with this control: the treelines appear to be
twice
> as long as the ones in the Windows Explorer app.  What gives?



Mon, 26 Jan 2004 23:01:29 GMT  
 ComctlLib; compiler error: User-defined type not defined
Mike,

I was trying to use the indentation in the properities dialog with no
effect.

Thanks again,
Ken


Quote:
> You can change that via the Indentation property.

> Mike



> > I have the treeview control working - traversing the "My Computer" path.
> > One thing that I noticed with this control: the treelines appear to be
> twice
> > as long as the ones in the Windows Explorer app.  What gives?



Mon, 26 Jan 2004 23:31:54 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Compiler Error: User-defined type not defined

2. Compile Error: User-defined type not defined

3. Compile Error - User defined type not defined

4. Compile Error - User-Defined type not defined

5. User-Defined type not defined error (MAPI.Session)

6. Compile error: User-defined data type not defined!

7. user defined type not defined error help please

8. User-Defined type not defined error (MAPI.Session)

9. Help!!-NEWBIE - Application Wizard -(WROX BOOK) Error- User defined type not defined

10. Error: User-defined type not defined

11. Compile error: User-defined type not defined

12. Help!!-NEWBIE - Application Wizard -(WROX BOOK) Error- User defined type not defined

 

 
Powered by phpBB® Forum Software