|
Hi all,
Currently I'm creating a process on a remote PC, the problem is that there is no UI that appears when the process starts. When I navigate to the task manager I can see the process in the process list, but nothing with regards to the UI.
I am make use of the following code:
ConnectionOptions options = new ConnectionOptions();
options.EnablePrivileges = true;
options.Authentication = AuthenticationLevel.Connect;
options.Impersonation = ImpersonationLevel.Impersonate;
string SystemName = "PC_NAME";
string Path = string.Format(@"\\{0}\root\cimv2", SystemName);
ManagementScope ms = new ManagementScope(Path);
ms.Connect();
ManagementPath processMgmtpath = new ManagementPath("Win32_Process");
ManagementClass processClass = new ManagementClass(ms, processMgmtpath, null);
ManagementPath processStartupMgmtpath = new ManagementPath("Win32_ProcessStartup");
ManagementClass processStartup = new ManagementClass(ms, processStartupMgmtpath, null);
ManagementBaseObject inParams = processClass.GetMethodParameters("Create");
inParams["CommandLine"] = @"c:\Application.exe";
inParams["CurrentDirectory"] = @"c:\";
inParams["ProcessStartupInformation"] = null;
ManagementBaseObject ReturnObj = processClass.InvokeMethod("Create", inParams, null);
Console.WriteLine("RC={0}", ReturnObj["returnValue"].ToString());
Many thanks in advance
Kind regards,
The only programmers that are better those C# programmers are those who code in 1's and 0's |
Programm3r
My Blog: ^_^
|
|
|
|
|
Programm3r wrote: The only programmers that are better those C# programmers are those who code in 1's and 0's
The sigs around here are getting stranger and stranger. C# is not a complex language, I don't see how being a user of it, means someone is terribly good.
If you're running it remotely, I think it runs as the remote user and so won't show on the desktop. But, I could be wrong.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Christian Graus wrote: The sigs around here are getting stranger and stranger. C# is not a complex language, I don't see how being a user of it, means someone is terribly good.
I think I should really change my sig, the strange thing is that it use to be "... C ..." and everybody was fine with that(during my first two year of being a member), but after I made it "... C# ..." I'm dodging bullets. Maybe I should change it back
Christian Graus wrote: If you're running it remotely, I think it runs as the remote user and so won't show on the desktop. But, I could be wrong.
That is what I thought too, but then I changed my local PC account to the account name of the remote PC, and it still does the same thing.
Thanks for the input.
The only programmers that are better those C# programmers are those who code in 1's and 0's |
Programm3r
My Blog: ^_^
|
|
|
|
|
Programm3r wrote: the strange thing is that it use to be "... C ..." and everybody was fine with that(during my first two year of being a member), but after I made it "... C# ..." I'm dodging bullets.
Yeah, that makes sense. You know C and C# are almost totally different, right ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
|
Accoring to this[^] it is due to security reasons..
The only programmers that are better those C# programmers are those who code in 1's and 0's |
Programm3r
My Blog: ^_^
|
|
|
|
|
|
You cannot create an interactive process remotely. This is so someone can't start an arbitrary application and trick someone into entering usernames and passwords or credit card information or some other sensitive information.
|
|
|
|
|
I have the below lines of code in a windows service.
When I run the service locally this works fine. But on the server it creates an issue on line no 6 "_dAdapter.Fill method". I can not debug it on the server as there is no VS 2005 installed.
The issue is the program just hangs and do not move further to line no 6 and it never comes on catch. It do not come on Finally block too.
Please advice.
1. try
2. {
3. ...
4.OracleDataAdapter _dAdapter = new OracleDataAdapter();
5. _dAdapter.SelectCommand = _oCom;
6. _dAdapter.Fill(dsGetOrder, "process");
7. }
8. catch (Exception ex)
9. {
10. ...
11. }
12. finally { }
Regards,
Pavas
|
|
|
|
|
mpavas wrote: I can not debug it on the server as there is no VS 2005 installed.
But you can add instrumentation and logging to get a view of what is happening inside your application.
mpavas wrote: The issue is the program just hangs and do not move further to line no 6 and it never comes on catch. It do not come on Finally block too
Is your live database bigger than your test/development database? The issue could be that it is attempting to load in all that data into memory.
|
|
|
|
|
Hangs for how long ? Sounds like it's just taking a long time to execute the call.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
hi all
I seem to have run into a problem and was wondering if anyone else had seen someting similar or could point me in the right direction.
I have an application that displays user inputted text in a choice of fonts (they choose). However when somebody inputs cyrillic text it doesnt show into the correct font (AbbeyRoad NF) but displays it in Arial. I thought this was because I set a default font face and then try to reset as the chosen one but this isnt the case, as AbbeyRoadNF doesnt have the cyrillic char set in it I'm assuming its defaulting to Arial internally but I can't see where this is happening as its not throwing any errors and I need to catch where this happens so I can alter the font for the print processing (which doesnt default to Arial).
has anyone heard of anything like this ? Any thoughts at all welcome.
thanks
tim
|
|
|
|
|
|
I am getting problem in searching. I am using SQL2005 and C#.net 2008. I have 6 text boxes to take input from user. input is depend upon user
either input for search in 1 textbox, either input in 2 or either input in 3 or in all
i am looking how can i handle it. i am not using data set in this application at all.
i have stproc for all other operations. please let me know how can i handle it.
thanks
|
|
|
|
|
how to handle what? getting input from a textbox?
I think you may need to re-write your problem here
|
|
|
|
|
are you able to create a connection to the server and query a database?
you will need to build your query string dynamically based on the input from the user.
make sure you use parameters thou and not direct text appends
|
|
|
|
|
Well, what specifically are you having difficulty with? Writing the query? Writing the code to query the database? Writing a stored procedure? Figuring out how to pass the parameters? Something else?
|
|
|
|
|
sorry guys,
all done
thanks
|
|
|
|
|
Member 2842468 wrote: all done
But what was the problem? I am curious
|
|
|
|
|
Hi All,
I would like to create own tcp/ip header for my client in c# like raw and can be send with data, my application wants this kind of process for my client.
Can any one please help me out in this with example or code in c#.
Thanks n Regards
Ankur Shrivastava
|
|
|
|
|
That's a very bad solution to an unknown problem. RAW packets can only be created by an admin level account since Windows XP Service Pack 2.
|
|
|
|
|
public partial class try1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
string query_ddl = "select range from DDLValue";
SqlDataAdapter da = new SqlDataAdapter(query_ddl, con);
DataSet ds = new DataSet();
con.Open();
da.Fill(ds);
con.Close();
ddl_value.DataSource = ds;
ddl_value.DataTextField = "Range";
ddl_value.DataValueField = "Range";
ddl_value.DataBind();
}
protected void ddl_value_SelectedIndexChanged(object sender, EventArgs e)
{
createTextbox();
}
private void createTextbox()
{
string selectedValue = ddl_value.SelectedValue;
if (!string.IsNullOrEmpty(selectedValue))
{
int aSample = Convert.ToInt32(selectedValue);
for (int i = 0; i > aSample; i++)
{
TextBox txtbox = new TextBox();
txtbox.ID = "txt" + i.ToString();
Button1.Click += new EventHandler(Button1_Click);
PH1.Controls.Add(txtbox);
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
}
}
}
How insert Data from Textbox at Button_click
|
|
|
|
|
At first glance there are several things wrong with this code.
1: you create several textbox controls but you don't set there location, so unless 'PH1' is a tablelayoutpanel or flowlayoutpanel all your textbox's will be shown on top off each other.
2: why add a new eventhandler to button1 for every textbox you create.
If button1 is created at designtime you don't need to add an eventhandler to it in code.
If button1 is created at runtime (off which there is no code here) adding it only once should be enough.
3: as to your question, the way you wrote it here you have 2 options.
Having a array variable (global) and adding all your textbox's to this array, then in button click event iterate this array.
Or iterate all the controls in 'PH1', check if there type is of the type textbox and get the text that way.
|
|
|
|
|
Can u Post Some code or Links
|
|
|
|
|
I knew this question was going to come.
Did you at least try to do anything I said?
I don't write c# so can't help you with that
But here is some vb.net code (easy to convert)
for each c as control in PH1.controls
if c.gettype.equals(gettype(textbox)) then
dim txt as textbox=c
dim textstring as string = txt.text 'now you have the text in the textbox
end if
next
modified on Wednesday, January 14, 2009 8:51 AM
|
|
|
|