Fastcounter by BcenTral
The most common problem (FAQ) Microsoft .NET streamlined framework is most common. This FAQ content, part from the NET streamlined frame news group (Microsoft.Public.dotNet.framework.CompactFramework) posts and answers questions. The .NET streamlined frame development team thanks to every person participating in the newsgroup, thank you for your active participation in FAQ and contribution to FAQ. To apply to add a FAQ project, please send an email to Netcffaq@microsoft.com.1. Development
1.1. What is Microsoft .NET streamlined frame?
1.2. What tool I need to develop .NET streamlined framework?
1.3. Where can I download the latest tools and related software?
1.4. What equipment does it support?
1.5. What equipment will it support after the framework?
1.6. Why does the debugger have an error that fail to connect to the simulator (when executing the program)?
1.7. What is the difference between .NET framework and .NET streamlining framework?
1.8. What improvements have been improved?
1.9. What is the difference between .NET streamlined frame development and Windows CE .NET? NET CE .NET?
1.10. Where is more about the application of the application on the framework of the framework?
1.11. Where is the documentation of the .NET streamlined frame?
1.12. How to set up the files involved in the device when you debug it?
1.13. How to set the properties of the simulator?
1.14. How to debug .NET streamlined framework application?
1.15. How do I start using the Visual Basic .NET development .NET streamlined program?
1.16. How can I install the .NET streamline frame to the assembly concentration (GAC)?
1.17. How to deal with "Sharing Violation" when the program is released from Visual Studio .NET 2003
1.18. What is a Common Language Runtime (CLR)?
1.19. What is Global Assembly Cache (GAC)?
1.20. What is the memory management in the .NET streamlining framework?
1.21. When my network protocol exceeds 50, why can't I send a release program?
1.22. Why have there be cross-platform code?
1.23. What is these ARM instructions?
1.24. How to write a registry?
1.25. How can I prevent .cab files from being deleted after install?
1.26. How can I DETERMINE THE VERSION OF THE .NET COMPACT FRMEWORK THAT ISTALLED ON A DEVICE?
1.27. How do i copy files to the emulator?
1.28. Why does installization of the point pocketpc 2002 SDK Fail?
1.29. How do I debug a web service consumed by a Smart Device Application?
1.30. What is the footprint of the .NET Compact Framework?
1.31. How do i include IMGDECMP.DLL IN AN Emulator Image?
1.32. How do I Programmatically Replace Assembly Cache (GAC)? 1.33. How can I display Pocket PC Applications On My Desktop or Laptop WITHOUT NEEDING ANY DEDE Configuration?
1.34. How can I Allow ActiveSync To Connect To An Emulator Session from Visual Studio .NET 2003?
1.35. How can I COPY FILES TO THE DEVICE CURRENTLY Connected to Desktop ActiveSync?
1.36. How can I Stress Test User INPUT?
1.37. WHERE CAN I GET A UI VERSION OF THE PLATFORM Builder Target Control WinDow?
1.38. WHERE CAN I GET A Command Shell for Pocket PC 2003 Devices?
1.39. How Can I get Detailed Information About Currently Running Processes?
1.40. How Can I Remotely START AN Application ON A Pocket PC from My Desktop?
1.41. Why can't i load Different Assemblies with the Same Name?
1.42. How Can I Force Visual Studio .NET 2003 To Connect To NEWER VERSIONS OF THE POCKET PC 2003 Emulator?
1.43. Why don't my customer in the Toolbox?
2. Graphics
2.1. How to build a graphic object?
2.2. How to optimize GDI ?
2.3. How do I draw a pattern on the form?
2.4. How do I draw a pattern with transparent color?
2.5. Why will CreateGraphics from TEXTBOX will fail?
2.6. How to get the size of the text on the screen?
2.7. Can I set the width of a pen? 2.8. How do i zoom an image? 2.9. Why can't i load an image?
3. Release
3.1. How to build a PocketPC setup program?
3.2. Which release package can be included in my installer?
3.3. How can I create a installer that does not need the .NET framework?
3.4. How to build a CAB installation file that is not constrained by the PocketPC system?
3.5. Why do different processors have different CAB installation files?
3.6. How do I create a desktop install of the .NET COMPACT FRMEWORK IT INTED DEVICE AND INSTALLS IT IF NECESSARY?
3.7. How do I Deploy a .NET Compact Framework Service Pack To The Emulator?
3.8. How do I include SQL Server CE with My Application Installation? 3.9. How do I use Gapi to create a graphics engine?
4. Graphical User Interface (GUI): Form
4.1. How to build a full screen form?
4.2. When do you use the form of a structure? When do you use the form of the LOAD event?
4.3. How to change the minimization button to the closing button?
4.4. How to build a multi-form system structure on the .NET streamlined framework?
4.5. How to improve the load speed of the .NET thin frame application?
4.6. How to modify the form of the form when running?
4.7. How to scroll the content of the form?
4.8. How to make a floating form? It seems that all forms are always full screen state.
4.9. How to force a form to minimize?
4. I have a smart device form containing a lot of controls, why is "NotSupportedException" error when running?
4.11. Which is correctly closed the form: AppPlication.exit is still form.close?
4.12. Why does showing a MessageBox on Windows Mobile 2003 for Smartphone with the Abort, Retry, and Fail set of buttons or the Yes, No, Cancel set of buttons, or the third button as the default button result in a NotSupportedException?
4.13 How do I get an icon in The Pocket PC START MENU MOST RECENTLY USED (MRU) List?
4.14 How do i center a form on the screen?
4.15 Why Can't i show a form thing haas been closed?
4.16 How can I Enable Multiple Instances of an Application?
5. Graphical User Interface (GUI): Universal
5.1. How to build a button with a graphic or supporting multi-line?
5.2. What is the work of TextBox.acceptsreturn in the .NET streamline?
5.3. When the data is loaded into ComboBox, why is the SELECTEDEXCHANGED event not triggered?
5.4. What is the difference between Show and ShowDialog?
5.5. Why can't I build the right-click menu separator? (Separetor)
5.6. When running imagelist, when the image does not appear?
5.7. How to set the cursor to wait?
5.8. How to display symbols in the menu item: &?
5.9. How to make an animated control based on .NET streamlined framework?
5.10. How to make a custom control on the .NET streamlined framework?
5.11. How to make a button-based button based on the .NET streamlined frame?
5.12. How to use the MessageWindow class library under the .NET streamlined frame?
5.13. How to add rows and columns to DataGrid?
5.14. How to implement the editor of DataGrid?
5.15. How do I set DataGrid DataSource?
5.16. How to sort the column of DataGrid?
5.17. How do you sort the contents of ListView? 5.18. How to use the input board (SIP) control?
5.19. How to customize an event?
5.20. How to do an OWNER-DRAWN LIST BOX?
5.21. How to do a multi-selection box to determine true and false?
5.22. Why is an exception when setting inputpanel.enabled = true?
5.23. Why does the custom control do not automatically inherit the font of the parent class?
5.24. Why does the NumericUpdown and DomainUpdown controls cause ValueChanged and SELECTEMCHANGED events when entering characters?
5.25. Why is the value of the NUMERICUPDOWN control? Isn't the value set?
5.26. Why can't Statusbar can be placed in any location of the form? Be sure to be at the bottom?
5.27. Why is my control to inherit the background color of the parent control?
5.28. Why the NumericUpdown control accepts the value of the Decimal type, but does not display a value greater than 2 ^ 16?
5.29. Why can't you enter text in DomainUpdown, and choose?
5.30. Why is OpenFileDialog to be restricted in the "My Documents" folder?
5.31. How Can I Activate The SIP (InputPanel) WITHOUT A MENU?
5.32. How do i add a limited to every node in a treeview?
5.33. How do I Determine The Number of Rows or columns in a datagrid?
5.34. How do I create A OWNER DRAWN Listbox?
5.35. How can I Implement Control.getnextControl Under The .NET Compact Framework?
5.36. How do i get notified when the user copy??
5.37. How do I set the title of a fullscreen multiline Edit Control WinDow?
5.38. Why Don 'i see the validitem SELECTED WHEN I SET ComboBox.selectedValue to ValidItemincollection?
5.39. How do I detect the location where a 'tap & Hold' Occurred To Bring Up A CONTEXT MENU ON MY CUSTOM Control?
5.40. Why doesn't the scrollbar value EVER GET SET TO THE MAXIMUM VALUE?
5.41. How do I Tab Out of a Custom Control to the PreviOS Control?
5.42. How do i add Toolbar Buttons with Transparench?
6. Work with local code (Native Code)
6.1. How to call the function in the local written DLL?
6.2. How to use dumpbin.exe help to describe P / Invokes?
6.3. How to write unmanaged code for Microsoft .NET streamline?
6.4. How to call P / Invoke GetTickCount? 6.5. How to get how much memory?
6.6. How is the window to remain minimized?
6.7. How to assemble the data type when calling the system function on the Microsoft .NET thin framework?
6.8. How to get a handle (HWND) of a form or control?
6.9. How to use Performance Countries?
6.10. What is the limit on the data type when calling a local code? What Are The Limitations ON Marshalling Types Via P / Invoke?
6.11. When calling getLastError, always get the uncertain code?
6.12. When calling a local code, there is a limit on the number of parameters?
6.13. Why is the "NotSupportedException" exception when calling a local code?
6.14. How to convert BYTE [] into INTPTR?
6.15. Why do i get a MissingMethodeException WHEN i call a Function from a native dll?
6.16. How do i set the system time?
6.17. How do i programatically Soft RESET the Device?
6.18. How Can I Put An Icon on The Title Bar Regardless of The Which Form Is Active?
6.19. How do i disabled and capture hardware button?
6.20. How do i hide the start icon?
6.21. How do I ENUMERATE, CREATE, AND TERMINATE PROCESSS?
6.22. WHERE CAN I FIND A CENTRALIZED LIBRARY OF P / INVOKE SAMPLES?
6.23. How do i play and record .wav audio files with the Waveform Audio Inteface?
7. General
7.1. How to determine the main directory of the application?
7.2. How to calculate the exact time interval?
7.3. How to treat embedded resources as a stream?
7.4. Why get an error in "an unhandled exception of type 'system.net.sockets.socketexception' occurred in system.dll"?
7.5. How to use Performance Monitor?
7.6. How to cancel a program to close?
7.7. How do I call another application in my program?
7.8. What will I establish what thread is established in the .NET streamlined?
7.9. How to convert the BYTE array into structure?
7.10. Can I create a delegate to INVOKE?
7.11. How to use the phone API on the Microsoft .NET thin frame?
7.12. How do I generate the GUID on the Pocket PC?
7.13. How to make my .NET streamlined framework and Pocket Outlook data combination?
7.14. Can I judge the version of a file in the .NET streamlined framework?
7.15. What is related to the background processing of Microsoft .NET streamlined framework?
7.16. What is the skill of using multi-thread on Microsoft .NET thin frame?
7.17. How to use an obfuscator in a smart device application?
7.18. How to encrypt or decrypt data using a password service? 7.19. How do I get the only number of the Windows CE device on Microsoft .NET thin frame?
7.20. How to send a short message on the application of Microsoft .NET thin framework?
7.21. Can you determine the sender of the event without using Control.name?
7.22. How to call the parameters of the method in the thread?
7.23. How to establish a reminder procedure and timing program?
7.24. How to play sound?
7.25. How to use command line parameters?
7.26. Why get an exception when using the method or attribute of the object already released?
7.27. How to get "Enter", "Tab", and "arrow" button event?
7.28. How to delete a read-only file?
7.29. How do i determine if a member exists at runtime?
7.30. How do I Determine The Device Name ProgramAtical?
7.31. How do i build a c # smart device project from the command line?
7.32. How do i abort an executing thread?
7.33. Why Can't i Play A MOVIE ON THE POCKET PC EMULATOR?
7.34. How do I support in the Active Applications List?
7.35. How do i access a control from its instance name?
7.36. How do I Detect The Hardware Directional Pad Buttons?
7.37. How do i get a double CLICK EVENT WHEN ONLY THE CLICK EVENT IS Supported?
7.38. How do i get onenter / onLes Style Notifications?
7.39. How do i use trreading in a Modal Dialog That Doesn't hang my app?
7.40. How do i round floating point number efficiently?
7.41. Why does control.invoke Take SO Long WHEN A MODAL DIALOG IS DISPLAYED?
7.42. Is there a way to retrieve the culture information of an assembly?
8. Communications and Web services
8.1. How to send data to desktop to desktop over TCP Socket?
8.2. Why can't I access the web service on this machine?
8.3. How to call Web services on Microsoft .NET thin framework
8.4. How to submit an HTTP GET application through a proxy server?
8.5. How to use a web service?
8.6. How to get map using mappoint3.0?
8.7. How to get maps and orientations using mappoint3.0?
8.8. Is NTLM Authentication Supported by the .NET Compact Framework?
8.9. WHEN Using Blocking Sockets, Why Does Send Throw An InvalidOperationException When BLOCKING IS set to false? 8.10. How do i create an http-server?
8.11. Why do I get an exception WHEN CALLING SETSOCKETOPTION WITH ReuseAddress set?
8.12. Why do I get a socket error Using SSL TO COMMUNICATE WITH A Server Via THE WebRequest Namespace?
9. SQL CE and data
9.1. What should I pay attention to when using the .NET streamlining framework, SQL Server CE, and replication development applications?
9.2. How to use the merge replication on Microsoft .NET thin framework?
9.3. How to bind ADO.NET data and XML?
9.4. How to build a database of SQL Server CE?
9.5. How to submit a query with parameters to SQL Server CE?
9.6. Why does using rda and the push method fail? Ire 27750?
10. Other information
10.1. Pocket TaskVision Process
10.2. Create a process manager based on Microsoft .NET thin framework
10.3. Develop mobile games using Microsoft .NET streamlining framework
10.4. Making a Microsoft's DateTimePicker Control of a Microsoft .NET
10.5. Write a program that captures the Pocket PC signature
10.6. Is there a website that is not a non-soft website to develop applications on the .NET streamlined framework?
11. Connectivity
11.1. Why is the device deployed from the ActiveSync to the Windows CE device?
11.2. Why can't you debug CEPC or other X86 Windows CE devices via ActiveSync?
11.3. Why is the debugging failure when the toolHelp.dll file on the device is lost?
11.4. Why cannot be released to the device when the number of network protocols exceeds 50?
11.5. After uninstalling ActiveSync, cannot be released to the device via ActiveSync?
11.6. Why do localized machine names or usernames or failures to the device release program?
11.7. Why is the current user who does not belong to the Administrators group?
11.8. Why appears a sharing violation error when publishing to the Pocket PC or the Simulator?
11.9. Why get a security warning message when using the simulator on the .NET Server's computer?
11.10. Why do you have an error message that can't find a file when you start running?
11.11. Why is an occasional error when publishing with an emulator?
11.12. Why did the first time I use the Connect button to connect the simulator and the release process failed?
11.13. Why does the emulator debugger will have an error when the computer does not have a network connection?
11.14. Why not start when the simulator uses a COM port (black screen)?
11.15. Why can't Visual Studio .NET 2003 simulator uses Embedded Visual Tools simulator simultaneously?
11.16. Why can't I pass the TCP connection to the device release program when there is no ActiveSync connection? 11.17. How can I Allow ActiveSync To Connect To An Emulator Session From Visual Studio .NET 2003?
11.18. How can I COPY FILES TO TO DEVICE CURRENTLY Connected to Desktop ActiveSync?
11.19. Why does The Visual Studio Debugger Fail To Connect To an Armv4i Device?
12. SmartPhone
12.1. WHERE CAN I GET THE LATEST Smartphone SDK?
12.2. What are the rules for smartphone menus?
12.3. Why Are The There DISABED CONTROLS in The Toolbox WHEN CREANG A SmartPhone Project?
12.4. Does SMARTPHONE SUPPORT RAM INSTALLS of the .NET Compact Framework?
12.5. How do i set the title of a fullscreen multiline edit control window?
12.6. How Can I Generate SmartPhone CabwizSP XML DOCS from EXISTING POCKET PC CAB FILES?
12.7. How can I send Characters and strings to the smartphone 2003 Emulator Via ActiveSync?
12.8. How do i programatically set the smartphone input mode?
Top of page
1. Development 1.1. What is Microsoft .NET streamlined frame? Microsoft .NET streamlined frame is a platform for intelligent equipment development for smart devices. It is a key to Microsoft's goals: "Provide a wonderful experience for users - any time, any location, any device". The .NET streamlined frame The world of hosted code from the web service from the web service to the smart device, allowing security, downloadable applications on personal digital assistants (PDAs), mobile phones, set-top box devices. http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/overview/default.aspx1.2. What tool I need to develop .NET streamlined framework? Visual Studio .NET 2003 is required to develop .NET streamlined framework in Pocket PC 2000, Pocket PC 2002, and Windows CE.NET 4.1,. Http: //msdn.microsoft .COM / MOBILITY / PRODTECHINFO / DEVTOOLS / VSTUDIO / DEFAULT.ASPX Other Windows mobile platform development packages can be obtained in the following places: Windows Mobile 2003 Pocket PC SDK: http://www.microsoft.com/downloads/details.aspx? FamilyId = 9996b314-0364-4623-9ede-0b5fbb133652 & displaylang = enWindows Mobile 2003 Smartphone SDK: http: //www.microsoft.com/downloads/details.aspx familyid = a6c4f799-ec5c-427c-807c-4c0f96765a81 & displaylang = en this article will? Describe how to develop robust smart device applications under the .NET streamlining framework and Visual Studio .NET 2003. http://msdn.microsoft.com/library/en-us/dnnetcomp/html/netcfgetstarted.asp1.3. Where can you download the latest tools and related software? Visual Studio .NET 2003 Trial Edition can be obtained here: http://msdn.microsoft.com/vstudio/ProductInfo/trial/default.aspx latest .NET streamlined framework and patch set can be obtained here: http: // msdn .microsoft.com / mobility / downloads / default.aspx1.4. What equipment is supported? NET? The .NET thin frame can run on the Pocket PC 2000, PCKET PC 2002, Windows Mobile 2003 Pocket PC and Pocket PC based on Windows CE.NET 4.1 embedded systems. 1.5. What equipment will it support after the framework? The .NET streamlined frame will be integrated into the Microsoft system and become part, including future Pocket PC devices, Pocket PC phones, smartphones, car Windows CE systems, MSTV. The release time of various devices is pending. The .NET thin frame will be part of the Windows CE .NET 4.1 system component, thus allow OEM vendors to integrate the .NET thin framework into the new Windows CE device using PlatformBuilder.
1.6. Why does the debugger have an error that fail to connect to the simulator (when executing the program)? Here's this connection will tell you how to set up debugging and troubleshoot. http://download.microsoft.com/download/c/d/b/cdbff573-73fb-4f9f-a464-c5adc890e1ae/readme.htm1.7. What is the difference between .NET framework and .NET streamlining? The relationship between .NET framework and .NET streamlined frame: http://msdn.microsoft.com/library/en-us/dv_evtuv/html/etconcomparisonSwithNetFramework.asp Online View .NET Difficulties Framework Relationship Tools: http: // MSDN .microsoft.com / library / en-us / dv_spchk / html / net_compact_framework.htm1.8. What is improved? Net thin framework patch? The .NET streamlined frame SP1 fixes many vulnerabilities, view the amendment item list: http://www.microsoft.com/downloads/details.aspx? FamilyId = 1F62A2A3-7282-4BA9-B26B-2267E972501D & DisplayLANG = EN1.9. Poclet PC What is the difference between .NET streamlining frame development and Windows CE .NET? NET streamlining framework development? This article will describe the differences between applications based on .NET streamlining frameworks on Pocket PC and Windows CE.NET platforms. Http://msdn.microsoft.com/library/en-us/dnnetcomp/html/netcfppctocE.asp1.10. Where is more about establishing a .NET streamlined application information? The following resources can teach you how to build .NET streamlined framework applications:
.NET thin frame quick start http://samples.gotdotnet.com/quickstart/compactframework/ .NET streamlined frame white paper MSDN Move and Embedded Development Center: http://msdn.microsoft.com/mobility/understanding/articles/default .ASPX 1.11. Where is the documentation of the streamlined framework? http://msdn.microsoft.com/library/en-us/dv_evtuv/html/etConnetCompactFramework.asp 1.12. How to set the files involved in the device when you debug it? In Visual Studio .NET 2003, right-click the file and select Properties, set the build property to none. The file will no longer be copied. If the file is modified, you need to copy the build property to content. 1.3. How do I set up the simulator's properties? In the Visual Studio .NET 2003 menu, select Tools-> Options. Open the Device Tools folder and select Devices. You should see a dialog box for the list of display devices. Select the device you want to modify, press the Configuration button. Now you You should see a dialog box containing multiple TABs and modify settings, such as setting memory and screen size. 1.4. How to debug the .NET streamlined framework application? Microsoft .NET streamlined framework is fully integrated in Visual Studio .NET 2003, debug the application of the .NET thin framework under Visual Studio .NET 2003 and status of other applications under Visual Studio .NET 2003. Debugging procedures on a separate device and debugging in the simulator requires a different place. See the following article You can get more debugged .NET streamlined framework experience. http://msdn.microsoft.com/library/en-us/dnnetcomp/html/compactfxdebug.asp1.15. How to start using Visual Basic .NET development .NET streamlined framework? Learn how to use Smart Device Extensions (SDE) to write only applications. This article detail the complete process of developing, debuging, publishing on the .NET streamlined frame, and describes the differences developed on the .NET framework. Http://msdn.microsoft.com/library/en-us/dnnetcomp/html/sdeforvb.asp1.16. How can I install the .NET streamline framework to the assembly set (GAC)? Http://msdn.microsoft.com/library/en-us/dncfhowto/html/howtogac.asp1.17. How to deal with "Sharing Violation" when publishing a program from Visual Studio .NET 2003 This article illustrates the cause of a sharing violation that prevents the deployment of your application from Visual Studio .NET 2003, and gives instructions on how to work around it.http: //msdn.microsoft.com/library/en-us/dncfhowto /html/howtosharingviociological.asp1.18. What is a COMMON LANGUAGE RUNTIME (CLR) ?. NET Reduce Framework The running environment is called a CLR, which makes the program run and is easier.
The following article will make you understand more about CLR: http://msdn.microsoft.com/library/en-us/cpguide/html/cpconcommonlanguageruntimeoverview.asp1.19. What is Global Assembly Cache (GAC)? Each The machines of the .NET environment will have a buffer within the range of this machine, which is GAC. The assembly stored in the GAC will be shared by some applications on this computer. This article will tell you more about the GAC information: http://msdn.microsoft.com/library/en-us/cpguide/html/cpconglobalAssemblycache.asp1.20. What is the memory management under the .NET streamline? ? Automatic memory management is a service provided by the CLR. The CLR's garbage collector manages the distribution and recycling of the application memory. The following article will explain to you: http://msdn.microsoft.com/library/en-us/cpguide/html/cpconautomaticMemoryManagement.asp1.21. When I When the number of network protocols exceeds 50, why can't I send a release program? Check out this article "11.4. Why is you not to the device release program when the number of network protocols exceeds 50?" 1.22. Why have there be cross-platform code? The .NET streamlined frame and its execution engine are a .NET framework and CLR subset. Default Strong Name Policy, programs for .NET thin framework can also be run on a complete .NET framework, but there will be some important exception information: .NET streamlined frame assembly and .NET framework unused strong name signature Therefore, CLR can distinguish between them. In the future released .NET framework and CLR binding strategy will be used in instead of compatibility .NET streamlined framework reference. Thus, in normal case, you can reuse the components without reconnection. For example: If your component only references the System and System.Net class libraries of the .NET streamlined frame, it does not need to be reconnected to run under the .NET streamlined framework and complete .NET framework. If you reference the .NET thin frame-specific feature, such as the PocketPC-specific user interface, the program will not be able to run on a complete .NET framework. As the development and release of the intermediate components of the platform, Microsoft believes that rich client applications should use smart devices to bring a better experience. This tasteful graphical user interface is basically unique to the client. Although Microsoft spends a lot of energy to divide different namespaces and assemblies for different equipment and functions to avoid assembly conflicts, there will be compatibility issues that cannot be handled in 1.0. In this case, the functionality of the device is not intended to use the device in the .NET frame will result in an exception at runtime, not an exception when loading. 1.23. What is these ARM instructions? Xscale supports the ARM V5 instruction set, and it is also compatible with the ARM V4 instruction set. There are three situations here:
ARMV4 -> only supports 32-bit ARMV4 instructions armv4t -> 't' represents thumb. Thumb is ARM16-bit command mode ARMV4I -> 'i' represents Interworking. Allow 32-bit and 16-bit instructions to coexist for other ARM processors:
Strongarm (sa1110) -> only supports ARMV4 instructions ARM920T, etc -> support all three cases .NET streamlined frame supports three ARM code
Armv4 for PocketPC 2000 and Pocket PC 2002. Supports all ARM devices, including xscale. The CAB file name published to the device contains "ARM" characters. Armv4 for Windows CE.NET. Supports Windows CE.NET devices compiled by PlatformBuilder using ARMV4 core. Pocket PC 2003 supports this code. The CAB file name published to the device contains "ARMV4" characters. ARMV4T or Armv4i for Windows CE.NET. Supports Windows CE.NET devices compiled by PlatformBuilder using ARMV4T or ARMV4i. The CAB file name published to the device contains "ARMV4T" characters. 1.24. How to write a registry? The remote registry editor including Windows CE is not included in the release of Visual Studio .NET. To modify the registration key value, you can use the following methods:
Microsoft Embedded Visual Tools Remote Registry Editor Microsoft Windows CE Platform Builder Remote Registry Editor PHM Pocket PC Registry Editor (shareware, it is easy to find on the Internet) 1.25. How can I prevent .CAB files from being deleted after installation? Automatic deletion of .CAB files can be prevented by setting the property of the .CAB file (s) to Read Only.1.26. How can I determine the version of the .NET Compact Framework that is installed on a device? Each version of the .NET Compact Framework is released with a different Win32 File Version number (this is a separate version number from the Assembly Version, which should be the same across all releases of the Version 1 .NET Compact Framework, including Service Packs) .In order to see what version is installed , use File Explorer to navigate to the / Windows directory on the device, and click the file called CGACUTIL. you will get a message box showing you the Win32 File Version of the .NET Compact Framework installed on the device.RTM = 1.0.2268.0 SP1 = 1 .0.3111.0SP2 Recall = 1.0.3226.0SP2 Beta = 1.0.3227.0SP2 Final = 1.0.3316.0To determine the version programmatically you can use System.Environment.Version.ToString (). 1.27. How do I copy files to the emulator? One approach would be to create a file share on your development PC, and then connect to share via that File Explorer in the emulator. You may then copy and paste the files from the share to the emulator's local file system. Another approach would be to add the file (s) to a smart device project and set their Build Action (s) property to "Content" See the Visual Studio .NET online documentation for more information on "File Properties":. http: //msdn.microsoft. COM / library / default.asp? URL =
/library/en-us/vbcon/html/vbconfileproperties.asp Step by step instructions for adding a "Content" file to a smart device project: Open or create a smart device project, On the View menu, click Solution Explorer, In Solution Explorer, right-click on your project, point to Add, and click Add Existing Item. Browse to and add the desired file to the project. right-click on the file that you added, in solution explorer, and click Properties, Set the Build Action property to "Content", if it is not already set 1.28 Why does installation of the PocketPC 2002 SDK fail Symptom:..? The Pocket PC 2002 SDK installer hangs while ". registering components" Cause: An unregestered component causes the installation to hang while attempting to run the emulator.Workaround: From a console window prompt:. cd / WINNT / system32regsvr32 atl.dll1.29 How do I debug a Web service consumed by a Smart Device application You need to attach the debugger to the? ASP.NET WORKER Process.refer to the Following Link for more in formation: http: //msdn.microsoft.com/library/default.asp url = / library / en-us / vsdebug / html / vxtskdebugginganaspdeployedwebapplication.asp 1.30 What is the footprint of the .NET Compact Framework .NET Compact?.? Framework Storage Size:
1.55MB (ROM) on Pocket PC 2000/2002 1.35MB (ROM) on Windows Mobile for Pocket PC 2003 or Windows CE .NET Devices Running Ram Requirements:
.5 MB (Depends ON Application) Typical Application Sizes:
5 -. 100 KB 1.31 How do I include imgdecmp.dll in an emulator image You must ask the OEM to include it in the device's image If you are the OEM and you are using Platform Builder 4.2, then including the OS Dependencies for?. the .NET item automatically causes imgdecmp.dll to be part of the emulator image -. if that is not working then refer to cesysgen.bat Another method is to set the environment variable "__SYSGEN_IMGDECMP = 1" to explicitly force the DLL into the image ..................................... .. '
Remove assemblies from the GAC using the -u option Install assemblies to the GAC using the -i option It is typically safest to remove the Assembly before reinstalling it. 1.33. How can I display Pocket PC applications on my desktop or laptop without needing any device side configuration Download the ActiveSync Remote Display from Windows Mobile Developer Power Toys:? http:?. //www.microsoft.com/downloads/details.aspx FamilyId = 74473FD6-1DCC-47AA-AB28-6A2B006EDFE9 & displaylang = en 1.34 How can I allow Activesync to connect to an Emulator session from Visual Studio .NET 2003? See the entry titled "11.17. How can I allow Activesync to connect to an Emulator session from Visual Studio .NET 2003?" of this FAQ. 1.35. How can I copy files to the device currently connected to desktop ActiveSync? See the entry titled "11.18. How can I copy files to the device currently connected to desktop ActiveSync?" of this FAQ. 1.36. How can I stress test user input? Download Hopper from Windows Mobile developer Powe r Toys: http: //www.microsoft.com/downloads/details.aspx FamilyId = 74473FD6-1DCC-47AA-AB28-6A2B006EDFE9 & displaylang = en 1.37 Where can I get a UI version of the Platform Builder Target Control Window Download?.? JShell from Windows Mobile Developer Power Toys: http: //www.microsoft.com/downloads/details.aspx FamilyId = 74473FD6-1DCC-47AA-AB28-6A2B006EDFE9 & displaylang = en 1.38 Where can I get a Command shell for Pocket PC 2003?. devices Download PPC Command Shell from Windows Mobile Developer Power Toys:? http: //www.microsoft.com/downloads/details.aspx FamilyId = 74473FD6-1DCC-47AA-AB28-6A2B006EDFE9 & displaylang =?
. En 1.39 How can I get detailed information about currently running processes Download RAPI Debug from Windows Mobile Developer Power Toys:? Http: //www.microsoft.com/downloads/details.aspx FamilyId = 74473FD6-1DCC-47AA-AB28-? . 6A2B006EDFE9 & displaylang = en 1.40 How can I remotely start an application on a Pocket PC from my desktop Download RAPI Start from Windows Mobile Developer Power Toys:? http: //www.microsoft.com/downloads/details.aspx FamilyId = 74473FD6-? 1DCC-47AA-AB28-6A2B006EDFE9 & displaylang = en 1.41. Why can not I load different assemblies with the same name? This is by design. You must either change the names of the DLLs, or if the DLLs are strong named, place them in .. the GAC and use Assembly.Load with a full strong name 1.42 How can I force Visual Studio .NET 2003 to connect to newer versions of the Pocket PC 2003 emulator Download the Emulator ActiveSync Connection Tool from Windows Mobile Developer Power Toys:? http : //www.microsoft.com/downloads/details.aspx? FamilyId = 74473FD6-1DCC-47AA-AB2 8-6A2B006EDFE9 & displaylang = en This allows ActiveSync to connect to your Emulator session from Visual Studio .NET 2003. Create an ActiveSync session to the 4.2 emulator, this will allow Visual Studio 2003 to consider it a real device (Choose PPC device as the deployment target ..?) 1.43 Why do not my custom controls show up properly in the toolbox While adding designer support in Visual Studio .NET 2003 for Smart Device custom controls, you may run into the following issues: Unable to associate an Icon to the Control For Showing It in The Toolbox At Design Time The Component, When Added To The Toolbox, Becomes Greyed Out Causes
Using a design project separate from the control project. Visual Studio .NET automatically prepends the project default namespace to the bitmap name. The "default namespace" defaults to the project name. This may be a problem because the design project has a slightly different name . than the runtime project Not setting the correct ToolBoxItemFilterAttribute values ResolutionsGiven the following example: Runtime VS.NET Project: MyProjectClass name: MyProject.MyClassDesign VS.NET Project name: MyProject.DesignBitMap name in VS.NET Design Project: Foo.bmpBitmap name in design assembly: MyProject.Design.MyClass.bmp-- This creates a problem because the bitmap needs the name: MyProject.MyClass.bmp In the above example, setting the design project's default namespace to "MyProject" rather then "MyProject.Design" SHOULD FIX The Problem. The Easiest Way to Check The Assembly Is To Run ILDASM AND Open The Manifest. The Embedded Resources Are listed at the end of the m . Anifest If you create a custom component derived from the Component class, your code must include the following statements so that your component appears in the Toolbox: ToolBoxItemFilterAttribute ( "NETCF", ToolBoxItemFilterType.Require) ToolBoxItemFilterAttribute ( "System.CF.Windows.Forms "ToolboxItemfiltertype.custom)
Top of page
2. Draw 2.1. How to build a graphic object? There are many ways to build a graphic object, see how you use: In OnPain, use the painteventargs parameter provided by the Object parameter: // C #
Protected Override Void Onpaint (Painteventargs E)
{
E.Graphics.drawline (...);
}
'VB
Protected Overrides Sub onpaint (Byval E As PainteventArgs)
E.Graphics.drawline (...)
End sub 'onpaint
Other parts of the program, using a method of the control can be used to establish a graphic object for any control: // c # using system.drawing;
Graphics g = this.creategraphics ();
'VB
Imports system.drawing
DIM G as graphics = me.creategraphics ()
Draw directly to Bitmap bitmap file: // c #
Using system.drawing;
Bitmap BM = New Bitmap (10, 10);
Graphics g = graphics.FromImage (bm);
'VB
Imports system.drawing
DIM BM AS New Bitmap (10, 10)
Dimg as graphics = graphics.fromImage (bm)
2.2. How to optimize GDI ? The following encoding methods help to improve the drawing speed using Graphics:
Only a graphic object is created (or only PainTeventArgs in OnPaint). Painting all drawings first painted on the non-displayed bitmap, then display the bitmap once again. Some image of a change in change. Picture of the same size image as much as possible in the same area. Main ideas: Minimize land heavy picture. For example, when the cursor is dragging the image, it is not necessary to reagent the entire map. It only needs to redraw the place before the cursor. 2.3. How do I draw a pattern on the form? Here is an example, tell you how to draw pictures on the form of the form: http://samples.gotdotnet.com/quickstart/compactframework/doc/bkgnimage.aspx2.4. How do you draw a pattern with transparent color? Draw an image with transparent colored colored colors, you need to set the transparent color of the ImageAttributes object. Currently .NET streamlined frame supports transparent colors of single colors. Although the SetColorKey function can set color range, the maximum and minimum value of the color must be the same, otherwise argumentException error: // c #
Using system.drawing.image;
ImageAttributes attr = new imageAttributes ();
'VB
Imports system.drawing.Image
DIM Attr as new imageAttributes ()
The following code describes how to set transparent colors based on the color of the upper left corner of the image. // C #
Attr.SetColorKey (bmp.getpixel (0, 0), bmp.getpixel (0,0));
'VB
Attr.SetColorKey (bmp.getpixel (0), bmp.getpixel (0, 0))
The following methods can set the color: // C #
Attr.SetColorKey (Color.Fromargb (255, 0, 255), Color.Fromargb (255, 0, 255));
Attr.SetColorKey (Color.Fuchsia, Color.Fuchsia);
'VB
Attr.SetcolorKey (Color.Fromargb (255, 0, 255), Color.Fromargb (255, 0, 255))
Attr.SetColorKey (Color.Fuchsia, Color.Fuchsia)
The image will be overloaded Graphics.DrawImage method to scribble, and use ImageAttributes object as a parameter parameter: // C #
g.drawimage (bmp, 0, 0, bmp.width, bmp.height, graphicsunit.pixel, attr); 'VB
G.drawImage (BMP, 0, 0, Bmp.Width, Bmp.height, GraphicsUnit.Pixel, Attr)
2.5. Why will CreateGraphics from TEXTBOX will fail? Only the FORM class supports Control.createGraphics (). 2.6. How to get the size of the text on the screen? Use the MeasureString method of Graphics. The following code explains how to draw a box around the text: // C #
Using system.drawing;
Protected Override Void Onpaint (Painteventargs E)
{
String s = "Hello World"
Pen Pen = New Pen (Color.fuchsia);
Font Font = New Font ("Arial", 18, FontStyle.Regular;
Brush brush = new solidbrush (color.black);
Sizef SSIZE = E.Graphics.MeasureString (S, FONT);
Rectangle R = New Rectangle (9, 199, (int) SSIZE.WIDTH 1, (int) SSIZE.HEIGHT 1);
E.Graphics.drawRectangle (Pen, R);
E.Graphics.drawstring (S, Font, Brush, 10.0F, 200.0F);
Base.onpaint (e);
}
'VB
Imports system.drawing
Protected Overrides Sub onpaint (e as painteventargs)
DIM S as string = "Hello World"
Dim Pen As New Pen (Color.Fuchsia)
Dim Font AS New Font ("Arial", 18, FontStyle.Regular
DIM brush = new solidbrush (color.ble)
DIM SSIZE AS SIZEF = E.Graphics.MeasureString (S, FONT)
DIM R AS New Rectangle (9, 199, Fix (SSIZE.WIDTH) 1, FIX (SSIZE.HEIGHT) 1)
E.Graphics.drawRectangle (Pen, R)
E.Graphics.drawstring (s, font, brush, 10f, 200f)
Mybase.onpaint (e)
End sub 'onpaint
2.7. Can I set the width of a pen? Setting the pen width is not available in the .NET Compact Framework. Some Alternate Solutions Include:
Drawing filled rectangles with the Graphics.FillRectangle method Drawing multiple lines next to each other Writing a custom graphics routine GAPI 2.8. How do I zoom an image? While there is no inherent support for zooming or stretching a single image, these effects can be with achieved quite easily by creating a new Bitmap object with an associated Graphics object and copying the desired portion of the original Bitmap into it. The following sample creates two bitmaps of the same size, where the second contains a zoomed center section of the first, provided the project has an embedded resource named MyImage.bmp This same technique could be used to stretch images by modifying the source and destination rectangles such that they do not maintain their original aspect ratio // C # using System.Drawing..;
Using system.reflection;
Bitmap m_bmporiginal;
Bitmap m_Bmpzoom;
Private Void Form1_Load (Object Sender, System.EventArgs E)
{
AskEMBLY ASM = askEMBLY.GETEXECUTISSEMBLY ();
M_BMPORIGINAL = New Bitmap (asm.getmanifestResourceStream (asm.getname (). Name
".Myimage.bmp"))));
// Take The Center Quarter of M_BMPORIGINAL
// and create steetch it to m_bmpzoom of the same size
M_BmpZoom = New Bitmap (m_bmporiginal.width, m_bmporiginal.height);
Graphics gzoom = graphics.fromimage (m_bmpzoom);
Rectangle SrcRect = New Rectangle (m_bmporiginal.width / 4, m_bmporiginal.height / 4,
m_bmporiginal.width / 2, m_bmporiginal.height / 2);
Rectangle DSTRECT = New Rectangle (0, 0, M_BMPZOOM.WIDTH, M_BMPZOOM.HEIGHT);
Gzoom.drawImage (M_BMPORIGINAL, DSTRECT, SRCRECT, GraphicsUnit.pixel);
}
Protected Override Void Onpaint (Painteventargs E)
{
E.Graphics.drawImage (m_bmporiginal, 0, 0);
E.Graphics.drawImage (M_Bmpzoom, 125, 0); Base.onpaint (e);
}
'VB
Imports system.drawing
Imports system.reflection
Private M_BMPORIGINAL AS Bitmap
Private M_BmpZoom as Bitmap
Private Sub Form1_Load (Byval E AS ISTEM.EventArgs) Handles MyBase.LOAD
DIM ASM AS [Assembly] = [assembly] .getexecutingassembly ()
M_BMPORIGINAL = New Bitmap (asm.getmanifestResourceStream ((asm.getname (). Name_
".Myimage.bmp")))))))))))
'Take the center quarter of m_bmporiginal
'and create steetch it to m_bmpzoom of the Same size
m_bmpzoom = new bitmap (m_bmporiginal.width, m_bmporiginal.height)
Dim gzoom as graphics = graphics.fromimage (m_bmpzoom)
DIM SRCRECT AS New Rectangle (M_Bmporiginal.width / 4, M_Bmporiginal.height / 4, _
m_bmporiginal.width / 2, m_bmporiginal.Height / 2)
DIM DSTRECT AS New Rectangle (0, 0, M_BMPZOOM.WIDTH, M_BMPZOOM.HEIGHT)
Gzoom.drawImage (M_BMPORIGINAL, DSTRECT, SRCRECT, GraphicsUnit.pixel)
End Sub 'Form1_Load
Protected Overrides Sub onpaint (Byval E As PainteventArgs)
E.Graphics.drawImage (m_bmporiginal, 0, 0)
E.Graphics.drawImage (m_bmpzoom, 125, 0)
Mybase.onpaint (e)
End sub 'onpaint
2.9. Why can not I load an image? Ensure that imgdecmp.dll is in the device's Windows directory.For more information, see the topic "1.31. How do include imgdemp.dll in an emulator image?" Of this FAQ. Top Of page
3. Publish 3.1. How to build a PocketPC setup program? This article tells you how to create a separate .msi file, run and install the app on a different Pocket PC device. The entire process is automatic, so it is easy to pack all the needs of the components into the .msi file. Contains C # and Microsoft Visual Basic .NET code. http://msdn.microsoft.com/library/en-us/dnnetcomp/html/netcfDeployment.asp3.2. Which release package can be included in my installer? You can provide a final release package for your users to help them upgrade your device. You can't disassemble this release package to give your content. However, you can disassemble the developer's release package to give your user. 3.3. How can I create a installer that does not need the .NET framework? This article discusses how to successfully install a Pocket PC application: http://msdn.microsoft.com/library/default.asp? URL = / library / en-us / dnppc2k / html / ppc_allation.asp3.4. How to build a CAB installation file that is not constrained by the PocketPC system? You can create a .inf file to generate an application installation file that is suitable for any Pocket PC. View Sample: http://samples.gotdotnet.com/quickstart/compactframework/doc/cabfile.aspx3.5. Why do different processors have different CAB installation files? Each CAB file contains a small segment that detects the .NET streamlining frame version of the code. This feature is that the processor / platform is unique, and different CAB files are bound to different codes based on the processor type.
3.6. How do I create a desktop installer that detects the presence of the .NET Compact Framework on the target device and installs it if necessary? The article titled "Creating an MSI Package that Detects and Updates the .NET Compact Framework" in the MSDN Library describes a technique that may be used: http: //msdn.microsoft.com/mobility/understanding/articles/default.aspx pull = / library / en-us / dnnetcomp / html / netcfdepl.asp 3.7 How do I?. ? deploy a .NET Compact Framework Service Pack to the emulator download and install to your desktop development PC a "Developer" version of the service pack (the download title will read something like: "Microsoft® .NET Compact Framework 1.0 SPx Developer Redistributable" ) from: http:. //msdn.microsoft.com/mobility/downloads/updates/default.aspx The next step is to copy the appropriate .NET Compact Framework cab file (as per next paragraph) to the emulator from within the emulator Point File Explorer to a Share on your pc and then and paste the cab t Omewhere on The Emulator's File System. Now Launch The Cab File from File Explorer and answer "YES" if asked to overwrite annice.
Emulator CAB FilePocket PC 2002netcf.core.ppc3.x86.cabWindows Mobile 2003 for Pocket PCnetcf.core.wce4.x86.cabWindows Mobile 2003 for SmartphoneRAM installs not supported3.8. How do I include SQL Server CE with my application installation? To install SQL Server CE with an application, simply install the proper SQL Server CE CAB files as part of the application's installation. There are two sets of cabs associated with SQL Server CE.The developer CAB includes Query Analyzer, and error strings. This CAB should not be included with application deployment It comes in two actual files, one for Pocket PC and one for Windows CE 4.x devices:... sqlce.dev.ppc3
.cabAll of these CABs are included in the Visual Studio .NET 2003 Professional Edtion install The default location is:.. / Program Files / Microsoft Visual Studio .NET 2003 / CompactFrameworkSDK / v1.0.5000 / Windows CE / ... 3.9 How do I use GAPI to create a graphics engine? This article describes how to create a DLL that wraps GAPI (Game API), such that it is .NET Compact Framework compliant, and use it to create and optimize a basic graphics library in managed code. http://msdn.microsoft.com/library/en-us/dnnetcomp/html/WrapGAPI1.asp This article expands upon the "Dancing Rectangles" sample by implementing loading and displaying of bitmaps. It also implements some more advanced features such as animated bitmaps, source and destination key transparency, and alpha blending, ie, translucency.http: //msdn.microsoft.com/library/en-us/dnnetcomp/html/WrapGAPI2.asp This article expands upon the "Dancing Zombies" sample By Implementing Drawing of Points, Lines, And Custom 1 Bit Fonts Converted from 8 Bit bitmaps It also implements an input system that overrides the functionality of the hardware buttons and tracks button states.http:.. //msdn.microsoft.com/library/en-us/dnnetcomp/html/WrapGAPI3.asp Top of Page4 graphical user Interface (GUI): Form 4.1. How to build a full screen form? You must set the WindowsTate property to maximize. Be a visible form, if you put a full-screen picture in the form, you need to set the FormBordersTyle to None, turn off the ControlBox to remove all the menus in the form. // C #
this.WindowState = formwindowstate.maximized;
This.FormBorderstyle = formborderstyle.none;
THIS.CONTROLBOX = FALSE;
THIS.MENU = NULL;
'VB
Me.WindowState = FormWindowState.maximized
Me.FormBorderstyle = FormBorderstyle.none
Me.ControlBox = false
Me.Menu = Nothing
4.2. When do you use the form of a structure? When do you use the form of the LOAD event? The LOAD function of the form is the best way to do interface operations. Typical and secure practices are examples of instances of data and controls in the constructor. Any control or form of a control or form containing the user interface should be completed in the LOAD function. For example, the establishment of the control object is completed in the form's constructor, and then set the position of the control in the LOAD function, etc. is a safe practice. 4.3. How to change the minimization button to the closing button? By developing the environmental designer, the automatic minimization mode of the form is converted into a closed mode, or by becoming implemented. (x) Button automatically minimize the application, (OK) button back to close the program. The style of transforming the form in the designer opens the Form Designer of the Visual Studio environment to view the properties. Right-click on the form and select Properties, set the minimizebox to false on the Window style section. The transition form is simple in the code to add the following line of LOAD function: //c#This.minimizeBox = false;
'VB
Me.minimizeBox = false
4.4. How to build a multi-form system structure on the .NET streamlined framework? This article discusses how to create a user interface for the application on the .NET streamlined frame: http://msdn.microsoft.com/library/en-us/dnnetComp/html/netcfuiframework.asp4.5. How to improve. NET thin frame application load speed? By the optimization skills in the following article, reduce the time of the .NET thin frame application: http://msdn.microsoft.com/library/en-us/dnnetComp/html/netcfimproveformloadperf.asp4.6. How to modify the runtime Form style? This quick start tutorial describes how to change the form interface in the Pocket PC application: http://samples.gotdotnet.com/quickstart/compactframework/doc/ppcformproperties.aspx4.7. How to scroll the content of the form? This rapid entry tutorial demonstrates how to use the portrait and horizontal scroll bars to draw an image in the form: http://samples.gotdotnet.com/quickstart/compactframework/doc/scrolling.aspx4.8. How to make A floating form? It seems that all forms are always full screen state. The top of the boundary is always full screen, cannot move or change the size. No boundary or subform can move and change the size. Use: form.borderstyle = BorderStyle.none; // Set there or boundless 4.9. How to force a form to minimize? Please check this question "6.6. How is the window kept minimizing?" 4. I have a smart device form containing a lot of controls, why is "NotSupportedException" error when running? If you contain a lot of controls in your form, you may have a NotSupportedException error when you run. If you are running in Debug mode, you will find an exception that is from the form of the InitializationComponent section. This is due to the method of streamlined the frame CLR in the compiled class, there will be 64KB restrictions. This means that the Return of the machine code cannot exceed 64KB when the CLR translated the method (eg, initializeComponent into an intermediate language. If it exceeds 64kb, NotsupportedException will be thrown. This is also why it is easy to cause errors under Debug mode (F5), not DEBUG mode (Ctrl F5) is not easy. More capacity debug code is generated because the debug mode is run. In addition to the simulator, you may also encounter this error on your smart device because instant compiled code is different from the CPU type (eg, the PocketPC is using the ARM instruction, and the X86 instruction used on the simulator is not an accurate Digital description, how many controls can be included in a form in a form. Because the amount of code produced by different controls is different. For example, a Button control is less than the code generated by the TabControl control. It will also vary from how much properties set. Contains a collection of controls, like ListBox or TreeView, if a lot of values are filled in the properties box in the design, it will generate a large number of code. Similarly, the localized form (localizable property is true), which will generate more code than the Localize form is not set. Because Localize needs to read the attribute value from the resource file, place it in the InitializationComponent method.
If you encounter this, there are some techniques to help you avoid it: divide the code of a form into multiple forms. The form of too much control will affect the performance of the program started. To divide the user interface into two or more forms as much as possible. Do not fill up in design, internal, with collection controls. If you add a lot of nodes to the TreeView control, you will add a large number of code in the InitializationComponent method. Move as much as possible to the collected code to the Form.Load event. The disadvantage of this is that editing these collections to be designed will become incapable, but it helps to split the code. Don't add your code to the InitializationComponent method, this is useful for usual coding, not recommended, modify the code generated. This will cause an unknown error that the designer is unknown. If you want to add your own boot code, you should do it in the form.load event. Similar controls are initialized at runtime. For example, there are 12 Button controls, just different text and location, you should consider using loops to set properties instead of setting properties when designing. At the time, if you write a code to implement it, don't put the code in the InitializationComponent method. The disadvantage of editing the InitializationComponent method is that the code for establishing an object instance outside the initializationComponent code will not be designed in the design device. Similarly, if you manually modify the code in InitializeComponent, you will find that the designer may no longer identify the code you modified. So the premise of the above tips is not to modify the code in InitializationComponent. 4.11. Which is correctly closed the form: AppPlication.exit is still form.close? Application.exit is a hard to exit similar to PostquitMessage () similar to the Win32 platform. Receive all the pop-up information, release the call stack to return the execution right to the system. The method of correctly shutting down the application under Windows Platform (Win32 or .NET) is to close the main form (such as: form.close). The form that still exists when all the main forms ends need to be manually shut down. ANY WINDOW THATE'S STILL PRESENT AFTER The Main Message Pump Ends Needs To Be Manually Closed. Turns close all forms before the application call form.close or form.dispose exits. Need to remember that OnClosing () is the hosted version of WM_CLOSE under Win32 platform, not WM_DESTROY. In addition, using form.close (), your program can process the release resource, turn off files, etc. in onclosing or onclosed events. If you use Application.exit to exit, these events will not be triggered.
4.12. Why does showing a MessageBox on Windows Mobile 2003 for Smartphone with the Abort, Retry, and Fail set of buttons or the Yes, No, Cancel set of buttons, or the third button as the default button result in a NotSupportedException? Windows Mobile 2003 for Smartphone only supports 1 2 button MessageBoxes or. 4.13 How do I get an icon in the Pocket PC Start Menu Most Recently Used (MRU) List? Create a shortcut to your application somewhere under / windows / start menu / programs. When your application is launched from this shortcut an icon for your applications will appear the MRU list. 4.14 How do I center a Form on the screen? In order to display a non-full screen Form, ensure that the Form's FormBorderStyle property is set to FormBorderStyle. None. To center the form add formload at handler: set formborderstyle = screen.primaryScreen.bounds;
This.Location = New Point (Screen.width - this.width) / 2,
Screen.height - this.Height) / 2);
'VB
Dim Thescreen As Rectangle
THESCREEN = Screen.PrimaryScreen.bounds ()
Me.Location = New Point (4creen.width - me.width) / 2, _
(Thescreen.height - me.height) / 2)
4.15 Why can not I show a Form that has been closed? Once a Form is closed, it is disposed and therefore may be garbage collected by the system so it is not safe to attempt to show a closed Form. An alternative solution is to use Form.Hide and Form.Show to hide and display Forms respectively.4.16 How can I enable multiple instances of an application? Multi-instancing is not supported by the .NET Compact Framework. The following code sample provides a solution that allows applications to be instanced rather than maximized when an application is launched but a running instance already exists.Note: The following code is not supported and is not guaranteed to work on all versions of the OS, including future versions // C # using System.Runtime. .Interopservices;
Using system.reflection;
Private Void Form1_Load (Object Sender, System.EventArgs E)
{
THIS.TEXT = String.Format ("form {0}", new random (). Next ());
}
[DLLIMPORT ("Coredll")]]]]]
Public Static Extern INTPTR FINDWINDOW (String LpWindown);
[DLLIMPORT ("Coredll")]]]]]
Public Static Extern int setWindowText (INTPTR HWND, STRING LPSTRING);
Protected Override Void OnResize (Eventargs E)
{
AskEMBLY ASM = System.Reflection.Assembly.GetexecutingAssembly ();
INTPTR HWND = FINDWINDOW ("# Netcf_AGL_PARK_",
asm.getmodules () [0] .fullyqualifiedname);
IF (hwnd! = INTPTR.ZERO)
SetwindowText (hwnd, "# 42");
Base.onResize (e);
}
'VB
Imports system.Runtime.InteropServices
Imports system.reflection
Private Sub Form1_Load (Byval Sender As Object, _
BYVAL E as system.eventargs) Handles mybase.load
Me.Text = String.Format ("form {0}", new random (). Next ())
End Sub 'Form1_Load
BYVAL LPWINDOWNAME AS STRING) AS INTPTR
END FUNCTION
Public Shared Function SetWindowText (Byval Hwnd As INTPTR, _
Byval lpstring as string) AS Integer
END FUNCTION
Protected Overrides Sub onResize (Byval E as Eventargs)
DIM ASM AS [Assembly] = system.reflection.Assembly.GetexecutingAssembly ()
DIM HWND As INTPTR = FINDWINDOW ("# Netcf_AGL_PARK_", _
ask.getModules () (0) .fullyqualifiedName)
IF hwnd.toint32 () <> INTPTR.ZERO.TOINT32 () THEN
SetwindowText (hwnd, "# 42")
END IF
Mybase.onResize (e)
End Sub 'OnResize
Top of page
5. Graphical User Interface (GUI): Universal 5.1. How do I create a button with graphics or support? Create a button with a graphic or supporting multiple lines that need to use a custom control. Custom control can inherit the Button's Paint method, as well as any other custom data. Refer to the following connections to get more information about custom controls: http://msdn.microsoft.com/library/en-us/dnnetcomp/html/customctrlsCompactFx.asp Quick Start Tutorial tells you how to build a button with an image: http : //samples.gotdotnet.com/quickstart/compactframework/doc/PictureButton.aspx5.2. What is working in the .NETBOX.ACCEPTSRETURN? Although acceptsreturn is set to False, it still operates in a TRUE. You can write a class that inherits the TextBox, which implements the process of ENTER in the KeyPress event. 5.3. When the data is loaded into ComboBox, why is the SELECTEDEXCHANGED event not triggered? This is a question that already knows, will be released in the later .NET streamlining framework. 5.4. What is the difference between Show and ShowDialog? ShowDialog will display a form in a mode mode, which is an exclusive call to know that the form shutdown will return. This method will return a DialogResult enumeration, indicating the critical condition. Show is a non-exclusive call mode, like a control, can return immediately, no return parameters. Displaying a control means that the Visible property is set to True until the Hide method is called, the visible method will change to false. 5.5. Why can't I build the right-click menu separator? (SEPARATOR) This is a known bug that sets the right-click menu to the split line and throws a NotSupportedException error. This problem is because the WinCe system has a restriction, and does not allow menu items that have already been added to the right-click menu to a separator, and the parent class of the menu is a control. In Visual Studio 2003, the designer segmentation mobile application code is similar to the application on the PC. This is the reason for this problem. The method of solving is where the right key menu is placed outside the INITILIZECOMPONENT method. 5.6. When running imagelist, when the image does not appear? You can assign ImageList to Toolbar when the form is loaded, but reapply the order of the image on Toolbar. The image order set to set the Toolbar button before setting the imagelist of Toolbar is not supported. 5.7. How to set the cursor to wait? This code can set the cursor to wait for the cursor: //c#cursor.current = Cursors.Waitcursor;
'VB
Cursor.current = Cursors.Waitcursor
This code can set the cursor to default: // C #
Cursor.current = CURSORS.DEFAULT;
'VB
Cursor.current = Cursors.default
5.8. How to display symbols in the menu item: &? This feature is not supported by the .NET streamlined framework. Use "&&" not displaying "&" symbols in the text of the menu item. 5.9. How to make an animated control based on .NET streamlined framework? This article will tell you how to make an animation control based on the .NET streamlined frame: http://msdn.microsoft.com/library/en-us/dnnetcomp/html/animationControl.asp5.10. How to streamline the frame in .NET What is the custom control? Learn to make .NET streamlined frame controls to improve your skills. (The article comes with a custom control sample code): http://msdn.microsoft.com/library/en-us/dnnetcomp/html/customctrlsCompactFx.asp5.11. How to make a .NET streamlined button with a picture button ? This article discusses a button with pictures based on .NET streamlined frame: http://msdn.microsoft.com/library/en-us/dnnetcomp/html/imagebutton.asp5.12. How to use .NET streamlined framework MessageWindow class library? Learn how to use the .NET streamlined frame MessageWindow class to create a prompt icon: http://msdn.microsoft.com/library/en-us/dnnetcomp/html/MessageWindow.asp This quick start is implemented, when the mouse click rectangular customization When the control or click on the Panel control, use MessageWindow to send the message to the send form: http://samples.gotdotnet.com/quickstart/compactframework/doc/messageWindow.aspx 5.13. How to add rows and columns to DataGrid? This quick start tutorial explains how to add or delete rows to the DataGrid control at runtime, column: http://samples.gotdotnet.com/quickstart/compactframework/doc/DataGridadding.aspx5.14. How to implement DataGrid editing? The DataGrid control in the .NET streamlined frame provides all the features of the DataGrid control in the .NET framework. A main difference is that the DataGrid in the .NET streamlined framework cannot edit the unit at runtime. This rapid entry tutorial demonstrates how to implement a method of editing cells through program: http://samples.gotdotnet.com/quickstart/compactframework/doc/DataGriditing.ASPX5.15. How to set DataGrid's DataSource? Another difference between the DataGrid of the .NET frame is that the .NET thin frame DataGrid does not support setting DataSource to DataSet. http://samples.gotdotnet.com/quickstart/compactframework/doc/dataGrid.aspx5.16. How to sort the column of DataGrid? Another difference from the DataGrid of the .NET frame is that the .NET streamlined DataGrid does not support sorting in the runtime. http://samples.gotdotnet.com/quickstart/compactframework/doc/dataGridsorting.aspx5.17. How to sort the contents in ListView? The .NET streamlined frame does not support a ListView.Sort method, but it can be sorted.
This quick start tutorial defines a method of inheriting the iComparable interface of ArrayList.Sort: http://samples.gotdotnet.com/quickstart/compactframework/doc/listviewsort.aspx5.18. How to use the input board control? This quick start tutorial demonstrates the soft input board (SIP) on the PocketPC, and when the SIP is displayed, the TAB control size follows the change: http://samples.gotdotNet.com/quickstart/compactframework/doc/inputpanel .ASPX multiple forms should share a input board object. You can create a SIP form that can be used in the main form or the method of exposing the SIP object first by establishing some of the SIP objects in the main form or exposing the SIP object. 5.19. How to customize an event? This rapid entry tutorial describes how to inherit the Button class, and the overload method is described in the event. This custom event is triggered when the button is double-clicked, and the interval between the two clicks is the value of the systemInformation.doubleClicktime property, in milliseconds. Http://samples.gotdotnet.com/quickstart/compactframework/doc/btndclick.aspx.net The control of the framework does not support the OnNTER and ONLEVE methods, including Windows.Forms.Control base classes. However, because of the support of the Control.onMouseMove method, you can judge when you enter and leave the control with it and the control.capture property. http://samples.gotdotnet.com/quickstart/compactframework/doc/enterleave.aspx5.20. How to make an Owner Drawn List Box of a .NET streamlined framework. The ListBox or other control of the .NET streamlined frame does not support DrawMode, DrawItem, or other Drawing methods, but you can program implementation. This quick start tutorial provides a custom control class to create an Owner-Drawn List Box, and implement the function of the selection font. http://samples.gotdotnet.com/quickstart/compactframework/doc/ownerdrawnlistbox.aspx5.21. How to make a multi-selection box to determine true and false? This quick start tutorial provides a true / false multi-selection box on Windows.Forms.Checkbox control: http://samples.gotdotnet.com/quickstart/compactframework/doc/tfcheckbox.aspx5.22. Setting InputPanel.Enabled = Why is TRUE? The InputPanel component requires a form that contains the MainMenu control, and that form is displayed on the screen. 5.23. Why does the custom control do not automatically inherit the font of the parent class? This feature is not supported by the .NET streamlined framework. 5.24. Why does the NumericUpdown and DomainUpdown controls cause ValueChanged and SELECTEMCHANGED events when entering characters? Change the value of the control or press it in your code, the down arrow will trigger the ValueChanged and SelectedItemChanged events. When the user enters characters to the control, it will not trigger. 5.25. Why is the value of the NUMERICUPDOWN control? Isn't the value set? When you press, the value that appears in the next, is not a factor of the growth value, which will go to that direction (upper or lower) until the value of the next growth value.
5.26. Why can't Statusbar can be placed in any location of the form? Be sure to be at the bottom? The STATUSBAR control can only stop at the bottom of the form, and its size cannot be changed. 5.27. Why is my control to inherit the background color of the parent control? This feature is not supported by the .NET streamlined framework. The method you can take is to inherit an onparentChanged method manually set color: // C # protected override void onparentChanged (Eventargs E)
{
Base.onparentChanged (e);
THIS.BACKCOLOR = Parent.backcolor;
}
'VB
Protected Overrides Sub onparentChanged (Byval E As EventArgs)
Mybase.onparentchanged (e)
Me.backcolor = parent.backcolor
End sub 'onparentchanged
5.28. Why the NumericUpdown control accepts the value of the Decimal type, but does not display a value greater than 2 ^ 16? Although the NumericUpdown control accepts the value of the Decimal type, the .NET streamlined framework is handled by the value of this control as an int type. Such as 10.23 as 10. Similarly, this control does not accept 16-bit integer greater than the symbol on the PocketPC. 5.29. Why can't you enter text in DomainUpdown, and choose? The DomainUpdown control does not confirm the input text (not an complete .NET framework). If you first enter some text, press, down the arrow, which will display the next value of the value before the content changes. 5.30. Why is OpenFileDialog to be restricted in the "My Documents" folder? The initial directory of OpenFileDialog is restricted in the "My Documents" folder or its subfolder. This limit is picked by the PocketPC system, in order to help users manage their own documents in the standard directory. 5.31. How Can I Activate The SIP (InputPanel) WITHOUT A MENU? The Sip Can Be ActiVated by P / Invoking The Function "Sipshowim" As Follows. // C #
Using system.Runtime.InteropServices;
Const uint SIPF_OFF = 0x0;
Const uint SIPF_ON = 0x1;
[DLLIMPORT ("Coredll.dll")]]]]]
Private Extern Static Void SipShowim (uint dwflag);
'VB
Imports system.Runtime.InteropServices
Const Sipf_off as integer = & h0
Const SIPF_ON AS INTEGER = & H1
Private Shared Function SipShowim (Byval dwflag as integer) AS Integer
END FUNCTION
5.32. How do I add a subnode to every node in a TreeView? Adding subnodes to all nodes is accomplished by iterating through all of the nodes in the TreeView and adding a new node to each.//C#foreach (TreeNode node in treeView1 .Nodes)
{
Node.Nodes.Add (New Treenode ("Subnode");
}
'VB
Dim Node as Treenode
For Each Node in TreeView1.nodes
Node.Nodes.Add (New Treenode ("Subnode"))
Next node
5.33. How do i determine the number of rows or columns in a datagrid? The number of rows and columns in a DataGrid can be determined from the data source itself. For example: // c #
DataSet DS = New Dataset ();
INT NUMROWS = DS.TABLES [0]. ROWS.COUNT;
INT Numcols = ds.tables [0] .columns.count;
'VB
DIM DS AS New DataSet ()
DIM Numrows as integer = ds.tables (0) .rows.count
DIM Numcols as integer = ds.tables (0) .COLUMns.count
If the DataGrid is bound to the DataView you can also use DataView.Count.5.34 How do I create a owner drawn Listbox See the .NET Compact Framework QuickStarts, Implementing Events topic:.? Http: //samples.gotdotnet.com/quickstart /compactframework/doc/btndclick.aspx 5.35. How can I implement Control.GetNextControl under the .NET Compact Framework? The tab order of the controls in the .NET Compact Framework correspond directly to the order of the Controls in the Form.Controls collection ............................. ..
Public Control GetNextControl (Control CTL, Bool Forward)
{
Int curindex = this.controls.indexof (CTL);
IF (forward)
{
CurIndex Curindex ; Else Curindex = 0; } Else { IF (CurIndex> 0) Curindex -; Else Curindex = this.Controls.count - 1; } Return this.Controls [curindex]; } 'VB Public Function GetNextControl (Byval CTL AS Control, _ ByVal Forward As Boolean) AS Control DIM Curindex as integer = me.controls.indexof (CTL) IF forward kil IF curindex CurIndex = 1 Else Curindex = 0 END IF Else IF Curindex> 0 THEN Curindex - = 1 Else Curindex = Me.Controls.count - 1 END IF END IF Return Me.Controls (CurIndex) End Function 'GetNextControl 5.36. How do I get notified when the user clicks on a treeview node? TreeView does not support the Click event, however, a workaround is to use the AfterSelect event instead.5.37. How do I set the title of a fullscreen multiline edit control window? This is not supported by the current version of the .NET Compact Framework.5.38. Why don 'I see the validItem selected when I set ComboBox.SelectedValue to validItemInCollection? Setting the SelectedValue property only works if the control is databound.5.39. How do I detect the location where a 'tap & hold' occurred to bring up a context menu on my custom control? Handle the ContextMenu.Popup event, and then query the current mouse coordinates using 'Control.MousePosition'.5.40. Why doesn 't the scrollbar value ever get set to the maximum value Similar to the NumericUpDown control, the maximum achievable value is the first empty row above the thumb More specifically, from the editor properties, this equates to:?. maximum - (LargeChange 1 ) .5.41. How do I tab out of a custom control to the previous control Call this.Parent.Controls (this.Parent.GetChildIndex (customcontrol) - 1)? .Focus () in the KeyDown event handler when a Keys.Up key is detected. 5.42. How do I add Toolbar buttons with transparency? Icons support transparency, however, there is a known bug in Visual Studio .NET 2003 designer that creates incorrect code and makes icons non-transparent. A work around is to add an icon file to THE IMAGELIST OUTSIDE OF INITIALIZEC MOMPONENT AND THE ICON FILES TO The Project As Content Or Embedded Resources. The Following Code Demonstrates THISTEM.DRAWING; Using system.io; Using system.reflection; // loaded as content example Private Void Form1_Load (Object Sender, System.Eventargs E) { This.Imagelist1.images.add (New icon ("FullFileName.ico", FileMode.Open)))))))))) THIS.TOOLBAR1.BUTTONS [0] .ImageIndex = 0; } // loaded as a resource esample Private Void Form1_Load (Object Sender, System.EventArgs E) { this.imagelist1.images.add (New Icon (Assembly.GetexecutingAssembly (). GetManifestResourceStream ".filename.ico"))))))))))) THIS.TOOLBAR1.BUTTONS [0] .ImageIndex = 0; } 'VB Imports system.drawing Imports system.io Imports system.reflection 'Loaded as content example Private Sub Form1_Load1 (Byval E AS ISTEM.EventArgs) Me.imagelist1.images.add (new icon ("FullFileName.ico", _ FileMode.Open))))))))))))))) Me.toolbar1.buttons (0) .ImageIndex = 0 END SUB 'FORM1_LOAD1 'Loaded as a resource esample Private Sub Form1_Load2 (Byval E AS ISTEM.EventArgs) Me.imagelist1.images.add (new _ Icon ([Assembly] .getexecutingassembly (). GetManifestResourceStream (_ ".filename.ico")))))))) Me.toolbar1.buttons (0) .ImageIndex = 0 END SUB 'FORM1_LOAD2 Top of page 6. Urban use with local code 6.1. How do I call a function in the DLL written by the local code? Local DLL code can be called by the system's Invoke (P / Invoke) method. These articles provide how to implement calls and more call techniques: Learn how to use the .NET thin frame of Platform Invoke (P / Invoke) Details: http://msdn.microsoft.com/library/en-us/dnnetcomp/html/netcfintrointerp.asp Explore .NET Reduction under the Framework Sex. http://msdn.microsoft.com/library/en-us/dnnetcomp/html/netcfadvinterop.asp Learn how to build unmanaged code on smart devices via P / Invoke. Http://msdn.microsoft.com/library/en-us/dnnetComp/html/unmanagedFuncs.asp how to collect data on managed and unmanaged code on the .NET streamlined framework. http://msdn.microsoft.com/library/en-us/dnnetcomp/html/netcfmarshallingtypes.asp learning use tool Dumpbin.exe declarested P / Invokes in the application of Microsoft .NET streamlining framework. Http://msdn.microsoft.com/library/en-us/dnnetcomp/html/netcfdumpbinpinvoke.asp6.2. How to use Dumpbin.exe Help Description P / Invokes? See the question and answer "6.1. How to call local written DLL The function? "Chapter. 6.3. How to write unmanaged code for Microsoft .NET streamline? See the question and answer "6.1. How do I call the function in the local written DLL?" Chapter. 6.4. How to call P / Invoke GetTickCount? Do not need to use P / Invoke to call the GetTickCount function, because Environment.TickCount provides this feature. See the "7.2. How to calculate the exact time interval?" Chapter. 6.5. How much is how much is available in the system? You can call GetSystemMemoryDiVision and GlobalMemorySystem letters, how much memory between programs and memory is quarantined and allocated. The instructions of the parameters can be found in the API reference documentation. // c # Using system.Runtime.InteropServices; Public Class MemoryStatus { Public uint dwlength; PUBLIC uint dwmemoryload; Public uint dwtotalphys; Public uint dwavailphys; Public uint dwtotalpagefile; Public uint dwavailpagefile; Public uint dwtotalvirtual; Public uint dwavailvirtual; } [DLLIMPORT ("Coredll.dll")]]]]] Public Static Extern Void GlobalMemoryStatus ( MemoryStatus LPBuffer ); [DLLIMPORT ("Coredll.dll")]]]]] Public Static Extern Int GetSystemMemoryDiVision ( Ref uint LPDWStorepages, Ref uint lpdwrampages, Ref uint lpdwpagesize ); Public void test () { uint storepages = 0; UINT Rampages = 0; UINT PAGESIZE = 0; Int res = getSystemMemoryDiVision (Ref Storepages, Ref Pagesize); MemoryStatus Memstatus = New MemoryStatus (); GlobalMemoryStatus (Memstatus); } 'VB Imports system.Runtime.InteropServices Public Structure MemoryStatus Public dwlength as uint32 Public dwmemoryload as uint32 Public dwtotalphys as uint32 Public dwavailphys as uint32 Public DWTOTALPAGEFILE AS uint32 Public dwavailpagefile as uint32 Public DWTOTALTUAL AS uint32 Public dwavailvirtual as uint32 End structure 'MemoryStatus Private Shared Sub GlobalMemoryStatus (byref MS as MemoryStatus) End Sub Public Shared Function GetSystemMemoryDiVision (_ Byref lpdwstorepages as uint32, _ Byref lpdwrampages as uint32, _ Byref LPDWPAGESIZE AS uint32) AS INTEGER END FUNCTION Public Shared Sub Test () Dim Storepages as uint32 DIM Rampages as uint32 DIM PageSize As uint32 Dim Res as integer = getSystemMemoryDiVision (Storepages, Rampages, Pagesize) Dim Memstatus as new memorystatus GlobalMemoryStatus (Memstatus) End Sub 'Test 6.6. How is the window to remain minimized? Inherit the "ONGOTFOCUS method for the form. Find the window handle of the form. Call ShowWindow (hwnd, sw_minimize) Force form minimizes. // C # Using system.Runtime.InteropServices; [DLLIMPORT ("Coredll")]]]]] Public Static Extern INTPTR FindWindow (String Windowsname); [DLLIMPORT ("Coredll")]]]]] Public Static Extern Bool ShowWindow (INTPTR HWND, INT NCMDSHOW); Const int sw_minimize = 6; Protected Override Void ONGOTFOCUS (Eventargs E) { INTPTR HWND = FindWindow (null, this.text); ShowWindow (hwnd, sw_minimize); Base.ongotfocus (e); } 'VB Imports system.Runtime.InteropServices END FUNCTION Public Shared Function ShowWindow (Byval HWnd As INTPTR, BYVAL NCMDSHOW AS INTEGER) AS Boolean END FUNCTION Private const sw_minimize as integer = 6 Protected Overrides Sub ONGOTFOCUS (Byval E As Eventargs) DIM HWND As INTPTR = FINDWINDOW (Nothing, Me.Text) ShowWindow (hwnd, sw_minimize) Mybase.ongotfocus (e) End sub 'overgotfocus 6.7. How to assemble the data type when calling the system function on the Microsoft .NET thin framework? See the question and answer "6.1. How do I call the function in the local written DLL?" Chapter. 6.8. How to get a handle (HWND) of a form or control? In fact, there are some ways to use the local code to get the handle of the control HWnd. Both of them are listed below, a use of getCapture, another using findwindow. // C # [DLLIMPORT ("Coredll.dll"] Public Static Extern INTPTR getCapture (); [DLLIMPORT ("Coredll.dll")]]]]] Public Static Extern INTPTR FINDWINDOW (String LpWindown); this.Text = "Findme"; INTPTR HWND1 = FindWindow (NULL, "Findme"); THIS.CAPTURE = True; INTPTR HWND2 = GetCapture (); THIS.capture = false; 'VB Public Shared Function GetCapture () AS INTPTR END FUNCTION Public Shared Function FindWindow (Byval Lpwindown As String) AS INTPTR END FUNCTION Me.Text = "findme" DIM Deskwin as INTPTR = FindWindow (Nothing, "Findme") Me.capture = TRUE DIM HWND As INTPTR = getcapture () Me.capture = false 6.9. How to use Performance Countries? Use the QueryPerformanceFrequency function and the QueryPerFormanceCounter function to create an accurate timer. These features are related to the device provider if they can't be executed, then they can only get the same result with the getTickCount function. If you can perform these functions, you can guarantee the most accurate operation of the timer, which is more accurate than getTickCounter or Environment.TickCount. Tickcount is actually called GetTickCounter. If the performance counter is an instance of GetTickCount, QueryperFormanceFrequency will use the 1000 as the timing frequency. If these functions cannot be executed, the return value is 0. The following code demonstrates how to use these functions. //C#[dllimport("coredll.dll ")] Public Static Extern Int QueryperFormanceFrequency (Ref INT64 LPFREQUENCY); [DLLIMPORT ("Coredll.dll")]]]]] Public Static Extern Int QueryperFormanceCounter (Ref INT64 LPPERFORMANT); Private void testtimer () { System.Int64 freq = 0; QueryperFormanceFrequency (Ref freq)! = 0) { System.Int64 count1 = 0; System.Int64 count2 = 0; IF (queryperformancecounter (ref count1)! = 0) { System.Threading.Thread.Sleep (1200); QueryperFormanceCounter (Ref count2); System.Int64 Time_ms = (count2 - count1) * 1000 / freq; } } } 'VB Public Shared Function QueryperFormanceFrequency (Byref Lpfrequency As INT64) AS INTEGER END FUNCTION Public Shared Function QueryperFormanceCounter (byref lpperformancecount as int64) AS INTEGER END FUNCTION Private sub testtimer () DIM FREQ As System.Int64 = 0 IF QueryperFormanceFrequency (freq) <> 0 THEN DIM Count1 as system.int64 = 0 DIM Count2 as system.int64 = 0 IF QueryperFormanceCounter (count1) <> 0 THEN System.threading.thread.sleep (1200) QueryperFormanceCounter (count2) DIM TIME_MS as system.int64 = (count2 - count1) * 1000 / FREQ END IF END IF End Sub 'TestTimer 6.10. What is the limit on the data type when calling a local code? What Are The Limitations ON Marshalling Types VIA P / Invoke? Return Value Can only be a type non-floating point not floating point parameter with a length of less than 302 bits. Only Support Marshaling Blittable Types Blittable Types -> Same Repesentation In Memory in Both Managed and Native Non-Blittable -> Memory Transformation Required Since Only Blittable Types, All Objects Are Pinned and Never Copied Exception: Passing String Byval in VB.Net Implies That You can't Marshal Nested Objects Since This Requires A Memory Transformation (non-blittable) can only be less than or equal to 32-bit length Value passes the exception through the stack: Float32 Reference (References) Pass Blittable Reference Types Transfer Reference to Value Type Variables This is how to pass the FLOAT32 type value can transfer value types. In the local code, you can use the pointer to point to the first object, and then access other object string is special, pass the char array -> constant StringBuilder is special, pass the char array -> Easy to change ( Need to pass the length alone) Note: C # Bool is 8 Bools, and does not mean the BOOL queue of Win32: Compiler default queue (4 bytes) Marshal.getLastWin32Error supports getLastError () Semantic unsupported: Marshalas: No Support for non-blittable Types structLayout: Cannot change DateTime Only Support Default Calling Convention 6.11. When calling getLastError, always get the uncertain code? Try not to try to call the Windows getLastError () API because the CLR can change the Last Error code when CLR calls the local code. Instead, use the call return value tag error code, then call the System.Runtime.InterOpServices.Marshal.Getlastwin32Error () method to get the error code. Using system.Runtime.InteropServices; [DLLIMPORT ("Coredll.dll", SetLastError = true)]] INT myfoo (...); Foo (...) { INT rc = myfoo (...); IF (RC == FALSE) { Throw New Win32Exception (Marshal.getlastwin32error (), "Foo Failed"); } } 6.12. When calling a local code, there is a limit on the number of parameters? limited. The .NET streamlined frame version 1.0 is limited to 12. 6.13. Why is the "NotSupportedException" exception when calling a local code? There are usually three possibilities: The declaration incorrect. NET streamlined frame does not support the name of the operation DLL you want to do in the exposure process: Is there any violation .NET streamlined frame P / INVOKE limit? Is there any The parameters need to be pre-allocated (eg, whether isn't it a pointer)? If yes, you should pass the references of the existing variables. Is the exposed function name correct? Can you use the dumpbin.exe tool to verify whether you want to try too much parameter? For example, for the second point of the above, the last parameter HKEY pointer of the Regopenkey API. You should declare and call: // C # [DLLIMPORT ("Coredll.dll", SetLastError = true)]] Public Static Extern long regopenkey INTPTR HKEY, String LPSUBKEY, Ref INTPTR HKEYRESULT ); Public long OpenMysubKkey () { INTPTR HKEY = INTPTR.ZERO; Return regopenkey (HKEY_CLASSES_ROOT, "MySubKey", Ref HKey); } 'VB Public Shared Function Regopenkey (Byval Hkey As INTPTR, BYVAL LPSUBKEY AS STRING, BYREF HKEYRESULT AS INTPTR) AS Long END FUNCTION Public function openmysubkey () as long DIM HKEY As INTPTR = INTPTR.ZERO Return Regopenkey (HKEY_CLASS_ROOT, "MySubKey", HKEY End Function 'OpenMysubKey 6.14. How to convert BYTE [] to INTPTR? There is more than one way to access the INTPTR. The first method, uses non-secure code, direct directing to the BYTE array with a pointer. // C # Unsafe { Byte [] test = new byte [5]; Fixed (Byte * P = & test [0]) { * p = 0xff; } } You can also use Gchandle to point to the object. // C # Using system.Runtime.InteropServices; Byte [] test = new byte [5]; Gchandle hobject = gchandle.alloc (test, gchandletype.pinned); INTPTR POBJECT = HOBJECT.AddrofpinnedObject (); IF (HOBJECT.IAllocated) HOBJECT.FREE (); 'VB Imports system.Runtime.InteropServices DIM TEST (4) AS BYTE DIM HOBJECT As Gchandle = Gchandle.alloc (TEST, GCHANDLETYPE.PINNED) DIM POBJECT AS INTPTR = HOBJECT.AddrofpinnedObject () IF hobject.isallocated the Hobject.free () END IF Finally, you can use the Localalloc and Marshalling function to copy the memory block to get the data block. // C # [DLLIMPORT ("Coredll.dll", setLastError = true)] public static extern INTPTR LOCALLOC (UINT UFLAGS, UINT Ubytes); [DLLIMPORT ("Coredll.dll", SetLastError = true)]] Public Static Extern INTPTR LOCALFREE (INTPTR HMEM); [DLLIMPORT ("Coredll.dll", SetLastError = true)]] Public Static Extern INTPTR LocalRealloc (INTPTR HMEM, UINT Ubytes, Uint Fuflags); Public const uint LMEM_FIXED = 0; Public const uint LMEM_MOVEABLE = 2; Public const uint LMEM_ZEROINIT = 0x0040; Byte [] test = new byte [5]; INTPTR P = Localalloc (LMEM_FIXED | LMEM_ZEROINIT, (UINT) TEST.LENGTH); IF (p == INTPTR.ZERO) { Throw new outofmemoryexception (); } Else { Marshal.copy (TEST, 0, P, Test.LENGTH); } 'VB Public Shared Function Localalloc (Byval uflags as uint32, byval ubytes as uint32) AS INTPTR END FUNCTION Public Shared Function LocalFree (Byval HMEM AS INTPTR) AS INTPTR END FUNCTION Public Shared Function LocalRealloc (Byval Hmem as uint32, byval fuflags as uint32) AS INTPTR END FUNCTION Public const LMEM_FIXED AS INTEGER = 0 Public const LMEM_MOVEABLE AS INTEGER = 2 Public const LMEM_ZEROINIT AS INTEGER = & H40 DIM TEST (4) AS BYTE DIM P AS INTPTR = Localalloc (Convert.TOUINT32 (LMEM_FIXED or LMEM_ZEROINIT), Convert.TOUINT32 (TEST.LENGTH)) If p.equals (INTPTR.ZERO) THEN Throw New OutofMemoryException Else Marshal.copy (TEST, 0, P, TEST.LENGTH) END IF . 6.15 Why do I get a MissingMethodException when I call a function from a native DLL There are several issues to consider when determining the case of a MissingMethodException When this exception occurs you should verify the following:?. If targeting Pocket PC 2003 use Microsoft eMbedded Visual C 4.0. If Targeting Pocket PC 2000 OR 2002 Use Microsoft Embedded Visual Tools 3.0 Verify That The Parameters To The Function Match Those of To A long in native code is typical 32-bits, whereas in the .NET Compact Framework it is 64-bits beware of bool According to MSDN documentation, "Its size is unspecified.": Http: //msdn.microsoft.com/library/default.asp url = / library / en-us / dv_vccelng4 / html / ellrffundamentaltypes.asp In a Microsoft specific section? of the MSDN documentation, the bool size is described as varying depending on the version of Visual C used to build the binary.:http://msdn.microsoft.com/library/default.asp?url=/library/en-us /dv_vccelng4/html/ell RrfBool.asp a Bool Is Defined as an int (32-bit value) .NET Compact framework blittable type: http://msdn.microsoft.com/library/default.asp? URL = / library / en -us / dv_vccelng4 / html / ellrffundamentaltypes.asp Non blittable Types and Marshaling Support: http: //msdn.microsoft.com/library/en-us/dv_evtuv/html/etconNonBlittableTypesMarshalingSupport.asp Make sure that the function name is spelled correctly Verify That The DLL IS LOCATED CORRECTLY - Windows or Executing Folder of Target Device Verify With Dumpbin That The names of the functioning of the dll (exter N "c" fixes this). More information on this topic can be found in section 6.1. How do i call a function tria I Native DLL? "of this faq. Verify That The DLL Being Imported Is Not Dendant Upon Other . DLLs A missing dependant DLL will result in the MissingMethodException For the latest Microsoft eMbedded Visual Tools and SDK downloads, visit the MSDN Mobile and Embedded Developer Center "Products & Updates" download page at:. http: //msdn.microsoft.com/ Mobility / Downloads / Updates / Default.aspx6.16. How do i set the system time by p / invoking the setsystemtime function. // c # Using system.Runtime.InterOpServices; Public struct systemtime { Public ushort wyear; public ushort wmonth; Public Ushort WDAYOFWEEK; Public ushort wday; Public ushort wheh; Public ushort wminute; Public Ushort WSecond; Public ushort wmilliseconds; } [DLLIMPORT ("Coredll.dll")]]]]] Public Extern Static Void getSystemTime (Ref SystemTime LpsystemTime); [DLLIMPORT ("Coredll.dll")]]]]] Public Extern Static Uint SetsystemTime (Ref SystemTime LpsystemTime); // set the clock ahead one hour SystemTime ST = New SystemTime (); GetSystemTime (Ref St); St.WHOUR = (Ushort) (St.WHOUR 1% 24); SetsystemTime (Ref St); 'VB Imports system.Runtime.InteropServices Public structure systemtime, PUBLIC STRUCTURE Public Wyear As uint16 Public WMONTH AS UINT16 Public WDAYOFWEEK AS UINT16 Public WDAY As uint16 Public WHOUR AS uint16 Public wminute as uint16 Public WSecond As uint16 Public wmilliseconds as uint16 End structure Public Shared Sub getSystemTime (Byref LpsystemTime As SystemTime) End Sub Public Shared Function SetSystemTime (byref lpsystemtime as systemtime) AS uint32 END FUNCTION 'Set the clock ahead one hour Dim St AS New SystemTime GetSystemTime (ST) St.WHOUR = Convert. Touint16 ((Convert.Toint32 (St.WHOUR) 1)) MOD 24) SetsystemTime (ST) 6.17. How do I programmatically soft reset the device? The device can be soft reset through P / Invoking of the KernelIoControl function, as demonstrated in the code below. For more information on how to use the function and extend the functionality of this sample, Refer to Visual Studio .NET Help.note: On Smartphone Devices, this Will Only Work if you are sign with a price. // C # Using system.Runtime.InteropServices; public const uint file_device_hal = 0x00000101; Public const uint method_buffered = 0; Public const uint file_ANY_Access = 0; Public uint CTL_CODE (Uint Fection, Uint Method, Uint Access) { RETURN ((DeviceType << 16) | (Access << 14) | (Function << 2) | Method; } [DLLIMPORT ("Coredll.dll")]]]]] Public Extern Static uint kernelioControl ( Uint dwiocontrolcode, INTPTR LPINBUF, uint ninbufsize, INTPTR LPOUTBUF, uint noutbufsize, Ref uint lpbytesreturned ); uint resetpocketpc () { uint bytesreturned = 0; uint ioctl_hal_reboot = CTL_CODE (file_device_hal, 15, Method_Buffered, File_Ane_access; Return kernelioControl (IOCTL_HAL_REBOOT, INTPTR.ZERO, 0, INTPTR.ZERO, 0, REF BYTESRETURNED; } Private Void Form1_Load (Object Sender, System.EventArgs E) { DialogResult r = messagebox.show ( "Are you sure you want to recst?", "TEST", MessageboxButtons.yesno, MessageBoxicon.question, MessageBoxDefaultButton.Button2 ); IF (r == DialogResult.yes) { RESETPOCKETPC (); } } 'VB Public const file_device_hal as integer = & h101 Public const method_buffered as integer = 0 Public const file_ANY_Access as integer = 0 Public Function CTL_CODE (_ Byval DeviceType as inTeger, _ Byval Func as integer, _ Byval method as integer, _ BYVAL Access as integer) AS Integer Return (DeviceType << 16) OR (Access << 14) or (Func << 2) or Method End function 'CTL_CODE Public Shared Function KernelioControl_ (_ _ Byval dwiocontrolcode as integer, _ BYVAL LPINBUF as Intptr, _ Byval ninbufsize as integer, _ Byval lpoutbuf as Intptr, _byval noutbufsize as integer, _ Byref lpbytesreturned as integer_ AS Integer END FUNCTION Function resetpocketpc () AS Integer DIM BYTESRETURNED AS INTEGER = 0 DIM ioctl_hal_reboot as integer = ctl_code (file_device_hal, _ 15, Method_Buffered, File_Ane_access? Return kernelioControl (IOCTL_HAL_REBOOT, INTPTR.ZERO, 0, _ INTPTR.ZERO, 0, BYTESRETURNED End function 'resetpocketpc Private Sub Form1_Load (Byval E AS ISTEM.EventArgs) Handles mybase.load Dim r as dialogresult = messagebox.show (_ "Are you sure you want to reset?", _ "Test", _ MessageboxButtons.yesno, _ MessageBoxicon.question, _ MessageBoxDefaultButton.Button2) IF r = DialogResult.yes Then RESETPOCKETPC () END IF End Sub 'Form1_Load 6.18. How can I put icon on the title bar regardless of the which form is active? This is not supported with the current version of the .NET Compact Framework. You can, however, P / Invoke Pocket PC's notificaiton system to do this an . Refer to the following for more information: sample code: http://msdn.microsoft.com/library/default.asp? URL = / library / en-us / dnppc2k2 / html / ppc_fications.asp Aygshell API API: http: / /msdn.microsoft.com/library/default.asp?url=/library/en-us/wceui40/html/_cerefaygshellfunctions.asp The native Notification APIs are:. SHNotificationAdd, SHNotificationRemove, SHNotificationGetData, and SHNotificationUpdate 6.19 How do I disable. ? and capture hardware buttons Refer to the sample in the P / Invoke library.http:. //msdn.microsoft.com/library/en-us/dnnetcomp/html/PInvokeLib.asp#PInvokeLib_Topic03 6.20 How do I hide the start icon ? The start icon can be hidden using the shfullscreen api. // c # Const uint shfs_showtaskbar = 0x0001; const uint shfs_hidetaskbar = 0x0002; Const uint shfs_showsipbutton = 0x0004; Const uint shfs_hiDesipbutton = 0x0008; Const uint shfs_showstarticon = 0x0010; Const uint shfs_hidestarticon = 0x0020; [DLLIMPORT ("Aygshell.dll")]]]]]] Static Extern Uint Shfullscreen (INTPTR HWNDREQUESTER, UINT DWSTATE); [DLLIMPORT ("Coredll.dll")]]]]] Public Static Extern INTPTR getCapture (); Private Void Form1_Load (Object Sender, System.EventArgs E) { Capture = true; INTPTR hWnd = getCapture (); Capture = false; Shfullscreen (hwnd, shfs_hiDestartic); } 'VB Const SHFS_SHOWTASKBAR AS INTEGER = & H1 Const SHFS_HIDETASKBAR AS INTEGER = & H2 Const shfs_showsipbutton as integer = & h4 Const SHFS_HIDESIPBUTTON AS INTEGER = & H8 Const SHFS_SHOWSTARTICON As INTEGER = & H10 Const SHFS_HIDESTATICON AS INTEGER = & H20 Shared Function Shfullscreen (Byval Hwndrequester As INTPTR, BYVAL DWSTATE AS INTEGER) AS INTEGER END FUNCTION Public Shared Function GetCapture () AS INTPTR END FUNCTION Private Sub Form1_Load (Byval E AS ISTEM.EventArgs) Capture = TRUE DIM HWND As INTPTR = getcapture () Capture = false Shfullscreen (hwnd, shfs_hidestartic) End Sub 'Form1_Load 6.21. How do I Enumerate, Create, and Terminate Processes? Refer to the sample: http://msdn.microsoft.com/mobility/understanding/articles/default.aspx? Pull = / library / en-us / DNNETCOMP / HTML /processmanager.asp 6.22. Where can I find a centralized library of P / Invoke samples? This sample demonstrates how to P / Invoke numerous useful native functions that are not directly available through the .NET Compact Framework. A test Form is provided that enumerates all available test procedures and allows the user to select and run them: http: //msdn.microsoft.com/library/en-us/dnnetcomp/html/PInvokeLib.asp 6.23 How do I play and record .WAV audio files with. the Waveform Audio Inteface Learn how to use the Waveform Audio Interface to record and play ".wav" files:? http: //msdn.microsoft.com/library/en-us/dnnetcomp/html/WaveInOut.asp Top of Page7. General 7.1. How to determine the main directory of the application? With Reflection, the application can determine which directory starts from you, or use IO.Path namespace to modify it. // C # Using system.reflection; Using system.io; // this is the full directory and eve name String fullappname = askEMBLY.GETEXECUTINGASEMBLY (). Getname (). Codebase; // this Strips Off the EXE NAME String fullapppppp_ = path.getdirectoryName (fullappname); // this add a file name to the path String splashimagename = path.combine (fullappp path, "myfile.txt"); 'VB Imports system.io Imports system.reflection 'This is the full directory and eve name DIM FULLAPPNAME AS STRING = [assembly] .getexecutingassembly (). Getname (). Codebase 'This strips off the estil Dim fulllapppp_ as string = path.getdirectoryName (fulllappname) 'This add a file name to the path DIM SPLASHIMAGENAME AS STRING = path.combine (fullapppath, "myfile.txt") Learn how to get the current directory executed by the program. In Embedded Visual Basic, the current directory executed by the program can be obtained via app.path attribute. Catalog execution of the program can be obtained by AssemblyName object assembly, AssemblyName object contains an assembly of all descriptions: http: //msdn.microsoft.com/library/en-us/dncfhowto/html/HOWTOExecutingAppPath.asp this fast Getting Started Tutorial tells you how to get the directory where your assembly and data files are located. Windows CE .NET itself does not support the current directory of the application: http://samples.gotdotnet.com/quickstart/compactframework/doc/getappdir.aspx7.2. How to calculate the exact time interval? An application has four ways to get the interval: system.environment.tickcount gets a symbolic integer value, indicating the number of Hazudi passed from the machine to the call. Under the .NET streamlined frame, this value has an error in 0.5 seconds, and most of the case will be less than 0.5 seconds. GettickCount () property environments is called a getTickCount function, so there is no need to call this method in the local code. Performance Monitor can be used as a pressure test, but not designed for the final application. For more information, check the "7.5. How to Use Performance Monitor?" Chapter TIMERS uses the System.Threading.Timer class, you can set the timer in the thread, point to the application with the delegate. Performance Counter If the OEM vendor supports, the QueryperFormanceCounter function provides the highest precision of timing. Please check the "6.9. How to use Performance Counter Features?" Chapter. 7.3. How to treat embedded resources as a stream? In order to access embedded resources, the application only needs to simply reference the relevant assembly (askSEMBLY) and calling the getManifestResourceStream method. The following example is how the rock creates a bitmap from embedded resources: // C # Using system.reflection; AskEMBLY ASM = askEMBLY.GETEXECUTISSEMBLY (); Bitmap Bmpsprite = New Bitmap (asm.getmanifestResourceStream ("asmblyname.filename)); 'VB Imports system.reflection DIM ASM AS [Assembly] = [assembly] .getexecutingassembly () Dim bmpsprite as new bitmap (asm.getmanifestResourceStream ("AssemblyName.FileName))) In the above code, the string AssemblyName section can be called asm.getname () at runtime. Name. Note: If there are spaces in AssemblyName, it will be underlined and must be accessed like this. 7.4. Why get an error in "an unhandled exception of type 'system.net.sockets.socketexception' occurred in system.dll"? This is the BUG of the .NET streamlined frame. This is due to the restriction of the SECURE SOCKETS LAYER (SSL) of the Windows CE underlay. However, even the method is avoided, if you set the req.allowwritestreamBuffering for True, do not set the Req.contentLength attribute, then this error will occur. 7.5. How to use Performance Monitor? Performance counter creates a registry registry: "HKEY_LOCAL_MACHINE / SOFTWARE / Microsoft / .NetCompactFramework / PerfMonitor" new dual-by-word item, the value is the name of the counter. Set the value of Counters to 1 means the allowable counter, set to 0 to indicate it. After setting the performance counter, a text file "mscoree.stat" is created when the program is turned off. This file stores the root directory of the device. This is a fixed length of a file, so importing Excel is very convenient. Note: The counter can only be used by a hosted program running. Note: When using a performance counter, 30% performance is reduced. 7.6. How to cancel a program to close? The program can overload the onclosing method, set can CanceleventArgs.cancel to cancel the shutdown. // C # Protected Override Void OnClosing (Canceleventargs E) { e.cancel = true; } 'VB Protected Overrides Sub onClosing (Byval E As Canceleventargs) e.cancel = true End sub 'onClosing 7.7. How do I call another application in my program? You can call the CREATEPROCESS function of the local code to start running the second program. Then call the WaitForsingleObject function of the local code to suspend the call until the second program runs. The following quick entry demonstrates this operation through the PocketPC simulator: http://samples.gotdotnet.com/quickstart/compactFramework/doc/waitforsingleObject.aspx7.8. What thread is created? One .NET streamlined framework will generate up to 4 threads: A primary application thread. A thread controls various time intervals, and time intervals are used by systems and other applications. A thread tracking activity change (the media action on Windows XP is simulated, and there is no such operation on Windows CE). A thread that performs termination objects. When the first object is recovered by the object of garbage, it is created. 7.9. How to convert the BYTE array into structure? In C , a class or structure to file can be saved and effectively switched through the construction type (Typecasting) and is directly refactored from the file. But the nature of the hosted code determines that it cannot be implemented. But there is still a way to implement, create a class, and make the data in memory as its attribute to access other classes. For example: // c # public class myclass { protected byte [] m_data = null; // uint uidummy // short sdummy // this is a bit unsafe so you shop throw an // Exception or assert if the byte array length iS // NOT 6. A Safer But Less Memory Efficient Approach // would be to set m_data = new byte [6] and the copy // bytes to m_data. Public myclass (byte [] bytes) {m_data = bytes;} // Get / set the uint Public uint uidummy { Get {return bitconverter.touint32 (m_data, 0); set { Buffer.blockcopy (BitConverter.getbytes (Value), 0, M_Data, 0, Bitconverter.getbytes (Value) .length); } } // Get / set the Short Public Short SDUMMY { Get {return bitconverter.Toint16 (M_Data, 4); set { Buffer.blockcopy (BitConverter.getbytes (Value), 0, M_Data, 4, Bitconverter.getbytes (Value) .length); } } } Byte [] fromfile = {1, 1, 1, 1, 2, 2}; Myclass myclass = new myclass (fromfile); uint test1 = myclass.uidummy; // 0x1010101 Short test2 = myclass.sdummy; // 0x202 Myclass.sdummy = 0x0505; // Test setting the short Uint test4 = myclass.uidummy; // 0x1010101 Short test5 = myclass.sdummy; // 0x505 'VB Public Class Byteclass Protected m_data as byte () = Nothing 'uint uidummy 'Short SDUMMY 'This is a bit unsafe so you shop throw an exception 'OR Assert if the byte array length is not 6. a Safer 'But Less Memory Efficient Approach Would Be To Set' M_Data = New Byte [6] and the copy bytes to m_data. Public Sub New (Byval Bytes () AS BYTE m_data = bytes End Sub 'NEW 'Get / set the uint Public property uidummy () AS uint32 Get Return Bitconvert32 (m_data, 0) END GET Set (Byval Value As System.uint32) Buffer.blockcopy (BitConverter.getbytes (Value), 0, M_Data, 0, Bitconverter.getbytes (Value) .length End set End Property 'Get / set the short Public property SDummy () AS Short Get Return Bitconvert16 (M_Data, 4) END GET Set (ByVal Value As Short) Buffer.blockcopy (BitConverter.getbytes (Value), 0, M_Data, 4, Bitconverter.getbytes (Value) .length) End set End Property END CLASS 'BYTECLASS Dim fromfile as byte () = {1, 1, 1, 1, 2, 2} DIM TestClass as new byteclass (fromfile) Dim test1 as system.uint32 = testclass.uidummy '0x1010101 DIM TEST2 AS Short = TestClass.sdummy '0x202 Testclass.sdummy = & h505 'Test Short DIM TEST4 as system.uint32 = testclass.uidummy '0x1010101 Dim test5 as short = testclass.sdummy '0x505 7.10. Can I create a delegate to INVOKE? No. In the .NET thin frame, only the EventHandler method can be called. The following code shows how to use this method correctly: // C # Public void Handleme (Object O, Eventargs E) {...} Form.Invoke (New EventHandler (Form.HandleMe); 'VB Public Sub HandleMe (o As Object, E AS Eventargs) End Sub 'HandleMe Form.Invoke (New EventHandler (Addressof form.handle)) Althought, IT WILL NOT WORK PROPERLY: // C # Public delegate void myhandler (); Public void handleMebadly () {...} Form.Invoke (New MyHandler (form.handleMebadly); 'VB Delegate Sub myHandler () public sub handleMebadly () End Sub 'HandleMebadly Form.Invoke (New MyHandler (form.handleMebadly)) 7.11. How to use the phone API on the Microsoft .NET thin frame? View this article, learn how to access the phone API in an application based on the .NET streamlined framework, http: //msdn.microsoft.com/library/en-us/dnnetComp/html/netcfphoneApi.asp7.12. How to Pocket Generate GUID on the PC? Guid.newguid methods can generate new GUIDs, but there is no such method in the .NET thin frame. Read this article, learn how to create a GUID object in the PocketPC application in accordance with the GUID specification: http://msdn.microsoft.com/library/en-us/dnnetcomp/html/ppcguidgen.asp7.13. How to make me. NET streamlined framework and Pocket Outlook data combination? This article discusses how to use INTHEHAND's Pocket Outlook .NET component: http://msdn.microsoft.com/library/en-us/dnnetComp/html/inthehandpoom.asp7.14. I can judge the .NET streamlined framework Is a file version? The C # Programmer's Reference in Visual Studio .NET 2003 provides a getFileVersionInfo function in the .NET streamlining framework. The problem brought by this example is that this function is determined by the OEM vendor and does not guarantee that the correct result can be returned. Use Reflection to get an assembly version: // c # Using system.reflection; String Ver = askAMBLY.GETEXECUTINGASSEMBLY (). GetName (). Version.toString (); 'VB Imports system.reflection; DIM VER AS STRING = [assembly] .getexecutingassembly (). Getname (). Version.toString () 7.15. What is related to the background processing of Microsoft .NET streamlined framework? Use the background processing, you need to pay attention to the details and carefully design. This article provides some of the most useful suggestions for background processing, many of the points introduced in the text are required: http: //msdn.microsoft.com/library/en-us/dnnetComp/html/backgroundProcess.asp7.16. In What is the skill of using multi-thread on Microsoft .NET streamlined framework? Learn how to use multiple threads in a Windows form application based on the .NET streamlined framework. Http://msdn.microsoft.com/library/en-us/dnnetcomp/html/netcfmultithreadedApp.asp7.17. How to use an obfuscator in a smart device application? Learn how to protect your code using the Preemptive Dotfuscator obfuscator. Http://msdn.microsoft.com/library/en-us/dnnetcomp/html/netcfobfuscation.asp7.18. How to encrypt or decrypt data using password services? Please refer to this question and answer "10.5. Write a program n." Section of capturing the Pocket PC signature. 7.19. How do I get the only number of the Windows CE device on Microsoft .NET thin frame? Learn how to use the .NET thin frame to get the device number of the Windows CE device. http://msdn.microsoft.com/library/en-us/dnnetcomp/html/retrieveDeviceID.ASP You can call the function of the local code to get the PocketPC's device number, which is the serial number. This rapid entry tutorial demonstrates that the device number is displayed with MessageBox. Http://samples.gotdotnet.com/quickstart/compactframework/doc/deviceid.aspx7.20. How to send a short message on the application of Microsoft .NET thin framework? This article demonstrates how to send short messages from an .NET streamlined framework: http://msdn.microsoft.com/library/en-us/dnnetComp/html/netcfsendsmsms.asp7.21. Do not use Control. Name, can you determine the sender of the event? This article discusses how to determine the sender of the event under the .NET streamlined framework, the control in the .NET thin frame does not support the Name property: http://msdn.microsoft.com/library/en-us/dncfhowto/html/ Howtosenderevent.asp7.22. How to call the parameters of the method in the thread? Using multithreading in your application, you can improve the performance of the user interface. Base class Control provides invoke, begininvoke, and endinvoke methods to create threads in the control. The .NET streamlined frame does not support asynchronous BeginInvoke and endInvoke calls. To now, it is also not supported to transfer parameters to the synchronous invoke invoke. This quick start tutorial provides a custom class ControlInvoker that implements parameters to the Invoke method: http://samples.gotdotnet.com/quickstart/compactframework/doc/controlinvoker.aspx7.23. How to establish a reminder program and Timers ? This quick start article describes the use of P / Invoke to define a user reminder and booking. You can plan to remind the window to pop up. You can also set an application run or respond to an event at a specific time. http://samples.gotdotnet.com/quickstart/compactframework/doc/notifications.aspx7.24. How to play sound? This quick start tutorial demonstrates the use of P / Invoke to play a short WAV file, one as an embedded resource, another as a content. This form contains two buttons, a Chord.wav played with the resource to play Chord.Wav on another file. http://samples.gotdotnet.com/quickstart/compactframework/doc/playsounds.aspx7.25. How to use command line parameters? Use the command line parameters in the code, just simply define the MAIN method to accept parameters and processes correctly. The following code demonstrates this method: // c # static void main (String [] args { // Do Your Thing Here } 'VB Shared Sub Main (Byval Args () AS STRING 'Do Your Thing Here End Sub When tested in Visual Studio 2003, the parameters of the command line can be set by inheritance. Main menu, select Project-> Project Name Properties. In the Property Pages dialog, select Configuration Properties-> Debugging. Enter a string in Command Line Arguments: Text Box.7.26. Why is you getting an exception when using the method or attribute of the already released object? The complete .NET framework is not guaranteed, it can be successful when accessing an attribute or method of an object that has been released. In a complete .NET framework, although accessed some attributes (like text), it can often be successful. The method or attribute of accessing an object that has been released on the .NET Framework and the .NET streamlined framework will often fail. 7.27. How to get "Enter", "Tab", and "arrow" button event? With keydown and keyup events, you can get a keyless key (like tab). Now, only some specific controls support Key events (such as Form, Panel, Textbox, and custom controls). All controls will support the Key event in the .NET thin frame SP2 version. I have known problems, when using the simulator, pressing the TAB button from the keyboard will not be supported, but when the TAB is pressed from the soft keyboard (SIP), it will have effect. This is the cause of the simulator of the VS belt, not the problem of .NET streamlined framework. .NET thin frame triggers the key event When it receives the WM_KEY * message from the system. When you run a local code program in the simulator, pressing the Tab button from the keyboard does not allow the system to trigger the WM_KEYDOWN event. If it is a soft keyboard (SIP), or a real device, there will be no such problem. 7.28. How to delete a read-only file? Use the System.IO.FileInfo class to access the properties of the file. // C # System.io.fileinfo fi = new system.io.fileinfo ("filename"); // Remove Readonly Attribute Fi.attributes - = system.io.fileAttributes.readonly; System.IO.File.delete ("filename"); 'VB Dim Fi As New System.IO.Fileinfo ("FileName") 'Remove Readonly Attribute FI.attributes - = IO.FileAttributes.Readonly System.IO.File.delete ("filename") 7.29. How do I determine if a member exists at runtime? The existence of a member can be determined at runtime using Reflection. The code below demonstrates how to use Reflection to access the "Width" property and the "GetPixel" method of a Bitmap object. In the case of the "Width" property, the code enumerates all "public" properties with a "get" component and then searches for one named "Width". The "GetPixel" sample demonstrates how one might use Reflection to call a known function where the parameter order is unknown. This sample is set up as if the author knows there is a method named "GetPixel" which takes a pixel location of x, y but does not know the order in which they appear in the parameter list . The sample enumerates the methods and searches for one named "GetPixel" and then enumerates the parameter list to determine whether the first or second parameter is named "X". Keep in mind that, due to the differences in hardware pixel formats, the value Returned by GetPixel May Be di fferent from that set by SetPixel in this sample.Reflection provides many powerful tools for determing functionality at runtime so for information, refer to the documentation regarding System.Type and the namespace System.Reflection.//C# Using system.reflection; Using system.drawing; Bitmap BM = New Bitmap (200, 100); INT width = 0; // Explicitly Set One Pixel for Testing INT x = 199; INT Y = 20; Color pixcolor = color.black; BM.SETPIXEL (X, Y, Color.magenta); // Get the "width" propertypropertyinfo [] propinfo = BM.gettype (). getproperties (BindingFlags.getProperty | BindingFlags.Public | bindingflags.instance; For (int i = 0; i { IF (PropInfo [i] .name == "width") { Width = (int) Propinfo [i] .GetValue (BM, NULL); Break; } } // Call the getpixel method Methodinfo [] methinfo = bm.gettype (). GetMethods (BindingFlags.Public | BindingFlags.instance); For (int i = 0; i { IF (MethInfo [i] .Name == "getpixel") { ParameterInfo [] paraminfo = methinfo [i] .GetParameters (); IF (paraminfo.length == 2) { Object [] xy = new object [2]; IF (paraminfo [0] .Name == "x") { XY [0] = x; XY [1] = Y; } Else { XY [1] = x; XY [0] = Y; } Pixcolor = (color) Methinfo [i] .invoke (BM, XY); Break; } 'VB Imports system.reflection Imports system.drawing DIM BM AS New Bitmap (200, 100) Dim width as integer = 0 'Explicitly Set One Pixel for Testing DIM X as integer = 199 DIM Y as integer = 20 DIM PIXCOLOR As Color = Color.Black Bm.Setpixel (X, Y, Color.MAGENTA) 'Get the "width" Property DIM PROPINFO as propertyInfo () = _ Bm.gettype (). getproperties (BindingFlags.getProperty or _ Bindingflags.public or bindingflags.instance)))) DIM I as integer For i = 0 to propinfo.length - 1 IF propinfo (i) .Name = "width" then Width = FIX (PropInfo (i) .GetValue (BM, Nothing) EXIT for END IF Next I 'Call The SetPixel Method Dim methodinfo as methodinfo () = bm.gettype (). GetMethods ((BindingFlags.Public _ OR bindingflags.instance)) For i = 0 to methinfo.length - 1if methinfo (i) .Name = "getpixel" then Dim paraminfo as parameterinfo () = methinfo (i) .GetParameters () IF paraminfo.length = 2 THEN DIM XY (1) As Object IF paraminfo (0) .name = "x" THEN XY (0) = x XY (1) = Y Else XY (1) = x XY (0) = Y END IF Pixcolor = ctype (MethInfo (i) .invoke (BM, XY), Color EXIT for END IF END IF Next I 7.30. How do I Determine The Device Name CAN Be Accessed Through The System.Net Namespace, As Demonstrated by The Following Code. // C # String devname = system.net.dns.getHostName (); 'VB Dim devname as string = system.net.dns.getHostName () 7.31 How do I build a C # Smart Device project from the command line Enter the following commands as single lines (each is broken into two lines for clarity):.? Set CFPath =% SystemDrive% / Program Files / Microsoft Visual Studio .NET 2003 / CompactFrameworksDK / V1.0.5000 / Windows CE CSC form1.cs / noconfig / nostdlib / lib: "% cfpath%" /R :"