Microsoft Study Bible

November 18, 2009

Windows Mobile Development in VS 2010

Firstly, let us talk about what we can get benefit when we develop WM application by VS 2010.Of course, we had to talk about the Windows 7’s official sale and Visual Studio 2010 on-line, both of which belong to a series of products released by Microsoft. These new products will have high levels of integration and closer mutual support. For a developer, Development of uniform standards will bring not only convenience, but also high efficiency.
Take “Hello World” as an example. We just need to change PSTE of the application under Win32 edition as LPSTR, the program can be compiled and on.
Code:

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,

                   LPTSTR lpCmdLine, int nShowCmd)

{

     MessageBox(NULL, TEXT(“Hello, Windows Mobile!”), TEXT(“HelloMsg”), 0);

     return 0;

}

From this, we can find that Windows Mobile development is the same as the general Windows program development. We can get a handle on it without hard learning process. And we can use our familiar language.
With intelligence handset more and more popular and coupled with the arrival of 3G area, the demand to write the mobile applications will increase much.
Now, let us see a code in windows mobile by using c# to achieve cmnet link:

public bool Connectcmnetmethod(Guid destGuid, bool exclusive, bool mode)

        {

            {

                connInfo.cbSize = (uint)Marshal.SizeOf(connInfo);

                connInfo.dwParams = 0×1;//CONNMGR_PARAM_GUIDDESTNET;

                connInfo.dwPriority = 0×08000;

                connInfo.dwFlags = 0×1 | 0×2 | 0×4 | 0×8;//0;

                connInfo.bExclusive = 0;// exclusive;

                connInfo.bDisabled = 0;// false;

                connInfo.guidDestNet = destGuid;

                connInfo.hWnd = this.Handle;

                if (mode == true)

                {

                    result = ConnMgrEstablishConnectionSync(ref connInfo, ref hConnection, 10000, out dwStatus);

                    if (result != 0) MessageBox.Show(result.ToString(“X”), dwStatus.ToString(“X”));

                    return result == 0;

                }

                return false;

            }

        }

        public struct CONNMGR_CONNECTIONINFO

        {

            public uint cbSize;

            public uint dwParams;

            public uint dwFlags;

            public uint dwPriority;

            public int bExclusive;

            public int bDisabled;

            public Guid guidDestNet;

            public IntPtr hWnd;

            public uint uMsg;

            public uint lParam;

            public uint ulMaxCost;

            public uint ulMinRcvBw;

            public uint ulMaxConnLatency;

        }

        [DllImport("cellcore.dll", EntryPoint = "ConnMgrEstablishConnectionSync", SetLastError = true)]

        internal static extern int ConnMgrEstablishConnectionSync(ref CONNMGR_CONNECTIONINFO pConnInfo, ref IntPtr phConnection, int dwTimeout, out int dwStatus);

        [DllImport("cellcore.dll", EntryPoint = "ConnMgrEstablishConnection", SetLastError = true)]

        internal static extern int ConnMgrEstablishConnection(ref CONNMGR_CONNECTIONINFO pConnInfo, ref IntPtr phConnection);

        [DllImport("cellcore.dll", EntryPoint = "ConnMgrReleaseConnection", SetLastError = true)]

        internal static extern int ConnMgrReleaseConnection(IntPtr hConnection, int lCache);

        [DllImport("coredll.dll")]

        private static extern int CloseHandle(IntPtr hObject);

        [DllImport("Coredll.dll", EntryPoint = "GetLastError", SetLastError = true)]

        internal static extern int GetLastError();

private void menuItem1_Click(object sender, EventArgs e)

        {

            MessageBox.Show(Connect(new Guid(“7022E968-5A97-4051-BC1C-C578E2FBA5D9″), false, true).ToString());

        }

Under Visual Studio 2010, it is very easy to write the simple, stable, efficient procedure. However, there are some problems .For example, the mobile have great resource consumption, and need to install the mobile version of the Framework program. The market share of the windows mobile is low, and there won’t be much demand to write the program in the short time.

May 22, 2009

MSDN Subscribers can acess Visual Studio 2010 Beta 1

Filed under: Developer tools and applications — Tags: , — admin @ 10:43 pm

One of the many benefits of being an MSDN Subscriber is early (and sometimes exclusive) access to early bits. Today the long awaited beta of Visual Studio 2010 and .NET Fx 4 will appear on the MSDN Subscribers site. It’s not there yet but it will appear later on today. Keeping an eye on Twitter is usually a good way to see when it hits

Later in the week (probably Wednesday) updated documentation will be released on the Visual Studio 2010 homepage.

We’re very keen for you to download, install and evaluate Visual Studio 2010. Most importantly we really need your feedback so we can improve it.

For those of you who’ve been soldiering on with the PDC CTP VM, I’m sure this will come as a welcome relief.

It should work just fine on Windows 7 RC.

Powered by WordPress

Close
E-mail It