|
How can we ShutDown Windows using APIs ? I am sure its possible with APIs. If there is another way to ShutDown Windows using C# code. Then please do tell me.
Cheers
|
|
|
|
|
You can P/Invoke either ExitWindowsEx or InitiateSystemShutdownEx. You can look them both up on MSDN. http://msdn.microsoft.com[^]
RageInTheMachine9532
|
|
|
|
|
İs there anybody can help me about this,i want to open and edit dicom images with c# codes,please help me.
|
|
|
|
|
;P
http://sourceforge.net/projects/dicom-cs/
|
|
|
|
|
Much information and links on DICOM can be found here[^].
If your going to be editing images, you might want to consider downloading the DICOM spec (in PDF form) from that same site.
RageInTheMachine9532
|
|
|
|
|
I am doing my final year project on remote desktop control.So I want to control remotely keyboard and mouse.How can i do this in C#.I know for mouse we can use Cursor.position.x or Cursor.position.y but how to get or set keyboard events?please help me in any way.
mughalali
|
|
|
|
|
mughalali wrote:
I know for mouse we can use Cursor.position.x or Cursor.position.y...
Actually, no you can't. Cursor.Position is defined as a Point , which is a value type. If you set the X and Y properties, you won't change anything because you're changing it on a copy of the Position . You would actually have to do something like this:
Cursor.Position = new Point(x, y); To send key strokes, you can use the SendKeys class, which sends keys to the active window. It's pretty limited, so if you want more control you should P/Invoke native APIs like PostMessage . See the Platform SDK documentation for more details.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I know that all the algorithms provided in the .net framework have a default block size and key size. For example, DES is 8 bytes for the block size and key size, Rijndael is 32 bytes and 16 bytes.
Is it possible for us to change the default block size and key size to cater to our needs ?
|
|
|
|
|
Any algorithm that derives from SymmetricAlgorithm has a read/write BlockSize property. Change that before using the algorithm.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
I'm pretty new to C#, so forgive me if this is an overly simple question.
I'm trying to write an event handler that can be used for multiple different controls. Each time the event is fired, I need to make changes to several different controls at once.
My controls are named as such:
avail0Add
avail0
daily0 ...
avail1Add
avail1
daily1 ... and so on
The way I've been trying to do this (which hasn't worked) is by building the reference to the control using a substring of the name of the sender (namely the "0" or the "1" in the name. So conceptually, I want to do something like this:
private void availAdd_Click(object sender, System.EventArgs e)
{
string i = ((Button)sender).Name.ToString().Substring(5,1);
foreach(Person person in ("avail" + i).SelectedItems)
{
("daily" + i).Items.Add(person);
}
}
I don't know if there is syntax for this is C# that I just don't know, or if this isn't possible. I know the equivalent in VB would look something like:
Me.Controls("daily" & i).[rest of the code]
I would prefer it to do it this way if possible, but am open to other solutions as well.
thanks,
Eric.
|
|
|
|
|
mironos wrote:
("daily" + i).Items.Add(person);
That won't work.
You'll have to use the Controls collection on the Form to refer to the controls your after, such as
If( this.Controls[ index ].Name == 'something' )
or something close to this. You'll also probably look into checking the type of control too.
RageInTheMachine9532
|
|
|
|
|
i searched alot for free source code for router configuration commands simulator and i didn't find any thing could you help me to find it as soon as possiple ....
:|i need a code running under windows not any OS else
Thanks
mbd
|
|
|
|
|
route add .. .. ..
how about you ask relevant questions for C#?
Do yourself a favor and install linux and you will have all the source code you ever need.
top secret
|
|
|
|
|
I have a program that interfaces a access database. I made the adapter and have a connection to it. I can view the schema and all. However for some reason the below code is not allowing me to insert a new roll and can't figure out why. Based on what i read on msdn this looks correct.
Thanks for the help.
private void button1_Click(object sender, System.EventArgs e)
{
oleDbDataAdapter1.Fill(dataset);
DataRow Insert = dataset.Movie.NewRow();
Insert["Title"] ="testing";
dataset.Movie.Rows.Add(Insert);
Controls.Remove(this);
this.Hide();
}
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
|
You need to call Update on the DataSet in order for the changes to be persisted back to the database.
Charlie
if(!curlies){ return; }
|
|
|
|
|
I do have a question though maybe you or someone else can answer this.
In my access database. I have a field called Information. I set it as type memo so its 65,535 in length. I took and changed the maxlength on my textbox to that size. However. Whenever I type in the box without hitting enter. Everythign looks fine but when i query the database i get only maybe a line an a half of whatever i type. Its not even close to 65,535. Any idea would could be causeing the data to truncate like that?
Win32newb
"Making windows programs worse than they already are"
|
|
|
|
|
If you are using Query Analizer (comes with the SQL install), then it is just the default behaviour of the client. It is not showing you the actual text on the DB. I don't have a database to bring mine up on right now, but there is some option you set which defines how much text it should grab on a query.
___________________
Forgoing antagonism and separation, one enters into the harmonious oneness of all things. Lao Tzu
|
|
|
|
|
I have made a neat little app that does lookups in Active Directory based on information entered. So far, i have had great success with literal strings, but i was wondering how, using DirectorySearcher (in C#), that i can do searches on partial strings.
Example: Right now, if i search on extension 12345, i get a row returning the user with 12345., and when i click on him/her, it returns all of their information. i would like to make it so if i did a search on 123, all entries with the 123 string in their properties would return.
Or, if i put in jd for username, i will get jdoe, jderr, jdingle, nedjam, etc. I have heard there is something called "insrch" or something similar that can do this, but cant find anything specific.
Yes, I am the highly suggestable type.
|
|
|
|
|
Use (sn=*123*) . I know 123* would be a valid filter in AD; I assume *123* would work as well.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I gave it a shot. The upside, it didnt generate any errors. The downside, with the * in place, it also doesnt return anything on the searches.
Yes, I am the highly suggestable type.
|
|
|
|
|
Try it without the preceeding asterisk and keep the trailing asterisk. I have a couple Exchange policy filters that use this notation to filter users and groups and it seems to work fine (it uses Active Directory). If not, I don't know what to tell you. I guess search the Active Directory documentation on MSDN[^] and see if there's anything in there about it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
You, sir, are a saint. It worked perfectly ;)
Yes, I am the highly suggestable type.
|
|
|
|
|
Hello people, how are you?
Does anybody knows how can I hide a tabPage in a TabControl?
For exemplo:
tabControl1.TabPage[1].Visible = false;
If anybody could help me, I would be glad...
thanks
André.
|
|
|
|
|
Just remove it - it doesn't mean you have to dispose of it:
tabControl1.TabPages.RemoveAt(1); Later, you can "show" it again by inserting it back in:
tabControl1.TabPages.Insert(1, tabPage2);
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have a C# dialog app, and haven't realized until now that I want to translate it that some of the auto generated *.resx files aren't compiled into the output. (!) I haver verified the build type for them, I have looked into the .csproj file and found nothing unusual.
I have also tried compiling the resx file with the resource compiler which worked right.
I would need help on this, or I can't proceed with my project.
Thanks in advance.
|
|
|
|