Click here to Skip to main content
15,924,829 members
Home / Discussions / Mobile
   

Mobile

 
Questiontransparent cellphones Pin
bhanu2419-Aug-09 0:58
bhanu2419-Aug-09 0:58 
QuestionI cannot get the information about PR_EMAIL_ADDRESS Pin
nkh3717-Aug-09 20:32
nkh3717-Aug-09 20:32 
QuestionTreeview background colour / image Pin
jhorlock13-Aug-09 21:32
jhorlock13-Aug-09 21:32 
QuestionMaking Interactive CAB. Pin
mayurpurandare12-Aug-09 21:00
mayurpurandare12-Aug-09 21:00 
AnswerRe: Making Interactive CAB. Pin
slumberparty20-Aug-09 3:20
slumberparty20-Aug-09 3:20 
QuestionCSocket Problem on Windows Mobile with WLAN Pin
Member 224636612-Aug-09 2:15
Member 224636612-Aug-09 2:15 
Questiontcp connection between two android emulators in two pcs Pin
qiuxumin110-Aug-09 7:15
qiuxumin110-Aug-09 7:15 
QuestionActivateDevice returns sometimes error 110 (ERROR_OPEN_FAILED) Pin
gernot_83-Aug-09 22:06
gernot_83-Aug-09 22:06 
I want to make a GPRS connection from a WinCe 6.0 device over a handy. The programming language is C#. So I used PInvoke to call some API functions like ActivateDevice. Everything works fine. Just sometimes I the ActivateDevice func. returns the error 110. Especally if I call ActivateDevice/DeactivateDevice a few times. What I am doing wrong?

RegistryKey rkNewDevice = null;
    RegistryKey rkPortsDevice = null;
    RegistryKey rkPortsDeviceUnimodem = null;
    IntPtr contextPtr = IntPtr.Zero;


        string regString = string.Format("\\SOFTWARE\\Microsoft\\Bluetooth\\Device\\modem\\{0}",
             Address.ToString().ToLower());

        rkNewDevice = Registry.LocalMachine.CreateSubKey(regString);

        if (Authenticate)
            rkNewDevice.SetValue("auth", 1, RegistryValueKind.DWord);
        else
            rkNewDevice.SetValue("auth", 0, RegistryValueKind.DWord);

        if (Encrypt)
            rkNewDevice.SetValue("encrypt", 1, RegistryValueKind.DWord);
        else
            rkNewDevice.SetValue("encrypt", 0, RegistryValueKind.DWord);

        // check if name is set
        if (rkNewDevice.GetValue("name", "").ToString() == "")
        {
            rkNewDevice.SetValue("name", FriendlyName);
        }


        // set settings in registry ports
        regString = string.Format("\\SOFTWARE\\Microsoft\\Bluetooth\\Device\\ports\\{0}", FriendlyName);
        rkPortsDevice = Registry.LocalMachine.CreateSubKey(regString);
        rkPortsDevice.SetValue("dll", "btd.dll", RegistryValueKind.String);
        rkPortsDevice.SetValue("prefix", "BSP", RegistryValueKind.String);

        int index = FindFreePort();
        rkPortsDevice.SetValue("index", index, RegistryValueKind.DWord);

        PORTEMUPORTPARAMS pep = new PORTEMUPORTPARAMS();
        pep.uiportflags = RFCOMM_PORT_FLAGS.REMOTE_DCB;

        if (Encrypt)
            pep.uiportflags |= RFCOMM_PORT_FLAGS.ENCRYPT;

        if (Authenticate)
            pep.uiportflags |= RFCOMM_PORT_FLAGS.AUTHENTICATE;

        pep.flocal = false;
        pep.device = Address.ToInt64();
        pep.channel = Channel;

        int size = Marshal.SizeOf(typeof(PORTEMUPORTPARAMS));

        contextPtr = Marshal.AllocHGlobal(size);
        Marshal.StructureToPtr(pep, contextPtr, false);

        rkPortsDevice.SetValue("context", contextPtr.ToInt32(), RegistryValueKind.DWord);

        if (DeviceType == DeviceTypes.MODEM ||
            DeviceType == DeviceTypes.LAP ||
            DeviceType == DeviceTypes.ASYNC)
        {
            regString = string.Format("\\SOFTWARE\\Microsoft\\Bluetooth\\Device\\ports\\{0}\\unimodem",
                FriendlyName);

            rkPortsDeviceUnimodem = Registry.LocalMachine.CreateSubKey(regString);
            rkPortsDeviceUnimodem.SetValue("friendlyname", FriendlyName, RegistryValueKind.String);
            rkPortsDeviceUnimodem.SetValue("tsp", "unimodem.dll", RegistryValueKind.String);

            int devicetype = DeviceType == DeviceTypes.MODEM ? 1 : 0;
            rkPortsDeviceUnimodem.SetValue("devicetype", devicetype, RegistryValueKind.DWord);
        }

        regString = string.Format("\\SOFTWARE\\Microsoft\\Bluetooth\\Device\\ports\\{0}", FriendlyName);

        rkNewDevice.Flush();
        rkPortsDevice.Flush();
        rkPortsDeviceUnimodem.Flush();

        IntPtr devHandle = WinNative.ActivateDevice(regString, 0);

if (devHandle != IntPtr.Zero &&
            devHandle.ToInt32() != -1)
        {

            active = true;
            Handle = devHandle.ToInt32();
            rkNewDevice.SetValue("handle", Handle, RegistryValueKind.DWord);
            rkNewDevice.SetValue("active", 1, RegistryValueKind.DWord);
            rkNewDevice.SetValue("port_name", string.Format("BSP{0}:", index.ToString()), RegistryValueKind.String);
}

        rkNewDevice.Close();
        rkPortsDevice.Close();
        rkPortsDeviceUnimodem.Close();
        Marshal.FreeHGlobal(contextPtr);

QuestionDifference between Web service and RSS Pin
priya12212-Aug-09 20:15
priya12212-Aug-09 20:15 
AnswerRe: Difference between Web service and RSS [VERY modified] Pin
mysparkle4-Aug-09 5:41
mysparkle4-Aug-09 5:41 
GeneralRe: Difference between Web service and RSS [VERY modified] Pin
Vivek Vijayan7-Sep-09 1:11
Vivek Vijayan7-Sep-09 1:11 
Questionconsume web service with smart phone application using vs 2005 Pin
SEYI MAFE1-Aug-09 22:54
SEYI MAFE1-Aug-09 22:54 
AnswerRe: consume web service with smart phone application using vs 2005 Pin
Arindam Sinha7-Aug-09 2:17
Arindam Sinha7-Aug-09 2:17 
Questionproblem with creating the cab file Pin
prasadbuddhika31-Jul-09 0:35
prasadbuddhika31-Jul-09 0:35 
AnswerRe: problem with creating the cab file Pin
prasadbuddhika31-Jul-09 0:57
prasadbuddhika31-Jul-09 0:57 
Questionmonth calendar can't build when use mfc in a static library [modified] Pin
huke198730-Jul-09 21:58
huke198730-Jul-09 21:58 
QuestionDeveloping Console Like Apps For Palm OS Pin
nathanpc29-Jul-09 15:18
nathanpc29-Jul-09 15:18 
NewsWindows Marketplace for Mobile now open for app submissions Pin
brucedkyle28-Jul-09 7:12
brucedkyle28-Jul-09 7:12 
Questiontooltip control for win ce app Pin
obalesu28-Jul-09 0:11
obalesu28-Jul-09 0:11 
AnswerRe: tooltip control for win ce app Pin
HimanshuJoshi28-Jul-09 23:09
HimanshuJoshi28-Jul-09 23:09 
GeneralRe: tooltip control for win ce app Pin
obalesu29-Jul-09 3:49
obalesu29-Jul-09 3:49 
GeneralRe: tooltip control for win ce app Pin
HimanshuJoshi29-Jul-09 20:13
HimanshuJoshi29-Jul-09 20:13 
QuestionC# Rest web service and Android Client Pin
struja_ns28-Jul-09 0:03
struja_ns28-Jul-09 0:03 
AnswerRe: C# Rest web service and Android Client Pin
faheemsial2-Jun-10 22:01
faheemsial2-Jun-10 22:01 
QuestionRS232 Terminal Chat on Windows CE Emulator Pin
ChincoCodus26-Jul-09 21:47
ChincoCodus26-Jul-09 21:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.