|
|
Hi,
Read this:
WPF vs. Windows Forms[^]
In some cases, my signature will be longer than my message...
<em style="color:red"> <b>ProgramFOX</b></em> ProgramFOX
|
|
|
|
|
Windows Form is now "dated" and is not expected to get a lot of support from MS.
WPF was considered to be the replacement.
Metro apps and Xaml based programming may be the future.
So your question is quite tricky.
Building a WPF will help you learn xaml programming which could help you developing Metro apps as well - so I guess WPF might just be better.
|
|
|
|
|
|
|
Hi,
I created a new account on the remote server and gave it Admin priviledges.
I am trying to execute an exe using this new account and it comes back with Access is Denied.
Is this something to do with this newly created account?
Thanks so much!
|
|
|
|
|
You haven't specified HOW you're trying to launch this .EXE and what this has to do with WMI.
|
|
|
|
|
ConnectionOptions opts = new ConnectionOptions();
opts.Username = "my_username"
opts.Password = "my_pwd";
ManagementPath path = new ManagementPath(@"\\<myserver>\root\cimv2:Win32_Process");
ManagementScope scope = new ManagementScope(path, opts);
scope.Connect();
ObjectGetOptions getopts = new ObjectGetOptions();
ManagementClass mgClass = new ManagementClass(scope, path, getopts);
ManagementBaseObject inParams = mgClass.GetMethodParameters("Create");
//Fill in input parameter values
inParams["CommandLine"] = @"\\<myprogramlocation>\myprogram.exe";
//Execute the method
ManagementBaseObject outParams = mgClass.InvokeMethod("Create", inParams, null);
|
|
|
|
|
It is an account issue, the account set up on the remote server needs to be a domain account. An account specific to that computer is not working.
|
|
|
|
|
It doesn't need to be a domain account...
It just needs to be an account that your code knows about and can pass credentials for.
|
|
|
|
|
You get Access Denied because the account your code is running under does not have permissions to the remote machine. By default, if you don't specify any account information in the Management connection objects, it'll use the account your code is running under. If that account doesn't have permissions on the remote machine, it'll fail.
|
|
|
|
|
On the Oracle DB there's a stored proc defined like:
PROCEDURE pGetHashes ( iFrom IN NUMBER, iTo IN NUMBER, sHash1 OUT CHAR, sHash2 OUT CHAR );
When I call this procedure from within my app, I only get a value for the sHash2 parameter. The value of the sHash1 parameter is always null. (Running the same stored proc from sqldeveloper gives a result for both hash values.)
Underneath I have added the code which I use to call the stored proc. Does anybody see anything I might have done wrong?
int iFrom = 0;
int iTo = 1000;
using (IDbCommand command = dbConnection.CreateCommand())
{
OracleCommand orclCommand = command as OracleCommand;
orclCommand.CommandText = "pGetHashes";
orclCommand.CommandType = CommandType.StoredProcedure;
orclCommand.Parameters.Clear();
orclCommand.Parameters.Add("iFrom", OracleDbType.Int32, iFrom, ParameterDirection.Input);
orclCommand.Parameters.Add("iTo", OracleDbType.Int32, iTo, ParameterDirection.Input);
OracleParameter orclParam = new OracleParameter("sHash1", OracleDbType.Char, 100);
orclParam.Direction = ParameterDirection.Output;
orclCommand.Parameters.Add(orclParam);
orclParam = new OracleParameter("sHash2", OracleDbType.Char, 100);
orclParam.Direction = ParameterDirection.Output;
orclCommand.Parameters.Add(orclParam);
orclCommand.BindByName = true;
orclCommand.ExecuteNonQuery();
}
For extra documentation. Running the following PLSQL from within sqldeveloper results in both a value for Hash1 and Hash2:
SET SERVEROUTPUT ON;
DECLARE
sHash1 CHAR(67);
sHash2 CHAR(67);
nFrom NUMBER := 0;
nTo NUMBER := 1000;
BEGIN
pGetHashes( nFrom, nTo, sHash1, sHash2 );
dbms_output.put_line('Hash1: '|| sHash1);
dbms_output.put_line('Hash2: '|| sHash2);
END;
Thanks for any light you can shed on this problem.
modified 17-Jan-13 2:00am.
|
|
|
|
|
Maybe you need two orclParam variables?
You create it with:
OracleParameter orclParam = new OracleParameter("sHash1", OracleDbType.Char, 100);
But later you assign a new object to it:
orclParam = new OracleParameter("sHash2", OracleDbType.Char, 100);
I would be very surprised if this fixes your problem but it might be worth a try? If it fixes your problem then the Add() function is implemented... in a peculiar way.
|
|
|
|
|
Dear all,
My application works well on Vista, Win 7 32 and 64 bits.
It modifies some registry key in HKEY_LOCAL_MACHINE.
But when run on Win 8 (both 32 and 64), with minimum level UAC (I drag the slider to bottom, then restart), it doesn't work. And there is the error:
"Application attempted to perform an operation not allowed by the security policy. To grant this application the required permission, contact your system administrator, or use the Microsoft .NET Framework Configuration tool. Requested registry access is not allowed."
When I disable completely UAC of win 8 by editing registry, then restart computer, my application works well.
How can I deal with win 8 UAC enable with c#?
Thank you very much.
|
|
|
|
|
If I run regedit on Windows 7 then it runs with elevated priviledges which causes a UAC dialog to pop.
I find it unlikely that your application is doing nothing and yet is allowed total access to the registry on Windows 7. Do you have UAC enabled on your Windows 7 test box? Are you only editing some user data and as such the app might have access? Or perhaps are you installing it on Windows 7 (installing does seem to provide certain priviledges)? Also are you sure that the user for windows 7 and that for 8 both have the same priviledges?
|
|
|
|
|
My application works well on win 7 (32/64) with UAC enabled, it requires to run as Administrator.
But when run this application as Administrator on win 8 (my user is in Administrators group), it gave me the error above. It just runs well when I disable UAC by registry editing.
|
|
|
|
|
You might be trying to modify TrustedInstaller keys. TrustedInstaller is a special user that has power beyond that of Administrator(s). You will need to take ownership of the key in order to work around that (completely ruining the security on your user's machine). If you need to change keys owned by TrustedInstaller you are doing something very very wrong.
If you are not trying to modify TrustedInstaller-owned keys you probably need to indicate which permissions you want when you open the key:
using (var key = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Foo\\Bar", RegistryKeyPermissionCheck.ReadWriteSubTree))
{
}
using (var key = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Foo\\Bar", RegistryKeyPermissionCheck.ReadWriteSubTree))
{
}
He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chinese Proverb]
Jonathan C Dickinson (C# Software Engineer)
|
|
|
|
|
I owned this registry key, and I can do what the app should do by hand using regedit.
This is one line of my code, works well under Vista, Win 7, it just has problem with Win 8 UAC enabled.
RegistryKey rk = Registry.ClassesRoot.OpenSubKey(subkey, RegistryKeyPermissionCheck.ReadWriteSubTree, RegistryRights.FullControl);
|
|
|
|
|
I am currently a student in TYBSC(IT) so I had a query that in C# windows form If for example a clientname combobox is there and on selecting the client Name in the combobox the 2 text boxes clientAddress and ClientNumber should be retrieved from the database and get filled in the textboxes.
Sir please help me in my project my mailing me a demo program so that I can Find A Solution to It.
Please Sir and as sson as possible as jan end is ma submission date
trishal
|
|
|
|
|
Try something and if you run into issues, post what you have done here.
Someone might be able to help you.
|
|
|
|
|
Sir can you give me your email id son that i will send my code to you its having some errors can you correct and give me???
|
|
|
|
|
Show your code (just the part with the errors) and the error messages here, and people will try to help you.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
public partial class Form1 : Form
{
string Id = "";
string Address = "";
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.testTableAdapter.Fill(this.database1DataSet1.Test);
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
string SelectedId = Convert.ToString(comboBox1.SelectedValue);
if (Convert.ToString(comboBox1.SelectedValue) != "")
database1DataSet1.DataSource = Database1DataSet1TableAdapters.GetData(int.Parse(SelectedId));
var Id = from r in testTableAdapter.GetData()
where r["Id"].ToString() == SelectedId
select r["Name"];
var Address = from r in testTableAdapter.GetData()
where r["ProductId"].ToString() == SelectedId
select r["Address"];
foreach (var unit in Id)
Id = id.ToString();
foreach (var measure in Name)
ProductMeasure = measure.ToString();
textBox1.Text = Id;
}
|
|
|
|
|
And the question is?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
u have to bind the two textbox to the same datasoure and the data will apper automatically
all waht u have to do is to put this code to the Load event
private void Form1_Load(object sender, EventArgs e)
{
this.testTableAdapter.Fill(this.database1DataSet1.Test);
comboBox1.DataSource = this.database1DataSet1.Test;
comboBox1.DisplayMember = "Name";
textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.database1DataSet1.Test, "Id", true));
textBox2.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.database1DataSet1.Test, "Address", true));
}
|
|
|
|