-
June 25th, 2010, 03:19 AM
#1
[RESOLVED] getting the .vbp filename in a vb project
Hi,
I need to get the .vbp file name of a project in vb6.0. This is required to read all the form names from it and get all the controls in that forms.
Thanx
-
June 25th, 2010, 04:32 AM
#2
Re: getting the .vbp filename in a vb project
In .NET this is one line of code!!!
I was thinking that you should Add a reference to Microsoft Development Environment 7.0 and then work from there. The problem is that I don't think that file is compatible with VB 6. In code view in VB 6 you will be able to access all the properties & methods, but I just can't seem to get something working. Maybe I should try again.
Or, you could build a basic thing in VB.NEt and import that dll into your VB 6 project
-
June 25th, 2010, 08:00 AM
#3
Re: getting the .vbp filename in a vb project
Could be one line in VB6 as well. By default the vbp filename is the same as the exe filename other than the extension.
Code:
ProjectName=app.path &"\" & mid(app.exename,1,len(app.exename)-3) & "vpb"
The vbp however is typically not part of the files that would be installed on the end users system so this file would not be available at runtime in most cases. Not sure why one would need to do this type of thing.
One easy way of course would be to simply use dir$() and search app.path for *.vbp files most of the time there will be only one result. In cases where more than one project exist you could read a few lines from each to find the exe name for that project and match it to your app.exename
Last edited by DataMiser; June 25th, 2010 at 08:02 AM.
Always use [code][/code] tags when posting code.
-
June 25th, 2010, 08:10 AM
#4
Re: getting the .vbp filename in a vb project
Opps.. I was mistaken app.exename does not include the extension so it would be
Code:
ProjectName=app.path &"\" & app.exename &".vpb"
Also app.title by default is the same as the project name so
Code:
ProjectName=app.path &"\" & app.title &".vpb"
should work as well assuming that you have not changed this in the project properties.
Always use [code][/code] tags when posting code.
-
June 25th, 2010, 08:23 AM
#5
Re: getting the .vbp filename in a vb project
I was overly complicated and complex again! HAHA! LOL!
-
June 25th, 2010, 08:38 AM
#6
Re: getting the .vbp filename in a vb project
app.title is the bettr choice anyway, because the exename is not necessarily the name of the project. In many cases people kee the Project1 name, but give the exe a distinct name.
-
June 25th, 2010, 09:30 AM
#7
Re: getting the .vbp filename in a vb project
Hi,
I am very unlucky because all the applications that I am working have their exe names changed to something. The title is set for all the applications to something different from the .vbp file name. Is there any other way to get the .vbp file name. Thanks to you all guys for your effort.
-
June 25th, 2010, 10:35 AM
#8
Re: getting the .vbp filename in a vb project
Like I menioned in the first post Dir$() with * .vbp as a filter will retrieve any .vbp files in the given folder. It you have only one project file per folder then this would work fine if you have more then you would need to parse the vbp files to find the right one for the program in question. Even then it should eb pretty simple.
Always use [code][/code] tags when posting code.
-
June 25th, 2010, 11:37 AM
#9
Re: getting the .vbp filename in a vb project
Okay people, App.exename is the actual name of the exe on disk, change it and so does the return value. App.Title is the actual file name of the *.vbp file as saved on disk, change it, and so does the return value.
Now, what it seem like the OP is after is the information contained within the *.vbp file... which is
Code:
Type=Exe
Form=Form1.frm
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\Windows\system32\stdole2.tlb#OLE Automation
IconForm="Form1"
Startup="Form1"
ExeName32="dummytest.exe"
Command32=""
Name="Test"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1
Which will allow someone experience at reading these files, find all of the other files associated with the project, and *.vbg files contain links to the *.vbp files. So one could make changes or as I have been doing, allow someone who does not have vb6 to see the vb6 project as one would at design time, code, icons, graphics included, and picture boxes for those controls that are not found/registered/etc. on the machine. Just a note on the graphics, if they have been added to the project at design time and not at runtime...
Good Luck
-
June 25th, 2010, 12:34 PM
#10
Re: getting the .vbp filename in a vb project
Actually App.Title is the value assigned to App.Title in the properties window. By default it is the same as the VBP file. If you change the name of the VBP file the title changes as well. If you change the Title in the properties area then the VBP file is no longer a match.
The only [almost] fool proof way that I can think of would be to look for VBP files in the project folder and if more than one exists then read the data from the file until you find the exename or title and compare that to what is returned. Even this could fail if the vbp has been modified since the exe was built.
Always use [code][/code] tags when posting code.
-
June 25th, 2010, 01:05 PM
#11
Re: getting the .vbp filename in a vb project
What's the point? Are you planning on shipping the source code with the app? Unless you do, this is all irrelevant and pointless. And a lesson in futility.
Now if you are building an app that needs to read the vbp info of other PROJECTS... then there's a way to work with that. But for an app to read it's own VBP file(s)... is another matter.
-tg
-
June 26th, 2010, 01:19 AM
#12
Re: getting the .vbp filename in a vb project
Hi,
I am trying to get the properties of an activex control in all the forms of the project. So to access all the forms, I am getting the form names of the project through the .vbp file. Then I pass the name of the forms to Forms.Add and then load them and read all the required activex control properties. This exercise is done to know what are all the properties which are set for the activex control ( comparing them against the default property values for the activex control.)
This has to be done for nearly 50 projects.
Hope I am clear.
-
June 26th, 2010, 06:16 AM
#13
Re: getting the .vbp filename in a vb project
why not use Dir$() with *.frm as a filter? This would give you all the file names of all the forms in a given folder.
Also why are you adding all these forms if all you want to do is grab the properties? You can read these from the frm file.
Always use [code][/code] tags when posting code.
-
June 29th, 2010, 08:43 AM
#14
Re: getting the .vbp filename in a vb project
Thank you. I am reading it from the .frm file. Thanks for the suggestion. Hope I could be like you.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|