-
1 Attachment(s)
Add-In: StaticToolz (Attached in First Post..just for fun)
I HAVE EDITED THIS FIRST POST....and the title... etc...
and attached it..
I know.. strange title.. but here is my question..
it seems like u can tap just about anything in the IDE as long as u know how..
Anyone know how to get the list available Dim as TYPEs?
Like String, Integer, etc... I want to get all of them :) (well only the CURRENT Available ones...)
Thanks!
(LATEST VERSION: TESTING ONLY! PRE-ALPHA VERSION! ;) lol)
play with it.. make suggestions... break it...
to run..
unzip..
run
start another VB and open a project...
as a suggestion I would make a backup of any project
you play with using this lol :D
Version -.00874.1.z :sick:
-
Re: Add-In: Dim ...... As ______?
If you mean standard data types then there are only a few, but there are TONS of different object types. You can Dim a variable as any Object, class, enum, UDT, etc.
Here are all the standard data types that I can think of but I'm sure someone can post a full list:
Byte
Integer
Long
Single
Double
String
Currency
Date
-
Re: Add-In: Dim ...... As ______?
I could get the "List" but I want to exctract it from VBIDE
MZTools can do it...
in the Add Procedure...Look in the datatype... click the FILL button on some of the types.. bam.. it fills the dropdown..
I want to get all of these on my form load (or something) so that when the user types in an var name then As bam.. the list appears..
(Auto filling like in the actual IDE) :) I know it can be done so I am determined to do it! lol
I am making an addin that will do similar things to MZ but do them better .. more easily used.. more intuitive etc..(plus others)
like my Msgbox creator presents u with a form that looks like a msgbox.. then lets you type in the title, prompt, right click select image, buttons, enter variable name for the return value etc.. really easy to use.. even multiline msgbox using ALT+Enter :)
-
Re: Add-In: Dim ...... As ______?
Cool idea.
To get a full list I think you would need to access the object browser. Either that or access whatever the obeject accesses to get that info. I'm not sure if it would be possible or easy. Is MZTools open source?
-
Re: Add-In: Dim ...... As ______?
Quote:
Originally Posted by eyeRmonkey
Cool idea.
To get a full list I think you would need to access the object browser. Either that or access whatever the obeject accesses to get that info. I'm not sure if it would be possible or easy. Is MZTools open source?
nope, mztools isnt.
-
Re: Add-In: Dim ...... As ______?
of course not.. I sent them an email... hope they respond. (doubt it but worth a shot!) I will share the info if I get it :)
-
Re: Add-In: Dim ...... As ______?
If I were you I would take some time to search for a site that has a ton of add-in info. There are always sites out there that are exactly what you need, it usually just takes time.
PSC is a good place to start. Just start skimming their add-in's and take notes on interesting/new things you see.
-
Re: Add-In: Dim ...... As ______?
The thing is, there is a DLL named TLBINF32.DLL. It lives i n "C:\WINDOWS\SYSTEM32"
It seems that the VB Object Browser uses that DLL.
This DLL gives you all, Classes, Contants, Properties...
It needs you to pass a Filename (DLL or OCX, or TLB), as far as I saw, it reads all OCX's, but not all DLL's, seems that it reads some VB DLLs.
This can also read the data if you pass the object, also reads from registry, performs search, well, it does too many things, here Ill post a little example reading from files in a collection.
ADD reference to "Typelib Information", located in: "C:\WINDOWS\SYSTEM32\TLBINF32.DLL"
Add a List (list1) and a Commandbutton (Command1)
VB Code:
Dim mCol As Collection
Private Sub LoadData()
Dim i As Integer
Dim j As Integer
Dim lMember As MemberInfo
Dim lConst As ConstantInfo
Dim tliTypeLibInfo As TypeLibInfo
On Error Resume Next 'Some Libs hasn't data to show and TypeLibInfo fire error
For i = 1 To mCol.Count
Set tliTypeLibInfo = TLI.TypeLibInfoFromFile(mCol.Item(i))
For Each lConst In tliTypeLibInfo.Constants
For Each lMember In lConst.Members
list1.AddItem lConst.Parent & " ; " & lConst.Name & " ; " & lMember.Name
Next
Next
Next
Set tliTypeLibInfo = Nothing
End Sub
Private Sub Command1_Click()
LoadData
End Sub
Private Sub Form_Load()
Set mCol = New Collection
'I'll add some files..
mCol.Add ("MSVBVM60.DLL") 'VBA Lib
mCol.Add ("MSVBVM60.DLL\3") 'mmm..more VBA?
mCol.Add ("VBRUN.OCX") 'VBRUN Lib
mCol.Add ("comctl32.ocx") 'Common Controls
mCol.Add ("richtx32.ocx") 'Rich Textbox
mCol.Add ("msflxgrd.ocx") 'Flexgrid
mCol.Add ("comdlg32.ocx")
End Sub
I think that, when you type: DIM ..... AS _____, VB IntelliSense get all the types in MSVBVM60.DLL and ALL the types inside each OCX component you are using in your APP. If you open your Project with NOTEPAD (VBP FILE) you have all that DLL's,TLB's;OCX's listed there, it looks like this:
Quote:
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\WINDOWS\system32\stdole2.tlb#OLE Automation
Reference=*\G{420B2830-E718-11CF-893D-00A0C9054228}#1.0#0#..\WINDOWS\system32\scrrun.dll#Microsoft Scripting Runtime
Object={16099B99-EC14-4BBB-807E-C06552824C4D}#1.0#0; BrowserEngine2.dll
Reference=*\G{8B217740-717D-11CE-AB5B-D41203C10000}#1.0#0#..\WINDOWS\system32\TLBINF32.DLL#TypeLib Information
Object={6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0; comctl32.ocx
Object={3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0; richtx32.ocx
Object={5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0; msflxgrd.ocx
Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; comdlg32.ocx
Object={A8F8E827-06DA-11D2-8D70-00A0C98B28E2}#1.0#0; VCMAXB.OCX
Object={23DA51FB-240D-451E-A309-D2BBDB28ED6E}#1.0#0; vbalExpBar6.ocx
There you can see: Scripting Runtime, Common Controls, Rich Textbox, flexgrid, Common Dialog... and don't know what else.
MZ TOOLS also takes many things directly from Project files.
Well, I recomend you GOGGLE this: TypeLibinfo
Some Links:
TypeLibinfo in VbAccelerator
TypeLibinfo in MSDN
TypeLibinfo in DEVX
-
Re: Add-In: Dim ...... As ______?
Quote:
Originally Posted by eyeRmonkey
If I were you I would take some time to search for a site that has a ton of add-in info.
I'm fond of this little tool. I hope others find it as useful.
(PS: Love the avatar eyeRmonkey! :thumb: :D )
-
Re: Add-In: Dim ...... As ______?
You guys are too damn smart... I don't understand this conversation at all. :(
-
Re: Add-In: Dim ...... As ______?
lol@von.. Patients young vb jedi!
Thanks jcis, hack...
jcis.. I just got an email from the people @ MZTools.. they pointed me to the same thing u did. the TypeLibinfo. Im glad I stopped back here before getting to deep into searching! That code is perfect.. I had just found the items in the VBA (MSVBVM60.DLL) file and saw all the "types" was wondering where the other stuff came from.. that is perfect!!
-
Re: Add-In: Dim ...... As ______?
Now.. lets here some opinions...
what would be the best "thing" to store these in so I could do a fairly simple Intellisense? An Array?
-
Re: Add-In: Dim ...... As ______?
and one more thing.. scanning that list I dont see "objects"
the variable types are easy to spot... vbInteger, vbLong etc..
but where are "Listbox", CommandButton, etc? hmmm....
-
Re: Add-In: Dim ...... As ______?
-
Re: Add-In: Dim ...... As ______?
Quote:
Originally Posted by Harsh Gupta
probably a Collection??
Harsh beat me to it...this would be my suggestion.
-
Re: Add-In: Dim ...... As ______?
ok.. its in the VB6.OLB file which I cant get it to read :(
-
Re: Add-In: Dim ...... As ______?
bingo! spoke too soon!!!
VB Code:
For X = 0 To tliTypeLibInfo.CoClasses.Count - 1
Debug.Print tliTypeLibInfo.CoClasses(X).Name
Next
-
Re: Add-In: Dim ...... As ______?
is a collection fast enough so when I type it can "search" and fill in what it thinks I am typing?
(I have not played with collections much)
-
Re: Add-In: Dim ...... As ______?
Quote:
Originally Posted by Hack
I'm fond of
this little tool. I hope others find it as useful.
(PS: Love the avatar eyeRmonkey! :thumb: :D )
I posted your avatar snowed in the old x-mas thread. I'll repost it in the new x-mas thread.
Okay, here it is.
Static, I wouldn't reccomend a collection for something that needs to be fast. Thats just me though.
-
Re: Add-In: Dim ...... As ______?
Quote:
Originally Posted by Static
is a collection fast enough so when I type it can "search" and fill in what it thinks I am typing?
(I have not played with collections much)
I think collections are slower than arrays, but maybe they are fast enough for doing that
-
Re: Add-In: Dim ...... As ______?
hmmm...
I have been playing with this some more.. seeing what can be "yanked" out...
taking JCIS's code, I changed a few things and added some so its easier to poke around...
Start a New Project...
Add Ref to TypeLib Information
Add a command Button (Name:Command1)
And a Treeview (Name:TV1)
VB Code:
Dim mCol As Collection
Private Sub LoadData()
Dim i As Integer
Dim j As Integer
Dim lMember As MemberInfo
Dim lConst As ConstantInfo
Dim tliTypeLibInfo As TypeLibInfo
TV1.Nodes.Clear
On Error Resume Next
For i = 1 To mCol.Count
Set tliTypeLibInfo = TLI.TypeLibInfoFromFile(mCol.Item(i))
TV1.Nodes.Add , , tliTypeLibInfo.Name, mCol.Item(i)
TV1.Nodes.Add tliTypeLibInfo.Name, tvwChild, tliTypeLibInfo.Name & "_CoClasses", "CoClasses"
For x = 1 To tliTypeLibInfo.CoClasses.Count
TV1.Nodes.Add tliTypeLibInfo.Name & "_CoClasses", tvwChild, "CoClasses_" & tliTypeLibInfo.CoClasses(x).Name, tliTypeLibInfo.CoClasses(x).Name
Next
TV1.Nodes.Add tliTypeLibInfo.Name, tvwChild, tliTypeLibInfo.Name & "_TypeInfos", "TypeInfos"
For x = 1 To tliTypeLibInfo.TypeInfos.Count
TV1.Nodes.Add tliTypeLibInfo.Name & "_TypeInfos", tvwChild, "TypeInfos_" & tliTypeLibInfo.TypeInfos(x).Name, tliTypeLibInfo.TypeInfos(x).TypeKindString & ": " & tliTypeLibInfo.TypeInfos(x).Name
Next
TV1.Nodes.Add tliTypeLibInfo.Name, tvwChild, tliTypeLibInfo.Name & "_Declarations", "Declarations"
For x = 1 To tliTypeLibInfo.Declarations.Count
TV1.Nodes.Add tliTypeLibInfo.Name & "_Declarations", tvwChild, "Declarations_" & tliTypeLibInfo.Declarations(x).Name, tliTypeLibInfo.Declarations(x).Name
Next
TV1.Nodes.Add tliTypeLibInfo.Name, tvwChild, tliTypeLibInfo.Name & "_Constants", "Constants"
For Each lConst In tliTypeLibInfo.Constants
TV1.Nodes.Add tliTypeLibInfo.Name & "_Constants", tvwChild, lConst.Name, lConst.Name
For Each lMember In lConst.Members
TV1.Nodes.Add lConst.Name, tvwChild, lConst.Name & "_" & lMember.Name, lMember.Name
Next
Next
Next
Set tliTypeLibInfo = Nothing
End Sub
Private Sub Command1_Click()
LoadData
End Sub
Private Sub Form_Load()
Set mCol = New Collection
'I'll add some files..
mCol.Add ("VB6.OLB")
mCol.Add ("MSVBVM60.DLL") 'VBA Lib
mCol.Add ("MSVBVM60.DLL\3") 'mmm..more VBA?
mCol.Add ("VBRUN.OCX") 'VBRUN Lib
mCol.Add ("comctl32.ocx") 'Common Controls
mCol.Add ("richtx32.ocx") 'Rich Textbox
mCol.Add ("msflxgrd.ocx") 'Flexgrid
mCol.Add ("comdlg32.ocx")
End Sub
-
Re: Add-In: Dim ...... As ______?
Nice! I like it.
I think there is all you need to create the Intellisense effect.
And I think Intellisense also list the types in the active OCX components in the project, you're gonna take that from the VBP?
i.e. the rich textbox control, the msflexgrid.. should be added only if the user has it selected in Componets. Else he can select it in your intellisense, and that would fire errors when running code.
Another thing to take care is the version of the components. I have 3 diferent versions of some OCX's. I saw some code that gets the right version from registry I think, 'ill see if I find it. ;)
-
Re: Add-In: Dim ...... As ______?
ok.. here is what i have it pulling in so far....
Code:
PictureBox
Label
TextBox
Frame
CommandButton
CheckBox
OptionButton
ComboBox
ListBox
HScrollBar
VScrollBar
Timer
Printer
Form
Screen
Clipboard
DriveListBox
DirListBox
FileListBox
Menu
MDIForm
App
Shape
Line
Image
Data
OLE
UserControl
PropertyPage
UserDocument
Global
VBControlExtender
Empty
Null
Integer
Long
Single
Double
Currency
Date
String
Object
Error
Boolean
Variant
DataObject
Decimal
Byte
UserDefinedType
Array
I cant find the section (file) with Control in it?
Dim ctl as Control
at the moment I am just adding the basics... because this is for a sub/function builder
adding the args... but this "feature" could be used elsewhere (And I plan on it!!)
-
Re: Add-In: Dim ...... As ______?
Control is in VB6.OLB
In your Treeview appears as..
dispinterface: Control
-
Re: Add-In: Dim ...... As ______?
The Dictionary (add reference to Microsoft Scripting Runtime) is much faster than a Collection.
-
Re: Add-In: Dim ...... As ______?
in using the collection.. it seems fast enough.. but I will check out the dictionary
Thank Penagate!
(and thanks JCIS.. I see it now)
-
Re: Add-In: Dim ...... As ______?
how do I "search" in a dictionary?
it wants a "Key" not index like a collection.. so how do u loop through it?
-
Re: Add-In: Dim ...... As ______?
Dim item As Object
For Each item In myDictionary
' do something
Next
-
Re: Add-In: Dim ...... As ______?
ahhh.. ok :) lol thanks
update! I have figured out how to easily get all the referenced items then grab the goodies from them!!
VB Code:
'This is for an addin.. thats where the VBInstance come into play
Private Sub LoadData()
Set dType = New Collection
Dim lMember As MemberInfo
Dim lConst As ConstantInfo
Dim tliTypeLibInfo As TypeLibInfo
On Error Resume Next
For R = 1 To VBInstance.ActiveVBProject.References.Count
'Here is where it gets the refs.. including controls!
Set tliTypeLibInfo = TLI.TypeLibInfoFromFile(VBInstance.ActiveVBProject.References(R).FullPath)
For X = 1 To tliTypeLibInfo.TypeInfos.Count
Select Case tliTypeLibInfo.TypeInfos(X).TypeKindString
Case "coclass" 'its good.. add it
dType.Add tliTypeLibInfo.TypeInfos(X).Name
Case "dispinterface"
Select Case Left(tliTypeLibInfo.TypeInfos(X).Name, 1)
Case "_", "I"
'Not these...
Case Else
dType.Add tliTypeLibInfo.TypeInfos(X).Name
End Select
End Select
Next
Set lConst = tliTypeLibInfo.Constants.NamedItem("VbVarType")
For Each lMember In lConst.Members
dType.Add CStr(Replace(lMember.Name, "vb", ""))
Next
Next
For X = 1 To dType.Count 'Checking what I got ;)
Debug.Print dType(X)
Next
Set tliTypeLibInfo = Nothing
End Sub
-
2 Attachment(s)
Re: Add-In: Dim ...... As ______?
screens of the function builder...
first one shows a function being built... (Intellisense is shown in the AS Type section)
second image is the same "thing" but switched to a Public Type..
Intellisense on the variables for the type...
-
Re: Add-In: Dim ...... As ______?
Another question:
With Property Let,Get,Set....
do all allow arguments? or just Let & Set?
not sure.. only used It a few times :rolleyes:
-
Re: Add-In: Dim ...... As ______?
All allow arguments, look up Properties in the Classic VB FAQ, Merri and myself explained it all.
-
Re: Add-In: Dim ...... As ______?
cool ;) thanks!!
I will post this Add-in soon for some "Alpha" testing
-
Re: Add-In: Dim ...... As ______?
Quote:
Originally Posted by eyeRmonkey
Static, I wouldn't reccomend a collection for something that needs to be fast. Thats just me though.
Just letting you know, they are faster unless you dim an array thats big enough to hold all the stuff you want in it without redimming
-
Re: Add-In: Dim ...... As ______?
Remix, you're saying that Collections are faster than arrays unless the array is very large?
I'm not sure that is what you meant, but if that is what you meant, then I am 95% sure you are incorrect. A collection is just a form of an array but each element takes up a lot more space and there is a lot more processing going on for each element. Especially since the "Key" is a variant (and can be a string or the index number).
-
Re: Add-In: Dim ...... As ______?
this is AS IS.. i really just stopped mid "playing" and zipped it...
give it a run through.. some stuff works.. other stuff is in its infancy.
open the project.. run it
then start a new instance of VB
add new exe... switch to code window of form1
the window that shows is dockable and fits nicely between the project and properties window.
let me know what u think "so far"
(ATTACHEMENT REMOVED! NEW VERSION PLACED IN FIRST POST)
-
1 Attachment(s)
Re: Add-In: Dim ...... As ______?
A couple this I noticed:
1) Youre window for the Procedure formatter is set to always on top of everything instead of just ontop of the IDE. I'm not sure how you would code it to just be on top of the IDE without being modal, but I'm sure there is a way.
2) I have XP styles on in my IDE and anywhere that you use a frame you have to put a picture box ontop of the from otherwise things look like the image attached below.
Other than that things look good. I didn't check too closely though.
-
Re: Add-In: Dim ...... As ______?
Quote:
Originally Posted by eyeRmonkey
Remix, you're saying that Collections are faster than arrays unless the array is very large?
I'm not sure that is what you meant, but if that is what you meant, then I am 95% sure you are incorrect. A collection is just a form of an array but each element takes up a lot more space and there is a lot more processing going on for each element. Especially since the "Key" is a variant (and can be a string or the index number).
Not saying if its a large array, just big enough so you dont have to redim it. Collections are faster if you redim..
-
Re: Add-In: Dim ...... As ______?
Quote:
Originally Posted by eyeRmonkey
put a picture box ontop of the from
what do u mean? use a picbox instead of the frame? or use a picbox to "contain" the frame? or.. use a picbox inside the frame?
-
Re: Add-In: Dim ...... As ______?