|
I've heard that accessing the COM ports on the pocket PC (Compact Framework) is "just like" on a desktop using the regular framework.
I'm missing some piece of the puzzle since most examples are in C++ and only show a small portion of the code assuming you've already linked to the right DLL's etc. but apparently I'm not.
On my desktop, I do this to open a COM port:
using System.Runtime.InteropServices; // needed for DllImport
-later on...
[DllImport("kernel32.dll")]
private static extern int CreateFile(...)
[DllImport("kernel32.dll")]
private static extern bool WriteFile(...)
-later on...
hFile = (IntPtr)CreateFile(fname, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
and so on. I can open a COM port if fname is COM1 etc. So why isn't this working on the Pocket PC? I suspect it's just finding out what dll to import.
Thanks in advance to any Saint who can simplify this for me.
Tom@tweez.com
|
|
|
|
|
Has anyone noticed that up and down buttons in PPC'02 and '03 would scroll the drop-down list of a ComboBox, but in WinMobile5, those events change the focus to the next control?
I liked the old way because it meant you could respond to those events by loading whatever the value was in the next slot of the drop-down list and update the screen, enabling the user to 'shop' for the right value.
With the new modality, you have to tap to get the list and tap to make a selection - a much less effective means of 'shopping' for the right value. So, I want to over-ride that focus change behavior in WM5.
I tried capturing WM_KEYDOWN and WM_CHAR in the CComboBox and in the CDialog, but those events don't arrive in either place. Does anybody know where those 'physical' button events go?
Here's what I'd hoped I could accomplish:
void CMyNillaDialog::OnChar( UINT nChar, UINT nRepCnt, UINT nFlags )
{ // WM5 up arrow down arrow
if ( theApp.m_osVer == 5 && (nChar == 38 || nChar == 40) )
{ // we're running WM5 and the event is an Up or Down button
CWnd* ctl = GetFocus();
if ( ctl->IsKindOf( RUNTIME_CLASS( CSeekComboBox ) ) )
{ // a ComboBox has the focus...
// redirect this event to the CComboBox (prevent the focus change)
ctl->OnChar( UINT nChar, UINT nRepCnt, UINT nFlags );
return; // leave the focus on the CComboBox
}
}
// if it's not a CComboBox, let WM5 change the focus
// if it's not WM5, just handle it normally
CNillaDialog::OnChar( nChar, nRepCnt, nFlags );
}
-- modified at 14:17 Thursday 23rd February, 2006
|
|
|
|
|
please help me, how can i connect database SQL server in my Pocket PC, when i run it in Visual studio 2003 this run correct but when i run in Pocket PC, it can't connect to my PC
kevil
|
|
|
|
|
Hello,
I'm looking for a little more help with another bit of code, and thought a seperate thread for this one was better!
I would like to run a program after a (user setable) "period of device inactivity"!
I'm also looking to do this with evc++ code. Can anyone help with this please?
Thank You...
ZapMe1
|
|
|
|
|
Look into
CeSetUserNotification(Ex) or the older CeRunAppAtEvent/Time
and
GetIdleTime
Im not sure you can get notifications tied to idle time, but you could write a gui-less application that gets started by the times events to check if the device has been idle for long enough, and then starts the program that should run.
If your app is always running (or if you implement a service), you should get by with just GetIdleTime.
HTH
---
"Man will never be free until the last king is strangled with the entrails of the last priest". -- Denis Diderot
|
|
|
|
|
Again, thank you for the reply, Jonas. I will run a few tests with this and see what I can come up with!
ZapMe1
|
|
|
|
|
Hello,
I'm looking for evc++ code that will "Disable ActiveSync" when the program is run, and restore connection (or at least the ability to connect), when the program is shutdown!
Can anyone help me with this?
Much Appreciated.
ZapMe1
|
|
|
|
|
Hi,
I've used this registry key in the past, dont know if it's still valid:
[HKEY_CURRENT_USER\ControlPanel\Comm]
"AutoCnct"=dword:00000000
This will stop the decive from trying to start an activesync session when a cable is plugged into the rs232/usb hybrid, but I guess it wont terminate an active connection. Unsure if that is what you are after.
HTH
---
"Man will never be free until the last king is strangled with the entrails of the last priest". -- Denis Diderot
|
|
|
|
|
Thank you, Jonas. I'll give it a try, and post results back here! I appreciate the reply.
BTW: I'm not concerned with stopping the connection if already started, but would like to stop from connecting to ActiveSync if my program is already running!
ZapMe1
-- modified at 18:44 Thursday 23rd February, 2006
|
|
|
|
|
Hi Jonas,
Just wanted to say thank you! The registry change for "AutoCnct" worked like a charm!
When the value is set to it's default "1", then AS works & connects as usual! When this value is set to "0", then AS is ignored, and no connection is made!
I am a happy boy!
Thank You Again....
ZapMe1
|
|
|
|
|
Hello. Is there any way of modifying the look and feel of the application without having to repaint the controls (i.e. without inheriting from CDialog and catching the WM_PAINT message)?
Thanks a lot,
Ah Z.T.X.
A polar bear is a bear whose coordinates has been changed in terms of sine and cosine.
|
|
|
|
|
Greetings:
I've been struggling with writting a communications IO thread for a Windows Mobile .NET 2003. I have boiled my concerns down to a couple of basic questions:
Is it possible to have one thread send an asynchronous message to another thread. In other words, I'm looking for something equivalent to the "PostMessage" API procedure which places a message into a message queue of a window or command target but does not wait for for the message handler to finish (the way "SendMessage" would). Does this facility exist in Windows Mobile? Can it be implemented in Windows Mobile .NET or must I import things from the CoreLib.DLL?
I have also noticed that Windows Mobile .NET does not seem to support waiting on an AutoResetEvent or ManualResetEvent with a timeout. The overrides for "WaitOne" that allow you to provide a timeout parameter don't seem to be there for Windows CE.NET. Ditto on the static function "WaitAll".
With these elements removed, I don't know how one goes about writing efficient threads that can sleep when they are not needed and send messages to each othere without having to be "joined at the hip".
Have I misunderstood something? I hope I have. If anyone has some insight, I'd appreciate hearing from you.
Cheers,
Mark
|
|
|
|
|
I recently ran thru the same problem you are describing. After researching other discussions, my solution was to implement a "native" event class using the underlying windows CE API. Next, create a thread-safe message queue (using generics in my solution) that signalled an embedded native event when events were added and reset the event when the queue emptied.
I used these pieces to implements a WaitForAny on an array of the native handles. Final result was the desired WaitForAny that you are describing.
|
|
|
|
|
Um trying to add web service in a pocket PC application when i debug my solution there is an unhandled exception when trying to connect to the web service. this exception is "Can not establish connection to network". please tell me how I could fix that exception.
Eng.Kholyo
|
|
|
|
|
hi friends
can anyone pls tell me of any helpful material for the development of a system that allows remote access to windows/linux pc platforms using a symbian OS based PDA -basically any article, guidelines or source code regd it.
i'll be grateful.thanks
SB
|
|
|
|
|
Greetings:
I am writing this application for a PDA on Visual Studio .NET 2003. It has a USB Host interface. Everything is going along tickety-boo until I realize that I can't figure out a way to send information asyncronously from the data-reader thread to the main form.
The data-reader thread runs in the background and services the USB driver when new incoming data shows up. Now, I want the thread to be able to notify the main form when it has put new data into a shared buffer. I can't figure out how to do this with the compact framework. I do NOT want the thread having to wait for the main form to finish processing before it can continue (synchronous). I would like the two things to act indepedendantly...
Any suggestions? And please, I am relatively new to .NET framework programming, take it easy on me!
Thanks in advance to anyone who responds,
Mark
-- modified at 13:55 Friday 17th February, 2006
|
|
|
|
|
Store the data in a thread protected statically accessible area that the form can get to and then call Invoke on one of the form's controls or the form itself when data is present, then in the overridden Invoke method access the data and do what you will with it.
This statement is false.
|
|
|
|
|
Hi Chris:
Isn't "Invoke" synchronous? Doesn't it wait until the "invoked" procedure returns? What inspired my original message was when I discovered that "BeginInvoke", which is asynchronous, is not offered under the compact framework.
I also discovered that "Invoke" under the compact framework does not offer any of the extra overrides. You can only send the delegate as a parameter. It does not let you include the object array as a second parameter.
Cheers,
Mark
-- modified at 14:15 Friday 17th February, 2006
|
|
|
|
|
Yep. Invoke is synchronous. But what your asking for is a method to notify your main form that the background process has data available. So you would need to set your delegate to simply notify that the operation has finished. Then inside your form, access the static data in a protected common area and use a set of flags or state machine to determine the operation that was performed and respond accordingly.
With this you can simulate asynchronous behavior with your background thread and only use the Invoke of the form as a notifier. If your worried that the invoke will hang your background thread while processing the data then you could just use it to set a flag and have another thread maybe on a timer or something watch the flag and operate on the data from there instead of during the invoking from the background thread. A little klugy but that's what we got.
The Compact way of threading is to have parameterless invokes. So that's why the need for a state machine or set of flags.
This statement is false.
|
|
|
|
|
Hi Again:
I understand everything you are saying. I guess that I am a bit surprised that CE.NET does not seem to provide anything similar to "PostMessage" which provides a means to trigger the invocation of a procedure in another thread without having to wait around for the procedure to finish.
I'll have to go and do some ascertainin' and determinatin'...
Thanks for your help.
Mark
|
|
|
|
|
You might need to research this further but I believe you can override the WndProc method of the MessageWindow class after deriving from it. I'm inexperienced with this so don't hold me to it. But this might be more work than its worth unless your needing to do a bit of interop with win32.
This statement is false.
|
|
|
|
|
Hi Chris:
Just as an aside to all of this, is there somewhere a relatively clear and simple summary of what CE.NET can and can't do? Either in a book or on the WEB?
Thanks,
Mark
|
|
|
|
|
This is my choice of book:
http://www.amazon.com/gp/search/ref=br_ss_hs/103-3646719-5627005?search-alias=aps&keywords=.NET%20Compact%20Framework%20Programming%20with%20C%23
Its not just a reference but goes into detail of all sorts of interop and ASync apps. I highly recommend it. As far as the web... I google and google and google. And find myself bouncing between a few sites, but the book is where I end up most.
Hope this helps. If you want to discuss more offline I don't mind.
This statement is false.
|
|
|
|
|
Thanks a lot, Chris. This has been very helpful.
Mark
|
|
|
|
|
Hi all,
We recently were asked to do maintenance of an already developed mobile application. The app is already deployed and used on PDAs.
Now we received change request. We completed them using VS.NET 2003, .NET Framework 1.1. Now I have not used .NET compact framework. If I deploy my binaries created on our regular .NET framework, will the binaries work in production system on PDA? Also:
a. What is .NET Compact framework?
b. From where to download it?
c. Can .NET Framework and compact framework run on same machine?
d. Which version of compact framework to use so that it is compatible with VS.NET 2003 and .NET framework 1.1?
Help is appreciated.
Vilas
|
|
|
|