|
See ServiceInstaller and ServiceProcessInstaller . The documentation for these two classes in the .NET Framework SDK also include samples.
Basically, you derive from Installer to create your own installer then add an instance of each of the aforementioned classes according to the documentation.
You can use the installutil.exe utility that is installed with the .NET Framework or include the assembly that includes the installer class in a Windows Installer setup project in VS.NET as a Custom Action.
If you want to set anything during installation, you'll have to use a command-line switch. You can find more information about this in the documentation for the Installer.Context property. You use some code like the following in your derived Installer class to get parameters passed to it from installutil.exe or from Windows Installer:
string value = Context.Parameters["SvcName"]; If you want to use this in an MSI package (Windows Installer), you can pass the command-line option based on an MSI database property that can be set by msiexec.exe when installing the package. For more information about that, see a previous thread I replied to: http://www.codeproject.com/script/comments/forums.asp?msg=711576&forumid=1649&XtraIDs=1649&searchkw=custom+action+windows+installer&sd=10%2F17%2F2003&ed=1%2F15%2F2004#xx711576xx[^].
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi...i need what my subjust states, and have no idea how to get their...Short of creating my own listview from scratch...does anyone know any solution to this? (c#)
|
|
|
|
|
dang...it doulbe posted and i cant delete cause of some forum bug saying i used a differant account to make this lol.
anyhoo when i said sort, i mean scroll
|
|
|
|
|
Hi...i need what my subjust states, and have no idea how to get their...Short of creating my own listview from scratch...does anyone know any solution to this? (c#)
|
|
|
|
|
The first thing is to understand that the ListView class in .NET encapsulates the List-View common control in Windows, as do most controls in the System.Windows.Forms namespace, so doing things like this will typically required that you extend ListView , override WndProc , and handle notification messages. Some Windows programming background will be helpful. You'll also want to know how to P/Invoke native methods. You can find more information in the documentation for the DllImportAttribute in the .NET Framework SDK.
You'll have to handle the drawing of each subitem by handling the NM_CUSTOMDRAW notification message. That will give you a struct (which you'll have to create, namely the NMLVCUSTOMDRAW struct). From information in that you can adjust the starting location of your text (though you'll have to draw it yourself, though that's not hard) and then paint the icon you want next to it. You'll have to figure out how to store that image information, though, be it an index into an ImageList or an Image itself. You could extend ListViewSubItem although you'll have to worry about casting each time.
Note that this may sound like a lot of work (and I'll admit it's not trivial) but it sure beats making your own list view control from scratch! There's a heck of a lot more to worry about than this. In the grand scheme of things, this approach is easy.
If you reply to this, I can send you some old source that shows some examples of owner-drawing. Though not specific to your requirements, it should give you some insight.
Again, be sure to read about the list-view common control at http://msdn.microsoft.com/library/en-us/shellcc/platform/commctls/listview/reflist.asp[^] and read about P/Invoking at http://msdn.microsoft.com/library/en-us/cpguide/html/cpconconsumingunmanageddllfunctions.asp[^]. Again, some Windows programming experience will be helpful.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Wow that owner-drawing stuff sounds tasty...Be most appreaciated :P
|
|
|
|
|
Hi there,
I have this little problem which is of pure cosmetic nature, so it doesn't really affect the application, but it would be something I'd really like to have. I searched around and couldn't find a solution for this anywhere, so I hope somebody in here knows the trick. The problem does also apply to any other .NET application, but since my application is written in C#, I post it here first:
My appplication has a nice application icon and opens several windows, which also all have this application icon. Everything looks fine in the windows taskbar, until the moment when the taskbar grouping function of WinXP kicks in. Then the group icon for my application suddenly is the default empty application icon, and the group button itself doesn't have any text, but just states the number of windows grouped, for example "3".
When I click on the group button, every item in the list has the nice application icon, but it seems that the group icon comes from somewhere else, as well as the group button text. Since other applications still have their icon even when the windows are grouped, this property must be able to set somewhere.
I read in a newsgroup that the group icon comes from SystemIcons.Application, which in fact is the empty default windows icon that I see, but this property is read-only, so there is no way for me to confirm that this icon is really used, nor can I change it to my application icon.
In case it is still not clear what I mean to the following to reproduce the problem: Open a new .NET project (C# or VB doesn't matter) and add a second dialog, then add a function in your main dialog that opens up the second dialog when clicking a button or something like that. Edit the App.ico resource so that the icon looks different and make both your windows use this file as the application icon. Now execute the application and press that button that executes your function to open more windows until the taskbar is full and WinXP groups the icons. Then you should be able to see the effect.
In case it is still not clear, I can also post a screenshot, but for the moment I'll just hope that someone is able to understand what I mean.
Any ideas?
Thanks,
Sascha
|
|
|
|
|
Set the static property Application.SafeTopLevelCaptionFormat for the group text. As far as the icon goes, I'm frankly surprised this isn't working correctly since Windows should be using the top-level form's icon. The only thing I can think of is to make sure you're using the Application.Run static method to launch your main form.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I have what should be a simple problem, but I'm not able to figure it out.
Suppose I have a 5 by 10 array. I populate the array, and now want to display this on a form.
The array is populated in a separate codefile, which passes the array to the main form file.
When I click on a button, I want to be able to see each row of the array i.e if the array is:
1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
21 22 etc etc...
Clicking the button once should give me
1 2 3 4 5 6 7 8 9 10
Clicking again should give me
11 ... 20
and so on.
How do I make this happen? I have a label named "labDisp" and a button "btnShow" on the form.
Thank you.
|
|
|
|
|
Easy - an array is a valid source for a repeater ( and that's all you need here, so why use anything heavier ? ), so store the index you're up to in viewstate, then grab the array you need from the array of arrays and make it the data source for a repeater.
Ooops - forget that if you're not doing a web page. Instead, just pass the arrays to a datagrid.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
In your form class set up a member variable like:
private int currentIndex = -1;
In your button click event handler:
currentIndex++;
if (currentIndex==5)
currentIndex = 0;
StringBuilder sb = new StringBuilder();
for(int i=0; i<9; i++)
{
sb.Append(arrayObject[currentIndex, i].ToString());
sb.Append(" ");
}
labDisp.Text = sb.ToString();
I'm assuming your array is called "arrayObject" since you didn't mention it anywhere.
--Colin Mackay--
EuroCPian Spring 2004 Get Together[^]
|
|
|
|
|
I am using the C# code below (found here: http://www.codeproject.com/cs/miscctrl/dotnetcolorpicker.asp) to override the cursor/arrow keys so I can use them for my own devices.
protected override bool IsInputKey( System.Windows.Forms.Keys keyData )
{
bool bIsInputKey = true;
switch( keyData )
{
case Keys.Left:
break;
case Keys.Right:
break;
case Keys.Down:
break;
case Keys.Up:
break;
default:
bIsInputKey = base.IsInputKey(keyData);
break;
}
return bIsInputKey;
}
This does not appear to work, I have set keypreview on the form to true, that does not help.
I have tried this code in a dummy app and it works fine, and I have placed a break in the above code to see if the override is ever run - it isn't. There must be something in the rest of the code or a property that is stopping this.
Does anyone have any suggestions???? I am new to C# and have banged my head against the wall all day on this one!!!
Many thanks in advance
|
|
|
|
|
I have managed to deduce some more on this, it appears that a series of buttons within a groupbox on the form are taking the key inputs as their own.
I have duplicated this in another simple form, by turning the tabstop property for each to 'false' it prevents this behaviour.
Unfortunately the same is not true for my actual application!!!
seriously busting my head over this now...
|
|
|
|
|
Hey
I'm looking for a good book covering distributed .NET programming. Not a book that introduces .NET/C#, men covering the subject.
Hope some of you might help.
Best regards
Rasmus
|
|
|
|
|
You could try ".NET Remoting" from MS Press, McLean, Naftel & Williams.
Should do the trick.
"Je pense, donc je mange." - Rene Descartes 1689 - Just before his mother put his tea on the table.
Shameless Plug - Distributed Database Transactions in .NET using COM+
|
|
|
|
|
i found this book useful
Microsoft .NET Distributed Applications: Integrating XML Web Services and .NET Remoting
by Matthew Macdonald
|
|
|
|
|
Hi!
Here is my question
What is the code or method to detect the application's CD
when the user install or start the application?
Since the application must access the videos that are in the CD,
I need the app to automatically detect where it's cd is, and if possible,
have the cd's file uncopyable
Thanks!
Antoine
ps.: I'm writing a c# app with Visual Studio 2002 Ent, .NET 1.1, on winXP and for WinXP/2K.
This by our hands that dream,
"I shall find a way or make one!"
|
|
|
|
|
First retrieve logical disks, If one of them has driveType 5 then it is a cdrom. Try to locate a file that you know your cd-rom contains.
you should also use System.Management in your code, i mean add it in references section of your project.
Here is the code:
ManagementClass disks = New ManagementClass("Win32_LogicalDisk");
ManagementObjectCollection moc = disks.GetInstances();
ManagementObject mo;
foreach(mo in moc){
if(mo["DriveType"].ToString() == "5"){
if(System.IO.File.Exists(mo["Name"].ToString + "\somefile.ext"){
MessageBox.Show("Correct disk in cdrom drive")
}
}
}
disks.Dispose()
I hope this helps
Don't forget, that's Persian Gulf not Arabian gulf!
|
|
|
|
|
I want to have a floating window in my app. One that is always on top of the main window...
But, if I make a form and set the TopMost property to true, the window is also on top of every other application.
I mean, when working in my app it works fine, but if i open another app in front of it, my floating window is also on top of that app... Not good...
Any ideas?
- Anders
Money talks, but all mine ever says is "Goodbye!"
My Photos[^]
nsms@spyf.dk <- Spam Collecting
|
|
|
|
|
|
Unfortunately you can not set the parent of a form
- Anders
Money talks, but all mine ever says is "Goodbye!"
My Photos[^]
nsms@spyf.dk <- Spam Collecting
|
|
|
|
|
Oh yes you can :-p
Form.OwnedForms Property
"When a form is owned by another form, it is minimized and closed with the owner form. For example, if Form2 is owned by form Form1, if Form1 is closed or minimized, Form2 is also closed or minimized. Owned forms are also never displayed behind their owner form. You can use owned forms for windows such as find and replace windows, which should not be displayed behind the owner form when the owner form is selected."
greetz
*Niels Penneman*
Software/Dev Site Personal Site
|
|
|
|
|
The parent and the owner are too different things. Besides, to set the owner you use the Form.Owner property on the form that should be owned. The Form.OwnedForms property is a read-only property that is a Form[] array. Even replacing an element in the array won't set the Form.Owner property of the form you want owned.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Sorry, but I had never used this before so I looked it up and found the OwnedForms property and I thought, that must be it!
Nice
greetz
*Niels Penneman*
Software/Dev Site Personal Site
|
|
|
|
|
SomeForm dlg = new SomeForm();
dlg.Owner = this;
dlg.Show();
works just like
SomeForm dlg = new SomeForm();
this.AddOwnedForm(dlg);
dlg.Show();
But thanks both of you, I got my problem solved...
- Anders
Money talks, but all mine ever says is "Goodbye!"
My Photos[^]
nsms@spyf.dk <- Spam Collecting
|
|
|
|