|
Hi,
I can use Directory.GetLogicalDrives() method to get the drives attached to the computer but it only returns an array of strings which contain the drive letters (i.e. A:\, C:\, D:\, etc). What I want to know is how can I get the volume names and is there a way to find out the type of drive (floppy, hard drive, CD-ROM, networked) within the .NET framework. I noticed in the SDK documentation that there appears to be a VB.NET function that will get the volume names, but there doesn't appear to be one for C#.
Thanks
WJ
|
|
|
|
|
Wjousts wrote:
I noticed in the SDK documentation that there appears to be a VB.NET function that will get the volume names, but there doesn't appear to be one for C#.
MSDN is full of errors. If it is .NET any language can be used BTW what is the "VB.NET function" called?
Give them a chance! Do it for the kittens, dear God, the kittens!
|
|
|
|
|
I think it was the dir() function described here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vafctdir.asp
At least I think that was the one I was looking at earlier, it so bloody hard to find anything in MSDN and even harder to find it again. Anyway, it appears to be a function that is specific to VB and not part of the .NET framework itself. I couldn't find the same function anywhere within the .NET class library. What gives?
|
|
|
|
|
I guess you will have to use WMI then... Have a look at the System.Management namespace.
Give them a chance! Do it for the kittens, dear God, the kittens!
|
|
|
|
|
Okay, I think I have it figured out using WMI inspite of the documentation. Could they make it any sketcher?
|
|
|
|
|
Wjousts wrote:
Could they make it any sketcher?
Dont give them ideas!
Paul
|
|
|
|
|
I think you can only use win32 API for this:
GetVolumeInformation
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Hello,
I know the tree control is one of the build-in components inside the toolbox of VC.NET C# window form, but it seems missing in web form control toolbox. The main purpose for this is that I got a database organized like tree and require to show it in ASPX. The DataGrid control cannot fit in my requirement.
Any suggestion?
Thanks.
-mh
|
|
|
|
|
|
Does anyone know how to do:-
1. Display a single & double precision floating point value.
a) the internal representation in hexadecimal
b) the true exponent in decimal, hexadecimal and binary
c) the significand in binary
d) the associated name
|
|
|
|
|
Is this homework?
Nick Parker
The goal of Computer Science is to build something that will last at least until we've finished building it. - Unknown
|
|
|
|
|
In VC++ i've always used the emessage WM_INITDIALOG.
In C# and dialog inherited from System.Windows.Forms.Form is this message
not attended.
I tried to do it in this way:
protected override void WndProc(ref System.Windows.Forms.Message m)<br />
{<br />
<br />
switch(m.Msg)<br />
{<br />
case WM_INITDIALOG:<br />
break;<br />
default:<br />
break;<br />
}<br />
base.WndProc( ref m);<br />
}
but it dosen't work . I mean, that with little help of my friends, i should
do it !!!
Best regards
|
|
|
|
|
Hi
Marcin wrote:
case WM_INITDIALOG:
You will need to define the constant somewhere, or if you are doing alot of WM related stuff, dump them all in an enumerration.
const int WM_INITDIALOG = 0x0110;
Cheers
[edit]
I read your message again, so all of the above mite be useless. Can you please give more info? What is the problem your experiencing? Does it just do nothing?
[/edit]
Give them a chance! Do it for the kittens, dear God, the kittens!
|
|
|
|
|
Im affter defined
<br />
private const int WM_INITDIALOG = 0x0110;<br />
thanks
|
|
|
|
|
I'm trying to create something similar to the start page for my application.
I'd ideally like to have a table with small icons that I can trap the
OnClick event. The contents of the table are dynamic.
One option is to make a webcontrol of sorts that I fill with HTML. Problem
is how to trap those events. Prefer to do it without IE (just another control to check for on the install).
I would like to stay away from the WinForm grid control and have something
more along the lines that looks similar to the VS.NET start page or the
Groove Welcome page
(http://www.groove.net/products/popup/workspace/welcome.html).
Any ideas?
Andrew Connell, MCDBA
IM on MSN
andrew@aconnell.com
|
|
|
|
|
It is easy
Once your web page is designed (just steal the Start page code from VS.NET, right click / View source. Jeecool!), just add onclick events, and add window.external.myMethod calls.
Now in your app hosting the web browser, you have a IDispatch interface exposing myMethod(), and this will get automatically called.
I have to admit that you'll get more easily done with full C++ code, because of the IDocHostUIHandler/IDispatch declaration and implementation.
For code sample, download the Driller sample from MSDN.
Be warned that both the VS.NET Start page, and other html pages using window.external, and HTA applications require ActiveX scripting be enabled on the user's browser settings.
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.
|
|
|
|
|
I took a look at the Driller, but it didn't help me as much as I had hoped. Lemme give it a shot...
StephaneRodriguez wrote:
add window.external.myMethod calls
So.... the onclick event is easy... is the syntax just: <img src="sample.gif" onclick="window.external.Button1Clicked('param1','param2')" />
StephaneRodriguez wrote:
Now in your app hosting the web browser, you have a IDispatch interface exposing myMethod(), and this will get automatically called.
So... that code would look something like (in C#)...
public void Button1Clicked(string p1, string p2) : IDispatch<br />
{<br />
MessageBox.Show("Dynomite!");<br />
}<br />
Sorry... this is greek to me... thanks for your first post
Andrew Connell, MCDBA
IM on MSN
andrew@aconnell.com
|
|
|
|
|
Drill has the plumbering you need, but it does it using C++. You obviously need it using C#.
Let's see the key code, in the driller app, the class which implements and subscribes for the custom (window.)external handler is attached like this :
CCustomOccManager *pMgr = new CCustomOccManager;
m_pDispOM = new CImpIDispatch;
AfxEnableControlContainer(pMgr);
So you need your hosting app implement a control site. Searching the .NET framework for the equivalent stuff, I found this[^] :
[C#]
protected virtual ISite CreateSite(
IComponent component,
string name
);
The above method must be implemented by your code, and it will be called by the framework when the app is started.
The implementation of this method must do what the C++ code does, ie provide implementation for the IDocHostUIHandler. In this implementation, that's GetExternal which attaches the site to a class of yours. This class implements IDispatch and implements any number of methods, among which myMethod : the one that gets called with the javascript code.
I know that's hard using C++ already, but trying to do it using C# is just harder. That's questionable.
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.
|
|
|
|
|
StephaneRodriguez wrote:
I know that's hard using C++ already, but trying to do it using C# is just harder.
Thanks... looks like I need to keep looking because C++ is greek to me. You got me going in the right direction.
Andrew Connell, MCDBA
IM on MSN
andrew@aconnell.com
|
|
|
|
|
I got a reply to my similar posting on GotDotNet[^] by an MS guy. He has a work around that seems VERY easy and not too hacky.
What he said he did is to use a 'fake' hyperlink and used the BeforeNavigate2 event to find out what the hyperlink URL is.
I'm going to try this as it seems like a good solution for me. My URL will be a flag like <a href="OpenCollection.1"> and I'll just have a switch statement inside my BeforeNavigate2 event handler method.
-AC
|
|
|
|
|
I need to write a .NET MDI web browser that supports content filtering but I don't quite know where to start. I would like to filter content before it is displayed in the WebBrowser control but I don't know the best practice for doing this.
I want to change the HTML to remove links to sounds, Flash animations, images and whatever else is defined by the user.
It doesn't look as though any of the WebBrowser events will work. Same with the MSHTML DOM events.
Should I be doing this even farther up-stream? Perhaps using a proxy server object and filtering the content there?
- John
|
|
|
|
|
Two options :
- change programmatically IE settings, ( only while your app is running of course), so that animations and/or images are not downloaded or played.
Search codeproject for that. Someone showed how to do this in the past. (it is not a matter of hacking down the registry, because it would require the user relaunches the browser).
- you can host the web browser control, and subscribe for navigationcomplete events or the like. Doing so, you can access the HTML tree with the DOM API. You've got a starting point here[^]. And you've got hooking techniques here[^] and here[^].
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.
|
|
|
|
|
Thanks a lot Stephane. The two articles you posted will do the trick I think. I don't like the first because I believe it's inappropriate to globally modify IE settings. What if my app crashes and the changes don't get "undone."
I wasn't aware of the NavigateComplete2 bug in .NET but that would definitely explain why my modifications were not being reflected in the HTML in the browser.
If you were to write a browser application that would allow users to create customized filtering rules, would you utilize the hooking techniques in your articles or is there a different approach?
- John
|
|
|
|
|
Quite honestly, if I had the time I would not use IE at all. Better use a recompiled Mozilla or other programmable browsers with source code.
And put web page filtering on top of it.
What has stopped me many times already with programming IE is that there are many cases where the IE API doesn't work as expected. For instance, when you have frames in the web page, several events are not triggered at all, or you have to subscribe special things. None of this is documented. So it takes time, and there is no guarantee at all you succeed.
Besides that, IE uses multiple threads. One thread for each picture being downloaded for instance, which means it is hard to stop the process as a whole.
If you go start programming IE, then you may consider this scenario :
- I assume you've got the target URL
- use MSHTML as a COM object to download the html code from that URL. (you also could use the wininet library). Store it as a file. To do this, look for the MSDN sample called "Walkall" (C++ code).
- filter the html code
- add the <base href="URL"> tag inside the HTML code, in order to mimic the right base domain.
- ask IE to load this html code in the browser : document.load(...)
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.
|
|
|
|
|
Can anyone help...
Can anyone point me to a site with free .Net components specifically an Outlook bar.
Newby question: How can I align controls on the form. I want a panel to be aligned left on the form, but the Align menu options never become enabled.
TIA
|
|
|
|