Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

[WM] Copy file at runtime to windows directory

Posted on 2009-12-26
6
Medium Priority
?
513 Views
Last Modified: 2013-12-27
Hi,
On my windows mobile 6 application:
My application needs a .dll to be present in the windows directory in order to run.
I have added the file to my project and set it to copy to output but need to copy it to the windows mobile "windows" directory at runtime. How is the best way to do this as i cannot seem to find the windows path as I would using full .NET.

Thanks
Shaun
0
Comment
Question by:sdom100
  • 3
  • 2
6 Comments
 
LVL 24

Accepted Solution

by:
alexey_gusev earned 2000 total points
ID: 26125021
just use "\Windows" in vb.net or "\\Windows" or @"\Windows" in c#
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26125249
This folder always has name "Windows".

You can install this dll to the windows folder - so the system (wceload) will solve this problem for you.

Copy a dll in the run-time... You can copy it once and it always be there.

I think, if the dll will be in the root, the application will work.

to copy a file from your program you can use CopyFile function: http://msdn.microsoft.com/en-us/library/aa910674.aspx

0
 

Author Comment

by:sdom100
ID: 26125914
so to clarify,
on windows mobile installs (WM5, WM6, WM6.5) the \Windows directory is always the same and this approach is not likely to change with WM7 ?
And thus i would be able to use the CopyFile function to copy the file from the same dir as the executable. Would i need to fully qualify the path for the "from" location in which case how would i do it in WM - can i use reflection to get the path of the .exe ?

Thanks,
S.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 24

Expert Comment

by:alexey_gusev
ID: 26125953
yes, \Windows  will stay the same. even in WM7

for the current folder: Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase)
and yes, you'd need to specify full path
0
 

Author Comment

by:sdom100
ID: 26126883
Hi,
I ended up using
System.IO.File.Copy as CopyFile was not playing ball and this seems like a good managed code solution.
S.
0
 

Author Closing Comment

by:sdom100
ID: 31670073
Your follow up comment was also very useful
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question