Smart Device Programming with Visual Studio .NET (June 14, 2006)
**Chat Topic:**Smart Device Programming with Visual Studio .NET
**Date:**Wednesday, June 14, 2006
Please note: Portions of this transcript have been edited for clarity
mikefos_msft (Moderator):
Welcome to today’s MVP-hosted chat regarding the Smart Device Programming with Visual Studio .NET!!
We are pleased to welcome our Experts for today’s chat. I will have them introduce themselves now.
*Introductions
Arnie_MVP (Expert):
Hi This is Jeff Arnett. I work a bit with the Compact Framework and Platform Builder.
PaulT_MVP (Expert):
I'm Paul Tobey, a .NET CF and Windows Embedded MVP. I work a lot with non-Windows Mobile Windows CE devices as an OEM.
AlexFeinman (Expert):
Hello, I'm Alex Feinman, a .Net Compact Framework MVP from Northern California and OpenNETCF.org member
*Start of Chat
mikefos_msft (Moderator):
Q: Is this chat only for managed code or will you be discussing native dev as well?
A: If you have native code development-related questions, we can certainly take a shot. :-)
PaulT_MVP (Expert):
Q: Is there any way to do .Net Remoting in a Windows Mobile environment? If not, are there any plans for this?
A: No and no, I'm afraid.
Arnie_MVP (Expert):
Q: Is there any way to do .Net Remoting in a Windows Mobile environment? If not, are there any plans for this?
A: There is some speculation that going forward the MS Compact Framework team will add some level of "Indigo" or WCF support where you could round things out a bit and get some level of remoting working. Stay tuned.
mikefos_msft (Moderator):
Q: I downloaded directx onmy computer. When I tried to install it I got this message. " The software you are installing has not passed Windows logo testing to verify its compatibility with Windows xp. Software could not be installed". I'm at a loss.
A: Hmmm....this chat is related to application development targeting Windows Mobile and Embedded devices, so you're a bit off-topic, but this should help: https://support.microsoft.com/kb/819836. See "Method 3" in this article.
PaulT_MVP (Expert):
Q: Why is designing forms and positioning controls so slow for CF apps?
A: Dan, you're seeing different speed on Smart Device development in the VS2005 environment than for desktop apps?
Arnie_MVP (Expert):
Q: What are the plans for incorporating WCF into CF? Will it be supported at all?
A: The CF teams have only communicated the following: that they will be providing support for WCF client side only. They will also be doing enough of the messaging layer that someone could potentially round things out for server side as well.
Arnie_MVP (Expert):
Q: Can you give a list of exact differences between full and CF - and the Micro Framework?
A: There is a nice power point slideset given at MEDC that shows the difference namespaces supported by Full, CF & Micro. Not alot of details other than the Micro supports about ~70 classes and 400 API's as compared to full which is much greater than this.
PaulT_MVP (Expert):
Q: PaulT: Well, I only build CF applications, and web services etc. without interfaces, so I can't compare the speed. I just noticed that in VS2003, form design is much faster compared to VS2005.
A: I don't think that I've noticed that myself. This would have to go to someone on the VS team, I think. Maybe Mike can try to get you an answer off-line. I'll try to ask what I suspect they will: what processor, what speed, how much RAM, anything else running at the same time (virus scanners, etc.)?
AlexFeinman (Expert):
Q: What is the simplest, fastest, and most "correct" way to, given only a file name, determine if it's on internal storage or an external flash card?
A: The simplest way is to check whether the Directory pointed to by this path has ReadOnly attribute. The most correct is to use FindFirstFlashCard/FindNextFlashCard (P/Invoke). If you are asking how to tell an external flash memory from internal one (like Ipaq Storage), I'm not sure if it's possible
AlexFeinman (Expert):
Q: Has anyone use Intelliprog Richink with VS 2005?
A: I don't believe it is supported under VS2005. I suggest sending an email posted at the Intelliprog web site.
Arnie_MVP (Expert):
Q: Suggestion: Then when debugging starts, pick a device on the list and go. Without having to dig deep within Tools-->Options-->Devices, etc.
A: Sounds like a good idea. So just another node in the server explorer then or possibly a totally different pane? This would require some lan based discovery mechanism like PnP-X for devices etc.
AlexFeinman (Expert):
Q: What is the recommended way to implement notification callbacks from Native code to C#?
A: Compact Framework 2.0 supports callbacks. Regular marshalling rules apply. Things to keep in mind are memory allocation, blocking and exception handling.
Arnie_MVP (Expert):
Q: So will a CF application be able to receive messages or objects from other CF devices?
A: Is this question in the context of WCF? According to MS once the WCF connection is established then yes messages can go back and forth. This is of course assuming that they (MS) or OpenNET or someone else implements the infrastructure for the server side of WCF on devices. In the meantime webservices using say the gsoap toolkit or possibly the "Mobile Web Server Architecture" (posted on MSDN) are a nice way to communicate between devices.
AlexFeinman (Expert):
Q: (Follow-up) I noticed that internal flash card has FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_SYSTEM attributes set, external has FILE_ATTRIBUTE_DIRECTORY | FILE_ATTRIBUTE_TEMPORARY set. Can I depend on these values to be the same and use them to distingui
A: I don't believe you can. THis is manufacturer-specific
Arnie_MVP (Expert):
Q: Arnie: Exactly. A separate pane would be good. Server explorer MIGHT work, but if you're doing web service and database backend work, going back and forth could be messy.
A: Yes, let me mention this idea to the VS Smart Devices team at MS and see what they think. Can you describe further your user scenarios? Would it just be for discovery/debug or a nice integration of all the remote tools to access any device it finds on the network?
PaulT_MVP (Expert):
Q: PaulT: Well, I only build CF applications, and web services etc. without interfaces, so I can't compare the speed. I just noticed that in VS2003, form design is much faster compared to VS2005.
A: Dan, the only thing I can think of is the support for the layout capability (handles changes in resolution on different devices, switching from portrait to landscape and back, etc.) That puts a little more code between you dragging something around and it actually getting to its final location. With anchoring off for controls and the form set for no DPI handling, I can do exactly the same things in VS2005 as in VS.NET 2003 and they seem to perform the same.
PaulT_MVP (Expert):
Q: It is possible to write a Stream I/O driver for Windows CE in C#? If so, has an article been written on it?
A: No. You can't export the necessary entry points *or* host managed code from unmanaged code (like the Device Manager). Say hello to C++.
AlexFeinman (Expert):
Q: You said most correct way is to use FindFirstFlashCard..., how do you mean to use it? What is the link between the file name and the flash card? Can dwOID value be used for this (in the WIN32_FIND_DATA structure)?
A: Since all storage cards are rooted to "\", you just need to get the top-level directory name on your file and match to the cFileName in the WIN32_FIND_DATA
Arnie_MVP (Expert):
Q: will DCOM be supported in the future or are there plans to get rid of it?
A: DCOM is supported on CE devices if that is what you are asking. There is no plans that I know of to remove support for it but MS has the final say on this.
PaulT_MVP (Expert):
Q: will DCOM be supported in the future or are there plans to get rid of it?
A: What do you mean by DCOM? Remote invocation? That's going away. Inter-process communication will stay around.
mikefos_msft (Moderator):
Q: Hi there Experts. I'm working on Mobile devices Provisioning. It's possible to add a new (and custom) Configuration Service Provider to use with the Configuration Manager? Our idea it's extends the provisioning. Don't know where start. Thx!
A: We don't have any CSP experts on today's chat. Best starting place I could suggest is https://msdn.microsoft.com/library/en-us/mobilesdk5/html/wce51conConfigurationServiceProviders.asp?frame=true. I hope that that's not too lame an answer. :-)
You could always try posting to the newsgroups to cast a bit of a wider net for responses to this question.
Arnie_MVP (Expert):
Q: As native code will always be necessary on embedded devices - do you think of ways to speed up managed to unmanaged calls?
A: Make sure you use blittable types so the marshaler doesn't work very hard. Also, make the interface as chunky as possible. Use P/invoke rather than COM interop as in general COM interop will be about 5x slower. P/invokes are usually the equivalent of 10 instructions while COM interop can be as much as 50 instructions.
AlexFeinman (Expert):
Q: What specific interoperabily between native and C# is not support or are quite limited. I'm looking for those one off cases here that are not obvious and can bite once you get into a project (and only learn by experience)
A: Watch for:
1) C++ class pointers, those do not map into C# classes
2) Jagged arrays
3) structures with variable-sized arrays
4) Arrays of COM interface pointers There are other things, but these come to mind immmediately. In reality you are going to hit some bumps until you get a feel of it anyway
PaulT_MVP (Expert):
Q: DCOM: I'm asking since I heard some rumors from MS that they'll probably get rid of it.
A: DCOM in the sense of remote object creation and communication has, I think, been publically confirmed as going away. DCOM in the sense of the DCOM component of the OS, which includes support for out-of-process COM, etc. will still be around.
Arnie_MVP (Expert):
Q: DCOM: I'm asking since I heard some rumors from MS that they'll probably get rid of it.
A: Okay, where did you hear the rumors, cause I would be interested to know as well. Let me bring this up with the CE team and see if there is anything here. However, I talk with them pretty frequently and haven't heard any plans to remove support.
PaulT_MVP (Expert):
Q: since C# does not support exported entry points and since hosting managed code from unmanaged is not supported, how do callbacks from native code to managed code work? What are the limitations?
A: That's a different story and I'm not qualified to tell you exactly what's happening under the covers, but, in that case, it's the other way around: you *can* host unmanaged code from managed code. Presumably the managed run-time, which is written in native code, provides an accessible entry point for the callback (it's just a pointer, after all), then marshals whatever needs it and calls the configured managed entry point.
PaulT_MVP (Expert):
Q: DCOM: I'm asking since I heard some rumors from MS that they'll probably get rid of it.
A: Here's a thread in one of the public groups that isn't an official statement, but you'll get the gist: https://groups.google.com/group/microsoft.public.windowsce.platbuilder/browse_frm/thread/abd6ddde4fed2a31/6ac9fb062a530935?lnk=st&q;=dcom+remote+group%3Amicrosoft.public.windowsce.*&rnum;=1&hl;=en#6ac9fb062a530935
AlexFeinman (Expert):
Q: since C# does not support exported entry points and since hosting managed code from unmanaged is not supported, how do callbacks from native code to managed code work? What are the limitations?
A: You pass them to the function calls like EnumWindows. The unmanaged code then calls your callback. If you check MEDC2005 sessions, in one of those I show how to do it
mikefos_msft (Moderator):
Q: Using CF - are there any impacts of realtime performance of the device?
A: Best place I can suggest for this is Maarten Struys' and Michel Verhagen's whitepaper at: https://msdn2.microsoft.com/library/ms836789.aspx
mikefos_msft (Moderator):
Q: Thanks for the reply Mike. So sad, I've already read the MSDN Doc from top to bottom and no luck. I also asked this in the newsgroups and nobody seems to know. Any change to talk with someone, like a SDE or MVP about CSPs??
A: If you can email me the question, I can see what I can find out. No person jumps to mind. I'll PM you.
AlexFeinman (Expert):
Q: (more on FindFirst/NextFlashCard) Another difference I've noticed (on 2 devices) that the internal flash card has a 0-length string in cFileName, whereas the external card has "Storage Card". Can this fact be used reliably to distinguish between them?
A: I don't believe so. Again, this is manufacturer-specific.
Arnie_MVP (Expert):
Q: since C# does not support exported entry points and since hosting managed code from unmanaged is not supported, how do callbacks from native code to managed code work? What are the limitations?
A: Another quick comment on this one: there are some methods in the framework to help with setting this up. You basicaly define a delegate in managed code, then calling GetFunctionPointerForDelegate?? it returns a nice IntPtr that you then pass to your unmanaged code via P/Invoke. In unmanaged code you simply call the function pointer and execution is returned to managed code. There is also a MessageWindow class that helps with callbacks.
PaulT_MVP (Expert):
Q: DCOM rumor: I heard it during the MEDC in Nizza. Don't remember which one of the experts told it.
A: There's also this blog entry: https://blogs.msdn.com/cenet/archive/2006/03/22/558505.aspx
AlexFeinman (Expert):
Q: since C# does not support exported entry points and since hosting managed code from unmanaged is not supported, how do callbacks from native code to managed code work? What are the limitations?
A: Callback by definition is something that you expose at the provider end and pass to another module/call/routine (consumer). The exported functions or hosted code works the opposite way. The connection is initiated from the consumer end. Callbacks are used to provide notifications or recurring results (enumeration)
Mark Arteaga (Expert):
Q: Is the currently any way to add a plugin to the home screen in CF2.0?
A: If you are talking about a Today Screen plugin, then no that is not supported with CF2.0. You will have to use native code to create a today screen plugin.
AlexFeinman (Expert):
Q: Is there any known problem with the OpenNetCF SDF 2.0 download (zip)? I am unable to extract the .msi file .
A: Please, send an email to support@opennetcf.com
AlexFeinman (Expert):
Q: Is there a way to bound the time that GC will take at any one time?
A: No. It is entirely non-deterministic
PaulT_MVP (Expert):
Q: So you're saying that there's ABSOLUTELY NO RELIABLE way to distinguish between internal and external flash cards? Any chance that deficiency will be addressed in a future version of WM/CE??
A: Maybe you could tell us why you need to know this. That might trigger something.
AlexFeinman (Expert):
Q: So you're saying that there's ABSOLUTELY NO RELIABLE way to distinguish between internal and external flash cards? Any chance that deficiency will be addressed in a future version of WM/CE??
A: All I'm saying is that I am not aware of one. This is actually a Windows Embedded question (and this chat is NETCF). I suggest posting this in the Windows Embedded forums
Barry Bond [MSFT] (Expert):
Q: Is Bluetooth supported by WM5 or WinCE5 in a generic way, or will I have to program to a specific vendor's driver?
A: I just found this page on microsoft.com: https://msdn2.microsoft.com/embedded/aa714533.aspx. It states "The class library wrapper provided by Windows Embedded Source Tools for Bluetooth Technology helps make development for Bluetooth Technology faster and easier by reducing the lines of code necessary to develop for Bluetooth Technology from hundreds to just a few."
Arnie_MVP (Expert):
Q: Is there any known problem with the OpenNetCF SDF 2.0 download (zip)? I am unable to extract the .msi file .
A: Yes, there does seem to be a problem with the free community addition (assemblies only). The CRC check during the unzip failed for me. Feel free to post something to their blogs notifying them of the problem.
AlexFeinman (Expert):
Q: As far as the today screen plugins, are there any examples for using native code from API calls?
A: There is no clean way to write a Today plugin with managed code today. Today plugins have to export functions, which is not possible with managed code.
PaulT_MVP (Expert):
Q: Is a complete headless configuration supported by CF or am I still required to use a null display driver?
A: Headless will be first supported in .NET CF 2.0SP1 (service pack 1). It's in beta now.
AlexFeinman (Expert):
Q: WHere can I find complete documentation regarding GC parameters for CF?
A: There are no user-settable GC paramters at the moment
Arnie_MVP (Expert):
Q: To be curious: have you ever had a look on Mono and DotGNU?
A: Yes, people at my company have. The Mono team at Novell appears to be a bit unorganized as we approached them about licensing their software for commercial use etc. We wanted to pay them money but they acted like they weren't interested. The technology is interesting but as I browsed the source I saw too many similiarities with teh Rotor/Ecma version from MS. I think their might be some legal entanglings into what they have done. The best use for Mono I've found is to take some of their higher level source and layer it on top of some of the missing pieces in CF. No experience with DotGNU.
AlexFeinman (Expert):
Q: I am doing native dev for windows mobile smart devices, first question I asked was if this chat covered that, and was told yes.
A: Sorry, you are correct. It appears that the chat topic is not exactly what I thought it is. And yet not every question can be exhausted in a chat. I still suggest posting this in the forums
Arnie_MVP (Expert):
Q: What is the minimum OS configuration to use CF?
A: CF is supported on SmartPhone, PockectPC and WinCE platforms. There is a nice whitepaper regarding which versions of the OS support which versions of the CF. If you are doing custom CE just add the CF version of your choosing to your PB workspace and the tool will take care of bringing in all other dependencies. Did this answer your question?
PaulT_MVP (Expert):
Q: What is the minimum OS configuration to use CF?
A: Well, this probably isn't a complete list, but, when building a new OS for a device, the following things are automatically added when you add .NET CF 1.0: C++ exception handling, CryptoAPI 1.0, WinINet support. Devices which are Windows Mobile have enough stuff in them, by definition to support .NET CF. For other devices, it makes much more sense to contact the OEM and ask...
mikefos_msft (Moderator):
Q: After downloading explorer 7 beta 2 my computer has slowed down on the internet. Any idea why ?
A: Thanks for your question. Our topic for today's MSDN chat is Smart Device Programming with Visual Studio .NET. Our experts will be able to address this question today as it doesn't relate to the topic at hand. My best suggestion would be to check out the IE Community Page at: https://www.microsoft.com/windows/using/community/ie/default.mspx
AlexFeinman (Expert):
Q: Are memory mapped files supported in CF or is this onl accessible through P/Invoke?
A: They are supported by the OS, but not every platform implements them. There is no support for them in CF - only P/Invoke is possible
PaulT_MVP (Expert):
Q: DCOM: sorry, to be clear: we heavily use remote access to WCE devices - so I was shocked that it should go away. I'd really appreciate, if some of you could intervene...
A: I think this battle has been fought and lost already. The MS emphasis on security has resulted in a number of unfortunate losses of functionality in the name of more-secure devices.
PaulT_MVP (Expert):
Q: Since memory mapped files are not natively supported by CF, what is the recommended IPC mechanism between two CF based apps?
A: Daniel Moth has a blog entry (or Web page), that describes the various interprocess communication methods. You can use point-to-point message queues, window messages, sockets, etc. There are almost too many to list. Daniel has posted a link in microsoft.public.dotnet.framework.compactframework on numerous occasions. I'm sure a quick GoogleGroups search there will turn it up for you.
AlexFeinman (Expert):
Q: Just to confirm: Shell extensions for PPC and WM5 cannot be written in CF because that would be native code hosting managed code - True?
A: Correct.
PaulT_MVP (Expert):
Q: I have a C DLL that fires an event (the function takes a HANDLE* parameter) instead of sending a Windows message. Is there any way to register for this event in managed code?
A: You'll have to wrap some calls. OpenNETCF Smart Device Framework already has this wrapper written for you. www.opennetcf.org. You might also search the old messages in microsoft.public.dotnet.framework.compactframework for "WaitForSingleObject".
AlexFeinman (Expert):
Q: I have a C DLL that fires an event (the function takes a HANDLE* parameter) instead of sending a Windows message. Is there any way to register for this event in managed code?
A: You should P/Invoke WaitForSingleObject or better yet, WaitForMultipleObjects in a separate thread
PaulT_MVP (Expert):
Q: What's next after Win Mobile 5? Vista CE?
A: Might be. There was the Windows CE.NET fiasco, so why not? Personally I doubt it, though.
AlexFeinman (Expert):
Q: PaulT: I use OpenNETCF on a regular basis. Do you know what namespace/class/function name I'd be looking for?
A: In SDF 2.0 it is OpenNETCF.Threading.EventWaitHandle. It wraps the whole thing
PaulT_MVP (Expert):
Q: PaulT: I use OpenNETCF on a regular basis. Do you know what namespace/class/function name I'd be looking for?
A: Search the source for WaitForSingleObject. It's in various places, but the basic wrapper, in 1.4 which is what I'm familiar with, is in OpenNETCF.Threading.NativeMethods.
AlexFeinman (Expert):
Q: does the CF runtime host the application message pump? If so what, if anything, can cause that pump to become blocked?
A: Yes, it does. As any message pump it is blocked by long-running calls (blocking calls), but also modal dialogs (.ShowDialog, MessageBox.Show)
Arnie_MVP (Expert):
Q: What's next after Win Mobile 5? Vista CE?
A: MS is working on the next version of CE, CE.60 due out in the 2H of '06. It's internal name is Yamakazi. It contains much better support for # of processes, address space & security. When the next version of Windows Mobile will begin to leverage this new CE core is still tentative but the new windows mobile platform is code named crossbow. Here is a fairely recent article on it:
Arnie_MVP (Expert):
Q: What's next after Win Mobile 5? Vista CE?
A: https://www.pdastreet.com/articles/2006/4/2006-4-24-Mobile-Enterprise-in.html
AlexFeinman (Expert):
Q: Will we ever be able to include CF projects in solutions that contain non-CF projects? What is the challenge to doing this now?
A: You can do it right now (VS2005). You just cannot step from managed into unmanaged in a debugger
AlexFeinman (Expert):
Q: Will we ever be able to include CF projects in solutions that contain non-CF projects? What is the challenge to doing this now?
A: See here: https://msdn2.microsoft.com/library/aa454884.aspx
Mark Arteaga (Expert):
Q: Since memory mapped files are not natively supported by CF, what is the recommended IPC mechanism between two CF based apps?
A: CHeck out this article on MSDN https://msdn2.microsoft.com/library/aa446556.aspx
Arnie_MVP (Expert):
Q: Is it possible to build CF projects in the context of a platform builder BSP build? (sources and dirs based?).
A: There is a managed code tab for the build settings of a PB project. Other than this I'm sure something can be worked out with an arbitrary command-line. What is your scenario? Are you trying to get rid of the requirement to define include of CF assemblies with .bib, .dat etc. files?
AlexFeinman (Expert):
Q: is it possible to manually set the mail icon on the top bar via CF2.0 or native code via API?
A: That icon belongs to the mail application. You cannot set it, but you can set your own that looks exactly like it
AlexFeinman (Expert):
Q: what api should I look at to set an icon?
A: OpenNETCF SDF has OpenNETCF.Windows.Forms.NotificationIcon class. See the 1.4 source for details
mikefos_msft (Moderator):
Q: Can you recommend CF profilers? I am interested in pre-2.0 and 2.0.
A: It doesn't look like we're going to be able to answer this one today. My best suggestion would be to post this out in the compactframework newsgroup. Hopefully, that'll garner some responses for you. Apologize for any inconvenience.
mikefos_msft (Moderator):
Thank you for joining us today for our MVP-hosted chat concerning Smart Device Programming with Visual Studio .NET. We'll try to wrap up the last couple of questions here.
A sincere thank you to our experts today! Thanks to Paul, Jeff, Alex, Mark and Barry!
We hope that this has been a worthwhile use of your time and we hope to see you again for a future chat!
Top of page