Click here to Skip to main content
15,902,299 members
Home / Discussions / Mobile
   

Mobile

 
QuestioneVC++ 4 - userdraw list box question Pin
LaCoder21-Jan-09 8:00
LaCoder21-Jan-09 8:00 
AnswerRe: eVC++ 4 - userdraw list box question Pin
malk0lm23-Jan-09 12:53
malk0lm23-Jan-09 12:53 
Question(nhibernate problem ) how i can one talbe(database table ) step across to access other talbe Pin
chenli051320-Jan-09 1:35
chenli051320-Jan-09 1:35 
AnswerRe: (nhibernate problem ) how i can one talbe(database table ) step across to access other talbe Pin
malk0lm23-Jan-09 12:25
malk0lm23-Jan-09 12:25 
QuestionCreate an Excel sheet from compact framework Pin
Ola E20-Jan-09 1:15
Ola E20-Jan-09 1:15 
AnswerRe: Create an Excel sheet from compact framework Pin
Lance Milleson21-Jan-09 8:32
Lance Milleson21-Jan-09 8:32 
QuestionHow to switch to existing instance of program Pin
Gregg Church19-Jan-09 5:37
Gregg Church19-Jan-09 5:37 
AnswerRe: How to switch to existing instance of program Pin
Joel Ivory Johnson19-Jan-09 12:33
professionalJoel Ivory Johnson19-Jan-09 12:33 
I am assuming you are writing using a native language (c/c++) since this is less of an issue with managed programs. I can think of two options. One involves using events, the other using the FindWindow function .

You can make use of named events so that a program knows
  • Whethere or not it is the first instance
  • If it is not the first instance the event can be used to notify the already existing instance to take focus
To use the event to detect whether or not a starting instance is the first instance all you have to do is look at the return result from a call to CreateEvent. If the return value is SUCCESS then this is the first instance of the program. If the return value is ERROR_ALREADY_EXISTS then this is a secondary instance of the program. ERROR_ALREADY_EXISTS is a successful error code and what is returned to you when this occurs is a handle to the same underlying event object that the first instance of the program is using. A full discussion of events isn't something that I can put in this reply but that is what you may want to look at.


You other option is to use the FindWindow function to see if another instance of your application is already running. If a window is found then use SetForegroundWindows to give it focus. This is far easier than using events but has drawbacks.

With the event solution you will have to make use of multiple threads. So it's more complex but also more reliable. With the FindWindow/SetForegroundWindow solution if two instances of your application are started in rapid succession then they could both check for the existence of a window before either instance has actually created a window. So neither instance will find the other. Since event creation is atomic this problem would never occurr.

Joel Ivory Johnson
My site: J2i.net
Twitter: J2iNet

QuestionHow to use BeginInvoke and Asynchronous Calls on XBOX 360 Pin
Walter Dias18-Jan-09 10:52
professionalWalter Dias18-Jan-09 10:52 
AnswerRe: How to use BeginInvoke and Asynchronous Calls on XBOX 360 Pin
Joel Ivory Johnson19-Jan-09 4:51
professionalJoel Ivory Johnson19-Jan-09 4:51 
QuestionSoftware Required To Develop Mobile Applications Using VB.net 2005 Pin
VikashGohil16-Jan-09 20:11
VikashGohil16-Jan-09 20:11 
AnswerRe: Software Required To Develop Mobile Applications Using VB.net 2005 Pin
Hurricane300017-Jan-09 4:45
Hurricane300017-Jan-09 4:45 
GeneralRe: Software Required To Develop Mobile Applications Using VB.net 2005 Pin
Joel Ivory Johnson17-Jan-09 6:58
professionalJoel Ivory Johnson17-Jan-09 6:58 
AnswerRe: Software Required To Develop Mobile Applications Using VB.net 2005 Pin
Joel Ivory Johnson17-Jan-09 6:07
professionalJoel Ivory Johnson17-Jan-09 6:07 
AnswerRe: Software Required To Develop Mobile Applications Using VB.net 2005 Pin
daniel9729-Apr-09 20:57
daniel9729-Apr-09 20:57 
QuestionWM5 development C++ - set up GUI Pin
uzziah016-Jan-09 11:22
uzziah016-Jan-09 11:22 
AnswerRe: WM5 development C++ - set up GUI Pin
Joel Ivory Johnson19-Jan-09 4:44
professionalJoel Ivory Johnson19-Jan-09 4:44 
GeneralRe: WM5 development C++ - set up GUI Pin
uzziah021-Jan-09 8:43
uzziah021-Jan-09 8:43 
GeneralRe: WM5 development C++ - set up GUI Pin
uzziah023-Jan-09 6:44
uzziah023-Jan-09 6:44 
GeneralRe: WM5 development C++ - set up GUI Pin
uzziah023-Jan-09 7:08
uzziah023-Jan-09 7:08 
QuestionWindows Mobile dll import error Pin
first_vvs77716-Jan-09 8:55
first_vvs77716-Jan-09 8:55 
QuestionRun application on WM6 based PDA startup Pin
kaushik_Manoj16-Jan-09 1:36
kaushik_Manoj16-Jan-09 1:36 
AnswerRe: Run application on WM6 based PDA startup Pin
Chaser9216-Jan-09 2:05
Chaser9216-Jan-09 2:05 
GeneralRe: Run application on WM6 based PDA startup Pin
kaushik_Manoj18-Jan-09 22:36
kaushik_Manoj18-Jan-09 22:36 
AnswerRe: Run application on WM6 based PDA startup Pin
Joel Ivory Johnson16-Jan-09 4:37
professionalJoel Ivory Johnson16-Jan-09 4:37 

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.