compact-framework

Getting the size (free, total) of a Windows Mobile phone drive using C#

与世无争的帅哥 提交于 2019-12-01 12:58:02
问题 How do I get the size (free, total) of any drive on a Windows Mobile phone using C#? I need to do this with code running on the device (not on a connected PC). 回答1: I've rewritten the answer based on a better understanding of the question, but without losing any of my original answer for those who find this question. Getting the size from code running on the device The answer is simple: P/Invoke GetDiskFreeSpaceEx directly (example here) or use a third-party library that does it for you. I'm

Getting battery information of a windows CE 5.0 device

Deadly 提交于 2019-12-01 12:17:58
Sir, I am developing an application for a device running WINDOWS CE 5.0. I want to know the battery/power information of the device. I am quit new in CE programming. Please make clear is there any difference between windows mobile programming and CE programming? I found MICROSOFT.WINDOWSMOBILE.STATUS namespace to work with. But when i include the reference, this namespace is not visible in the list. What should i do? You need to P/Invoke GetSystemPowerStatusEx . An example is actually found in this old MSDN article . I have used the P/Invoke GetSystemPowerStatusEx before and found it caused

How to get all processes running in .net cf

只愿长相守 提交于 2019-12-01 11:58:38
问题 I want to get a list of all running application in my windows mobile 6.5 from my application. Can anyone tell me how to do this for CF?? 回答1: You have to P/Invoke the toolhelp APIs. There used to be an MSDN article that covered this (it's a bit long to put it all into a post here, though maybe that's a better idea?). The gist of it can also be found in the SDF source code over on Github. 来源: https://stackoverflow.com/questions/7430982/how-to-get-all-processes-running-in-net-cf

ThreadStart.BeginInvoke throws NotSupportedException on Compact framework

这一生的挚爱 提交于 2019-12-01 11:33:16
I'm working with threads on a compact framework project and have code that looks something like below. When I try to step into StartThreads(), a NotSupportedException is thrown. This seems a bit wierd, why is the exception thrown on the line calling StartThreads() and not inside, and what is it that's not supported on CF? I think its ThreadStart.BeginInvoke but that's not where the exception is actually being thrown. void SomeMethod() { this.StartThreads(); // <- NotSupportedException is thrown here, I can't step into this method with the debugger } void StartThreads() { ThreadStart

color whole row instead of single cell

笑着哭i 提交于 2019-12-01 11:30:51
问题 Ive been trying to change the background color of a row in the Compact Framework DataGrid and have found little success since the DataGrid on .NET CF is limited compared to its Windows Forms counterpart. My only bit of success in achieving my goal is I have now been able to change the background color of a single cell depending on its values. I couldnt manipulate the code I got from Googling since I am not that good in C#. However, this is the code that I have: namespace GridColor { public

Getting battery information of a windows CE 5.0 device

孤人 提交于 2019-12-01 10:55:23
问题 Sir, I am developing an application for a device running WINDOWS CE 5.0. I want to know the battery/power information of the device. I am quit new in CE programming. Please make clear is there any difference between windows mobile programming and CE programming? I found MICROSOFT.WINDOWSMOBILE.STATUS namespace to work with. But when i include the reference, this namespace is not visible in the list. What should i do? 回答1: You need to P/Invoke GetSystemPowerStatusEx. An example is actually

Draw border around bitmap

混江龙づ霸主 提交于 2019-12-01 07:39:34
I have got a System.Drawing.Bitmap in my code. The width is fix, the height varies. What I want to do, is to add a white border around the bitmap, with about 20 pixel, to all 4 edges. How would this work? You could draw a rectangle behind the bitmap. The width of the rectangle would be (Bitmap.Width + BorderWidth * 2), and the position would be (Bitmap.Position - new Point(BorderWidth, BorderWidth)). Or at least that's the way I'd go about it. EDIT: Here is some actual source code explaining how to implement it (if you were to have a dedicated method to draw an image): private void

Detect whether the assembly was built for .NET Compact Framework

强颜欢笑 提交于 2019-12-01 07:05:03
问题 Having a .NET assembly, how can I detect whether it was built for .NET CF or a full framework? 回答1: It's quite simple: public enum AssemblyType { CompactFramework, FullFramework, NativeBinary } public AssemblyType GetAssemblyType(string pathToAssembly) { try { Assembly asm = Assembly.LoadFrom(pathToAssembly); var mscorlib = asm.GetReferencedAssemblies().FirstOrDefault(a => string.Compare(a.Name, "mscorlib", true) == 0); ulong token = BitConverter.ToUInt64(mscorlib.GetPublicKeyToken(), 0);

Force close Windows CE 5 app using C#

旧城冷巷雨未停 提交于 2019-12-01 06:43:32
问题 How do I go about force-closing an application on Windows CE 5.0, using C#? I've already tried Application.Exit() but this doesn't always kill all currently running threads. I'd normally use Environment.Exit() but this is not available in CF, unfortunately. 回答1: It depends on the version of the CF you're using. Application.Exit is the correct mechanism to exit the app, but your threads have to be handled as well. In CF 2.0 and 3.5, set the IsBackground property to true on all created threads

.NET Compact framework - make scrollbars wider

落花浮王杯 提交于 2019-12-01 06:28:48
Is there some way, how to make scrollbar wider in winforms for .net compact framework? I want to be application finger-friendly, but the scrollbars are very narrow for people with not-small fingers. EDIT: The problem is with built-in scrollbars in components like ListView, DataGrid, etc... Windows Mobile 6.0, .NET Compact Framework 3.5 Thanks. I haven´t checked that, because I have no device but rumor has it that you can change the Size per Regstry Settings: [HKEY_LOCAL_MACHINE\SYSTEM\GWE] cyHScr=13 - Default height of horizontal scrollbar cxVScr=13 - Default width of vertical scrollbar Kind