Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

App.EXEName problem. Help! 3

Status
Not open for further replies.

SharonLove

Programmer
Feb 26, 2003
18
DE
Who knows what causes the return value of the App.EXEName property to be always upper case on Win98 systems, but not on NT systems?

Example:
Actual Exe name is "MyApp.exe"

On Win98 systems (same VB run time files), App.EXEName returns the value: "MYAPP".
On NT: "MyApp"

Reason: Per customer request, I'm trying to do a binary comparison of the Exe name so if anyone changes the name to something different than desired, the application will not run.

If StrComp(App.EXEName, "MyApp", vbBinaryCompare) = 0 Then
'Ok
Else
End
End If
 
CCLINT,

difference is that I changed
[tt]
W9xAppPath = fso.GetAbsolutePathName(lpFilename)
[/tt]
to
[tt]
W9xAppEXEName = fso.GetFile(lpFilename).Name
[/tt]

I did also originally toy with a solution very similar to the one you give. However, I rejected it because it suffers certain problems if you use it in, say, an OCX or a DLL
 


strongm
You mean:

W9xAppEXEName = fso.GetFileName(lpFilename)
to
W9xAppEXEName = fso.GetFile(lpFilename).Name

and not
W9xAppPath = fso.GetAbsolutePathName(lpFilename)

(now I see it)

Yes, these will return two different things.

>it because it suffers certain problems if you use it in, say, an OCX or a DLL

Which problems are you aware of?



Schweiger:

Nope!
Dir() will return the DOS name (which on W95/98/ME is upper case) just as GetFileName(Filename)

But
fso.GetFile(Filename).Name should return the correct case.



[/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
What problems? Well, it depends on what you might expect a class method or property utilising the function to return...

I'd want it to get proper app name of the client application, not the app name of the OCX/DLL
 
Of course I would expect it to return an answer based on whatever I pass to it:

Pass to a dll app.path and app.EXEName (and extension if desired)

FileName = fso.GetFile(sPath & "\" & sAppBaseName & sExtension).Name

or

FileName = fso.GetFile(sPathAndNameAndExtension).Name

So a change also needs to be made to the GetModuleFileName call.

O am I missing something? [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Wow!

You people are wonderful!
I didn't expect so much attention.

I will be testing all suggestions as soon as I can (probably first on monday).

Thank you kindly for all of your help!
 

rorubin: I do not see in that code which part would solve the problem.
 

I have been watching this thread grow and have immensely enjoyed the “friendly” exchange between some of the experts in this forum.

Perhaps I am missing something here. The reason for this post was to find a methodology to kill the program if the name had changed from its original, which I assume is a name that “LoveSharon” has.

If that be the case, how is this discussion going to solve, or address, her problem.
Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
thornmastr:

The request was for a "binary comparison" and "case sensitive".

Meaning, not only if the exe name has changed, but also if the exe name is also in the correct case.

The suggestion posted by strongm apparently solves this problem.

To apply this to the originally posted code would mean:

If StrComp(W9xAppEXEName(), "MyApp", vbBinaryCompare) = 0 Then
'Ok
Else
End
End If


[/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
CCLINT:

First, thank you for the clarification.

I did a search on lower case notepad.exe.

I returned 2 hits both on upper case NOTEPAD.EXE. One hit in WINDOWS and the other in

WINDOWS\SYSTEM32.

Using start>run notepad or start>run>NOTEPAD runs notepad.

What is being requested here, I think, is a way to insure that one of these cases will run notepad and the other case will run nothing at all, or, myapp.exe will run. MYAPP.EXE will fail. MyApp will fail, etc, ad nauseum.

I think this thread while very interesting is overkill. I think the distinction between myapp, MYAPP,and mYaPP is moot, and that the distinction between myapp.exe and changedapp.exe is critical. Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 

>I think the distinction between myapp, MYAPP,and mYaPP is moot

Maybe. I wouldn't give a hoot either, whether or not the exe name is in a certain case or not. I wouldn't even care if someone changed the name of my top finance program to Meatballs.exe on their pc.
As long as they are happy and I get paid.

And I think the point is not myapp, MYAPP or Myapp, but mYaPP.

bUt iT mAy hAvE bEeN jUsT aN iNtErEsTiNg cHaLlAnGe fOr tHe pArTiCiPaNtS, aNd aN lEaRnInG eXpErIeNcE fOr aLl.

Some of these questions like this I also answer "just for fun".

But then, some companies are sensitive in keeping a certain image.
And, if so, then that's one thing not to argue over when it comes to getting paid, I guess. And if they give a few extra bucks for a little extra work, then why not.

I'm wonder how many people would take on the job above if a company paid a few extra good bucks for the little extra work, whether it made a hoot or not.
But then again, how many companies would want it... [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top