|
Try overriding WndProc and checking for the message manually?
|
|
|
|
|
That was my emergency-solution.
The big question is why an event is raised in the beginning, but not after a button was pressed...
That´s kind of strange to me...
|
|
|
|
|
Hi folks
Would higly appreciate your help on this.
Suppose a C# Windows Service is running with some domain user login/password...
Now suppose the user's password expires...
Will the service keep running? or will it stop as soon as the password expires?
|
|
|
|
|
I don't know for sure but I would suspect the service will continue to run since it had already started and authenticated, however, if it restarts it should not.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Domain services should run under the Network service account or a domain account with no password expiry duration. If you use any other account service will stop running not start once the password expires.
modified on Tuesday, March 23, 2010 11:48 AM
|
|
|
|
|
d@nish wrote: will stop running once the password expires
are you sure? It seems to me it would keep running until restarted. The process has already been started and I'm not aware of a mechanism that continues to check if the service has been authenticated
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Yes. It won't happen suddenly. But it will not run start once password is expired.
Still, I guess it would depend on the kind of the service. I guess if the service tries to do any kind of file operations, since the account has already expired it should not be allowed to.
|
|
|
|
|
d@nish wrote: if the service tries to do any kind of file operations, since the account has already expired it should not be allowed to
Makes sense to me also.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I'm not sure about that, I think that a file operation on local machine may still work after the password has expired.
A network operation, on the other hand, should probably fail.
|
|
|
|
|
AFAIK, any time you do a file operation, windows will check if you right to do so. Now, since the account itself has expired, it should have no rights to do anything. Hence the operation would fail and service will either not work as expected or might stop as well.
|
|
|
|
|
I have a activex control written in C++ (Visual Studio 6). I have used AxImp to get the required assembly out so that I can use this as Windows Forms Controls in my C# application on a Windows Form. I have changed the generated .cs file to cater to my requirement. The constructor of the class (which is derived from AxHost) is getting called. But the AttachInterface() is not getting called at all. I am not able to figure out why. I have message boxes in the constructor and the AttachInterface method. I get the messagebox in the constructor during run time but NOT the one in AttachInterface.
Please help.
Thanks much in Advance.
|
|
|
|
|
Does anyone know of a CHM viewer control that could be integrated into a .NET application? I'd like to be able to integrate a CHM help file into my application, but I developed a custom look for all of my dialog box frames, so I don't want to launch the default Windows CHM viewer.
Thanks.
|
|
|
|
|
You could always look at using this[^] article as a basis for writing your own.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Yeah, I saw that article before I even posted this. Just thought I would post to see if there were any .NET components out there so I wouldn't have to reinvent the wheel.
|
|
|
|
|
I have a custom control, MyControl . It has a property, SubControls , of type SubControlCollection .
When I drop a new instance of MyControl on a form, I want the InitializeComponent method to create two SubControl s and add them to the new instance. By way of example, dropping a TabControl on a form will generate the two starting TabPage s and add them to the TabControl .
Can anyone point me to examples of how this is managed? VB.Net would be preferred, but I can translate from C#.
Added: See the response EUREKA! below for the solution.
modified on Tuesday, March 23, 2010 1:14 PM
|
|
|
|
|
|
I guess that would be helpful information The control is based on System.Windows.Forms.Panel .
Actually, I have found some code -- A Multipanel Control in C#[^] -- that has something similar to what I want. This example serializes through the designer; what I ultimately want is to start off with a few components whether or not the designer is invoked at design time.
|
|
|
|
|
Lovely town on the northern California coast; I lived theren when I went to college. But in any case, I have a solution. It is based on liron.levi[^]'s article from last year, A Multipanel Control in C#[^]
The answer turned out to be in the designer. In the CodeProject article linked directly above, the AddPage method gets a reference to IDesignerHost , then calls CreateComponent to create a new instance of the object (in this case, an untabbed "tab" panel.) Called without the name parameter, the created object is given a default instance name, which solves a different problem I had been trying to figure out.
My solution for serializing two child controls into InitializeComponent was to replicate this part of AddPage into the Initialize method. The whole method (translated into VB, sorry) looks like this:
Public Overrides Sub Initialize(ByVal component As IComponent)
MyBase.Initialize(component)
Dim iccs As IComponentChangeService = _
DirectCast(GetService(GetType(IComponentChangeService)), IComponentChangeService)
If iccs IsNot Nothing Then AddHandler iccs.ComponentRemoved, AddressOf ComponentRemoved
Dim s As ISelectionService = DirectCast(GetService(GetType(ISelectionService)), ISelectionService)
If s IsNot Nothing Then AddHandler s.SelectionChanged, AddressOf sSelectionChanged
'Attempt to add two pages
Dim DH As IDesignerHost = DirectCast(GetService(GetType(IDesignerHost)), IDesignerHost)
If DH IsNot Nothing Then
Dim MPP As MultiPanelPage = _
DirectCast(DH.CreateComponent(GetType(MultiPanelPage)), MultiPanelPage)
MPP.Text = MPP.Name
_MPanel.Controls.Add(MPP)
_MPanel.SelectedPage = MPP
MPP = DirectCast(DH.CreateComponent(GetType(MultiPanelPage)), MultiPanelPage)
MPP.Text = MPP.Name
_MPanel.Controls.Add(MPP)
End If
End Sub
With this, dropping a MultiPanel control onto a form causes the form's InitializeComponent to declare the control, two autonamed panels, initialize everything and assemble them properly.
If this is confusing, don't worry: I'm working on a simplified version which will become a new article.
|
|
|
|
|
|
Hi Guys,
I am trying to send bytes over TCP/IP using the StreamWriter and/or the BinaryWriter.(visual Studios 2008 - VB)
I am so confused, and tried various other ways.
what I want to do:
send 1st data packet as a Long (47, 4, 0)
get a reply (automatic one)
then send long (001)
I can open a connection using the Client connect....
using Dim Client as new Net.sockets.TCPclient
then just send the packets as above!
Really could do with some help!
Cheers,
James
|
|
|
|
|
gymgym_jim wrote: Really could do with some help!
And what exactly do you want help with? Try and describe what you are doing (include a code snippet to clarify), and what is not working.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Hi,
Ok, I have a piece of hardware that can communicate with a PC over TCP/IP.
I want to write a Visual Basic program to be able to send packets of data (as a Long) to this Hardware. The response coming back from this card is not Important.
I have tried different things, and now my code is in a bit of a mess.
I am now trying Winsock.
This makes the connection:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If AxWinsock1.CtlState = MSWinsockLib.StateConstants.sckConnected Then
MessageBox.Show("Server is already connected")
Exit Sub
Else
AxWinsock1.RemoteHost = "10.0.0.202"
AxWinsock1.RemotePort = 7655
AxWinsock1.Connect()
End If
and this sends the data:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If AxWinsock1.CtlState <> MSWinsockLib.StateConstants.sckConnected Then
MessageBox.Show("Server is not connected")
Else
AxWinsock1.SendData(TextBox1.Text)
End If
End Sub
and this is the data Type:
Private Sub AxWinsock1_DataArrival(ByVal sender As Object, ByVal e As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles AxWinsock1.DataArrival
Dim strData As Object
Dim i As Integer
Dim tstring As String
tstring = ""
AxWinsock1.GetData(strData)
For i = 0 To UBound(strData)
tstring = tstring + Chr(strData(i))
Next
TextBox2.Text = tstring
End Sub
How do i get this to not send strings, But Longs only?
Cheers
|
|
|
|
|
I'm not sure of the actual syntax for the library you are using, but you can send and receive data as a sequence of bytes rather than as a string. Just build your message as a byte array and send from there. Similarly on receive store your data into a byte array. If you are putting long values in the array then you need to know where the value starts in order to extract it.
This link[^] has some sample code that should help you.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Would you know how I change this to send a Byte Aray?
|
|
|
|
|
I don't know anything about AxWinsock (could not find it in MSDN), but the link I sent you explains how to do it with tcp.send. If you are having trouble figuring this out it is always best to go to the documentation and look at the samples provided.
txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|