windows-ce

P/Invoking CreateToolhelp32Snapshot failing in Compact Framework

让人想犯罪 __ 提交于 2019-11-28 11:41:26
问题 Hey, im doing a little app for my smart phone, using Windows Mobile 6. I'm trying to get all currently running processec, but method CreateToolhelp32Snapshot always returns -1. So now im stuck. I tried to get error with invoking GetLastError() method, but that method returns 0 value. Here is a snippet of my code. private const int TH32CS_SNAPPROCESS = 0x00000002; [DllImport("toolhelp.dll")] public static extern IntPtr CreateToolhelp32Snapshot(uint flags, uint processid); public static Process

Methods to nail down 16 bit CRC/Checksum algorithm used by Windows CE executable?

泄露秘密 提交于 2019-11-28 10:23:22
I need to reverse engineer CRC/Checksum algorithm implemented by windows CE executable. Being propritory protocol, it does not say anything about CRC/checksum algorithm. However, There is console interface that reports correct/calculated checksum and I can construct my own messages with random bits if message protocol is correct: I have observed that, Changing single bit in message changes checksum bytes completely. Algorithm seems to be position dependent as I fed some single 1 bit messages in various message data positions with rest of the bits zero and all the time console reported

Serial Port ReadLine vs ReadExisting or how to read the data from serial port properly

折月煮酒 提交于 2019-11-28 09:11:06
I am reading data from serial port. The data comes off the scale. I am now using Readline() and getting data dropped even after I removed DiscardInBuffer() . What is the proper way to read the data from the serial port? There are so few examples online that I feel it's like some holy grail that no one has figured out. Any help please? Seems like serial port is a capricious child. C#, WinCE 5.0, HP thin client, Compact framework 2.0 private void WeighSample() { this._processingDone = false; this._workerThread = new Thread(CaptureWeight); this._workerThread.IsBackground = true; this.

Should I call “SqlCeEngine.Upgrade()” when both the SDF file and the device are seemingly the same version (2)?

天涯浪子 提交于 2019-11-28 06:49:37
问题 This is a followup to a question here ctacke said there regarding SQL Server CE-related "issues" I was/am having: " The problem, as indicated by the error text, is that the SDF file was created by a version of SQL Compact that doesn't match the version of SQL Compact that the application is referencing. I wouldn't focus on the reported version numbers, just the fact that it knows there's a mismatch. If you don't know the version of the SDF, you can always look it up by reading a few bytes

How can I determine whether a column exists in a SQL Server CE table with C#?

对着背影说爱祢 提交于 2019-11-28 04:39:32
问题 The legacy code does it this way: 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; } ...but I find it doesn't always work. After calling that method, and getting false , some code

Specified argument was out of the range of valid values. Parameter name: size & Serial Port Communication

。_饼干妹妹 提交于 2019-11-28 02:26:23
问题 I need to create an application which requires communicating to an existent software using TCP/IP, where both mine and the other application will be using the port number specified below. private void frmScan_Load(object sender, EventArgs e) { clientSocket.Connect("100.100.100.30", 76545); } public void msg(string mesg) { textBox1.Text = textBox1.Text + Environment.NewLine + " >> " + mesg; } private void cmdSCANok_Click(object sender, EventArgs e) { msg("Client Started"); NetworkStream

Partly crashing application? How can I catch uncatchable exceptions?

 ̄綄美尐妖づ 提交于 2019-11-28 01:52:12
I have a program written in C#, running on a Windows CE device (on Compact Framework). It processes minimal user actions (button clicks), uses serial port and TCP/IP communication. The problem is sometimes the software shuts down on its own. In the background the application (or parts of the application) seems to be still running (at least in one documented case it was) because it uses the serial port, so restarting the application doesn't help. I can't reproduce the problem since it happens in most of the cases when there is no user interaction, no serial port communication and the network

How could I create a custom windows message?

天大地大妈咪最大 提交于 2019-11-28 01:03:37
问题 Our project is running on Windows CE 6.0 and is written in C++ . We have some problems with the code , and we are unable to debug . We also found out that if in our application we create threads and try to printf from them , the output won't appear . The only output that will appear is the one from the main thread . I would like to do the following : create a custom windows message use as it's WPARAM the address of a char* I want to show on the screen use as it's LPARAM the length of the char

Exporting DLL C++ Class , question about .def file

核能气质少年 提交于 2019-11-27 22:45:44
问题 I want to use implicit linking in my project , and nmake really wants a .def file . The problem is , that this is a class , and I don't know what to write in the exports section . Could anyone point me in the right direction ? The error message is the following : NMAKE : U1073: don't know how to make 'DLLCLASS.def' P.S: I'm trying to build using Windows CE Platform Builder . 回答1: You can always find the decorated name for the member function by using dumpbin /symbols myclass.obj in my case

How do I get the file HANDLE from the fopen FILE structure?

萝らか妹 提交于 2019-11-27 22:43:50
The fopen function returns a pointer to a FILE structure, which should be considered an opaque value, without dealing with its content or meaning. On Windows, the C runtime is a wrapper of the Windows API, and the fopen function relies on the CreateFile function. The CreateFile function returns a HANDLE , which is used by other Windows API. Now, I need to use Windows API deep inside of a library that uses fopen and FILE* . So: is there a way to get the HANDLE from the FILE structure? As this is compiler specific, I mean on the MSVC runtime library. I understand that this would be an ugly, non