Link to home
Start Free TrialLog in
Avatar of william007
william007

asked on

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?)
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

you can know the project folder by refer to app.path, like:

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

MyProjectTest.vbp MyProjectProd.vbp MyProjectOld.vbp
Avatar of william007
william007

ASKER

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...
Why dont you just include some comments in you code reflecting which project it is..
don't think you can do from IDE

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

Name="otherProject1"
Or include a dummy form that contains this information in its name etc .. visible at design time.
SOLUTION
Avatar of Mark_FreeSoftware
Mark_FreeSoftware
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
how 'bout hard-coding the caption of the main form to reflect the path of the test one and the "old" one?
don't have vb readily available to me while I'm typing this but, doesn't the project properties window give the path?
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.

or you can add a button to the toolbars that displays the path when clicking on it
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?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
>>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.
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.
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.
Now I am thinking whether it is possible to subscribe the form running event or something similar;)
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
Hi, egl1044,
Can you post it at
https://www.experts-exchange.com/questions/21788458/When-Run-the-program-full-path-on-the-IDE-Using-Add-in-is-dissapear.html
I have changed the question a bit.

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