473,809 Members | 2,718 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1426
You can PInvoke FindWindow, ShowWindow, and SetForegroundWi ndow 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*********@Pr ospectiveLink.c om> 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.c om...
You can PInvoke FindWindow, ShowWindow, and SetForegroundWi ndow 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*********@Pr ospectiveLink.c om> 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. ActivateWindowB yHandle), 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*********@Pr ospectiveLink.c om> 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 SetForegroundWi ndow 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*********@Pr ospectiveLink.c om> wrote:
Hey everyone,

I have an application that I am developing (well, that's obvious!). The
applicatio n 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
5241
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 processor db2 license for this machine and to configure the db2 software with db2licm just to use one processor.
16
10149
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? Thanks a lot!
18
5667
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 mutex, I know there is another instance of my program running. Problem is, how do I get the "new" instance to communicate with the "old" instance? The new one will have been started with a command line parameter that I want to pass to the old...
7
2164
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 using the application needs to see their own data only. My problem is that when multiple users are in the application, when in the session object, data is fine, however as there is only one instance of the class files, when data is put into them,...
9
5116
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 open a second instance of the application. This will cause an unhandled exception and the "Send Error Report" box shows up. Does this happen to anyone else, or is it just me? Debug info: "Unhandled exception at 0x00e149fd in...
2
2345
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 want to reuse the same instance object (myInstance) every time. So it would be created the first time i initiate the constructor, but the following times it would just refer back to the same one. //the specification class Rec {
13
5392
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* getInstance()
3
1720
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 pseudo code to illustrate: public class VideoAcquisition { public Image GetFrame(){}; // other stuff
5
1699
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& GetInstance(){ static CSingleton s; return s; } private:
0
10639
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10383
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10120
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9200
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5688
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.