|
System.Enviroment
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
I already checked the System.Environment
And it does not have a memeber variable to rerieve the path for Windows directory .
I want to retrieve c:\winNT
not C:\winNT\system32 (which you can retrieve with Environment.SystemDirectory() )
or any of those: Program Files, Programs, System, or Startup directory (which you can retrieve with Environment.GetFolderPath() )
is there any method in System.Environment that rerieves Windows Directory path ?
Thanks
~Mithat
|
|
|
|
|
Mmithat wrote:
not C:\winNT\system32
just remove the \system32 bit or \system in win9x....
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
this is how i retrieve it right now,
csTempDirectory = Environment.SystemDirectory;<br />
m_csWindowsDirectory = Directory.GetParent(csTempDirectory).ToString();
But I dont want to rely on those kinda stuff
sometimes system does not let u get those paths.
and it may vary .
in my orginal message, there should be a way to import this function (getwindowsdirectory()) from SDK
But i am just not comfortable with the variables in import-declaration-functions.
~Mithat
|
|
|
|
|
Or you can try:
Environment.GetEnvironmentVariable("windir");
I havent tried it, but it should work
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
I like that better.
Thanks =)
~Mithat
|
|
|
|
|
[DllImport("kernel32.dll", CharSet=CharSet.Auto)]
private static extern uint GetWindowsDirectory(
[MarshalAs(UnmanagedType.LPTStr)]
System.Text.StringBuilder lpBuffer,
uint uSize
);
System.Text.StringBuilder buffer = new System.Text.StringBuilder(255);
GetWindowsDirectory( buffer, (uint) buffer.MaxCapacity ); Works here.
I think as a general rule, when you need to pass in a buffer to receive text you use a StringBuilder object.
[edit]Looking at MSDN for the GetWindowsDirectory function it is supposed to accept a TCHAR, so the MarshalAs and DllImport attributes should be changed accordingly as above.[/edit]
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
[DllImport("kernel32.dll", CharSet=CharSet.Auto)]private static extern uint GetWindowsDirectory( [MarshalAs(UnmanagedType.LPTStr)] System.Text.StringBuilder lpBuffer, // buffer for Windows directory uint uSize // size of directory buffer);
Really great language C#. Fast, simple and very comfortable...
|
|
|
|
|
Better get used to it.
|
|
|
|
|
i'm curently writing an application that use winamp , but i can't find any way that i can get informaions about the song it's curently playng(i'm especialy interest in geting the path of the file)
sorry for my english
|
|
|
|
|
I'd like to create an array of references to variables--for example:
void Foo()
{
int a;
string s;
Point p;
Item[] items=new Item[] {new Item(out a), new Item(out s), new Item(out p)};
then pass the array to a function and have the function iterate through the array and populate the data, so that the local vars in the caller get populated--for example:
...
PopulateItems(items);
...
}
void PopulateItems(Item[] items)
{
items[0]=1;
items[1]="abc";
items[2]=new Point(0, 0);
}
Keep in mind this is a simplified example, as ultimately the thing needs to extract the type. The point is I'm looking for something that does this given a dynamic list of items.
Is this possible in C# (and how), the equivalent in C++ being int*, string*, and Point* ?
Thanks!
Marc
Help! I'm an AI running around in someone's f*cked up universe simulator. Sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian Graus Every line of code is a liability - Taka Muraoka Microsoft deliberately adds arbitrary layers of complexity to make it difficult to deliver Windows features on non-Windows platforms--Microsoft's "Halloween files"
|
|
|
|
|
Marc, how does your poor girlfriend/wife keep up with this?
I'm not really grasping what you are trying to do, but I have a suggestion or 2. Have you tried this in an unsafe context, that would appear to be the easiest. Secondly, boxing those variables mite do the trick, but I'm not really sure about that.
Hope you win
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
Marc, how does your poor girlfriend/wife keep up with this?
She often has lesson plans to do in the evening, and a thesis paper that she works off&on on.
Basically, I want an array of pointers. You're right, an unsafe context would work, because I can get at the pointer. I'll have to try that.
I'll look at boxing too.
Thanks for the tips!
Marc
Help! I'm an AI running around in someone's f*cked up universe simulator. Sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian Graus Every line of code is a liability - Taka Muraoka Microsoft deliberately adds arbitrary layers of complexity to make it difficult to deliver Windows features on non-Windows platforms--Microsoft's "Halloween files"
|
|
|
|
|
Hi all,
I am working on an application that has several file associations. I am wondering how to embed a 2nd icon to be displayed by the shell for the files that are associated with my application. I am able to associate them with the main application icon, but I don't know how to embed a 2nd icon that the shell can access from my exe.
Thanks for your help,
Scott
|
|
|
|
|
How to manipulate the bgcolor of the box within the CheckBox or the RadioButton?
(by System.Windows.Forms)
Can anybody help?
Thanks
|
|
|
|
|
Another question, can anyone tell me how to run an external application from C#! Acctually I want to run cmd.exe from my application and do some thing there!
Thanx...
|
|
|
|
|
Look at System.Diagnostics.Process class.
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
Hello, I have a problem working with binding data to controls!
I have a dataset and windows form with some controls (textboxes, comboboxes) on it. I have binded them to dataset (I used EditValue property or Text, doesn't matter). So when I change data like normal user does (through controls) then everything works properly (data in dataset is also changed). But when I change controls (text/EditValue) property in code, then data in dataset is not changed!! WHY??? Or vice versa, when I change data in dataset, it will not change in controls? Does anyone knows where is the problem?
Thanx...
|
|
|
|
|
What after using EndEdit() after changing property value in code? What happens about changing row after changing value in DataSet? Try to see what's in DataSet using WriteXML( ...DiffGram) May be it will be helpful. There are some errors in DataBinding I think ...
Hi,
AW
|
|
|
|
|
I found a problem!!!!
You cannot call method BeginEdit() when the datarow is already in edit mode!!!
Problem was that I was using valueChanged event, but I had to use validated event!!!
|
|
|
|
|
I'm looking for a guide on creating com+ applications in C#. Anybody know of one?
Thanks!
|
|
|
|
|
A good book that goes over COM+ in C#.NET is "COM and .NET Component Services" from O'REILLY. Give that a try...
Amazon.com Link
|
|
|
|
|
I'm still mere beginner so some questions that might be obvious to you puzzle me.
Is it possible to change to look of the caption bar? Under WindowsNotXP it looks so ugly, when
the form is filled with nice owner drawn controls.
Generally my questio is: is it possible to make a .NET owner drawn caption bar (but no Win32
calls - I know with in standart Win32 programming everything is possible)?
Thank you
|
|
|
|
|
Something went wrong in the registry of my computer. All of a sudden
I cannot compile C# any more. At line 0 of the first source file
fatal error C1102 is generated and the error printed with it
(translated to English) is: "class is not initialized".
When trying to make a new C# project the project cannot be opened and
the error "cannot create the C# compiler" is printed. The suggestion
by the system to repair the installation via the Set-up did not work.
Deleting the C# compiler and then re-installing did not work either.
Next step that I have not taken yet would be to delete all of the
Visual Studio.NET and then re-install.
Then the next step would be to start from scratch with Windows-XP.
A search on the internet also yielded nothing.
Anyone has a better solution?
Harm Salomons
|
|
|
|
|
Do you get the same error running csc.exe from the command line? If so, then the problem is with the C# compiler itself and you need to just reinstall the SDK, not all of VS.NET. However, if you can use csc.exe from the command line, then there's a problem with VS.NET and you need to reinstall that.
any idiot
can write haiku you just stop
at seventeenth syl
-ThinkGeek Fortunes
|
|
|
|