473,406 Members | 2,352 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,406 software developers and data experts.

how to make the exe file be a single application on running mode

xxoulmate
how to make the exe file made in vb to be run only once..,
i mean is only one application can be run a time.

commonly we can run multi application of a specific exe file..
ex. test.exe
can be run as many as we can....
how can it be set that exe to be not run so many, and i wanted is just one only.
how can it be done..
tnx more power.....
Dec 18 '07 #1
10 1573
lotus18
866 512MB
how to make the exe file made in vb to be run only once..,
i mean is only one application can be run a time.

commonly we can run multi application of a specific exe file..
ex. test.exe
can be run as many as we can....
how can it be set that exe to be not run so many, and i wanted is just one only.
how can it be done..
tnx more power.....
Hi

If I got your question add this to your codes:

Expand|Select|Wrap|Line Numbers
  1. If App.PrevInstance = True Then
  2.         MsgBox "Cannot run the program. Program is already running.", 64
  3.         End
  4. End If
'This will check if your application is already running.

Note: Add this codes at the start of your program (Sub Main). Be sure your Startup object is your Sub Main.

Expand|Select|Wrap|Line Numbers
  1. Public Sub Main()
  2. <Add it here>
  3. <Your first form to be showed>
  4. ...
  5. End Sub
  6.  

Rey Sean
Dec 18 '07 #2
vdraceil
236 100+
Hi

If I got your question add this to your codes:

Expand|Select|Wrap|Line Numbers
  1. If App.PrevInstance = True Then
  2.         MsgBox "Cannot run the program. Program is already running.", 64
  3.         End
  4. End If
'This will check if your application is already running.

Note: Add this codes at the start of your program (Sub Main). Be sure your Startup object is your Sub Main.

Expand|Select|Wrap|Line Numbers
  1. Public Sub Main()
  2. <Add it here>
  3. <Your first form to be showed>
  4. ...
  5. End Sub
  6.  

Rey Sean
Is it necessary to add that code in main()? I think it would run even if it is added to form's load event...
Till now i've never used main(). Pls can u give me the place where main() must be strictly used..
Jan 3 '08 #3
lotus18
866 512MB
Is it necessary to add that code in main()? I think it would run even if it is added to form's load event...
Yes you are right, it is not necessary to add that code in Sub Main(). Perhaps you can add that in a splash form (if you have).
Till now i've never used main(). Pls can u give me the place where main() must be strictly used..
What do you mean by this?

Rey Sean
Jan 3 '08 #4
Killer42
8,435 Expert 8TB
What do you mean by this?
vdraceil must be using a startup form, rather than Sub Main.

One thing to note. I'm pretty sure I have encountered an error when I used the End statement in Sub Main. If this happens, just change the End to Exit Sub. As long as you haven't loaded any forms yet, this should work OK.
Jan 4 '08 #5
lotus18
866 512MB
vdraceil must be using a startup form, rather than Sub Main.
Maybe vdraceil didn't understand my post (2nd). OK, it's my fault, insufficient explanation : )

Rey Sean
Jan 4 '08 #6
vdraceil
236 100+
Maybe vdraceil didn't understand my post (2nd). OK, it's my fault, insufficient explanation : )

Rey Sean
U were clear with the use of PrevInstance property..as killer said i always use a startup form..i just wanted to know why programmers use sub main()? Is there any advantage in using it?
Jan 4 '08 #7
Killer42
8,435 Expert 8TB
U were clear with the use of PrevInstance property..as killer said i always use a startup form..i just wanted to know why programmers use sub main()? Is there any advantage in using it?
To be honest, I think it's largely a matter of personal preference.

On the other hand, a form is really just a user interface element (similar in many ways to a text box or scroll bar). So in some ways it seems more logical to start the actual program and have it display whatever forms are appropriate, rather than starting up a form and then having other things happen. I mean, you wouldn't expect to run a text box and have it create a form to hold it, and so on.

Besides, there may be cases where your application doesn't include a form at all. For instance, I sometimes write a "quick and dirty" program to read a text file, make some change, and write out a new one. For something that only I will run, and which will take maybe five seconds, a user interface is just a waste of time. It's simpler to just write the routine to do the work, and run it.
Jan 4 '08 #8
thnx for post.,
ill try the code.,
Jan 17 '08 #9
Killer42
8,435 Expert 8TB
Let us know how it turns out.
Jan 17 '08 #10
many thanks.,
it runs as i wish......
Jan 19 '08 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Sebastian | last post by:
Dear members, I'am thinking about the "best" way to connect to my sql-server via ADO.Net (if there is a best way). My application uses the sql-server very intensively. At the moment every...
0
by: Imran Aziz | last post by:
Hello All, I have developed an ASP.net application using the latest beta release (version 2 beta 2)of dot net using Visual studio .net express edition. I have been testing the application using...
4
by: xTroLL | last post by:
Hi, I want to get the running mode (DEBUG or RELEASE) of my application ? Somebody can help me ? xTroLL --------------= Posted using GrabIt =---------------- ------= Binary Usenet...
9
by: Abhishek Srivastava | last post by:
Hello All, In IIS 6.0 We have a concept of worker processes and application pools. As I understand it, we can have multiple worker process per appliction pool. Each worker process is dedicated...
0
by: Paul | last post by:
I have an application and was thinking of creating a make file for it to be deployed on different servers. The application will need to have a global assembly registered using the GACUTIL and it...
2
by: Tim Diggle | last post by:
I'm trying to enter data into a database application running under Citrix ICA Client. I'm doing it from a VBA macro running under Microsoft Excel 2000 (although it may need to be backwardly...
1
by: mortenf | last post by:
I am in need of a method of writing a byte sequence to a file opened in text mode without translating <lf> ('\n') to <cr><lf> when compiling for MSDOS platform. Is there a way of skipping this...
6
by: buffinator | last post by:
I have two applications that should work together, let's call them A and B. The first time A starts, it should open a B process and start communicating with it. All other times an A instance...
3
by: prajakta143 | last post by:
Problem Statement: Is there any way to recognize the binary file is in Release mode or in Debug mode from the core file :: Details :: I have core file with me, & wan't to know the mode of...
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: 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
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,...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.