Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
C# / VB.NET - Uscire dal programma
Forum - C# / VB.NET - Uscire dal programma

Pagine: [ 1 2 ] Precedente | Prossimo
Avatar
fosforo (Normal User)
Expert


Messaggi: 391
Iscritto: 06/04/2009

Segnala al moderatore
Postato alle 15:52
Venerdì, 10/07/2009
Questo topic è stato chiuso dal moderatore

Ciao a tutti
Domanda da neofita:
Ho creato un programmino e, finito il suo compito dovrebbe chiudersi.
Non capisco come posso fare.

Grazie

PM
Avatar
ruggy94 (Member)
Guru


Messaggi: 890
Iscritto: 21/04/2008

Segnala al moderatore
Postato alle 15:59
Venerdì, 10/07/2009
Application.Exit()

PM
Avatar
fosforo (Normal User)
Expert


Messaggi: 391
Iscritto: 06/04/2009

Segnala al moderatore
Postato alle 16:04
Venerdì, 10/07/2009
vado avanti con le domande ovvie.
Application.Exit() l'ho messo dopo End module
ma mi da errore "Prevista dichiarazione"

PM
Avatar
riseofapocalypse (Ex-Member)
Pro


Messaggi: 150
Iscritto: 08/07/2009

Segnala al moderatore
Postato alle 16:23
Venerdì, 10/07/2009
Devi metterlo appena prima di End Module :k:

PM
Avatar
ruggy94 (Member)
Guru


Messaggi: 890
Iscritto: 21/04/2008

Segnala al moderatore
Postato alle 16:55
Venerdì, 10/07/2009
Testo quotato

Postato originariamente da fosforo:
vado avanti con le domande ovvie


:rotfl::rotfl:

PM
Avatar
fosforo (Normal User)
Expert


Messaggi: 391
Iscritto: 06/04/2009

Segnala al moderatore
Postato alle 17:46
Venerdì, 10/07/2009
Aiuto.
Riassumo.
Uso Visual Studio 2008.
Sto creando in VB.net e mi da questo errore
Prevista dichiarazione

PM
Avatar
ruggy94 (Member)
Guru


Messaggi: 890
Iscritto: 21/04/2008

Segnala al moderatore
Postato alle 17:50
Venerdì, 10/07/2009
Testo quotato

Postato originariamente da fosforo:
Riassumo


Eh, hai riassunto un po' troppo. Posta il codice (intendo tutto, non solo Application.Exit) o non possiamo aiutarti

PM
Avatar
fosforo (Normal User)
Expert


Messaggi: 391
Iscritto: 06/04/2009

Segnala al moderatore
Postato alle 18:04
Venerdì, 10/07/2009
Module Module1

    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

    Sub Pause(ByVal sec As Single)
        Dim t As Single
        t = Timer + sec
        If t >= 86400 Then t = 0 'evita il midnight-bug
        Do
            'DoEvents()        'permette di agire sui controlli
            'MsgBox("sto aspettando")
            Sleep(500)
        Loop While Timer < t
    End Sub
    Sub Main()


        Dim NomeFile, NomeFile1 As String

        Dim Peso1, Peso2 As Long
        Dim fs As System.IO.FileStream
        Dim fileInUse As Boolean = True
        NomeFile = "C:\TemporaryUpload\" + Command()
        'MsgBox(NomeFile)

        Do
            Do
                Peso1 = FileLen(NomeFile)
                Pause(15)
                Peso2 = FileLen(NomeFile)
                If Peso2 = Peso1 Then
                    'MsgBox(Peso2)
                    Exit Do
                End If

            Loop


            Try
                fs = System.IO.File.Open(NomeFile, IO.FileMode.Open, IO.FileAccess.Write, IO.FileShare.None)


                fileInUse = False
                'MsgBox("chiuso")
                fs.Close()



            Catch ex As Exception

                fileInUse = True
                'MsgBox("aperto")


            End Try
        Loop While fileInUse = True

        'MsgBox("caiser")
        ' nome che avrà il file renderizzato come da formato MAM
        NomeFile1 = DateString() & "_" & CInt(Rnd() * 100) & "_" & TimeString()
        ' sostituisco nel nome il carattere / e . con il carattere _ e tolgo gli spazi tra i caratteri del nome
        NomeFile1 = Replace(NomeFile1, "-", "_")
        NomeFile1 = Replace(NomeFile1, ":", "_")
        NomeFile1 = "C:\TemporaryUpload\" + NomeFile1 + ".mov"
        'MsgBox(NomeFile1)

        Rename(NomeFile, NomeFile1)

        'Shell("render_mov.exe " + NomeFile1)
        System.Diagnostics.Process.Start("C:\Programmi\MAM_Watch_folder\RenderBat.exe " + NomeFile1)


    End Sub


        Application.Exit()
  

End Module

PM
Avatar
ruggy94 (Member)
Guru


Messaggi: 890
Iscritto: 21/04/2008

Segnala al moderatore
Postato alle 18:20
Venerdì, 10/07/2009
Application.Exit alla fine della Sub Main (cioè prima di End Sub)

Ultima modifica effettuata da ruggy94 il 10/07/2009 alle 18:20
PM
Pagine: [ 1 2 ] Precedente | Prossimo