|
rajeevr@interrait.com wrote: Why its not possible to change display name using ServiceController class
I dont know why.
rajeevr@interrait.com wrote: do you know any other approach to do this.
Perhaps the registry, but you will need admin rights to do so.
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
Hi tried with registry. It changes the display name in Property Window of Service only but not in cosole menu. And also in the object of Service Controller when reading property of the service after making change, DisplayName change doesn't reflect. But I were successgul in changing description.
I am adding my code here
private void button2_Click(object sender, System.EventArgs e)
{
ServiceController obj = new ServiceController("Telephony");
Microsoft.Win32.RegistryKey objReg;
string str = obj.DisplayName;
try
{
ServiceControllerEx objSercEx =new ServiceControllerEx("Telephony");
string strDes = objSercEx.Description;
objReg = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"System\CurrentControlSet\Services\tapisrv",true);
objReg.SetValue("DisplayName","Telephony5678");
objReg.SetValue("Description", "DEscription");
objReg.Close();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
|
|
|
|
|
Create the ServiceController instance AFTER you change the value.
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
Hi
I would like to know how can I detect the sql server on a machine?
Thanks
|
|
|
|
|
_Hacker wrote: I would like to know how can I detect the sql server on a machine?
- Look in registry
- Look in file system
- Try establish connection
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
Hi,
Can anyone please tell me how to get the scroll position of a control. I have a tree view control and I would like to get the scroll position of the control when I scroll it using a scrollbar.
Thanks!
|
|
|
|
|
Hi ,
I am working in c# with crystal report XI.
I read an example about dynamic image location ..
1) In that we have a xml xchema file with two fields n amed country--datatype is string, img--datatype is base64Binary. using this as the datasource,i have designed the crytal report. And a parameter is set asking for the name.
2) I have designed teh form by adding a crystal report viewer and
now the coding part is as follows
// Prcocedure: AddImageRow
// reads an image file and adds this image to a dataset table
//
// [in] tbl DataTable
// country name of a country
// filename name of an image file
//
void AddImageRow(DataTable tbl, string name, string filename)
{
FileStream fs = new FileStream(filename, FileMode.Open);
// create a file stream
BinaryReader br = new BinaryReader(fs);
// create binary reader
DataRow row;
// create a new datarow
row = tbl.NewRow();
// set country field and image field
row[0] = name;
row[1] = br.ReadBytes((int)br.BaseStream.Length);
// add this row to the table
tbl.Rows.Add(row);
// clean up
br = null;
fs = null;
}
// Function: CreateData
// Creates a dataset that has 1 table with two fields: Country (string), and img (blob/byte[])
// Adds four records to this table
//
DataSet CreateData()
{
DataSet data = new DataSet();
// add a table 'Images' to the dataset
data.Tables.Add("Images");
// add two fields
data.Tables[0].Columns.Add("Country", System.Type.GetType("System.String"));
data.Tables[0].Columns.Add("img", System.Type.GetType("System.Byte[]"));
// add rows
AddImageRow(data.Tables[0], "argentina", Directory.GetCurrentDirectory() + "\\argentina.jpg");
AddImageRow(data.Tables[0], "canada", Directory.GetCurrentDirectory() + "\\canada.jpg");
return (data);
}
// Procedure: CreateReport
// Creates a report and passes the dataset
//
void CreateReport()
{
// create a report
CrystalReport1 cr = new CrystalReport1();
cr.SetDataSource(CreateData());
// pass a reportdocument to the viewer
crystalReportViewer1.ReportSource = cr;
}
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
CreateReport();
}
This is the coding part..ie,when the program is run the image which is existing in the directory (say argentina.jpg and canada.jpg). it will ask for country name...so if we type canada..then canada.jpg wil be displyed in the report.
This is wht the program does..
No I have to modify such that .. I have to add a buttn on the form say load..so when the load button is clicked, we should be able to load any image from the disk(any location) and that image should be displayed in the crystal report..How to do this..
please if any one change the coding part above and sent it .
|
|
|
|
|
Hi,
I am working with Drawing class.
My problem is I am unable to retain the previous drawing whenever i draw a new diagram.
Steps followed:
1. Draw a diagram(line) on Mouse up event.
2. When i draw the diagram second time using Mouse Up event, i am losing the previous diagram only new diagram is visible.
How to retain the previous and new diagram?
Thanks in advance.
|
|
|
|
|
Every time you redraw in your Paint event you need to redraw everything. There are at least two ways you could handle this (depending on what you need), one would be to keep a list of all lines that have been drawn and iterate through it on the Paint event redrawing them. The other would be to save the image as a bitmap and just redraw the bitmap every time you paint.
|
|
|
|
|
Thanks for the reply.
I got the answer waht I needed.
|
|
|
|
|
Typically, all your drawing code should be in the Paint event of your control or form. This is because part or all of your form/control can and will need to be redrawn at any time. Even if you don't have an event, like a button click or a mouse move to draw something in. Your application has to maintain a "database" of things that need to be drawn. Your app will modifiy this database using whatever methods you supply and the Paint code should interpret and draw everything in the database it needs to.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks for the reply.
I got the answer waht I needed.
|
|
|
|
|
Hi,
Using C# code is it possible to know the OS type, whether it is 32 bit or 64 bit OS ????
Any help will be great.
Saleem
|
|
|
|
|
Yes, the infact they have different runtime versions for 32 and 64bit.
Else try the good old autoconf check.
return Marshal.SizeOf(typeof(IntPtr));
Will return 4 for 32bit , and 8 for 64bit.
xacc-ide 0.0.99-preview7 now with C#, C, C++, IL, XML, Nemerle, IronPython, Perl, Caml, SML, Ruby, Flex, Yacc, Java, Javascript, Lua, Prolog and Boo highlighting support!
|
|
|
|
|
[C#]
public virtual int GetBytes(
string s,
int charIndex,
int charCount,
byte[] bytes,
int byteIndex
);
If the length of string s is less than the charCount, there will be a error.
How to solve it?
Thanks!
|
|
|
|
|
Check the length first ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi all,
can anyone please tell me how to trap the
WM_MOUSEUP message in the Wnd Proc in c#
i want to know the value of WM_MOUSEUP
so that i can check it with the Message value
and do the further processing
Thanks
Pramod
|
|
|
|
|
What's wrong with the mouse up message in C# ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
i want to know the value of WM_MOUSEUP
so that i can trap it
and perform some operations
can u tell me the Hex value that WndProc returns
for this msg
Thanks
Pramod
|
|
|
|
|
To find these, open a C++ project, type in the message, and hover the mouse over it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
HI,
Thanks for your advice
but Actually there is no any message called WM_MOUSEUP
it's always WM_LBUTTONUP
i found it
Expect your co-operation always
Regards,
Pramod
|
|
|
|
|
I would like to get bitmap screenshot of control. the problem is this control doesn't appear anywhere on form. i don't want to put this control on the form directly, just bitmap screenshot of this control.
can it be done in c#?
thanks
pete
|
|
|
|
|
You can't get a screenshot of anything that is not being drawn.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
can I force a control draw into a bitmap object instead of screan?
|
|
|
|
|
Hello , I'm new in the development world. Well the reason why for this message is for me to ask what microsoft technology that i can use to develop an OMR application? I would like to try explore such development.
should i use the OCR technology ? or should i try something else ?
Thanks.
|
|
|
|
|