Tag: compact framework

.NET winforms应用程序在不使用ClickOnce的情况下更新自身的最佳方法是什么?

由于技术原因,我无法使用ClickOnce自动更新我的.NET应用程序及其程序集。 在.NET中处理自动更新的最佳方法是什么?

P /在Compact Framework中调用CreateToolhelp32Snapshot失败

嘿,我正在为我的智能手机做一个小应用程序,使用Windows Mobile 6.我正在尝试获取所有当前正在运行的进程,但方法CreateToolhelp32Snapshot总是返回-1。 所以现在我卡住了。 我试图通过调用GetLastError()方法获得错误,但该方法返回0值。 这是我的代码片段。 private const int TH32CS_SNAPPROCESS = 0x00000002; [DllImport(“toolhelp.dll”)] public static extern IntPtr CreateToolhelp32Snapshot(uint flags, uint processid); public static Process[] GetProcesses() { ArrayList procList = new ArrayList(); IntPtr handle = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if ((int)handle > 0) { try { PROCESSENTRY32 peCurr; PROCESSENTRY32 pe32 = new PROCESSENTRY32(); // get byte array to […]

在Compact Framework中更改文件LastWriteDate

FileSystemInfo.LastWriteTime属性在CF中只读。 有没有其他方法来改变那个日期?

SQL Server连接字符串

我猜你得到了上百个问题,但是这里有: 因此,我正在尝试使用霍尼韦尔Dolphin 6100移动设备(CE5.0,.NET Compact Framework)与我正在开发的机器上安装的SQL Server Express 2008数据库进行通信。 我是SQL Server和移动开发的完全新手,在C#中我仍然有点绿色(是的,我知道,在这里跳得很深,是吗?:D) 到目前为止我有: string sConnection = @”Data Source=JEZ-LAPTOP;DataBase=EMS_Main;Integrated Security=SSPI;”; SqlConnection sqc = new SqlConnection(sConnection); sqc.Open(); 该应用程序非常愉快地部署到6100,但最后一行出现了一个模糊的“SQL Exception”错误。 我已经尝试更改数据源以包括实例名称,斜杠和点之前等(即使服务器只是使用默认实例),无济于事。 我可以毫无问题地连接到Management Studio中的数据库。 那么,连接字符串是错误的,还是我在SQL Server中没有正确完成的? 提前致谢。 这个网站真棒,一些知识渊博的家伙。

P /通过错位名称调用函数

我试图在windows ce 6.0环境中调用.net cf 3.5中的非托管c ++ dll中的函数。 结构定义为: typedef struct TagOperatorInfo { DWORD dwMode; DWORD dwFormat; //Operator name format DWORD dwAct; //Network type(Available in 3G module£ºGSM or 3G), TCHAR szOper[32]; }OperatorInfo,*LPOperatorInfo; 和函数调用是: BOOL GetCurOperatorInfo(LPOperatorInfo pinfo); 我在.net中定义了TagOperatorInfo,如下所示: [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Auto)] public struct TagOperatorInfo { /// DWORD->unsigned int public uint dwMode; /// DWORD->unsigned int public uint […]

如何使用C#确定SQL Server CE表中是否存在列?

遗留代码以这种方式执行: public bool isValidField(string tableName, string fieldName) { bool retVal; string tblQuery = string.Format(“SELECT {0} FROM {1}”, fieldName, tableName); checkConnection(); try { SqlCeCommand cmd = objCon.CreateCommand(); cmd.CommandText = tblQuery; object objvalid = cmd.ExecuteScalar(); retVal = (null != objvalid); } catch { retVal = false; } return retVal; } ……但我发现它并不总是奏效。 在调用该方法并获得false ,一些代码ALTERS表添加了一些列,但我得到: 列ID在规范中出现多次。 我在StackOverflow上找到了几个有前途的SQL语句: if exists(select […]

Serial Port ReadLine vs ReadExisting或如何正确读取串口数据

我正在从串口读取数据。 数据来自规模。 我现在使用Readline()并在删除DiscardInBuffer()后删除数据。 从串口读取数据的正确方法是什么? 网上的例子很少,我觉得这就像是一些没有人想到的圣杯。 有什么帮助吗? 好像串口是一个反复无常的孩子。 C#,WinCE 5.0,HP瘦客户端,Compact framework 2.0 private void WeighSample() { this._processingDone = false; this._workerThread = new Thread(CaptureWeight); this._workerThread.IsBackground = true; this._workerThread.Start(); } //end of WeighSample() private void CaptureWeight() { globalCounter++; string value = “”; while (!this._processingDone) { try { value = this._sp.ReadLine(); if (value != “”) { if (value == […]

紧凑框架中的透明度

我需要在.NETCF中创建一个透明背景的图像,我使用洋红色作为我希望透明的背景。 我尝试这样做的方法是重写onPaint()。 但我无法让背景透明化? 这就是我所拥有的: protected override void OnPaint(PaintEventArgs e) { Graphics g = e.Graphics; ImageAttributes imageAttributs = new ImageAttributes(); imageAttributs.SetColorKey(Color.FromArgb(255, 0, 255), Color.FromArgb(255, 0, 255)); g.DrawImage(cross, crossRect, 200, 10, cross.Width, cross.Height, GraphicsUnit.Pixel, imageAttributs); base.OnPaint(e); } 但是当我尝试包含ImageAttributes时,我的图像根本没有被绘制?

System.Text.Encoding.GetEncoding(“iso-8859-1”)抛出PlatformNotSupportedException?

请参阅主题,请注意,此问题仅适用于.NET compact框架。 这种情况发生在Windows Mobile 6 Professional SDK以及我的英文HTC Touch Pro(所有.NET CF 3.5)附带的仿真器上。 iso-8859-1代表西欧(ISO),它可能是除了us-ascii之外最重要的编码(至少当用户网帖的数量时)。 我很难理解为什么不支持这种编码,而支持以下版本(同样在模拟器和我的HTC上): iso-8859-2(中欧(ISO)) iso-8859-3(拉丁语3(ISO)) iso-8859-4(波罗的海(ISO)) iso-8859-5(西里尔文(ISO)) iso-8859-7(希腊语(ISO)) 那么,支持说希腊语比支持德语,法语和西class牙语更重要吗? 任何人都可以对此有所了解吗? 谢谢! 安德烈亚斯

保存并加载图像SQLite C#

我正在尝试使用带有CF的WinForm上的应用程序使用SQLite保存和加载图像。 我找到了一种方法将图像保存到数据库中,但我不知道它是否正确,因为我找不到加载存储在数据库中的图像的方法。 我有一个代码将我的图像转换为Base64: public void ImageToBase64(Image image, System.Drawing.Imaging.ImageFormat format){ using (MemoryStream ms = new MemoryStream()){ // Convert Image to byte[] image.Save(ms, format); byte[] imageBytes = ms.ToArray(); // Convert byte[] to Base64 String string base64String = Convert.ToBase64String(imageBytes); SaveImage(base64String); } } 这是我将图像保存到db中的代码: void SaveImage(string pic){ string query = “insert into Table (Photo) values (@pic);”; string conString = […]