If you are running a Device application and want to know (in the code) which platform you are running on (it could be CE.NET or Windows Mobile or various versions of each), then you can use:
Environment.OSVersion.Platform
For much more information and several examples, see:
http://www.christec.co.nz/blog/archives/77
This blog is a depository for things I have found regarding VB.NET and C#.NET development (and other things I may need to remember). This blog is primarily for my own reference, but if the information I found is useful to others, then that is great. If others want to contribute with comments or other information, then that is great too.
Showing posts with label Windows Mobile. Show all posts
Showing posts with label Windows Mobile. Show all posts
Tuesday, November 11, 2008
Thursday, October 2, 2008
Getting Windows Mobile Owner Name and Device Name
It is sometimes useful to get the Owner Name and/or the Device Name of the Windows Mobile device. If you are wanting a Device Id, then see this posting.
There are different ways to get the Owner Name and Device Name:
For Owner Name, add the following reference to your project:
Microsoft.WindowsMobileMicrosoft.WindowsMobile.Status
Then in your code:
Imports Microsoft.WindowsMobile.Status
.
.
.
MessageBox.Show(SystemState.OwnerName)
More info at:
http://www.c-sharpcorner.com/Forums/ShowMessages.aspx?ThreadID=46306
To get the Device Name (which is what you find under Start/Settings/System Tab/About), you simply have to say:
MessageBox.Show(System.Net.Dns.GetHostName())
For more Info:
http://msdn.microsoft.com/en-us/library/system.net.dns.gethostname.aspx
There are different ways to get the Owner Name and Device Name:
For Owner Name, add the following reference to your project:
Microsoft.WindowsMobileMicrosoft.WindowsMobile.Status
Then in your code:
Imports Microsoft.WindowsMobile.Status
.
.
.
MessageBox.Show(SystemState.OwnerName)
More info at:
http://www.c-sharpcorner.com/Forums/ShowMessages.aspx?ThreadID=46306
To get the Device Name (which is what you find under Start/Settings/System Tab/About), you simply have to say:
MessageBox.Show(System.Net.Dns.GetHostName())
For more Info:
http://msdn.microsoft.com/en-us/library/system.net.dns.gethostname.aspx
Labels:
Device Name,
Owner Name,
Windows Mobile
Wednesday, September 24, 2008
Unresolved Externals when using POOM in VC++
I found several postings when searching for a solution to compiling a POOM app that errors out with Unresolved External Symbol CLSID_Application and IID_IPOutlookApp. Only one of the solutions I found worked for me using Visual Studio 2008 C++:
http://www.tech-archive.net/Archive/PocketPC/microsoft.public.pocketpc.developer/2006-03/msg00236.html
The trick is to use:
#include "initguid.h"
#include "pimstore.h"
at the begining of the .cpp file. The initguid.h is the item that fixes the problem.
http://www.tech-archive.net/Archive/PocketPC/microsoft.public.pocketpc.developer/2006-03/msg00236.html
The trick is to use:
#include "initguid.h"
#include "pimstore.h"
at the begining of the .cpp file. The initguid.h is the item that fixes the problem.
Labels:
POOM,
Windows Mobile
Thursday, August 28, 2008
Getting a Device ID using the Compact Framework
Here are a couple of approaches I found for getting a Device ID using the compact framework. Both are lengthy solutions to something that should probably be built into platform.
http://msdn.microsoft.com/en-us/library/ms172516.aspx
http://msdn.microsoft.com/en-us/library/aa446562.aspx
http://blogs.msdn.com/jehance/archive/2004/07/12/181067.aspx
http://msdn.microsoft.com/en-us/library/ms172516.aspx
http://msdn.microsoft.com/en-us/library/aa446562.aspx
http://blogs.msdn.com/jehance/archive/2004/07/12/181067.aspx
Labels:
device Id,
Windows Mobile
Sunday, June 17, 2007
Getting Application's Path (Desktop and Windows Mobile)
Getting the Application's Path is different depending on the platform and application type. Ideally, you would just use the Application.StartupPath, but that only works for Forms apps on the desktop. I have provided this approach and another for Desktop Console App and another one for Windows Mobile.
VB.NET - Forms App
VB.NET - Console App
VB.NET - on Smart Device (Windows Mobile) Platform
VB.NET - Forms App
Public Function GetAppPath() As String
return System.Windows.Forms.Application.StartupPath
End Function
VB.NET - Console App
Imports System.Reflection
...
Public Function GetAppPath() As String
Return Path.GetDirectoryName([Assembly].GetEntryAssembly().Location)
End Function
VB.NET - on Smart Device (Windows Mobile) Platform
Imports System.Reflection
...
Public Function GetAppPath() As String
Dim asm As [Assembly] = [Assembly].GetExecutingAssembly()
return System.IO.Path.GetDirectoryName(asm.GetName().CodeBase)
End Function
Labels:
Console,
StartupPath,
Windows Mobile
Subscribe to:
Posts (Atom)