IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Windows Forms Discussion :

[VB.NET] Question sur la console?


Sujet :

Windows Forms

  1. #1
    Membre régulier Avatar de waldo2188
    Profil pro
    Chef de projets
    Inscrit en
    Mars 2004
    Messages
    115
    Détails du profil
    Informations personnelles :
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Chef de projets

    Informations forums :
    Inscription : Mars 2004
    Messages : 115
    Points : 113
    Points
    113
    Par défaut [VB.NET] Question sur la console?
    Bonjour,
    je souhaite réaliser une appication en VB.Net que je qualifirais de silencieuse.
    Je m'explique:
    Pour le moment j'ai développé une application de type console.
    Donc lorsque je lance mon exe, la fenêtre de console se lance, mon prog aussi tout va bien.
    Maintenant, comment pourais-je faire pour que la fenètre n'apparaisse pas, mais pour que mon programme continu à tourner.

    En gros je voudrais faire un daemon (c'est un prog qui tourne en tache de fond).

    QuelQu'un a une idée???
    Je vous remercie d'avance pour vos réponses.

  2. #2
    jab
    jab est déconnecté
    Rédacteur
    Avatar de jab
    Homme Profil pro
    SharePoint developpeur
    Inscrit en
    Février 2004
    Messages
    1 173
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : Belgique

    Informations professionnelles :
    Activité : SharePoint developpeur
    Secteur : Service public

    Informations forums :
    Inscription : Février 2004
    Messages : 1 173
    Points : 4 339
    Points
    4 339
    Par défaut
    N'aurrait-il pas été mieux de développez l'application comme un service ?

    Perso, je ne vois pas comment rrendre l'application console invisible mais je suppose que c'est possible. Une solution est de lancer l'application console depuis une appli winform. L'appli winform est rendue invisible par la propriété Visible de la fenêtre principale. Il est alors possible de cacher l'application console http://jab.developpez.com/CSharp/Process/Synchrone/#LIV.

    Mais c'est du bricolage. Il me semble mieux de transférer ton appli en service windows.

  3. #3
    Rédacteur
    Avatar de Thomas Lebrun
    Profil pro
    Inscrit en
    Octobre 2002
    Messages
    9 161
    Détails du profil
    Informations personnelles :
    Âge : 42
    Localisation : France

    Informations forums :
    Inscription : Octobre 2002
    Messages : 9 161
    Points : 19 434
    Points
    19 434
    Par défaut
    En effet, les process semblent plus adapté à ce type d'application

  4. #4
    Membre régulier Avatar de waldo2188
    Profil pro
    Chef de projets
    Inscrit en
    Mars 2004
    Messages
    115
    Détails du profil
    Informations personnelles :
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Chef de projets

    Informations forums :
    Inscription : Mars 2004
    Messages : 115
    Points : 113
    Points
    113
    Par défaut re
    comment faire alors pour faire un service avec Vb.net???
    J'ai utilisé le mode console, car je ne sais pas comment faire.
    mercie pour vos réponses

  5. #5
    jab
    jab est déconnecté
    Rédacteur
    Avatar de jab
    Homme Profil pro
    SharePoint developpeur
    Inscrit en
    Février 2004
    Messages
    1 173
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : Belgique

    Informations professionnelles :
    Activité : SharePoint developpeur
    Secteur : Service public

    Informations forums :
    Inscription : Février 2004
    Messages : 1 173
    Points : 4 339
    Points
    4 339
    Par défaut
    Si tu utilise Visual Studio, tu crée un projet spécifique Service Windows. Si tu utilises un autre IDE, regarde si tu ne vois rien de semblable.

    Sinon le code généré pour un service par VS est
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
     
    Imports System.ServiceProcess
     
    Public Class Service1
        Inherits System.ServiceProcess.ServiceBase
     
    #Region " Component Designer generated code "
     
        Public Sub New()
            MyBase.New()
     
            ' This call is required by the Component Designer.
            InitializeComponent()
     
            ' Add any initialization after the InitializeComponent() call
     
        End Sub
     
        'UserService overrides dispose to clean up the component list.
        Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
            If disposing Then
                If Not (components Is Nothing) Then
                    components.Dispose()
                End If
            End If
            MyBase.Dispose(disposing)
        End Sub
     
        ' The main entry point for the process
        <MTAThread()> _
        Shared Sub Main()
            Dim ServicesToRun() As System.ServiceProcess.ServiceBase
     
            ' More than one NT Service may run within the same process. To add
            ' another service to this process, change the following line to
            ' create a second service object. For example,
            '
            '   ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}
            '
            ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1}
     
            System.ServiceProcess.ServiceBase.Run(ServicesToRun)
        End Sub
     
        'Required by the Component Designer
        Private components As System.ComponentModel.IContainer
     
        ' NOTE: The following procedure is required by the Component Designer
        ' It can be modified using the Component Designer.  
        ' Do not modify it using the code editor.
        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
            components = New System.ComponentModel.Container()
            Me.ServiceName = "Service1"
        End Sub
     
    #End Region
     
        Protected Overrides Sub OnStart(ByVal args() As String)
            ' Add code here to start your service. This method should set things
            ' in motion so your service can do its work.
        End Sub
     
        Protected Overrides Sub OnStop()
            ' Add code here to perform any tear-down necessary to stop your service.
        End Sub
     
    End Class
    Pour l'assemblyInfo.vb tu as
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
     
    Imports System
    Imports System.Reflection
    Imports System.Runtime.InteropServices
     
    ' General Information about an assembly is controlled through the following 
    ' set of attributes. Change these attribute values to modify the information
    ' associated with an assembly.
     
    ' Review the values of the assembly attributes
     
    <Assembly: AssemblyTitle("")> 
    <Assembly: AssemblyDescription("")> 
    <Assembly: AssemblyCompany("")> 
    <Assembly: AssemblyProduct("")> 
    <Assembly: AssemblyCopyright("")> 
    <Assembly: AssemblyTrademark("")> 
    <Assembly: CLSCompliant(True)> 
     
    'The following GUID is for the ID of the typelib if this project is exposed to COM
    <Assembly: Guid("437AD991-26AF-45BB-A043-F9486C1B2EAB")> 
     
    ' Version information for an assembly consists of the following four values:
    '
    '      Major Version
    '      Minor Version 
    '      Build Number
    '      Revision
    '
    ' You can specify all the values or you can default the Build and Revision Numbers 
    ' by using the '*' as shown below:
     
    <Assembly: AssemblyVersion("1.0.*")>
    et comme référence:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    System
    System.Data
    System.XML
    System.ServiceProcess
    J'espère que cela pourra t'aider.

  6. #6
    Membre régulier Avatar de waldo2188
    Profil pro
    Chef de projets
    Inscrit en
    Mars 2004
    Messages
    115
    Détails du profil
    Informations personnelles :
    Localisation : France, Côte d'Or (Bourgogne)

    Informations professionnelles :
    Activité : Chef de projets

    Informations forums :
    Inscription : Mars 2004
    Messages : 115
    Points : 113
    Points
    113
    Par défaut re
    merci beaucoup.
    Je teste ca se soir, merci à vous tous!

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [MFC] [Visual.NET] Question sur l'impression
    Par LapinGarou dans le forum MFC
    Réponses: 8
    Dernier message: 31/03/2006, 08h51
  2. [C#] [WinForms] sur [VS.NET] question sur le panel
    Par onizuanda dans le forum Windows Forms
    Réponses: 4
    Dernier message: 03/12/2004, 19h00
  3. [VB.NET] Question sur le deploiement
    Par TONY44 dans le forum ASP.NET
    Réponses: 8
    Dernier message: 22/10/2004, 09h28
  4. [VB.NET] Question sur le pilotage d'Excel
    Par alfprod dans le forum Windows Forms
    Réponses: 4
    Dernier message: 20/10/2004, 15h15
  5. [VB.NET] Question sur liaison VB et Access
    Par Hoegaarden dans le forum Accès aux données
    Réponses: 2
    Dernier message: 18/05/2004, 09h35

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo