[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 321
  • Last Modified:

Display full path of the project

Hi, I have a project called MyProject.vbp, and I have multiple copy of it under different folder

eg
C:\MyProject(Testing)\MyProject.vbp
C:\MyProject(Production)\MyProject.vbp
C:\MyProject(Old)\MyProject.vbp

Sometimes, I will open 3 of them at the sametime.
However, this make me confuse as on the TitleBar, it only displays the project name

eg
MyProject - ......

Is there anyway to show the full project path on the title bar, or any other convenient way to know what full project path I am working on?

(P/S: Currently, I always use the File>SaveAs, as by default it is save into the current folder, so I knew what folder I am working on, but is there any more convenient way like showing it in the title bar?)
0
william007
Asked:
william007
  • 9
  • 6
  • 3
  • +5
2 Solutions
 
Ryan ChongCommented:
you can know the project folder by refer to app.path, like:

msgbox app.path
0
 
lyonstCommented:
Why not just call them 3 different names

MyProjectTest.vbp MyProjectProd.vbp MyProjectOld.vbp
0
 
william007Author Commented:
Hi, ryancys,
App.path is only in runtime. Is there a method that we can see the project path in design time?

Hi, lyonst,
Thanks, there is one of the option, as we can see the file name at the properties windows to know the project. But is there a option to displays full path somewhere in the design view? So I do not need to rename all the file that supposed to have same name...
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
lyonstCommented:
Why dont you just include some comments in you code reflecting which project it is..
0
 
EDDYKTCommented:
don't think you can do from IDE

However, you can open your vbp file from notepad and change the field

Name="otherProject1"
0
 
lyonstCommented:
Or include a dummy form that contains this information in its name etc .. visible at design time.
0
 
Mark_FreeSoftwareCommented:

type in the immediate window:

msgbox app.path
0
 
g_johnsonCommented:
how 'bout hard-coding the caption of the main form to reflect the path of the test one and the "old" one?
0
 
dds110Commented:
don't have vb readily available to me while I'm typing this but, doesn't the project properties window give the path?
0
 
nffvrxqgrcfqvvcCommented:
Yes its possible you need to create an addin project and then when you load up your project you can make the tittle bar the project path.
0
 
Mark_FreeSoftwareCommented:

or you can add a button to the toolbars that displays the path when clicking on it
0
 
william007Author Commented:
Hi, egl1044
What is addin project, can you elaborate a bit how it can be done?

Hi, Mark_FreeSoftware
How to add a button to the toolbar?
0
 
nffvrxqgrcfqvvcCommented:
It's very easy when you start up VB they usually ask what project you would like to begin with, you would choose ADD-IN. I have created a simple example that you can download. It is the project files, all you need to do is compile the addin and when you open your instances of your saved projects the title bar should change to the path.

http://www.geocities.com/egl1044/PROJECTS/IDE_titile_bar.zip
0
 
nffvrxqgrcfqvvcCommented:
The code...


Option Explicit

Public VBInstance As VBIDE.VBE

Private Declare Function FindWindowW Lib "user32.dll" ( _
    ByVal lpClass As Long, _
    ByVal lpWindow As Long) As Long
   
Private Declare Function SetWindowTextW Lib "user32.dll" ( _
    ByVal hwnd As Long, _
    ByVal lpString As Long) As Long

Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As Object, custom() As Variant)
    Set VBInstance = Application
End Sub

Private Sub AddinInstance_OnStartupComplete(custom() As Variant)

    Dim hwnd    As Long
    Dim capt    As String
   
    capt = VBInstance.ActiveVBProject.FileName

    hwnd = FindWindowW(StrPtr("wndclass_desked_gsk"), 0)
    SetWindowTextW hwnd, StrPtr(capt)
   
    Set VBInstance = Nothing
   
End Sub
0
 
william007Author Commented:
0
 
william007Author Commented:
>>Thanks, this is the best method for the moment=)
But slowly I discover, when there is a switching of form, the title will be overrided with the IDE default title=( However, I think using add-in is a good start..I am thinking whether it is possible to subscribe the switching form event or something similar.
0
 
nffvrxqgrcfqvvcCommented:
Hmmm.. The only way I see that is when the Code Window is maximized? Is that the case? It should only change the main IDE caption.
0
 
william007Author Commented:
Sorry, when I see it clearly, it is not dissapear when we switch the form, is when we run the program, sorry for the wrong info.
0
 
william007Author Commented:
Now I am thinking whether it is possible to subscribe the form running event or something similar;)
0
 
nffvrxqgrcfqvvcCommented:
You can do just about anything using Add-Ins. I updated the project dont know if there is an actuall property that lets you change the caption so thats why I am using the windows API because I am un-certain. This is rather a work around the changing of the title bar whenever it changes but I don't know how good it will be until you use it for awhile.

http://www.geocities.com/egl1044/PROJECTS/IDE_tbar.zip
0
 
william007Author Commented:
Hi, egl1044,
Can you post it at
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21788458.html
I have changed the question a bit.

I will going to grade this question now.
0
 
william007Author Commented:
Thanks for the comment..:-)
0
 
nffvrxqgrcfqvvcCommented:
You can close that other question since it is still related to this question. I think the above might work fine.
0
 
william007Author Commented:
I have deleted the question. Seems like it is working OK now! Thanks:-)
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 9
  • 6
  • 3
  • +5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now