Click here to Skip to main content
16,008,469 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCreate and Implement Icons :: MFC Pin
valikac8-Oct-02 16:55
valikac8-Oct-02 16:55 
GeneralRe: Create and Implement Icons :: MFC Pin
Gero Gerber8-Oct-02 21:59
Gero Gerber8-Oct-02 21:59 
GeneralRe: Create and Implement Icons :: MFC Pin
valikac9-Oct-02 4:33
valikac9-Oct-02 4:33 
GeneralRe: Create and Implement Icons :: MFC Pin
Gero Gerber9-Oct-02 4:42
Gero Gerber9-Oct-02 4:42 
QuestionNish perticulerly or any body else plz reply? Pin
imran_rafique8-Oct-02 15:28
imran_rafique8-Oct-02 15:28 
AnswerRe: Nish perticulerly or any body else plz reply? Pin
Nish Nishant8-Oct-02 15:47
sitebuilderNish Nishant8-Oct-02 15:47 
GeneralRe: Nish perticulerly or any body else plz reply? Pin
imran_rafique8-Oct-02 16:47
imran_rafique8-Oct-02 16:47 
AnswerRe: Nish perticulerly or any body else plz reply? Pin
Gaul8-Oct-02 18:34
Gaul8-Oct-02 18:34 
To install a service, you generally use the InstalUtil.exe tool from the command line as:
InstalUtil svcname.exe

To install a service from a setup wizard (in VS.NET), you need to include a Custom Action in your wizard that executes on Commit when the wizard is run. (Take a look at the Custom Actions tab in a VS.NET setup project)

A Custom Action can execute an external .exe or a script. In the situation where you want to install a service, you could execute the InstallUtil in a script that is called as a custom action, or write a console application like the one below using the AssemblyInstaller class. The AssemblyInstaller loads an assembly, and runs all the installers in it.

To use the AssemblyInstaller, you need to include an Installer class in your service that registers your service.

There is not enough time for me to discuss all the details, but you may want to take a look at the AssemblyInstaller and the ServiceInstaller classes.

The following is the example given in the docs for the AssemblyInstaller class:

using System;
using System.Configuration.Install;
using System.Collections;
using System.Collections.Specialized;

class AssemblyInstaller_Example
{
static void Main()
{
IDictionary mySavedState = new Hashtable();

Console.WriteLine( "" );

try
{
// Set the commandline argument array for 'logfile'.
string[] commandLineOptions = new string[ 1 ] {"/LogFile=example.log"};

// Create an object of the 'AssemblyInstaller' class.
AssemblyInstaller myAssemblyInstaller = new
AssemblyInstaller( "MyAssembly.exe" , commandLineOptions );

myAssemblyInstaller.UseNewContext = true;

// Install the 'MyAssembly' assembly.
myAssemblyInstaller.Install( mySavedState );

// Commit the 'MyAssembly' assembly.
myAssemblyInstaller.Commit( mySavedState );
}
catch (ArgumentException)
{
}
catch (Exception e)
{
Console.WriteLine( e.Message );
}
}
}

To help you get started, an example Installer implementation will look something like this:

[RunInstallerAttribute(true)]
public class MyServiceInstaller : Installer
{
private ServiceInstaller _installer;
private ServiceProcessInstaller _processInstaller;

public MyServiceInstaller()
{
InstallServices();

}
public void InstallServices()
{
_processInstaller = new ServiceProcessInstaller();
_processInstaller.Password = null;
_processInstaller.Username = null;
_processInstaller.Account = ServiceAccount.LocalSystem;
Installers.Add(_processInstaller);

// Add each service to installer
_installer = new ServiceInstaller();

_installer.StartType = ServiceStartMode.Manual;
_installer.ServiceName = "YourServiceName";
_installer.DisplayName = "YourServiceDisplayName";
Installers.Add(_installer);
}
}

There may be typos above, but the intention is to point you to the right classes to use.



Gaul
Gaulles Technologies, Inc.
http://www.gaulles.com

Questionregistry keys ? Pin
imran_rafique8-Oct-02 15:17
imran_rafique8-Oct-02 15:17 
AnswerRe: registry keys ? Pin
Nish Nishant8-Oct-02 15:50
sitebuilderNish Nishant8-Oct-02 15:50 
AnswerRe: registry keys ? Pin
Navin8-Oct-02 15:53
Navin8-Oct-02 15:53 
GeneralRe: registry keys ? Pin
imran_rafique8-Oct-02 17:05
imran_rafique8-Oct-02 17:05 
GeneralRe: registry keys ? Pin
Navin8-Oct-02 17:21
Navin8-Oct-02 17:21 
GeneralDLL Pin
stevenson8-Oct-02 14:46
stevenson8-Oct-02 14:46 
GeneralRe: DLL Pin
Navin8-Oct-02 15:48
Navin8-Oct-02 15:48 
GeneralTCPIP/NDIS driver issue Pin
Jesse Rosalia8-Oct-02 13:33
Jesse Rosalia8-Oct-02 13:33 
GeneralBitmap Pin
Anonymous8-Oct-02 12:56
Anonymous8-Oct-02 12:56 
GeneralRe: Bitmap Pin
Christian Graus8-Oct-02 14:23
protectorChristian Graus8-Oct-02 14:23 
GeneralRe: Bitmap Pin
Paul M Watt8-Oct-02 18:20
mentorPaul M Watt8-Oct-02 18:20 
GeneralRe: Bitmap Pin
Bartosz Bien10-Oct-02 11:24
Bartosz Bien10-Oct-02 11:24 
GeneralHost name from given url Pin
orcun colak8-Oct-02 12:19
orcun colak8-Oct-02 12:19 
GeneralRe: Host name from given url Pin
valikac8-Oct-02 12:44
valikac8-Oct-02 12:44 
GeneralRe: Host name from given url Pin
Jon Sagara8-Oct-02 12:47
Jon Sagara8-Oct-02 12:47 
GeneralRe: Host name from given url Pin
Michael Dunn8-Oct-02 18:51
sitebuilderMichael Dunn8-Oct-02 18:51 
GeneralMaking Autoruns in C++ Pin
CSHighCommand8-Oct-02 11:28
CSHighCommand8-Oct-02 11:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.