Link to home
Start Free TrialLog in
Avatar of ambush276
ambush276

asked on

Windows Mobile Overriding Cprog.exe

ok im creating a phone application and its not really TAPI (as if u read this site you have seen my posts before)...

anyway...

ok basically i want for when an inocming call comes in it automatically points to my app before it poitns to cprog.. this is to hopefully allow for my program to get information before cprog to hopefully not have the ringer or popup notification when people are running my program. Is there a reg edit for this... so that when people install my cab it automatically reg edits for the phone to first point to my app then cprog.exe.; so if my app is not running cprog.exe is still working and ringer etc.. is fine. But when people are using my app, any phoen data is pushed to my app first and then to cprog to hopefully not get ringer, notificaiton on incoming call etc...
Thanks!
Avatar of Mikal613
Mikal613
Flag of United States of America image

Avatar of ambush276
ambush276

ASKER

ok thati s fine... but i need help with TAPI...
because its not managed code i reallyl dont know how to use tapi becasue i dont want any popups or anything... just for my program to recieve phone info before cprog, and execute functions on the system state...

is there any Reg edit i can do before ...

so like when the app is installing the cab a Reg edit... is that possible?

because then my progfram gets info before the cprog?
no i knw what tapi is.. i knw about it... i just dont know how to use... it or code it...

see here is my code.. (below) or the working status...

basically what i was thinking is possibly doing a reg edit on the cab install to always have incoming call point to my device before cprog.exe so it always does..

now if there is some tapi function that can just point the incoming call info right to my device everytime on run that would be great... buti would need some help coding that...


thanks.!
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.WindowsMobile.Telephony;
using Microsoft.WindowsMobile.Status;
using System.Runtime.InteropServices;
 
namespace celldialer3
{
    public partial class CallKab : Form
    {
        Microsoft.WindowsMobile.Telephony.Phone p;
        SystemState _PhoneCallTalking; // declare it here, so it won't fall out of scope
        SystemState _PhoneIncomingCall;
        const int KEYEVENTF_KEYUP = 0x2;
        const int KEYEVENTF_KEYDOWN = 0x0;
        const int KEYEVENTFF_KEYUP = 0x72;
 
        [DllImport("coredll.dll")]
        public static extern void keybd_event(Keys bVk, byte bScan, int dwFlags, int dwExtraInfo);
 
        public CallKab()
        {
            InitializeComponent();
            p = new Microsoft.WindowsMobile.Telephony.Phone();
            p.Talk("9497433374");
            InitializeComponent();
            _PhoneCallTalking = new SystemState(SystemProperty.PhoneCallTalking);
            _PhoneCallTalking.Changed += new ChangeEventHandler(_PhoneCallTalking_Changed);
            _PhoneIncomingCall = new SystemState(SystemProperty.PhoneIncomingCall);
            _PhoneIncomingCall.Changed += new ChangeEventHandler(_PhoneIncomingCall_Changed);
        }
 
        private bool wasTerminated = false;
 
void _PhoneCallTalking_Changed(object sender, ChangeEventArgs args)
        {
            // this should stop both incoming and outgoing voice calls
            if (SystemState.PhoneCallTalking == true)
            {
                //F4 = red buton (hangup)
                keybd_event(Keys.F4, 0, KEYEVENTF_KEYDOWN, 0);
                keybd_event(Keys.F4, 0, KEYEVENTF_KEYUP, 0);
                wasTerminated = true;
                System.Threading.Thread.Sleep(500);  
            }
            // I'd delete above Sleep() or make it shorter
            // otherwise I'm not sure what happens first - this handler is
            // called again with PhoneCallTalking = false
            // or the next one with IncomingCall = false when you close
            // incoming call
            else if (SystemState.PhoneCallTalking == false)
            {
                if (!wasTerminated)
                {
                    MessageBox.Show("TESTING123XX1");
                    Application.Exit();
                }
                wasTerminated = false;
            }
        } 
 
 
        void _PhoneIncomingCall_Changed(object sender, ChangeEventArgs args)
        {
           MyNewFunction();
        }
 
        void MyNewFunction()
        {
            System.Threading.Thread.Sleep(8000);
 
            for (int i = 0; i <= 20; i++)
            {
                if (SystemState.PhoneIncomingCall == true)
                {
                    keybd_event(Keys.F3, 0, KEYEVENTF_KEYDOWN, 0);
                    keybd_event(Keys.F3, 0, KEYEVENTFF_KEYUP, 0);
                    System.Threading.Thread.Sleep(500);
 
                    Application.Exit();
                }
 
                if (SystemState.PhoneIncomingCall == false)
                {
                    MessageBox.Show(" Could Not Recieve Server Connection");
 
                  
                }
            }
        }
    }
}

Open in new window

does the code on Line 80 ever get hit (if you put a breakpoint)
right now its not... im having some serious problems.. i would like it too.. but i just having some problems with the code above.. ive tried in earlier posts but maybe you can help me...

ok basically in thef irst part hte phonecalltalking
if = true

then it goes to goes to those commands..

but since it ends the call, then obviously the state becomes phoneclaltalking=false.


since its then talking=false, it goes to that testing popup box...

i do NOT want it to do that. If it satifies the first part.. then i want it to SKIp the second part and go straight to the line 80 stuff (phoneincomingcall etcc..)

what do i have to change to do that>?
ok i got it to loop correctly but my question is i guess? how do i write that first TAPI part?

so basically when the registry sees an incoming call it notifies my program before Cprog.exe?

can i regedit that? or what can be done to change that????

thanks!
ASKER CERTIFIED SOLUTION
Avatar of Mikal613
Mikal613
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
was a solution of failure