Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Close And Reopen Program


Is it possible to let our program close it self and then reload it self?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Keep Values In An MSFlexGrid When I Close And Reopen The Forms
Hi,

I've got a form where I enter a load of data into a flexigrid all I want to do is save the values in the flexigrid so that it (the form) opens with the same values next time I go back to it. I presume it is quite simple, but even so I don't know what method to use.

cheers

Howler

Close Program After Excel Program Executes
I am having a problem unloading my program after I complete an automation to excel process. Basically I pump a bunch of data to an excel workbook, save it as a file name, shut down excel. Now I want to close the exe, but it is not unloading. What am I missing (maybe I need to set focus back to the exe, how can I do that if that is the case?)

Thanks!

oapp.ActiveWorkbook.SaveAs FileName:="\master log" & Format(Now, "m-d-yyyy") & ".xls"
oapp.Quit

Set oapp = Nothing

Unload Me

Shut Down 2 .EXE's Then Reopen.
I work in an I.T. department and need a little program that will fix reocurring printing errors. 99% of the problems are fixed by shutting down and restarting 2 EXE files. I am a beginner when it comes to VB so I surfed the forums a little bit and found this code that I hope will work:

Dim p As Process = Process.Start("CFP")
Dim q As Process = Process.Start("ProDoc")

If p.Responding Then
p.Kill()
Else
p.Kill()
End If

On Error Goto ErrTrap

shell <C:Program FilesCFP.exe>
shell <C:Program FilesProDoc.exe>

Exit Sub
ErrTrap:
msgbox "There has been an error, the executables you are trying to execute do not exist", vbcritical, "Error in execution"
End Sub

All I need the program to do is shutdown the 2 EXE's and then restart them and I was wondering if this should work and if this is the best way going about it. Thank you in advance!

How To Reopen Exe Files
My harddisk died, so have lost all my VB 6.0. On an athother server I could only find an exe file that I have created. Are there any chances that it can reopen in VB 6.O ?

Broesen

How To Reopen A Form??????
hi. I want to knoow how to reshow a form. for example if my form is called form1. And in this form is a game and u have to reach a certain score to move on. If u don't u redo the level. So how do i open that same form again?

New Window (Reopen It)
Hi

I am trying to reopen a window which i created using:


Code:
Dim NewWindow As New frmWindow
NewWindow.Show


Each window is for a unique purpose but i want to be able to then enter information into this window at a later time.

Basicly i have a log window which contains information for each type of thing to be logged. A message is then displayed in the window but apart from calling frmWindow which does not bring up the unique window i cant find another way of doing it.

Anyone got any ideas?

Hope it all makes sence for you, Thanks.

Reopen A Recordset
Hi,
 Can someone tell me the right way?
I am using ADODB. But when I want to change the query in my Recordset. I have to close it Open it and set the Datasource of all my objects again.
Am I doing it in the right way or there's better one.

Please I am not asking for way to do it with other kind of objects I am talking with ADODB, is the rith way.

Thanks!!

Reopen Binary File ???
Hi VB Gurus,
I just joined the Forum and I know some bits and pieces, hope
I can be any help in one point,too.
I'm stucking on a rather weird problem.
I have Binary *.dat Files which contain Information about a Form Layout(the User chooses) there can be several possible.
By clicking a Button it opens the File, reads it and sets up the Form.
All fine if I do it once, if I close the Form and open it immediatly again it
wont read the File anymore all it returns is '0'. (unless I close the App and
run it again, but then again it does it once ).
Reading the File with Characters with

Get #outpu, , byter
Debug.Print " " & byter & " car: " & Chr(byter)

I noticed there is that 0 on the end (for any strange reason )
The code is:


Code:
Public Function open_dat(filename As String)
Dim a As Integer
Dim outpu As Long
outpu = FreeFile()
Dim geb As String
Dim byter As Byte

If filesys.FileExists(App.Path & "Daten" & filename & "CS.dat") Then
Open filename & "CS.dat" For Binary As #outpu

Get #outpu, 1, anhangout 'Felder Anzahl
ReDim feldarrayout(anhangout)
ReDim dbfeld_bezout(anhangout)
ReDim feldtypout(anhangout)
ReDim newdbindexout(anhangout)
ReDim vorhandenstandardout(anhangout)
ReDim geburtstagout(0)
ReDim pimindexout(0)
ReDim tempfiledbout(0)
Get #outpu, , feldarrayout() 'formnamen
Get #outpu, , dbfeld_bezout() 'Feldnamen
Get #outpu, , geburtstagout()
Get #outpu, , pimindexout() 'Index Primärschlüßel
Get #outpu, , feldtypout() 'feldtyp
Get #outpu, , vorhandenstandardout() 'enum Typ
Get #outpu, , newdbindexout()
Get #outpu, , tempfiledbout() 'Logound dDBPfad
Get #outpu, , commentdaout 'wieviel comment
If commentdaout > 0 Then
ReDim commentnameout(commentdaout - 1)
ReDim commentbezout(commentdaout)
Get #outpu, , commentnameout() 'commentname
Get #outpu, , commentbezout() 'Form comment

End If

'Open filename & "CS.dat" For Binary As #outpu
'While Not EOF(outpu)
' Get #outpu, , byter
' Debug.Print " " & byter & " car: " & Chr(byter)
'Wend
'Close #outpu

outpu = 0
open_dat = True
Else
open_dat = False
End If


End Function
what does change with that File by opening a second Time ?????????????

Thanks for any help

Reopen Word Application
Hi
I'm working on a program that types to Word. I have some problem with opening the application after the user manually have closed it. I have extracted the problematic lines from my code as follows.This simple program do just have a form and a comman button.

Command1_Click

Dim appl As Word.Application
Dim doc As Word.Document
On Error Resume Next
Set appl=GetObject(,"Word.Application")
If Err.Number<>0 Then
Set appl=CreateObject("Word.Application")
End If
Set doc=appl.Documents.Add()
doc.Activate
Selection.TypeText "Hello Word"
Set doc=Nothing
Set appl=Nothing
End Sub

The user have different alternatives with the opened document and application.

1 The user let both the application and document be open. Then my programs add a new document and types "Hello Word"

2 The user closes the document but let the application be open. Then my program creates a new document and types "Hello Word"

3 The user closes both the application and document. Then my program
opens the application and creates a new document but types nothing.
What is wrong in my code. I want it manipulate Word even in this case.

Hope someone understands my question and have an answer!


Henrik Landén

Reopen Discussion About Movefolder
I found in the google newsgroup there was a discussion about the movefolder
method. But that thread isn't on the newsserver any more. So I want to
reopen it.

I already know that there is a problem moving files between two servers
using different operating systems. A workaround is copyfolder and delfolder.
But when I use copyfolder the date-properties (last-changed, last-accessed
etc) are lost. And these attributes of the original folder I want to keep.
Is there a way to do this.

Thanks
Arian

How Can I Prevet To Reopen The Application?
If I have the application on minimized mode or If I have the application runing. How Can I to prevent the reopen the App?

I need that if you do DblClick on the Icon Don't open a new app, Just open the applications that is runing....



thanks.

Reopen Mdi Child Form After Closed
Hi. I have a mdi form with a few child forms. My problem is when the user closes (hits the X button) a child form, it's gone and there is no way to open it back again. Is there an automatic way to do this, maybe by enabling a property? Or do I have to explicitly code it into a menu or something to reload the child form?

Making Variable In Run Time? **REOPEN**
I try to print 2,3 and 6 in the debugger. How I make this work.

With making variable in run time


VB Code:
Option Explicit Dim Mat1 As IntegerDim Mat2 As IntegerDim Mat3 As Integer Private Sub Form_Load()Dim i As IntegerDim tmp As String     Mat1 = 2    Mat2 = 3    Mat3 = 6    For i = 1 To 3        tmp = CStr("Mat_" & CStr(i))        Debug.Print tmp    Next iEnd Sub

Launch/close Program For Another Program
I help out at a Boys & Girls Club in their computer lab. They recently got a copy of Sim City 3000 donated, but this program is having issues with their Windows XP OS. If you go here, "SimCity 3000 restarts spontaneously when exiting", you can see the problem we are encountering. I was wondering if writing a small program to launch SimCity 3000, then catch it when it exits and force it to close down programmatically is possible? If so, how difficult would it be? I assume it would require several various API calls.

Program Still In Process When Close Program
Hi There,

I've come across a strange but annoying bug, but i cannot seem to track it down. when I close my program (its been compiled), the program still stays in the process (Ctrl+Alt+Delete).

Would this be some sort of memory Leekage???

The strange thing is this happens in one form only that i can figure out becuase the other forms don't do it.

Stranger thing is that both, or i should say all forms are build on the same building structure.


Code:
'This is in the Form_Load Sub

Set Me.Picture = LoadPicture(App.Path + "ImagesPODFormWindowPODFormWindow.bmp")
PicXButton.Picture = LoadPicture(App.Path + "ImagesSharedXButtonShaded.bmp")
Set CmdCancel.TopPicture = LoadPicture(App.Path + "ImagesSharedhanddown.bmp")
Set CmdGoToPrint.TopPicture = LoadPicture(App.Path + "ImagesSharedhandup.bmp")

Also i have built a usercontrol that as you can see adds a bitmap to it and manipulates it(Transparent, blending etc), should i be using lets Say UserControl_Terminate to do some clean up stuff

the pig..

Reopen Access Report Through Command Button
hi i was wondering if you can reopen an report from access if you close it by hitting the command button. This is what i have to open the file

Private Sub cmdclientlcontact_Click()

mAcc.DoCmd.OpenQuery "contacts", acViewNormal
mAcc.Visible = True
End Sub

Open Command Fails In Data Environment When Connection Reopen
http://www.222go.com/test.zip
Why when I close and open the dataenviroment connection, the command fail to open?
In my project I need to copy the mdb file out for backup purpose. Before copy the file out I need to close the connection.
when i finish copy the mdb file and open, and try to open a recordset, it fails. How can I solve this problem


DE.Conn.ConnectionString = Connectionstring1

DE.Conn.Open

DE.rsCommand1.Open "select * from table_name"

DE.Conn.Close

DE.Conn.Open
DE.rsCommand1.Open "select * from table_name"

.EXE Close Program
Hi,

Juz to query, whether can i keep my .exe running if i encountered an error?

Coz when i run my program in .exe and whenever i encountered an error for example:runtime error, the program will automatically close the whole program and i'll have to reopen the .exe file.

How can i avoid this problem?

Thanks a million!

Program Won't Close.
Hey guys, it's been a while since I've posted here. Anyhoo, lets get down to the brass tax.

I'm currently programming another simple tile-based game for the heck of it. I'm pretty far too. I'm running DX7 DirectDraw in Windowed mode. My game runs fine so far and everything is smooth and dandy, and when I hit escape, the program terminates like I desired. However, I have a small problem. When I click the [X] button in the top-right corner of the window, the window closes, but then re-opens, almost as if the program was executed again.

The player's coordinates get reset back to the original position and everything, it's very odd.

Anyone know what I'm doing wrong? I assume its something rediculous.

Thanks in advance,
Vinx.

Close Program
hi,
How can i open another program for example, the notepad from vb and when i close it, i want the VB program to pop up a msg box??

Close Another Program
Hi Folks,

Is there a way to close another running program when I exit the program I am building in VB. I know how to load through Shell but I'm at a loss.

Thanks in advance,

Dave

Want To Close Off A Program
In my program I have opened another application using the shell command (EasyLabel 32) to print labels. When the process of printing labels is done the easylabel program remains open, is there anyway to close of this application.

By leaving the program open, when I try to use the function again, its won't work until I manually close of the program.Then select the printing function in my program.

currently I have the shell command in a command box as follows:

Dim myappid
myappid = Shell("c:Program FilesTharoEasylabel 32easy.exe label")

with label being the data and configuration to use for printing out the labels required.

Close My Program
I want to close form1 when other program gets focus. But also if one of my other forms gets focus form1 doesn't close. Any ideas???


-Hao Li-

Close Program
Hi, is there a way to use vb code to close a program like when we press cltr+alt+delete and select a program to close? Thanks a lot!

sasa

Close Program
I want a program that waits (in the background without trying down the system) for certain programs to start-up. When they do the program must close them and send a message? Anyone have any ideas?

Close Program
I have a program that launches a terminal emulation with every instance of its execution, it however does not automaticly close this window on exit, i need a program that will watch for the initial launch and detect if the first app has closed, and if so close the terminal as well. Does any one know of such a thing or how this would be achieved in vb?

"No one can know everything, only so much as to drive us to look for the rest." -PrOpHeT-

Close Program
Hi again.

I am now making a program that will, after ten minutes from the time it is set to, close a running program of the users chioce. For example, I am a real Tetris addict. I want to make a program that will close Tetris after 10 minutes so that I don't spend all of my waking hours playing games instead of making games!

I would like it so that the user can see a list of all running programs (like the list in End Task, nothing more, no hidden programs), and then let them choose which one to close. I have no problems with the Timer event, just what I described above.

Many thanks!

Jacob Sheehy
http://sheehy.ca

Close Program
i need to no how to close a program with a command bottun.

How To Close Another Program From VB ?
Guys, I'm using VB 6.0 and I couldn't find a way to close another program (a .exe file) from VB ? Coud anyone please let me know ?

I already tried this :

Public Sub File_Close()
tes = File_Close()
End Sub

But it doesn't work, actually I'm trying to make a program (namely Program A) which calls another program (Program B) using shell function. And when I click exit button at program B, program B closes and go back to program A.

Any help would be very much appreciated.
Thanks in advance.

Regards,
Pittml

Cant Close Program
how do u make ur program so it cnat be closed from the little X in the corner? I want the user to have to go to file quit instead.

Close Program
Back again !!

I want to create a button that closes the program instead of pressing the X(cross) in the top right hand corner of the window....

Thanks guys

Tyrone

Close Another Program
How can I close another program from a vb application?

How To Close Program ?
what function use close program?

Help Program Close
hi i have a problem
i have a spyware or a virus on my pc i tried with many many antiviruses and antispywares such as : panda is , kaspersky is , pccellini , mcafee , avast , avg , grisoft , symantec etc....
but none of these didn't detect it
How i now i have a virus or spyware ??
i now because every almost 2 minutes it opens an iexplore by it self with ads's and i downloads and installs programs automaticly by it self
so only choice that i have is to make a program which will end iexplore.exe process automaticly when it opens
and i really dont now how to make this so plz i need this help urgently

How To Close The Program
I have confuse between "unload me" and "End" . What is best way to close the program running from executable file?Close the program mean to close the program and clear all the memory used by the program.

How To Close .exe Program?
Hi, I can exit my .exe program by clicking on the EXIT command button which closes all the files and unload 3 forms. When I checked Windows Task Manager, the .exe program is also closed. This confirms that it has been closed down properly.

However, if I click on 'X' symbol in the top right corner of the .exe program, it closes the program, but in Windows Task Manager, the .exe program is still running. How do I close it down properly? Thanks.

I use VB6 SP6 and Win 2000.

Best Way To Close A Program
Hi all

What is the best way to end or close a program in VB6? My program will run in the background when it is called from my website and once it has run it should close.

I've noticed there are numerous ways to end a program (e.g. End, Unload Me...) but I'm not sure which way is best.

Many thanks
Emma

Close Program
How do I close a running application via VB 6?

Thank you,
Sir Loin

Close A Program
How do I close a program for good?? i have a application which I want to picture buttom to close the program for good.....

Any help

Cheers

Can't Close My Program
Greetings,

I have a program that just will not quit running, even when I close it. It has a timer; I thought this would help, but it doesn't:


Form_Unload()
DoEvents
timer .Interval = 0
timer.Enabled = False
End Sub

Any ideas???

Thank you,
Jim

Close Another Program...
Anyone know how to close another program from VB? For instance, My program uses a scanner, and when the scanner is finished i want the scanner driver program (runs minimized) to shutdown because everytime the scanner is used, another driver window pops up. This will become very memory consuming when these begin accumulating.

Close The Program
How would you make a program close its self? I'm making a program and if you enter the wrong data it closes but can't figure out the closing part

Close Program?
how can i program a close button that would fully close the whole program? and also erases every variable stored in the memory? I tried using the "Unload" statement but it doesn't erase the variables in the memory.

How To Close A Program The Right Way?
Hi,

How do I close my VB programs the right way?
When you use the end statement or the set ...= nothing I alsways see that the program is still in the memory.
This is done by Ctrl+Alt+Del.

Does somebody nows the answer.

Thanks...

Close Program
When I use the:

Unload FormName

method, the form disappears, but if I try to delete the program the computer says that the program is in use.

Am I not using the correct command to close the program?

&lt;&lt; The Un-Close-Able Program &gt;&gt;
Does anyone know how to disable Ctr-Alt-Del and Alt-F4 in VB using Winnt.

I have the source to do it in 95 and 98 but it just dont' work in Winnt. I know its a tuff one but I hope someone out there can show me the light.

-Ober

Close A Program
Hello!

How can I close some other program through my own program in VB? How can I minimize/maximize/set focus it?

Close Program
hi,

i know how to run a program using the shell line, but i am writing a program that shuts your computer down, after an alloted time, but i want to close winap first, what code do i use to close it.

Thanks

Merlin ?

Close A Program
How can i close an executable file (extension .exe) with vbscript?

Copyright © 2005-08 www.BigResource.com, All rights reserved