|
Sorry, what I meant to ask was:
How do I implement and expose a function to the SCM which can return a SERVICE_STATUS struct?
|
|
|
|
|
If your service is based on the ServiceBase class, you don't. It's already registered when your service is launched. The ServiceBase class does not let you override any of it's members. You don't get the opportunity to replace it's functionality at all. Like I said, that stuff is maintained internally by the ServiceBase class.
You'd have to rewrite your service entirely on your own, supplying ALL the functionality that the ServiceBase class takes care of for you, but replacing the piece that registers the service control callback with your own function.
Google for ".NET Reflector" and download it. Open up the System.ServiceProcess.dll, then drill down to the ServiceBase class. This is what you'd have to rewrite. You'd mak your modifications to the Run method. Notice that most of the class is Private and not overridable. This is what's stopping you from replacing the piece you need.
The ServiceBase class is not only a wrapper for your service, but is also a buffer that insulates your service from the large amount of code between your service and the SCM.
Now, the problem is, this is all moot because you cannot replace the callback for the original service that you're trying to get a status for. It will STILL be registered and STILL return bogus status information.
|
|
|
|
|
hello dotnetians,
I'v to do an application through which a xml file has to be read,and to be written into excel, i'm using vb.net 2.0,
as i'm freasher so do'nt know how to proceed,
So, providing any code(badly needed),or any other help (ASAP) would be
appreciated .
thanx..........Be_Aman
|
|
|
|
|
Noone is going to write the code for you. You have to write it yourself and when you get stuck, you can ask specific questions.
Excel 2003 and above will already import XML data without any code from you. All you have to do is File, Open...
But, if you have to write the code to do this, you'll need to brush up on reading an XML file, parsing the data, and doing Excel Interop.
There are various ways of reading an XML file. If the number of records is not known, but can be large, then an XmlReader[^] would probably be appropriate.
There's tons of example of doing Excel Interop on the web. The problem is the Excel object model isn't exactly the easiest thing to learn. All you have to do is Google for "vb.net excel interop[^]".
|
|
|
|
|
I'm working with Microsoft Access, using VBA, and I want to be able to click on an item in a ListBox, then use the AfterUpdate() Sub-routine for that ListBox control, and be able to store that value into a String variable. My loop is as follows:
***START***
Private Sub Descriptions_lst_AfterUpdate()
Dim iterator As Integer
Dim descriptionName As String
'ListBox name is simply Descriptions_lst
For iterator = 0 to Descriptions_lst.ListCount - 1
If Descriptions_lst.Selected(iterator) Then
descriptionName = Descriptions_lst.Column(0, iterator)
End if
Next iterator
***END***
The loop is working correctly, however, the 'if' statement is not evaluating to true, so I therefore cannot test to see if the code inside the 'if' statement is even valid in retrieving the String equivalent for the selected item. Any ideas?
|
|
|
|
|
I think you want to use the Click event, not AfterUpdate. AfterUpdate only fires after any change in the controls data. Selecting items in the ListBox does not fire the AfterUpdate event.
|
|
|
|
|
Its weird though, If I put Message Boxes throughout the code, everytime I click, it actually does fire the AfterUpdate() event.
For example, I placed a MsgBox inside the loop but outside the if statement to check to see if the loop is working: MsgBox "loop works".
Then I placed a MsgBox inside the if statement: MsgBox "if works"
Then I placed a MsgBox inside the event, but after the loop executes: MsgBox "post loop works"
I get "loop works" and "post loop works" to come up, but not "if works".
So its having troubles verifying my selected item. There are two Selected properties (one in Access, and one in MSForms). The default one when I write my code seems to come up with the Access Selected version. The thing I think is the issue here is, this returns a Long value...you would think Boolean. However, the MSForms version of Selected under a ListBox returns a Boolean...I just can't figure out how to call that version of it. It seems to always call the Access version.
With this extra information, do you have any ideas? Thanks again Dave.
|
|
|
|
|
If it's an Access Form ListBox, the it will call the Access version. Period. You cannot change that. According to the docs, ListBox.Selected(index) takes a Long (32-bit signed integer) as an arugment and returns a Boolean if that item is selected or not.
Does the selection highlight disappear after your AfterUpdate code runs?? If it does, then AfterUpdate fires AFTER the data is changed and the selections are removed. In which case, yes, all of your "is selected?" compares will return false.
|
|
|
|
|
No, it stays highlighted...I even tried changing it to a Click Event Routine. Didn't help.
My if statement is:
If ListBox.Selected(iterator) Then ' iterator is defined as a Long, but I have also tried Integer
End If
Nothing inside the if block is executing...which makes me think there is something wrong with the ListBox.Selected(iterator). This just seems too bizarre.
|
|
|
|
|
Wait, could it be because my original ListBox's Row Source Type is Table/Query rather than Value List? Right now I'm using an Access Query to populate the list...would it make a difference if I were to set up the SQL query in the VB Editor and populate it as a Value List?
|
|
|
|
|
OK. I knew I gave up on Access development for a reason... actually, LOTS of reasons...
If the ListBox's MultiSelect property is "None", you can get the selected item index number from the ListBox.ListIndex property.
If the ListBox's MultiSelect property is NOT "None", you can get the selected items index numbers from the ListBox.ItemsSelected collection.
|
|
|
|
|
Thanks, the ListIndex property worked wonders!
|
|
|
|
|
hi all,
i am developing a windows application, where in which i have taken a form to insert some records,
My Question is ...
after i insert a record the form should be in the same MDI
actually i put, xyz form on my Main MDI form and i am using this insertion formm on my xyz form,
so here, my doubt is how to ristrict my form's multiple instances in the xyz form which is agian in MDI
the code that i wrote is
If FDAStatusChange_cmbProtocolFDAStatus.Text = "" Then
MessageBox.Show("Please select a Protocol FDA Status", "Trial Traking System", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
Try
con.Open()
intversionid = objdalversions.VERSION_ID
Dim intUserId = 1
Dim strFDAStatus As String = FDAStatusChange_cmbProtocolFDAStatus.Text.Trim
Dim strFDAStatus_name As String = "select dbo.F14_FDA_Status_ID(FDA_STATUS) from T6_PROTOCOL_FDA_STATUS where FDA_STATUS='" & strFDAStatus & "'"
Dim cmd1 = New SqlCommand(strFDAStatus_name, con)
Dim intFDAStatisID As Integer = cmd1.ExecuteScalar()
objFDAStatusChange.T3_PROTOCOL_VERSIONS_ID = intVersionId
objFDAStatusChange.T6_PROTOCOL_FDA_STATUS_ID = intFDAStatisID ' CTAStatusChange_cmbProtocolCTAStatus.Text.Trim()
objFDAStatusChange.FDA_Status_Date = FDAStatusChange_dtFDAStatusDate.Value
objFDAStatusChange.FDA_STATUS_Comments = txt_FDA_Comments.Text.Trim()
objFDAStatusChange.DOCUMENTED_DATE = System.DateTime.Today
objFDAStatusChange.T50_User_ID_CREATED_BY = intUserId
objFDAStatusChange.PROTOCOL_FDA_STATUS_TRACKING_CREATED_ON = System.DateTime.Today
objFDAStatusChange.CreateFDAChangeStatus(objFDAStatusChange)
con.Close()
MessageBox.Show("Successfully Saved", "Trial Traking System", MessageBoxButtons.OK, MessageBoxIcon.Information)
Me.Close()
Catch ex As Exception
MessageBox.Show("Save Error", "Trial Traking System", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End If
Prashanth
|
|
|
|
|
This should not be an MDI form but down as a dialog.
The MDI solution is incredibly easy. All you have to do is create a flag that you set when you create an instance of the form. But, before you create that instance, check the status of the flag. If it's already set, just don't create the new instance!
This does not sound like a candidate for an MDI application. MDI stands for Multiple DOCUMENT Interface, not multiple forms. MDI was designed so you can have multiple documents open and edit them all using the same interface. Nothing is your code or post suggests that what this app is doing, so I have to question why you're even using MDI.
|
|
|
|
|
Hi, Im just started on developing a keylogger and have a dll that helps me capture keystrokes. Im looking for ideas and suggestions of how to go about this whole project. Assistance of any kind is highly appreciated.
erkertsa
|
|
|
|
|
akatsa wrote: Im looking for ideas and suggestions of how to go about this whole project.
Bin it. The last thing the world needs is more spyware.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton
My website
|
|
|
|
|
You're joking, right?
99.9% of the time a keylogger is illegal to use. So, you want help with what again? Something illegal? I don't think so.
|
|
|
|
|
Dave Kreskowiak wrote: 99.9% of the time a keylogger is illegal to use.
Not all. I wrote a key logger one time just to track how much and how fast I typed.
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
|
Am writing on genetic algorithm for nurse duty rostering and got hooked in my coding.can anyone send me samples in vb6.0 or java.for a period of one month or more.my email address is sopsophia@yahoo.com
Thanks
|
|
|
|
|
First, don't cross post. Second, your cross post in the Vista forum makes no sense. Third, if you are having problems post the code you have thus far, tell us the error and we will see if we can help you. Just asking for us to give you code is considered rude.
______________________
stuff + cats = awesome
|
|
|
|
|
Java is an academic language, because it is free. Genetic algorithms are academic playgrounds. If you search for Genetic Algorithm and Java, you will find many stable already complete and robust libraries.
Pualee
Edit: and they are free
|
|
|
|
|
For a movie project(in vb.net 2005), i have to store the availabilty of seat (100 checkboxes) in a textfile.According to the value of textfile like "True" or "false" ,i have to make the enable property of checkbox as enabled or disabled.The checkboxes are named as A1,A2,A3,..,A10
B1,B2..B10.Can anyone help me for this question ?
|
|
|
|
|
What kind of format is this textfile set up in? In other words, how are you determining whether the checkbox control should be enabled to true or false?
|
|
|
|
|
Thanks. The textfile is in the format of T;T;F;T;T;T;T;T;F;T .This pattern in ten rows. "T" stands for true (that is that seat is available for booking) and "f" for false .
|
|
|
|
|