|
hi everyone
i'm looking for a way to display services associated with a process. i've found that i need to use "QueryServiceStatusEx" , problem is i'm programming in C# and don't have much experience in Win32 API. i'm struggling to make it word in my program and MSDN's code example aren't are complex . can anyone please help me? how do i implement "QueryServiceStatusEx" in C# first and then enumerate the list of services associated with a process? plz help
kind regards
|
|
|
|
|
Hello,
I have a client app written in c# that contains checklistbox. I had the statement clearselected() to clear out the checked checkboxes when the user loads the new case... Everything worked perfectly until my users got converted to new domain.
Since they got converted to the new domain, the checkbox is no longer cleared out on pageload. Whatever the user selected in the previous case remained checked for the new case. The problem is: the application will not do anything because there are nothing actually checked (the checkedindices collection is actually cleared)! The user either has to shutdown the app or manually uncheck/recheck the items in order to add them to the checkeditem collection.
The situation makes me thinking of the cache problem, but the data is brought back correctly for each case, excepts the checkboxes remained checked "graphically" on the UI. I had tried to clear the check marks of the checklistbox by looping through the checkedindice collection, but that didn't help.
I have searched for a solution but did not see any. If anyone has suggestion please let me know.
Thank you very much in advance.
VN.
|
|
|
|
|
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace WindowsApplication4
{
public partial class Form1 : Form
{
//private System.Windows.Forms.TextBox textBox1;
private System.Data.DataSet MODEL_1DataSet;
private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;
//private System.Data.OleDb.OleDbCommand selectcommand;
//private System.Data.OleDb.OleDbCommand insertcommand;
//private System.Data.OleDb.OleDbCommand updatecommand;
//private System.Data.OleDb.OleDbCommand deletecommand;
private System.Data.OleDb.OleDbConnection connection1;
//private System.ComponentModel.Container components = null;
public Form1()
{
InitializeComponent();
//using
//(System.Data.OleDb.OleDbConnection connection1 = new System.Data.OleDb.OleDbConnection())
//{
// The insertSQL string contains a SQL statement that
// inserts a new row in the source table.
//OleDbCommand command = new OleDbCommand(insertSQL);
// Set the Connection to the new OleDbConnection.
// command.Connection = connection1;
// Open the connection and execute the insert command.
//try
//{
connection1.Open();
//command.ExecuteNonQuery();
// }
//catch (Exception ex)
//{
// Console.WriteLine(ex.Message);
// }
// The connection is automatically closed when the
// code exits the using block.
}
}
private void Form1_Load(object sender, EventArgs e)
{
oleDbDataAdapter1.SelectCommand.CommandText = "SELECT Frame FROM Element Forces-Frames =" + comboBox1.AllowDrop;
oleDbDataAdapter1.Fill(modeL_1DataSet1);
Display(modeL_1DataSet1);
textBox6.Text += "\r\nsuccessful\r\n";
}
private void Display(DataSet dataset)
{
try
{
DataTable dataTable = dataset.Tables[ 0 ];
if (dataTable.Rows.Count != 0)
{
int record = (int)dataTable.Rows[0][0];
textBox1.Text = (string) dataTable.Rows[0][3];
textBox2.Text = ( string)dataTable.Rows[0][4];
textBox3.Text = (string)dataTable.Rows[0][5];
textBox4.Text = (string)dataTable.Rows[0][6];
}
else
textBox6.Text += "\r\nnot found\r\n";
}
catch (System.Data.OleDb.OleDbException oleexecption)
{
Console.WriteLine(oleexecption.StackTrace);
textBox5.Text += oleexecption.ToString();
}
}
}
}
this is my program i donno watzz wrong in this...
its giving errors
as
Error 1 The namespace 'WindowsApplication4' already contains a definition for '?' 71 53 WindowsApplication4
Error 2 The namespace 'WindowsApplication4' already contains a definition for '?' 71 56 WindowsApplication4
Error 3 The namespace 'WindowsApplication4' already contains a definition for '?' 72 60 WindowsApplication4
Error 4 The namespace 'WindowsApplication4' already contains a definition for '?' 72 63 WindowsApplication4
Error 5 The namespace 'WindowsApplication4' already contains a definition for '?' 73 60 WindowsApplication4
Error 6 The namespace 'WindowsApplication4' already contains a definition for '?' 73 63 WindowsApplication4
Error 7 The namespace 'WindowsApplication4' already contains a definition for '?' 74 59 WindowsApplication4
Error 8 The namespace 'WindowsApplication4' already contains a definition for '?' 74 62 WindowsApplication4
Error 9 The namespace 'WindowsApplication4' already contains a definition for '?' 75 59 WindowsApplication4
Error 10 The namespace 'WindowsApplication4' already contains a definition for '?' C:\Documents and Settings\sasikumar\My Documents\Visual Studio 2005\Projects\WindowsApplication4\WindowsApplication4\Form1.cs 75 62 WindowsApplication4
Error 11 Expected class, delegate, enum, interface, or struct C:\Documents and Settings\sasikumar\My Documents\Visual Studio 2005\Projects\WindowsApplication4\WindowsApplication4\Form1.cs 55 17 WindowsApplication4
Error 12 Expected class, delegate, enum, interface, or struct C:\Documents and Settings\sasikumar\My Documents\Visual Studio 2005\Projects\WindowsApplication4\WindowsApplication4\Form1.cs 64 17 WindowsApplication4
Error 13 Identifier expected C:\Documents and Settings\sasikumar\My Documents\Visual Studio 2005\Projects\WindowsApplication4\WindowsApplication4\Form1.cs 68 55 WindowsApplication4
Error 14 Identifier expected C:\Documents and Settings\sasikumar\My Documents\Visual Studio 2005\Projects\WindowsApplication4\WindowsApplication4\Form1.cs 71 54 WindowsApplication4
Error 15 Identifier expected C:\Documents and Settings\sasikumar\My Documents\Visual Studio 2005\Projects\WindowsApplication4\WindowsApplication4\Form1.cs 71 57 WindowsApplication4
Error 16 Identifier expected C:\Documents and Settings\sasikumar\My Documents\Visual Studio 2005\Projects\WindowsApplication4\WindowsApplication4\Form1.cs 72 61 WindowsApplication4
Error 17 Identifier expected C:\Documents and Settings\sasikumar\My Documents\Visual Studio 2005\Projects\WindowsApplication4\WindowsApplication4\Form1.cs 72 64 WindowsApplication4
Error 18 Identifier expected C:\Documents and Settings\sasikumar\My Documents\Visual Studio 2005\Projects\WindowsApplication4\WindowsApplication4\Form1.cs 73 61 WindowsApplication4
Error 19 Identifier expected C:\Documents and Settings\sasikumar\My Documents\Visual Studio 2005\Projects\WindowsApplication4\WindowsApplication4\Form1.cs 73 64 WindowsApplication4
Error 20 Identifier expected C:\Documents and Settings\sasikumar\My Documents\Visual Studio 2005\Projects\WindowsApplication4\WindowsApplication4\Form1.cs 74 60 WindowsApplication4
Error 21 Identifier expected C:\Documents and Settings\sasikumar\My Documents\Visual Studio 2005\Projects\WindowsApplication4\WindowsApplication4\Form1.cs 74 63 WindowsApplication4
Error 22 Identifier expected C:\Documents and Settings\sasikumar\My Documents\Visual Studio 2005\Projects\WindowsApplication4\WindowsApplication4\Form1.cs 75 60 WindowsApplication4
Error 23 Identifier expected C:\Documents and Settings\sasikumar\My Documents\Visual Studio 2005\Projects\WindowsApplication4\WindowsApplication4\Form1.cs 75 63 WindowsApplication4
Error 24 A namespace does not directly contain members such as fields or methods C:\Documents and Settings\sasikumar\My Documents\Visual Studio 2005\Projects\WindowsApplication4\WindowsApplication4\Form1.cs 77 17 WindowsApplication4
Error 25 Type or namespace definition, or end-of-file expected C:\Documents and Settings\sasikumar\My Documents\Visual Studio 2005\Projects\WindowsApplication4\WindowsApplication4\Form1.cs 80 13 WindowsApplication4
|
|
|
|
|
arjunsasikumar wrote: // code exits the using block.
}
}
private void Form1_Load(object sender, EventArgs e)
{
Delete the one of the closing brackets ("}").
|
|
|
|
|
this shows me connection error in
connection1.open()
|
|
|
|
|
this shows me connection error in
connection1.open()
|
|
|
|
|
Also I need to know if there is a way I can make my listview columns in details view unable to be resized.
|
|
|
|
|
I found an article and designed a new user control based on that.
|
|
|
|
|
How can i make my treeview show all the items expanded by default?
|
|
|
|
|
Either call the ExpandAll() method after adding new nodes or call the added node's Expand() method or even subclass the TreeView and override the Adding functionality so that it expands the added nodes automatically.
|
|
|
|
|
Hello fellow .NET users. I've been searching for a while and haven't found a good way to detect if a standard laptop lid has been closed through C# or any of the .NET languages. Does anyone know how I might do this though managed or even unmanaged code? Essentially if the laptop lid was set to "do nothing" under the power options I would like to be able to check if the lid has been closed.
|
|
|
|
|
There is no API for this that I know of, I suspect it's something that laptop manufacturers build in to their hardware, which then calls a known API based on how it is set.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
When the lid-closed power option is set to "do nothing" you are, in effect, telling windows to ignore the fact that the lid is closed - so it does. I don't agree with that, but it appears to be the way things are hooked up.
This[^] blog - it describes this in a fair amount of detail.
Cheers,
Drew.
|
|
|
|
|
I've read the article and experimented but it seems more applicable if I was working with the DDK and writing a driver.
Do you know if there's a DLL / windows API I can hook into.
All I want to be able to do is to detect status of my lid either open or closed.
|
|
|
|
|
I've added a dll (added as refernce)
and I am trying to create a new class from the dll
but I get this error:
Retrieving the COM class factory for component with CLSID {DD683B25-1820-412E-AA8A-7AA92321EBC8} failed due to the following error: 8007007e.
in the tips: it tell me something about the location
of the dll
can someone please help me?
|
|
|
|
|
That error code is for : "The specified module could not be found."
Just a guess but it could be an outdated COM object registration, but I'm no expert in COM.
|
|
|
|
|
How to create IE toolbar?
if it is with .net it will be gr8
|
|
|
|
|
|
need to connect .xls files as a database connection...
wat should i install for this purpose????
i'm geetin an error regarding ODBC connectivity...but i did complete installtion of VS2005
|
|
|
|
|
Hi ,
would you help me to add a calculated record in a data grid (select the maximum id value then add 1 & assign the new value to the new row in the datagrid)
thanks,,
|
|
|
|
|
Can't wait to be allowed to download and use .NET 3 here at the office. Hopefully lambda expressions (or something else I'm not thinking of at the moment) will fix the fact that I can't do this:
DateTime dt = new delegate(SomeObject o)
{
int year = Convert.ToInt32(((string)o.Value).Substring(0, 4));
int month = Convert.ToInt32(((string)o.Value).Substring(4, 2));
int day = Convert.ToInt32(((string)o.Value).Substring(6, 2));
return new DateTime(year, month, day);
};
Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan
Portland, Oregon, USA
|
|
|
|
|
Jamie, I'm afraid .NET 3 is purely a .NET library extension; C# 3 (which includes lambda expressions) isn't yet released.
However, you can do what you just wrote in C# 2:
delegate TReturn ReturnFunction<TReturn, TArg>(TArg argument);
ReturnFunction<DateTime, SomeObject> method = delegate(SomeObject o)
{
int year = Convert.ToInt32(((string)o.Value).Substring(0, 4));
int month = Convert.ToInt32(((string)o.Value).Substring(4, 2));
int day = Convert.ToInt32(((string)o.Value).Substring(6, 2));
return new DateTime(year, month, day);
};
DateTime dt = method(someObjectInstance);
|
|
|
|
|
Oh, I know it's just an extension. My complaint is this part:
delegate TReturn ReturnFunction<TReturn, TArg>(TArg argument);
This seems like a mute point. If I'm going to write that, THEN write the delegate description, it seems like the ONLY thing gained is not having to call the function something (on the other hand, you still have to name the delegate). To me, it seems as though you're actually doing MORE by using anonymous methods than just writing a helper func, because you have to declare the delegate signature.
Maybe I'm just missing something (which is totally possible). Why would I want to go through the extra typing instead of just declaring a helper func?
Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan
Portland, Oregon, USA
|
|
|
|
|
I just have a utility library that contains a bunch of generic delegate declarations. I then use these throughout my code.
With C# 3, System.Query.dll will contain a bunch of generic delegates, allowing you to just use these instead and won't have to declare your own.
And honestly, just a few generic delegates (maybe 4 overloads, each one taking 1 more parameter than the last, and another 4 for return functions) and you never have to write another delegate again.
|
|
|
|
|
Generic delegates? If you don't mind me asking, can you post an example (or email me directly)? I believe you, I'm just really trying to understand the point of these things. They're the one thing about 2.0 that's escaped me thus far.
Either way, thanks for your input, Judah. I appreciate it.
Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan
Portland, Oregon, USA
|
|
|
|