|
Hi,
Please help me to find a solution for change the windows service logon account and password through code
Thanks in advance
Regards
Subin
|
|
|
|
|
If you want to do this at install time, use a ServiceInstaller and ServiceProcessInstaller which allow you to set the logon account when a service is installed using installutil.exe or the AssemblyInstaller in your own code.
If you want to do this at runtime, you'll need to P/Invoke ChangeServiceConfig like in the following example:
[DllImport("advapi32.dll", CharSet=CharSet.Auto)]
static extern bool ChangeServiceControl(
IntPtr hService,
uint dwServiceType,
uint dwStartType,
uint dwErrorControl,
string lpBinaryPathName,
string lpLoadOrderGroup,
ref uint lpdwTagId,
string lpDependencies,
string lpServiceStartName,
string lpPassword,
string lpDisplayName
); To get the hService handle, you'll need to also P/Invoke OpenService or CreateService . The ServiceController does most of what you need but not in this case, so you're probably better off writing your own class to handle that. I would recommend using the dispose pattern to make sure that any handle you open using OpenService or CreateService is closed using CloseServiceHandle .
Read Service Functions[^] for more information.
You can also visit http://pinvoke.net[^] for many managed signatures for unmanaged functions.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hello,
Does exist on the codeproject website any article where a little pretty login function for PocketPC is developed??
thx
regards
pat
|
|
|
|
|
http://www.codeproject.com/info/search.asp[^]
...or use the search box right below the logo on every page on CodeProject.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hello,
Unfortunately i did not find a good sample so i develop a login-screen on my own. The course of the events in my application is the following: When the the user logs in some a new form is showed where some user specific information is displayed. The problem can i know in the new form which user with wich userid was logged in?? - Is this possible with taken over a parameter form the login-screen to the other form? if yes how does it work in mobile applications?
Regards
patrick
|
|
|
|
|
Unfortunately i did not find a good sample so i develop a login-screen on my own. The course of the events in my developed application is the following: When the the user logs in a new form is showed where some user specific information is displayed. The problem is how can i know in the new form which user with wich userid was logged in?? - Is this possible with taken over a parameter from the login-screen to the other form? if yes how does it work in mobile applications?
Regards
patrick
|
|
|
|
|
Hi,
The ONLY way I can find to change a bound datagrid's cursor look successfully is to subclass DataGrid and inside the OnMouseMove force the cursor. However, because of some black magic we are using to force row heights on a particular grid I am NOT allowed to subclass it.
Are there any other ways I can force the cursor? Our requirements insist on a 'hand' cursor for all our grids containing selectable items.
thanks,
Deanna
|
|
|
|
|
I am looking for an OLAP control. So far i found two ActiveX controls:
- DynamiCube
- ContourCube
I like the functionality of both controls, but the controls do not support the XP visual styles. Also i prefer a .NET component above the ActiveX controls.
Is such an OLAP control available?
|
|
|
|
|
Search OLAP in .NET section of www.componentsource.com. You will get two hits.
|
|
|
|
|
That's correct. Only these two are OLAP charts. What i need is an OLAP table with multiple dimensions on both the x and y axis.
|
|
|
|
|
Hi
I have simple class
[Serializable]<br />
public class Siren : IDataSourceItem<br />
{<br />
uint _id;<br />
string _Name;<br />
int _InventoryNumber;<br />
string _SirenType;<br />
string _LocationStreet;<br />
string _LocationNumber;<br />
string _Remark;<br />
DateTime _LastDiagnostic;<br />
DateTime _NextDiagnostics;<br />
.<br />
.<br />
.<br />
.<br />
.<br />
.<br />
}
and I have collection of classes of this type
[Serializable]<br />
public class SirenGroup : System.Collections.CollectionBase,IDataSourceItem<br />
{<br />
public SirenGroup(){}<br />
<br />
public int Add(Siren siren)<br />
{<br />
return this.InnerList.Add(siren);<br />
}<br />
<br />
public void Insert(int index,Siren siren)<br />
{<br />
InnerList.Insert(index,siren);<br />
}<br />
<br />
public void Remove(Siren siren)<br />
{<br />
InnerList.Remove(siren);<br />
}<br />
<br />
public new void RemoveAt(int index)<br />
{<br />
InnerList.RemoveAt(index);<br />
}<br />
.<br />
.<br />
.<br />
}
when I serialize this object evrything seems OK
BinaryFormatter binaryFormatter = new BinaryFormatter();<br />
System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(100);<br />
<br />
<br />
try<br />
{<br />
binaryFormatter.Serialize(memoryStream,sirenGroup);<br />
}<br />
catch (System.IO.IOException exc)<br />
{<br />
Utilities.WriteLog.WriteError(exc);<br />
}
when I deserialize it
try<br />
{<br />
System.Type typeObjectType = typeof(Definitions.SirenGroup) ;<br />
if(typeObjectType.IsSerializable)<br />
object sirenGroup = <br />
System.Convert.ChangeType(binaryFormatter.Deserialize(memoryStream),typeObjectType);<br />
}<br />
catch (System.Runtime.Serialization.SerializationException exc)<br />
{<br />
Utilities.WriteLog.WriteError(exc);<br />
}
I get an error : stream ended before analysis was finished
Could anybody please tell me wat can produce this error.
Thank You
Salut!
|
|
|
|
|
If you're doing that all in one go you're going to have to set the MemoryStream's "Position" property back to zero before trying to deserialize.
Also, the use of ChangeType is not necessary as you should be able to cast it directly like so:
Definitions.Sirengroup sirenGroup = (Definitions.SirenGroup)binaryFormatter.Deserialize(memoryStream);
|
|
|
|
|
thank you very much. It was exactly the problem.
Salut!
|
|
|
|
|
Hi all,
I'm currently trying to use an xml-file as datasource for CrystalReports.
Works fine so far, but unfortunately Crystalreports displays the image, which is in the xml-file as base64String, as string.
Is there something like the Convert.FromBase64String() method in Crystalreports, so that my image is actually shown as an image?
Best Regards
Bernd
-------------------------------------------
The light at the end of the tunnel has been switched off temporarily due to budget problems...
|
|
|
|
|
I haven't done any convertions in Crystal Reports but I would recomend using an ADO.NET as a data source. You can load a dataset from your XML file and pass it into the report
|
|
|
|
|
Hi,
Does any one know to pop up a GUI from a windows service? The windows service I am developing uses process to execute exes(another applications). Some of those exes may have user interface. Since the exe's are being executed from a windows service, the user interface of that is not displaying.
Thanks,
Jo.
|
|
|
|
|
If you look at the service in the control panel you should find an option that allows the service to interact with the desktop. It should be under the logon tab.
www.troschuetz.de
|
|
|
|
|
|
|
|
Font.GetHeight Method and Font.Height Property are being described in almost identical words in MSDN.
If I test both the font size = 11
The GetHeight return 14.66667 and
Height Property returns 15Font.
What is the difference between two values?
please guide
|
|
|
|
|
The difference is described in the documentation for Font.Height in MSDN.
GetHeight is returning a float and Height is an int. GetHeight is returning the exact height and Height is GetHeight rounded upwards.
|
|
|
|
|
thanks for the reply, but i actually had deleted this question when i realised the difference, i don't know how come it still remains there in the forum.
regards
|
|
|
|
|
I've noticed a strange bug in my application (C#.Net using the express 2005 beta)
I've currently got it set to open new child windows maximized, and I get the normal child minimize/restore/close/etc buttons appear on the parent's menu bar
However, if I restore the child window, it's a bit hit or miss as to whether the child window gets widgets in its title bar
See screenshot[^] - the King Tut image window doesn't have widgets, but the other two windows do.
I've found that sometimes resizing the child window a bit makes the widgets suddenly appear.
What am I doing wrong? (or is this a Whidbey bug?)
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
I'm trying to make a component who's function can best be described as similar to the MainMenu component in VS.NET. The component should be able to add controls to the parent form at design time.
Via code in the component, I can create the new control and add it to the same container as the component, thus making it visible in the properties window of the form (via the combobox in the properties window), but I can't seem to figure out how to make the control visible on the form. How can this be done?
|
|
|
|