How Do You Close An Open App?
If I want to close something with code, and I know its running, like ms word or something, how would I go about doing that?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
- Should I Have 100s Of Winsock Connections Open/close.. Or Keep Them Open (hard Q)?
- Open An Excel Worksheet, Close It, Perform Cleanup And Open It Again - Can't Do It
- Open A File, Close It, Open Next.
- Open A File, Close It, Open Next.
- Close Then Re-open App
- Open Close
- Open/close Cd-rom
- Close An Open Exe From A Different Exe
- Open/Close Cd Rom
- Close And Open Again ...
- On Close Open App
- How To Open/close CD-ROM?
- Close Exe That's Open?
- If Open Then How To Close
- Close All IEs Open
- CD Open And Close
- ? On Open / Close Files In VB
- Open/Close Program
- Open And Close Access
- Close Open Folder
- If Recordset Open, Close
- How To Close.. Open Program
- Open And Close With 1 Button :(
- Do Not Close App If FORMS Are Open
- Open And Wait To Close
- How To Close All Open Files...
- Open/Close, Write/Put...
- New - Close Open *DELETED*
- Help Me Close Open Programs
- How I Close All Form That Open Under Mdi?
- Open/close Cd Error...
- Open Exe File, On Close Do...
- Open, First, Next, Last , Prev, Close
- Keep Connection Or Close && Re-open?
- How Can I Check And Close Any Open Cn Or Rs
- Open And Close Txt File
- Close Program If There Are 2 Of Them Open.
- Close Files That Are Not Open
- Close All Open VB Windows.
- Close, Set, OPEN.....connection...
- Close All Open IE Browsers From Within VB6
- Open And Close Other .exe Files
- [Resoloved]Close And Open?
- FileSystemObject Close Or Open
- How To Close A Window That You Did Not Open
- Close All Open Files
- How To Close ADO Recordset If Already Open
- Open/Close CD ROM Drive??
- How To Close All Open Recordsets?
Should I Have 100s Of Winsock Connections Open/close.. Or Keep Them Open (hard Q)?
Hello
Ive got a server to which many clients connect to.
They each are given a few tasks to complete - which may or may not take a long time to finish, and after each task is done they send back the result.
This has caused massive amounts of problems for me. Right now I keep the connections open all the time. My server listens on one particular winsock control on a particular port to which all clients connect. It then accepts the connection request thru a second array of winsocks, so each client is connected to the server via the array via one connection.
There is generally no problem sending out the tasks thru that single connection/client - but receiving is a problem. The client may need to send back a few hundred kb at a time but since it was completing several tasks at once - it is not always received correctly. My guess is because taskA is sending data thru the connection at the same time as taskB - and the data isnt received right (each task sends its data via a <start> and an <end> string so I know where the start/end of data is and when transmission is over). Its important to note that the tasks are multithreaded (via a 3rd party control)
The data is sent in one line per task. winsock.SendData theResult. But many tasks can complete at around the same time. I thought that VB would wait until the data was completely sent (for one lines code) before moving on... but I dont think this is happening. I even tried adding a DoEvents but to no avail - I still cant receive the data properly. Maybe winsock is 'skipping over' some data - I dont know. (Kinda like when if you 'break' the application winsock does not get incoming data and when you resume it still wont pick it up)
So Ive got 2 options..
1) Somehow figure out how to receive data properly when multiple tasks finish on a client at around the same time and they send data at the same time - basically making the program send the data of a task and not continue until the data has been sent, then send another tasks data.
2) Use many connections. Basically the max # of tasks running at once will be about 10. So the idea is to have another winsock array of 10, each dedicated to one task, and when a task is completed - connect thru the winsock array, send the data, and when the server receives it - it disconnects.
3) A mixture of 1 and 2 - have the 10 winsocks connect to the server and be open at the same time, then I can just send data and receive via a specific winsock array control and there is no problem distinguishing taskA from taskB from taskC on a client, or client from client.
But honestly.. I dont know if its 'bad' to have lots of connections open and close all the time. And I dont know if its 'bad' to have thousands of connections open at the same time either..
What do you guys think?
Open A File, Close It, Open Next.
I've got my searching code going now, but I'm looking for a way to tell the program to load each file in a directory, one at a time, search, close it, move on to the next. And I have no clue how to do that. Any ideas?
Thanks in advance.
-Jer
Open A File, Close It, Open Next.
I've got my searching code going now, but I'm looking for a way to tell the program to load each file in a directory, one at a time, search, close it, move on to the next. And I have no clue how to do that. Any ideas?
Thanks in advance.
-Jer
Close Then Re-open App
I am trying to find a solution that will close and then re-open a vb app if it is idle for more than 30 mins
The reason is because I was told that vb apps don't release memory so I want to sort of "auto release or refresh the memory" any ideas?
Open Close
When i user this code to open a file:
Code:
Open FName For Input As #1
Input #1, Data
Close #1
Edit1.Text = Data
It opens the first line or up to the next ','. What is the correct method for opening a file?
Close An Open Exe From A Different Exe
How do I close an open Exe from another Exe?
Once I close this Exe I want to delete this Exe from another Exe, Please let me know as to how can I do this?
On Close Open App
how do i do something like on close of application or on error open "shell code here"
How To Open/close CD-ROM?
Hi
Does anybody know how to open/close CD-ROM?
I'm really a amatuer so..............
Thnx!
Netherlands
Close Exe That's Open?
I need to close an Exe that's already running. I know the window title, and the name of the exe. Thanks for any help!
If Open Then How To Close
In my code I'm creating a log file of some of the events I'm trying to track. Every now and then when the program checks to see if the log file exists it flags that its open then immediately exist the sub. Meanwhile it missed an entry. The error I receive tells me that the log file is open when checking for the existance.
What am I missing:
Code:
'declaration
Public strChecker As String
'create migration logs
Public Sub LogName()
Dim strLog As String
Dim Location As String
Location = App.Path & ""
strLog = Location & strLogName & ".log"
strChecker = strLog
FileExists
If intTest <> 0 Then
Open strLog For Append As #1
Else
Open strLog For Output As #1
End If
'the information for the log goes below
end sub
''if intTest=0, then there is no file to replace. Anything else means it exists.
Public Sub FileExists()
intTest = Not (Dir(strChecker) = "")
strChecker = ""
End Sub
If the log file was left open for some reason intTest returns a -1 indicating the fileexists, thats good, but when it returns to the if then above and tries to append the file it jumps out.
Is there a way to check to see if "c:crap.log" is open before appending then close it.
TIA,
Close All IEs Open
Anyone have a code to closes all instances of IE open,not just the active one?
Thanks
CD Open And Close
does anyone know how you can open and close the cd-rom drive with visual basic?
? On Open / Close Files In VB
Hi,
I have a text file (see below) that I only care for "Port x/xx" at the end of each line. This is the output of a Cisco switch from issuing the "show logging buffer 1023" command and the output is being captured to a text file.
What is the best way to remove all the duplicated "Port x/xx" on each line?
Based on my limited VB experience, I can only think of opening 2 files within VB. 1) being input and the other being output. Read the text file one line at a time and using a string command to keep only "Port x/xx" and write that info into a second file. In the end, I will have the second file that contains all the "Port x/xx" with no similar entries.
I notice using open/close files in VB is time consuming imagine there are 25 of such logs I have to go through. Are there different or quicker methods to get this done?
Thanks in Advance,
Log file starts here
==============
2004 Mar 09 09:34:05 %PAGP-5-PORTTOSTP:Port 3/14 joined bridge port 3/14
2004 Mar 09 09:34:25 %PAGP-5-PORTFROMSTP:Port 3/14 left bridge port 3/14
2004 Mar 09 09:34:33 %PAGP-5-PORTTOSTP:Port 3/14 joined bridge port 3/14
2004 Mar 09 10:02:38 %CDP-4-DUPLEXMISMATCH:Full/half duplex mismatch detected on port 3/11
2004 Mar 09 10:03:46 %PAGP-5-PORTTOSTP:Port 2/28 joined bridge port 2/28
2004 Mar 09 10:32:46 %PAGP-5-PORTFROMSTP:Port 3/22 left bridge port 3/22
2004 Mar 09 10:32:54 %PAGP-5-PORTTOSTP:Port 3/22 joined bridge port 3/22
2004 Mar 09 10:34:38 %CDP-4-DUPLEXMISMATCH:Full/half duplex mismatch detected on port 3/11
2004 Mar 09 10:37:50 %PAGP-5-PORTFROMSTP:Port 3/22 left bridge port 3/22
2004 Mar 09 10:37:59 %PAGP-5-PORTTOSTP:Port 3/22 joined bridge port 3/22
2004 Mar 09 10:42:10 %PAGP-5-PORTFROMSTP:Port 3/22 left bridge port 3/22
2004 Mar 09 10:42:18 %PAGP-5-PORTTOSTP:Port 3/22 joined bridge port 3/22
2004 Mar 09 11:06:38 %CDP-4-DUPLEXMISMATCH:Full/half duplex mismatch detected on port 3/11
2004 Mar 09 11:23:33 %PAGP-5-PORTFROMSTP:Port 3/32 left bridge port 3/32
2004 Mar 09 11:24:04 %PAGP-5-PORTTOSTP:Port 3/32 joined bridge port 3/32
2004 Mar 09 11:24:44 %PAGP-5-PORTFROMSTP:Port 3/32 left bridge port 3/32
2004 Mar 09 11:25:18 %PAGP-5-PORTTOSTP:Port 3/32 joined bridge port 3/32
2004 Mar 09 11:26:28 %PAGP-5-PORTFROMSTP:Port 3/32 left bridge port 3/32
2004 Mar 09 11:26:34 %PAGP-5-PORTTOSTP:Port 3/32 joined bridge port 3/32
2004 Mar 09 11:38:38 %CDP-4-DUPLEXMISMATCH:Full/half duplex mismatch detected on port 3/11
2004 Mar 09 12:10:38 %CDP-4-DUPLEXMISMATCH:Full/half duplex mismatch detected on port 3/11
2004 Mar 09 12:42:38 %CDP-4-DUPLEXMISMATCH:Full/half duplex mismatch detected on port 3/11
Log file ends here
==============
Open/Close Program
I'm trying to write a program that will be able to open a file, apply values from the file in an array, close that file. If I try to open another file and apply a different number of values to the same array (even if I redimension it first), I get a 'Subscript out of range' error.
I think the best way around this error is if I can simply restart the program.
Is there a way to run a separate vb program that will close the current program, and re-open it?
Open And Close Access
Sounds simple enough, but I'm not quite sure where to start. I used the tutorial for opening and closing Excel, but it looks like the commands are different and after a lot of searching, I still cannot find a code example of how to open and close Access from VB. If someone could share a code snippet, I'd really appreciate it!
Close Open Folder
I am using a shell command to open a folder. How can I close it afterwards?
If Recordset Open, Close
VBA for Access 2002:
What's the best way to do this? The two examples below produce Object Variable ir Wirh Block not set, or Runtime 91 errors
' if recordset is open, close
If rs.State = 1 Then rs.Close
If rs.State And adStateOpen Then rs.Close
Thanks in advance for the help...
How To Close.. Open Program
I use the shell program to open my internet explorer.... Now I want to close it by clicking a button on my program... How can I do this.. does any one could give me a code.. thanks
Open And Close With 1 Button :(
hello ppl, i'm new to vb and i have a problem...
i have 2 forms.
the 1st with a button called 'show wage details'
the 2nd form which has no buttons (no buttons needed).
now my problem...
i want to use the 'show wage details' button, so th@ when its pressed, the 2nd form will show, the caption will change from 'show .....' to 'hide ......' and then if th@ button is now pressed after the caption change, it will hide the 2nd form and re-display 'show .....' again.
i can change the caption and show the 2nd form, but i cant get my button 2 function as a hide form or get the caption to change.
plz if ne1 can help me, i'd be very greatful
thanx for the help
Do Not Close App If FORMS Are Open
Is there a way of stopping an application from closing if other forms are still loaded. So before they can close the app they must close the other forms.
I know you can do if form.visible then cancel = true
but is there a general thing where it knows whether other forms are visible or not.
Thanks
Open And Wait To Close
Hi, How I can open a file using the Filename, and wait to be closed, it means, stops the code execution.
Thanks !!
How To Close All Open Files...
I open a file to write to it, but sometimes it will come back and say file already open. How can I make sure that all the files in my application are closed?
Open/Close, Write/Put...
I have a server/client program that I have been working on. The client opens up and ftp's its ip to a secure site. The server starts up and downloads all the ip's from the ftp site.
The purpose of this is to be able to help friends with their pc's AND as a way to kind of set up a server for a game I have been working on for me and a few friends. This would allow for easier connections and help me avoid having to send ip's over email before each session.
It then pings and lists all available ip's. I request a connection and I am accepted. I request a directory listing and receive it.
I need to be able to download files from the other computer. I have been succesful with .txt files but NOT with .jpg and other formats. Here is what I was using.
The client does this:
Dim i As Integer
Dim sTxt As String
i = FreeFile
Open strFileToSend For Binary As #i
Do Until EOF(i)
DoEvents
Line Input #i, sTxt
buff = buff & sTxt & vbCrLf
Loop
Close #i
wsClient.SendData "FILE" & strFileToSend & "," & buff
The server does this:
Open sFile For Binary As #1
Put #1, , strFileData
Close #1
I have never worked with winsock much and admit I don't really understand what opening as binary does.... is there anything obvious to you that I am not seeing.
Basically I need to be able to request and receive files from other pc. Thanks for ANY help you can offer. This is currently the only thing holding my project up. Thanks.
Help Me Close Open Programs
In my program i want to "see" the path of all programs and close certain one
s, depending on the users settings. How do i find the paths of OPEN programs
and then terminate them?
Open/close Cd Error...
i have this code that should open/close the cd-rom when i click on a button but it gives an error wich i dont understand. What is wrong with it?
This is the code i use.
Code:
Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Dim lngReturn As Long
Dim strReturn As Long
'This one opens the cd door:
lngReturn = mciSendString("set CDAudio door open", strReturn, 127, 0)
'and this one closes the cd door:
lngReturn = mciSendString("set CDAudio door closed", strReturn, 127, 0)
Open Exe File, On Close Do...
A bit cryptic...
What i want is, to start a exe file (with shell command). If i close this same exe file ,the program (code) witch has started the exe must do something. How can i do this???
Carlito
Open, First, Next, Last , Prev, Close
(new at databases) I'm at the onset of trying to create a simple example of a bringing up one-at-a-time (Access 2000) table databases (topics: one db on colleges, one db on airports, one db on students) and displaying the contents in individual textboxes ... not using the ADO or Data control as the goal is to build this without using a control and manually code all buttons and making the fields show up in specific textboxes.
I have created an interface that has:
- one input textbox to enter the desired database name - user has a choice of three.
- one command button to open the entered database name.
- various command buttons for moving to First, Next, Last, Prev records and possibly adding, deleting, searching records.
- various textboxes for every individual item to display based upon which database was entered ... such as college or airport name, code, address, city, state, zip, phone, website, email address, etc., SSN, student name, student address, etc.
I know the db has to be opened, recordsets defined, txtboxes defined, amongst other events that I'm unsure of ... I'm looking to see if there is an example on something like this? Then I could see the pieces needed and how it's put together. Just something similar, even if it only shows one database, that would give me an idea how to do this.
I can show what I've done so far, no way is it close, just has snippets of code for now, definitely not complete, but it's where I am at ...
Can anyone help? simple examples?
Attached what I have built so far.
Keep Connection Or Close && Re-open?
I have a VB app that allows up to 10 clients to access an Access 97 db (typically about 50 meg in size) on an NT server. Each client opens one connection to the database and the connection remains open as long as the app is running. The app typically needs to create and close many recordsets.
Anyone have an opinion as to whether this is a poor practice? If so, what problems might it cause. Also, what effects might I see if I continually open and close connections as they are needed?
(using DAO now but am currently upgrading to ADO)
How Can I Check And Close Any Open Cn Or Rs
Hello
How can I check is there any Open Connection or Recordset to database from any where taht I need?
And how can I close any open Database any time I need?
VB6 & Access & ADO
Thanks
Open And Close Txt File
hi im trying to align the name and the email address can someone help me out?
Private Sub cmdcontact_Click()
'Save Contact
Open "contact.txt" For Append As #1
Printer.Print "txtname.Text", "txtemail.Text"
MsgBox ("Contact Saved")
End Sub
it ends up coming out like this in the text file
jim mack jmack@gmail.com
Albert Sanchez ASanchez@gmail.com
Chris Jones Cjones@mail.com
Close Program If There Are 2 Of Them Open.
Well. I am designing a new program and it's a trial run with only one allowed per machine. so you can't have like 30 open.
do you know how to make it so it closes if there are two projects open
Close Files That Are Not Open
I am downloading file from the internet with freefile
FileOne = Freefile
FileTwo = Freefile
FileThree = FreeFile
After each file is downloaded then
Close #FileOne, Close #FileTwo, Close #FileThree
The connection could be interupted at any point or the form closed
Is this wrong?
on error resume next
Close #fileOne
close #filetwo
close #file Three
On error goto error handler
I realize i could write a module boolean for each file and set it to true when they get succeffuly opened and then downloaded and then selectly close them.
Sure be a lot easier to just close them all even if they are not open.
Bad idea?
Close All Open VB Windows.
Is there a way to close all the open code and form windows in VB?
It's just that when I stop the program I have to wait for all the open windows to refresh before I can do anything.
It's getting worse as my program gets bigger.
Close, Set, OPEN.....connection...
head fired!!!!!!!!
When i click on button4 (this button UPGRADE record in mdb) have this message:
"opearation not possible if object is open....." error 3705
WHY!!!!!!
Open And Close Other .exe Files
I want to write my own online update system. I have several reasons for that as most of my updates are data related. I want to be able to load a different .exe file from my program and then shut down my program to replace it's .exe file if needed.
Is it possible to open another .exe file from VB and also to close any running instance of a program from VB...
Something like this
From myProgram
Command1_Click
Open myUpdates.exe
From myUpdates.exe
Command_Click
Close myProgram.exe (All Open Instances)
Can anyone help please !!!
Thanks
Chris
FileSystemObject Close Or Open
Hi,
I have sample code as following, is there anyway of checking the file's open/close status before invoke mobjFile.close? since it will be a run time error if you try to close a already closed file.
HTML Code:
Private mobjFileSys As FileSystemObject
On Error GoTo Error
Set mobjFileSys = CreateObject("Scripting.FileSystemObject")
Set mobjFile = mobjFileSys.CreateTextFile(strTargetFile, True)
....
Error:
mobjFile.close
Thanks,
Robert
How To Close A Window That You Did Not Open
Hi,
if my VB prog is running and a new window opens (one that i did not ask for) is there a way to close it automatically.
I think this is to do with handles, but i am unsure of this.
Regards
Terry
Close All Open Files
Is there a simple way to close all files that have been opened
with the Open and FreeFile function? If you dont know what file
numbers are open, to avoid any closing errors, if you loop
through some file numbers you will get an error if the file is
already closed. I want to avoid looping and the error.
Is the anything like a "Close All" function?
How To Close ADO Recordset If Already Open
I cannot seem to cleanly close a recordset if it is open. It's been causing me major headaches trying to make sure that the recordset is closed before antoher one is opened. This is largely due to error handling and it leaving recordsets open.
So what I did was just have a routine that ran before a recordset was opened, this is:
VB Code:
If aRST1.State = 1 Then aRST1.Close End If
For the most part this seems to work. But occasionaly I get the error "3219 - Operation is not allowed in this context" when it issues the close command above.
Any thoughts?
Thanks!
Open/Close CD ROM Drive??
Hi..I have two CD ROM Drives F and G ...how I can open and close the CD drive F only with a click of button?
|