473,396 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Single Instance Of App - Please Help!

Hey everyone,

I have an application that I am developing (well, that's obvious!). The
application minimizes to the system tray when it is minimized. I have a
function called Show_Click() that is part of the context menu of the tray
icon. Here's the dilemma I face. I only want to allow 1 instance of the
program (I've already done that), and have the "original" process show back
up on the screen. The problem is, if it is already on the screen (i.e. not
minimized to the system tray), it works perfectly. However, if it IS
minimized to the system tray, how can I call the "Show_Click()" function?

Thanks for any and all help!

Chad Beckner
Nov 16 '05 #1
3 1405
You can PInvoke FindWindow, ShowWindow, and SetForegroundWindow to do
this.

There is some sample code here:
http://dotnet.org.za/ernst/archive/2004/07/20/2887.aspx

--
Scott
http://www.OdeToCode.com

On Sun, 5 Sep 2004 01:24:24 -0500, "ASP .NET Newbie"
<Ch*********@ProspectiveLink.com> wrote:
Hey everyone,

I have an application that I am developing (well, that's obvious!). The
application minimizes to the system tray when it is minimized. I have a
function called Show_Click() that is part of the context menu of the tray
icon. Here's the dilemma I face. I only want to allow 1 instance of the
program (I've already done that), and have the "original" process show back
up on the screen. The problem is, if it is already on the screen (i.e. not
minimized to the system tray), it works perfectly. However, if it IS
minimized to the system tray, how can I call the "Show_Click()" function?

Thanks for any and all help!

Chad Beckner


Nov 16 '05 #2
Actually, that is where I found the code to check for single instance.
However, it does not (as far as I can tell) show how to call a function of
that process.

Ideas?

Thanks!

Chad

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:8o********************************@4ax.com...
You can PInvoke FindWindow, ShowWindow, and SetForegroundWindow to do
this.

There is some sample code here:
http://dotnet.org.za/ernst/archive/2004/07/20/2887.aspx

--
Scott
http://www.OdeToCode.com

On Sun, 5 Sep 2004 01:24:24 -0500, "ASP .NET Newbie"
<Ch*********@ProspectiveLink.com> wrote:
Hey everyone,

I have an application that I am developing (well, that's obvious!). The
application minimizes to the system tray when it is minimized. I have a
function called Show_Click() that is part of the context menu of the tray
icon. Here's the dilemma I face. I only want to allow 1 instance of the
program (I've already done that), and have the "original" process show
back
up on the screen. The problem is, if it is already on the screen (i.e.
not
minimized to the system tray), it works perfectly. However, if it IS
minimized to the system tray, how can I call the "Show_Click()" function?

Thanks for any and all help!

Chad Beckner

Nov 16 '05 #3
I believe it is in his WindowsHelper class
(WindowsHelper.ActivateWindowByHandle), which he links to here:
http://dotnet.org.za/ernst/articles/3491.aspx

--s
On Mon, 6 Sep 2004 11:34:21 -0500, "ASP .NET Newbie"
<Ch*********@ProspectiveLink.com> wrote:
Actually, that is where I found the code to check for single instance.
However, it does not (as far as I can tell) show how to call a function of
that process.

Ideas?

Thanks!

Chad

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:8o********************************@4ax.com.. .
You can PInvoke FindWindow, ShowWindow, and SetForegroundWindow to do
this.

There is some sample code here:
http://dotnet.org.za/ernst/archive/2004/07/20/2887.aspx

--
Scott
http://www.OdeToCode.com

On Sun, 5 Sep 2004 01:24:24 -0500, "ASP .NET Newbie"
<Ch*********@ProspectiveLink.com> wrote:
Hey everyone,

I have an application that I am developing (well, that's obvious!). The
application minimizes to the system tray when it is minimized. I have a
function called Show_Click() that is part of the context menu of the tray
icon. Here's the dilemma I face. I only want to allow 1 instance of the
program (I've already done that), and have the "original" process show
back
up on the screen. The problem is, if it is already on the screen (i.e.
not
minimized to the system tray), it works perfectly. However, if it IS
minimized to the system tray, how can I call the "Show_Click()" function?

Thanks for any and all help!

Chad Beckner


--
Scott
http://www.OdeToCode.com
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: dba_db2 at nospam gmx.net | last post by:
We have got a brand new mutltiprocessor machine IBM pseries server with 2 processors. Now we want to buy a IBM DB2 license for this box. Does anyone know whether it is possible to buy a single...
16
by: Elad | last post by:
Hi, I have an application that is made up of several executables. I need all these executables to use the same instance of an object. What is the best, most efficient way to approach this? ...
18
by: Steve Barnett | last post by:
I want to ensure that there is only ever one instance of my app running on a single PC at any time. I understand that I can achieve this by using a mutex and, if I can't take ownership of the...
7
by: jsale | last post by:
I have made an ASP.NET web application that connects to SQL Server, reading and writing data using classes. I was recommended to use session objects to store the data per user, because each user...
9
by: MrSpock | last post by:
1. Create a new Windows Application project. 2. Open the project properties and check "Make single instance application". 3. Build. 4. Go to the release folder and run the application. 5. Try to...
2
by: ice8595 | last post by:
Hi there, I'm having a little trouble getting this, so please excuse me if my question and description sounds confusing or juvenile. I'm creating a new class called 'Rec'. And essentially I...
13
by: JohnQ | last post by:
Why would anyone write: class SomeThing // class littered with non-domain single-instancing code :( { private: SomeThing(); static SomeThing* pInstance_; public: static SomeThing*...
3
by: sklett | last post by:
I suspect the answer might be in one of the words of my subject, but here goes anyway. I'm working on a system that will execute a very long (300+) chain of task objects. Here is some quick...
5
by: Sarath | last post by:
I've to write a single instance class. there are different methods to control the single instance of a program. I've tried the following method class CSingleton { public: CSingleton&...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.