|
I believe both out and ref will work, but ref will cause the compiler to complain if the parameter hasn't been initialized before calling check() .
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
ok, so i know it's some sort of permission problem i'm having, but i can't quite figure out what exactly i need to do to get this working. my windows service is starting a new Process object and launching an EXE. this exe is not getting called, but as a test i confirmed that i am able to launch things like notepad and perfmon from this service.
i think i know what the problem is, but i just can't figure out how to fix it. my service is set to run under local system, and i believe the EXE i'm running is not running correctly because it needs resources that can only be accessed from the user account. is this correct? i've confirmed my code works by running the same code in a console app, and the exe successfully is called. it just won't get called from my exe!
any ideas?
thax!
|
|
|
|
|
Have you tried setting up the service to run as a specific user account, for instance the account you used to confirm that the EXE would start successfully?
You should only do that as a test, by the way. If it does turn out to be a permission issue, a new account or group should be created with the least necessary permission(s) to use the EXE.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
yeah, i tried running it as the user that i run the exe manually successfully from. still doesn't work. i even tried setting it to networkservice, and that didn't even run at all cuz of permission issues...
what else is there to try??
|
|
|
|
|
Well, are you logging events on the service? If so, are there errors getting logged?
Do you know for certain that the executable is not getting started? I don't know what it is you're trying to do, or what the executable is, so it's hard to make suggestions, but if you don't have some form of logging in place, then I would recommend adding some and seeing if anything comes of it.
Good luck.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
i saw some winsock errors in the eveentlog associated with my service.
theh exe i'm running is an exe that communicates with a server. so it opens up a tcp connection to a remote macine and sends some data...
the fact that this is not easy to get working seems to be a GOOD thing, since this is typical action of some malicious service i would assume...
i've spent a lot of time on this and i'm thinking it might be just easier to communicate with the natice c++ written in win32 code directly. then this way i would avoid haveing to spawn a new process and execute it, which is what's causing these security problems, right?
so i can either covert this win32 exe into a DLL or a com object and talk to it using .net's com interop or dill importing attributes. which one is easier?
-- modified at 11:00 Sunday 22nd January, 2006
|
|
|
|
|
In Tab Control the Tab Dialogs change their position automatically whenever I do a change. Sometimes they change at design time and sometimes at runtime. A very strange behaviour I am experiencing.
Help required.
The Phantom.
|
|
|
|
|
Hi, i'm a newbie at C#, how can i know if a child form was terminated? Let's say that there are 10 child forms and I closed 2 child forms, how can I know that these forms were closed? Thanks
|
|
|
|
|
hello, for those who didnt know an answer to this, i have found an answer, refer to this site, it's really helpful http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=181891&SiteID=1
ciao
|
|
|
|
|
my application closes a a few other applications which have system tray icons using the Process.Kill method. The application is closed succesfully, however they leave thier icons behind in the system tray. Is there any way i coould flush or refresh the system tray of useless icons.
|
|
|
|
|
You shouldn't kill other process except in extreme circumstances. Doing so doesn't give the process a chance to do any cleanup - like remove its tray icons - or worse. The normal way to close another application is to post a WM_CLOSE message to its main window.
Steve
|
|
|
|
|
To answer your question about cleaning up the icons, no there is no way to force the Tray to clean itself up.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The only way i will refresh is if you point your mouse to the "destroyed" icons...
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
Tell the OP, not me. I already know that.
He was referring to a programmatic way of forcing the cleanup.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi, I have created the following program first as a console application. Then I created a windows application and copied the class data there. It is shown below. In the console application, I have used the printData() method to output the data of an instance of a Person or Athlete class. I want to do the same, but now that output should be in the label.
Any help would be appreciated.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace windowsPracticingWithClasses
{
///
/// Summary description for Form1.
///
public class Person : System.Windows.Forms.Form
{
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
//My instance variables
private string firstName, lastName;
private int age;
private double height, weight;
private string bankName;
private double bankAccount;
private double balance = 0;
private string squareColor;
# region Properties
//Properties
public string FirstName
{
get { return firstName; }
set { firstName = value; }
}
public string LastName
{
get { return lastName; }
set { lastName = value; }
}
public int Age
{
get { return age; }
set { age = value; }
}
public double Height1
{
get { return height; }
set { height = value; }
}
public double Weight
{
get { return weight; }
set { weight = value; }
}
public string BankName
{
get { return bankName; }
set { bankName = value; }
}
public double BankAccount
{
get { return bankAccount; }
set { bankAccount = value; }
}
public double Balance
{
get { return balance ; }
set { balance = value; }
}
public string SquareColor
{
get { return squareColor ; }
set { squareColor = value; }
}
# endregion
//Custom constructor
public Person(int age, double height, double weight, string bankName, double bankAccount, double balance)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
this.age = age;
this.height = height;
this.weight = weight;
this.bankName = bankName;
this.bankAccount = bankAccount;
this.balance = balance;
}
//Default constructor
public Person()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
}
#region My Methods
//My Methods
public void makeDeposit(int amount)
{
balance+= amount;
}
public void makeWithdrawal(int amount)
{
balance-= amount;
}
public virtual void printData()
{
Console.WriteLine("\nProfile: \n\nAge: " + this.age);
Console.WriteLine("Height: " + this.height);
Console.WriteLine("Weight: " + this.weight);
Console.WriteLine("Bank Name: " + this.bankName);
Console.WriteLine("Bank Account: " + this.bankAccount);
Console.WriteLine("Balance: " + this.balance);
}
#endregion
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
//
// Person
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Name = "Person";
this.Text = "Form1";
}
#endregion
}
class Athlete : Person
{
public string sport;
public Athlete(string sport) : base(23,5.6,120,"Chase",5671234,1000)
{
this.sport = sport;
}
public override void printData()
{
base.printData();
Console.WriteLine("Sport Practicing: " + this.sport);
}
};
class TestClasses
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Person());
Person[] person = new Person[5];
person[0] = new Person(22,5.6,120,"Chase",5671234,2000);
person[0].printData();
Person[] athlete = new Athlete[3];
athlete[0] = new Athlete("Figure Skating");
athlete[0].FirstName = "Sarah";
athlete[0].LastName = "Hughes";
athlete[0].Age = 20;
athlete[0].Height1 = 5.5;
athlete[0].Weight = 120;
athlete[0].BankName = "Chase";
athlete[0].BankAccount = 434324;
athlete[0].Balance = 200;
athlete[1] = new Athlete("Martial Arts");
athlete[1].FirstName = "Kim";
athlete[1].LastName = "Chung";
athlete[1].Age = 21;
athlete[1].Height1 = 5.7;
athlete[1].Weight = 130;
athlete[1].BankName = "Citi";
athlete[1].BankAccount = 212312;
athlete[1].Balance = 300;
athlete[2] = new Athlete("Soccer");
athlete[2].FirstName = "Joe";
athlete[2].LastName = "Tribiani";
athlete[2].Age = 22;
athlete[2].Height1 = 5.6;
athlete[2].Weight = 140;
athlete[2].BankName = "Apple";
athlete[2].BankAccount = 123124;
athlete[2].Balance = 400;
for(int i = 0; i < athlete.Length ; i++)
{
athlete[i].printData();
}
Console.ReadLine();
}
}
}
|
|
|
|
|
I am trying to open a .sln in vs 2005 but the error is:
The application for project ....csproj is not installed.
Make sure the applucation for project type (.csproj) is installed.
Thanks
|
|
|
|
|
I've never seen that error before, but it looks like it wants to open a C# project. I'm guessing it thinks that C# isn't installed. You can go to Add/Remove Programs and select Visual Studio 2005 and there is a Change/Remove option. Click that and you will get a "Maintenance Mode" installation wizard. It should be able to install or repair the components you need.
Unfortunatly, if that does not work, then I don't know what it could be.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
I've actually seen this error when you've got a corrupted VS install. There is some fix as I recall, but it's probably best just to do a clean install of VS.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Little House on the Flickr
Judah Himango
|
|
|
|
|
hey guys!
how do u loadin gthe resource string in C# 2005?
thanks
|
|
|
|
|
If you are using Visual Studio then it makes it very easy. When you create a resource file, it puts a nice auto generated code file behind it containing one class, that class has the same name as your resource file, and it contains lots of static methods. Each method name corresponds to the identifier you've given each string. So, say you've named your resource file MyReources.resx and you have a string named "MyString" you can access it in you code like this:
MyResouces.MyString
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
|
by the way, does it do the samething in managed c++ 2005
|
|
|
|
|
Hi,
I'm trying to get all the paths of the open applications in a C# program.
What I need is only paths of open windows(the ones the "Task Manager" shows under his "Applications" Tab),i.e. the windows that are shown in the Taskbar.
For example if there is only 1 Word file open, named "1.doc", I need it's full path. (for example : "D:/Temp/1.doc").
Thanks, Gal.
|
|
|
|
|
So what you're asking is to get the full path of opened documents, not the paths of applications.
For starters, you can get the running processes (which includes applications) using the System.Diagnostics.Process.GetProcesses() method.
But from there you're on your own. There's nothing built into the framework (nor the Win32 API, AFAIK) that will let you see which document is opened by a program, simply because there is no way of letting Windows know when an application has a document opened. Windows does know when a file is opened, so you might be able to find some Win32 APIs that you could query to find the opened documents of the system.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Little House on the Flickr
Judah Himango
|
|
|
|
|
Hi,
I do need open documents but also open programs, which I opened (i.e. if the Visual .NET is open, I need the path to it's .exe file also)- all open windows(windows of documents and programs).
You said windows does know when a file is open.
I looked in the System and Environment objects but didn't find anything yet. From the process list I couldn't get anything usefull.
Do you know where windows keeps it? what Objects besides the 2 I mentioned might keep that kind of information?
Maybe the Task Manager keeps it since in his application tab it does shows exactly the open windows, though I couldn't find any API related to the Task Manager, nor files with that information that the Task Manager manages.
Thanks,
Gal.
|
|
|
|
|