Get a reference to windows directory ?

dotnet framework


  • 1. Keeping context menu open even after clicking?
    Hi, I'm trying to add a context menu to my form that would contain only items that can be checked. I would like the context menu to stay open when the user clicks an item. This way, they wouldn't need to re-open the context menu to check 5 or 6 items at once. So basically, open the context menu, check a few items, then click out of the context menu to close it. Is it possible? I thought about reopening the menu after every click but that seems like a stupid solution (and the flickering is ugly). Thanks! Carl
  • 2. System.ArgumentException.. on databinging
    Hi, I have MDI windows application. On form I have Datagrid.. The datagrid is user control which is inherited from Windows datagrid. I bind dataset to this datagrid. On this datagrid, user can select a recod and perform an action.. An action could open a child form or just display mesasge box and execute functionality.. And after completing functionality, it refreshes the datagrid. I also have referesh button which rebinds dataset to datagrid. Till now everything was working fine.. And suddenly I have started getting "System.ArgumentException" in one of the cases (when user is just displayed a messagebox and on OK, it rebinds the data).. I dont get error on click of referesh (although it does the same thing except displaying messagebox). I have try catch in all places, it is not getting caught.. And I get an error when I am rebinding the dataset to datagrid. If I set enable = false, rebind and then set enable = true then it works but in that case I dont see scroll bars.. Anyhelp would be appreciated. Regards, Nilay.
  • 3. How to move last column to first column in ArayList?
    Hello, My ArayList contains a specific class which have some properties. Then i put that ArrayList as DataSource in DataGrid, the consequence is properties become columns in that DataGrid. But I'd like to move last column to fist column, any one know how to do that? I tried some ways, such a change the orders of place of property in that class, but it didn't work. Any suggestion will be great help. Thank you. Deasy
  • 4. date Row filter
    Hello, This statement is generating an error message.. any ideas? dv.RowFilter = String.Format("TRDate = #{0}#", dtpDate.Value) Error: String was not recognized as a valid date time Thank you
  • 5. Hierarchical ListView
    Hi, Is it possible to create a hierarchical listview like the one we get while doing a quick watch. Is there any article on using a tree view inside a Listview. I have searched all thru and havent got any luck. Tarkeshwar L .Net Programmer Fifth Generation Technologies

Get a reference to windows directory ?

Postby JezB » Wed, 18 Aug 2004 19:48:15 GMT

There is no enumeration for the windows directory in SpecialDirectories, how
can I get the windows directory path ?

Re: Get a reference to windows directory ?

Postby Jared » Wed, 18 Aug 2004 20:36:11 GMT

Depending on which directory you want...

 Dim WinDir As String = 
 WinDir += vbCrLf & Environment.ExpandEnvironmentVariables("%SYSTEMROOT%")

Re: Get a reference to windows directory ?

Postby mortb » Wed, 18 Aug 2004 20:43:26 GMT




Re: Get a reference to windows directory ?

Postby hirf-spam-me-here » Thu, 19 Aug 2004 00:58:56 GMT

* "JezB" < XXXX@XXXXX.COM > scripsit:

System directory:


Windows directory:


- or -

Trick by Bill McCarthy:

'System.Environment.GetFolderPath(CType(&H24, System.Environment.SpecialFolder))'

- or -

P/invoke on 'GetWindowsDirectory' (IMO the preferred way):

<URL: http://www.**--****.com/ %23pJhic2CBHA.2200%40tkmsftngp07>

Herfried K. Wagner [MVP]
<URL: http://www.**--****.com/ ;

Similar Threads:

1.Getting parent window reference

Is there a way is a 'class library'  to get the reference to window of
application that uses the library ?

I'm using class library to create a custom command for a closed source
application (GeoMedia), so obviously I can't make it to pass this
reference to my lib as a method parameter.


2.Difference between bin and obj directories and difference between project references and dll references

hello all,

whats the Difference between bin and obj directories and difference
between project references and dll references?


3.Get computer's Windows or Windows Fonts directory

In 2005 - I know that to get the system directory, it's 

I need to find the fonts directory  - - which is normally inside the Windows 
directory - so how can I locate either or both of these (if I find the 
windows directory with a global variable, then I can at least concatenate 
'\fonts' to it)? 

4.C# - getting window list and changing activ window

I want to write application which
1) Get list of windows
2) Change activ window

ad1 I have writen:
Process [] localAll = Process.GetProcesses();
String lista = "Lista procesow\n";
 for (int i=0; i<localAll.Length; i++){
   if (localAll[i].MainWindowHandle.ToInt32() == 0) continue;
    lista = lista + "\n" + i + "\t:" + localAll[i].MainWindowTitle;

So I have list of handlers form localAll[i].MainWindowHandle method.
But what to do next ?

I have tried
Control a = Form.FromChildHandle(localAll[i].MainWindowHandle);
Control a = Form.FromHandle(localAll[i].MainWindowHandle);
and then
Form f = a.FindForm();
But it's not working. It's only gives not null reference to my program

TIA, Tyler

5.Getting window position from IntPtr window handle


I am looking for a way in C# to use a IntPtr handle to a (possibly
unmanaged) windows form to get the current position of the window on
the desktop. I have tried using Form.FromHandle( handle ) but this
does not work for non .NET windows.

I am expecting to need to use SendMessage somewhere along the line,
but cannot find the correct message to get the window position. Also,
is there a way to perform simple operations on a window such as

Any help would be very much appreciated!
Many Thanks


6. System.IO.Directory.GetDirectories() and System.IO.Directory.GetFiles() are not returning the specified directory

7. Getting directory info in an IIS hosted WCF service

8. Getting MAPI to fetch() from a different directory?

Return to dotnet framework


Who is online

Users browsing this forum: No registered users and 83 guest