|
GriffonRL wrote:
What I can't understand, is why e.pDisp exists if we can't cast it ?
the IE namespace you use once you have imported the IE web control ocx (drag&drop, add reference, ...) is actually the result of an automated type-library import which simply creates a thin wrapper around the idl interfaces. Because the IDispatch *pDisp appears in some members of some of the interfaces, it thus appears in the resulting wrapper.
But as I have said already, this is a case where it's not useful : IDispatch* is seen as a raw untyped object . Furthermore, the namespace already provides interfaces from which you can invoke the methods you would with a C++ ptr on the web control. So, you don't lose power by using C# or other .NET languages.
The thing you lose is that the marshaller (at the heart of all the interop stuff) is not able to comply with all kind of variant subtypes (limitation known by MS people). As long as MS doesn't fix it, whevener we import a type-library, we may or may not for any reason be able to call certain methods depending on the parameter types. That's it. We'll have to live with it. And by the way, the article I have suggested bypasses the standard tlbimp.
She's so dirty, she threw a boomerang and it wouldn't even come back.
|
|
|
|
|
Yep !
Here is the solution working with frames :
<br />
private void documentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e){<br />
SHDocVw.IWebBrowser2 Frame;<br />
IHTMLDocument3 Doc;<br />
IHTMLDOMChildrenCollection Tags;<br />
IHTMLElement Tag;<br />
int NumTags;<br />
<br />
Console.WriteLine("URL: "+e.uRL);<br />
try{<br />
Frame=(SHDocVw.IWebBrowser2)e.pDisp;<br />
if(Frame!=null){<br />
Doc=(IHTMLDocument3)Frame.Document;<br />
Console.WriteLine("Document URL: " (IHTMLDocument2)Doc).location.href);<br />
if(Doc!=null){<br />
Tags=(IHTMLDOMChildrenCollection)Doc.childNodes;<br />
if(Tags!=null){<br />
NumTags=Tags.length;<br />
for(int i=0;i<NumTags;i++){<br />
Tag=(IHTMLElement)Tags.item(i);<br />
if(Tag!=null) traverseDOM(Tag);<br />
}<br />
}<br />
}<br />
}<br />
}<br />
catch(Exception ex){<br />
Console.WriteLine("F***: "+ex.ToString());<br />
}<br />
}<br />
Enjoy,
R. L.
|
|
|
|
|
I haven't run it, but I don't buy it. Why ? Not only MS clearly says in MSDN that frame events are signaled within their own frame space, but I know that there are 3 frame related events which actually get signaled on individual frames : that's FrameBeforeNavigate(dispid=200), FrameNavigateComplete(dispid=201) and FrameNewWindow(dispid=204).
That said, whatever the code you have, if it does what you are looking for, then it's probably because it's fine.
She's so dirty, she threw a boomerang and it wouldn't even come back.
|
|
|
|
|
GriffonRL-
Have you had success in trapping the navigation events in the browser?
-AC
|
|
|
|
|
Hi,
At least for DocumentComplete() it works. I also applied the "patch" to get BeforeNavigate2 events (until we get .NET SP3 . Everything else seems to work like in VC++/COM so far. But who knows ?
I am starting with .NET and it took me 1 day to learn C# and the .NET basics. But the marshalling system was not clear and I spent 2 days on problems.
Regards,
R. L.
|
|
|
|
|
Unfortunately, there is no .NET SP3 coming this fall.
.NET 1.1 is in beta, and this issue is not among the things that have been fixed (see gotdotnet.com for further details).
She's so dirty, she threw a boomerang and it wouldn't even come back.
|
|
|
|
|
Anyone know how to share memory between applications in DotNet for a realtime (Machine Control) application???
viva AMIGA
|
|
|
|
|
GlobalAlloc[^]
C++-->C# : You can use WIN32 GlobalAlloc and then use the handle in a C# app (thanks to PInvoke or the like).
C#-->C++. You can also use .NET AllocHGlobal and then pass the IntPtr (it's a pointer) down to C++ code (thanks to PInvoke or the like).
She's so dirty, she threw a boomerang and it wouldn't even come back.
|
|
|
|
|
When writing code in Visual Studio .NET the notational code dropdowns have tooltips next to them.
How do you write classes which produces this behaviour?
I think it's somthing to do with metadata, but not sure what or where...
Thanks
|
|
|
|
|
|
Thanks Marc
I am slowly comming to the conclusion that I will have to write in C#, and not VB.NET as this feature does not seem to be available in VB.NET.
I know this a C# forum, but I didn't think I would get an answer from the VB camp.
Looking at the solution I think I may have been wright.
|
|
|
|
|
You are correct. Under "Coding Techniques" for Visual Studio, I found the following:
If developing in C#, use the XML Documentation feature.
I suspect that only C# supports this feature because Microsoft pushed C# to be a standard, which it now is (supported by an outside standard committee not related to Microsoft--I can't remember the name). Another reason to code in C# and not VB (oops, biased statement!)
Marc
|
|
|
|
|
Hey all -
how exactly do you get the current date in C#? Last week when I writing a bunch of stuff in VB.NET, I was able to simply write:
new DateTime().Now().ToString()
Alas, it appears not so in C#... when I try to use Now as a static member I'm barked at and when I look at the default date the constructor initializes it is:
1/1/0001
Thanks much
*->>Always working on my game, teach me
*->>something new.
cout << "dav1d\n";
|
|
|
|
|
Fine for me, String dt = DateTime.Now.ToString();
She's so dirty, she threw a boomerang and it wouldn't even come back.
|
|
|
|
|
The wildest little inconsistency:
The DateTime class exposes Now as a static member in C# but allows you to get it as an instance member in VB.NET. In other words, you can say:
<br />
dim x as String = new DateTime().Now.ToString() <br />
in VB.NET
but in C# you cannot say:
<br />
string x = new DateTime().Now.ToString();<br />
Anyone know why?
*->>Always working on my game, teach me
*->>something new.
cout << "dav1d\n";
|
|
|
|
|
afronaut wrote:
but in C# you cannot say:
string x = new DateTime().Now.ToString();
Now is a static property of the DateTime class. When getting the property, a DateTime instance is created for you, so no need to do it again. Tip: think of as just another construtor (like many other static methods that also returns an instance of a class) with a meaningful name. Now, that sound a lot better than just DateTime() , but it adds meaning to the object.
Hope this helps
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
I just find it intriguing that VB.NET allows access to static members via *instance* variables. Actually, it's not really intriguing, it's just *wrong*.
*->>Always working on my game, teach me
*->>something new.
cout << "dav1d\n";
|
|
|
|
|
|
Here is how to get at string with the current DateTime in c#.
DateTime d1;
d1 = DateTime.Now;
MessageBox.Show(d1.ToString("G"));
The DateTime.ToString() method accepts many formatting strings, see the doc for details. The "G" format is mm/dd/yyyy hh:mm:ss.
|
|
|
|
|
Anonymous wrote:
MessageBox.Show(d1.ToString("G"));
The DateTime.ToString() method accepts many formatting strings, see the doc for details. The "G" format is mm/dd/yyyy hh:mm:ss.
Hi, the default behavior for the ToString() method for most classes (maybe all???) is "G", so no need to even use that
Cheers 3 less keys too type
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
How do you send an email message using C# WITHOUT using System.Web.Mail namespace?
I have a windows service that does some monitoring and I want it to send out an email after some trigger.
Thanks in advance,
David
P.S. AGAIN...WITHOUT USING THE SYSTEM.WEB.MAIL NAMESPACE!!!!!!
|
|
|
|
|
|
|
OpenSmtp on SourceForge does a nice job and it works on all Win platforms and it does NOT use THE SYSTEM.WEB.MAIL NAMESPACE!!!!!!
Before you criticize a man, walk a mile in his shoes. That way, when you do criticize him, you'll be a mile away and have his shoes.
|
|
|
|
|
Have you tried System.Web.Mail?
PS - If that doesn't work, try System.Web.Mail.
|
|
|
|