Problem with GotFocus and Shell

Discussion in 'Questions (Windows Mobile)' started by epsharp, Apr 30, 2009.

  1. epsharp

    epsharp Member Licensed User

    I have in a very large database system where a shell command opens two duplicate programs. To avoid uploading a ton of stuff, the attached duplicates my problem.

    In my program, I use a textbox superimposed on a combobox that is loaded by a database table for updating, but clicking the textbox takes you to the database table update program.

    No matter what I have tried, I always get two programs running.:sign0085:

    Regards,

    Ed Sharp
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    A possible solution is too use a timer with a small interval to run Shell:
    Code:
    Sub Globals
        
    'Declare the global variables here.
    End Sub

    Sub App_Start
        Form1.Show
        AddTimer(
    "timer1")
        timer1.interval = 
    10
    End Sub

    Sub tCalc_GotFocus
        bExit.Focus
        Timer1.Enabled = 
    True
    End Sub
    Sub Timer1_Tick
        Timer1.Enabled = 
    False
        
    Shell("calc.exe","")
    End Sub

    Sub bExit_Click
        AppClose
    End Sub
     
  3. epsharp

    epsharp Member Licensed User

    Thank you Erel for your assistance.

    Having previous Table Selection Focus problems, I had already tried the "Timer" solution . My program already had a timer running but with a 1000 interval. Unfortunately, I used a switch to call a "new" focus routine instead of simply placing the Shell command in the Timer Tick and this still produced duplicate programs.

    Using your code as Timer2 worked perfectly.

    Thanks again.

    Ed Sharp
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice