Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / January 2008

Tip: Looking for answers? Try searching our database.

newbie: Getting Program Files folder in Windows Mobile 6.0

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bjørn Brox - 07 Jan 2008 15:23 GMT
Hi!

Can anyonecome with some C# program example on how to get the path of
the "Program Files" folder on a windows mobile unit (//Program Files" in
an english version of WM 6)

I need to know if a specific executable is installed on the unit, and
start it when needed.

I know about the following statement:

String path =
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);

but it just return the "Program" folder in the Start Menu, i.e. name
where the startup links is present, not the real path where the exe is
present.

Signature

Bjørn Brox

Ignacio Machin ( .NET/ C# MVP ) - 07 Jan 2008 16:20 GMT
Hi,

You should post this question into the Compact framework NG (crossposting
there now)

Signature

Ignacio Machin
http://www.laceupsolutions.com
Mobile & warehouse Solutions.

> Hi!
>
[quoted text clipped - 12 lines]
> but it just return the "Program" folder in the Start Menu, i.e. name where
> the startup links is present, not the real path where the exe is present.
Paul G. Tobey [eMVP] - 07 Jan 2008 16:46 GMT
Generally, you'd use SHGetSpecialFolderPath().  I'm not aware of a
generally-available (all versions of Windows Mobile), method of getting that
without P/Invoking it.

BOOL SHGetSpecialFolderPath(
 HWND hwndOwner,
 LPTSTR lpszPath,
 int nFolder,
 BOOL fCreate
);

SHGetSpecialFolderPath( hwnd, pathstring, CSIDL_PROGRAM_FILES /* 0x26 */,
FALSE ) would get the path that you're interested in.

Paul T.

> Hi,
>
[quoted text clipped - 18 lines]
>> where the startup links is present, not the real path where the exe is
>> present.
Bjørn Brox - 07 Jan 2008 19:56 GMT
Paul G. Tobey [eMVP] skrev:
> Generally, you'd use SHGetSpecialFolderPath().  I'm not aware of a
> generally-available (all versions of Windows Mobile), method of getting that
[quoted text clipped - 9 lines]
> SHGetSpecialFolderPath( hwnd, pathstring, CSIDL_PROGRAM_FILES /* 0x26 */,
> FALSE ) would get the path that you're interested in.

Thanks, it worked.
The returned value from this was as expected: "\\Program Files"

Any reason that the
Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
wrapper returns "\\Windows\\Start Menu\\Programs"?

...

Signature

Bjørn Brox

Paul G. Tobey [eMVP] - 07 Jan 2008 20:55 GMT
I'm sure there must be, but I certainly don't know what it is!  What version
of .NET CF does it do that in?  Maybe it was fixed in a later version or
service pack.

Paul T.

> Paul G. Tobey [eMVP] skrev:
>> Generally, you'd use SHGetSpecialFolderPath().  I'm not aware of a
[quoted text clipped - 19 lines]
>
> ...
Bjørn Brox - 07 Jan 2008 21:20 GMT
Paul G. Tobey [eMVP] skrev:
> I'm sure there must be, but I certainly don't know what it is!  What version
> of .NET CF does it do that in?  Maybe it was fixed in a later version or
> service pack.

I am using CF 3.5

Anyhow, both "\\Program Files" and "\\Windows\\Start Menu\\Programs" are
in my opinion both special folders that should be covered by the
Environment.SpecialFolder enum.

>> Paul G. Tobey [eMVP] skrev:
>>> Generally, you'd use SHGetSpecialFolderPath().  I'm not aware of a
[quoted text clipped - 18 lines]
>>
>> ...

Signature

Bjørn Brox


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.