473,626 Members | 3,265 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Run Program only once

Hello

How can i control, that a user can't start my VB.Net-Program 2 ore more times at once (maybee like Outlook)?

At same time Parameters which are transfered with the second program should be transfered to the first program.

Best regards
Josh
Dec 20 '06 #1
4 7086
If you are using VB2005, it's built in. Open the project's properties panel
(Project --WindowsApplicat ion1 Properties), select the Application tab,
make sure that "Enable application framework" is selected, and then select
"Make single instance application." To process the incoming arguments for
subsequent startups, click the "View Application Events" button on that same
panel. In the code file that appears, add an event handler for MyApplication_S tartupNextInsta nce.
In that handler, the e.CommandLine property gives you access to the new command
line.

-----
Tim Patrick - www.timaki.com
Start-to-Finish Visual Basic 2005
Hello

How can i control, that a user can't start my VB.Net-Program 2 ore
more times at once (maybee like Outlook)?

At same time Parameters which are transfered with the second program
should be transfered to the first program.

Best regards
Josh

Dec 20 '06 #2
This is what I use for VB.NET 2003:

#Region "Previous Existance Function"
' Previous Existance function
Private Function PrevInstance() As Boolean
' Check to see if another existance of the assembly is found
If UBound(System.D iagnostics.Proc ess.GetProcesse sByName(System. Diagnostics.Pro cess.GetCurrent Process.Process Name)) 0 Then
' Yes, it was - return true
Return True
' No previous existance found - return false
Else
Return False
End If
End Function

#End Region

Usage:

' Check for previous existance of the application
If PrevInstance() = True Then
' Display a message box if a previous existance exists
MessageBox.Show ("The application is already running. Press OK to exit", Me.Text, MessageBoxButto ns.OK, MessageBoxIcon. Error)
' End the application (see note at bottom of header above)
End
End If

I hope this helps,

Newbie Coder
"Josh Burkard" <jb@josh-burkard.chwrote in message news:81******** *************** ***********@mic rosoft.com...
Hello

How can i control, that a user can't start my VB.Net-Program 2 ore more times at once (maybee like Outlook)?

At same time Parameters which are transfered with the second program should be transfered to the first program.

Best regards
Josh
Dec 20 '06 #3
Josh,

Rereading the excelent answer from Tim, if it is for versions before 2005 than is this in my idea the best result from endless discussion about this question on this board.

http://www.vb-tips.com/dbpages.aspx?...6-343ac05a7617

Keep in mind that our website is under construction at the moment

Cor

"Josh Burkard" <jb@josh-burkard.chschre ef in bericht news:81******** *************** ***********@mic rosoft.com...
Hello

How can i control, that a user can't start my VB.Net-Program 2 ore more times at once (maybee like Outlook)?

At same time Parameters which are transfered with the second program should be transfered to the first program.

Best regards
Josh
Dec 21 '06 #4
Thanks & Best Regards

Josh

"Tim Patrick" <in*****@invali d.com.invalidsc hrieb im Newsbeitrag
news:e3******** *************** **@newsgroups.c omcast.net...
If you are using VB2005, it's built in. Open the project's properties
panel (Project --WindowsApplicat ion1 Properties), select the Application
tab, make sure that "Enable application framework" is selected, and then
select "Make single instance application." To process the incoming
arguments for subsequent startups, click the "View Application Events"
button on that same panel. In the code file that appears, add an event
handler for MyApplication_S tartupNextInsta nce. In that handler, the
e.CommandLine property gives you access to the new command line.

-----
Tim Patrick - www.timaki.com
Start-to-Finish Visual Basic 2005
>Hello

How can i control, that a user can't start my VB.Net-Program 2 ore
more times at once (maybee like Outlook)?

At same time Parameters which are transfered with the second program
should be transfered to the first program.

Best regards
Josh

Dec 21 '06 #5

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

Similar topics

1
2358
by: Hung Jung Lu | last post by:
Hi, I have been looking into AOP (Aspect-Oriented Programming) for sometime, now. I frankly don't like the syntax of any of the approaches I have seen so far. I am kind playing around with some ideas, and maybe write up an article later. AOP is not just buzzword. It's not just callback, it's not just Ruby's MixIn, it's not just Python's metaclass, it's not just C++'s template. AOP can be implemented/considered as a subset of...
33
3473
by: Nick Evans | last post by:
Hello there, I have been on and off learning to code (with python being the second language I have worked on after a bit of BASIC). What I really want to know is, if you are going to actually write a program or a project of some sort, how do you actually start. Picture this, you know what you want the program to do (its features), you have a possably rough idea of how the program will work. You have opened an empty text file and saved...
17
3992
by: los | last post by:
Hi, I'm trying to create a program similar to that of Google's desktop that will crawl through the hard drive and index files. I have written the program and as of now I just put the thread to sleep for 1 second after indexing a couple of files. I'm wondering if anyone knows of a way that I could make so that the program will run at full speed only runs after the computer has been idle for a while. I've looked at the "nice" command...
22
3590
by: edgrsprj | last post by:
PROPOSED EARTHQUAKE FORECASTING COMPUTER PROGRAM DEVELOPMENT EFFORT Posted July 11, 2005 My main earthquake forecasting Web page is: http://www.freewebz.com/eq-forecasting/Data.html Newsgroup Readers: If you circulate copies of this report to groups of computer programmers at different universities etc. around the world then they might find the subject matter to be interesting.
1
1993
by: Arnold | last post by:
I need to modify my existing program into two separate executables. The first exe will be executed once to initiate a hardware card, the second program exe can be called multiple times to process data. The second program calls a member function of the first program so it needs access to the object created by the first exe. How can I do this? More if details if you are curious: I am writing a program which initializes and loads up a pci...
9
4525
by: Hemal | last post by:
Hi All, I need to know the memory required by a c program. Is there any tool/utility which can give me the memory usage in terms of DATA segment, TEXT segment, BSS segment etc. I am working on linux platform and my target is ARM processor. But i guess it should not matter. Actually i need to know both RAM & ROM usage.
22
60225
Frinavale
by: Frinavale | last post by:
How To Use A Database In Your Program Many .NET solutions are database driven and so many of us often wonder how to access the database. To help you understand the answer to this question I've provided the following as a quick example of how to retrieve data from a database. In order to connect to a SQL Server Database using .NET you will need to import the System.Data.SqlClient package into your program. If you are not connecting to a...
334
11441
by: Antoninus Twink | last post by:
The function below is from Richard HeathField's fgetline program. For some reason, it makes three passes through the string (a strlen(), a strcpy() then another pass to change dots) when two would clearly be sufficient. This could lead to unnecessarily bad performance on very long strings. It is also written in a hard-to-read and clunky style. char *dot_to_underscore(const char *s) { char *t = malloc(strlen(s) + 1); if(t != NULL)
2
19337
Banfa
by: Banfa | last post by:
Posted by Banfa The previous tutorial discussed what programming is, what we are trying to achieve, the answer being a list of instructions constituting a valid program. Now we will discuss how we set about doing that. Every program starts with a specification, this may be a several hundred page document from your latest client or one small paragraph from your professor and pretty much anything in-between. The specification is very...
3
1780
by: Dean Slindee | last post by:
Need to write a standalone application that processes data once per day. Looking for the application program types available that would satisfy these requirements: Requirements: 1. Unattended processing that looks for rows in tables in a SQL Server database that is updated in batch once per day via another company's daily process. The newly added rows are selected based on a process date parameter (see #4). 2. Cleans and reformats the...
0
8265
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8196
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8364
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
7193
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
5574
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
4092
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...
1
2625
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
1
1808
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1511
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.