|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Run Program only onceHello
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 If you are using VB2005, it's built in. Open the project's properties panel
(Project --> WindowsApplication1 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_StartupNextInstance. 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 Show quoteHide quote > 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 Thanks & Best Regards
Josh Show quoteHide quote "Tim Patrick" <inva***@invalid.com.invalid> schrieb im Newsbeitrag news:e3b469763e248c8f226e2b4935e@newsgroups.comcast.net... > If you are using VB2005, it's built in. Open the project's properties > panel (Project --> WindowsApplication1 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_StartupNextInstance. 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 > > 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.Diagnostics.Process.GetProcessesByName(System.Diagnostics.Process.GetCurrentProcess.ProcessName)) > 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, MessageBoxButtons.OK, MessageBoxIcon.Error) ' End the application (see note at bottom of header above) End End If I hope this helps, Newbie Coder "Josh Burkard" <j*@josh-burkard.ch> wrote in message news:814A21E1-BC6C-462E-94AE-05402EE4B6A6@microsoft.com... How can i control, that a user can't start my VB.Net-Program 2 ore more times at once (maybee like Outlook)?Hello At same time Parameters which are transfered with the second program should be transfered to the first program. Best regards Josh 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?ID=59135549-e5dd-4501-9526-343ac05a7617 Keep in mind that our website is under construction at the moment Cor "Josh Burkard" <j*@josh-burkard.ch> schreef in bericht news:814A21E1-BC6C-462E-94AE-05402EE4B6A6@microsoft.com... How can i control, that a user can't start my VB.Net-Program 2 ore more times at once (maybee like Outlook)?Hello At same time Parameters which are transfered with the second program should be transfered to the first program. Best regards Josh
VB.Net advice needed
Windows History Deletion Using Web.config's <system.web><pages><controls><add /></controls></pages></system.web> To Register VB and CCTV System.Nullable 2.0 Framework Datagridview...cepopulating Mailmerge date problem Running installed application asks for MSI Threading How to logon to network server via code |
|||||||||||||||||||||||