|
i was posting these kind of issues in C# forum.i think this is the correct place to post!
i am using SHDocVw.InternetExplorer with shellwindow (BHO)
in the DocumentComplete event i have registered HTMLDocumentEvents2_Event (click)
my problem:
the click event is called recursively.
i need a solution, once the event is fired, then i want to unregister the event only for the particular button,image,lint etc that i have clicked.
The code i have used inside the oncomplete event as bellow:
HTMLDocumentEvents2_Event DocEvents = (HTMLDocumentEvents2_Event)browser.Document;
DocEvents.onclick += new HTMLDocumentEvents2_onclickEventHandler(DocEvents_onclick);
bool DocEvents_onclick(IHTMLEventObj pEvtObj)
{
if (pEvtObj.srcElement.title != null)
{
MessageBox.Show(pEvtObj.srcElement.title.ToString());
}
return true;
}
|
|
|
|
|
<html>
<head>
<title>
</title>
</head>
<SCRIPT language="JavaScript"
type="text/javascript">
function checkAnswer(quizForm,
theAnswer,
urlRight,
urlWrong)
{
var s = "?";
var i = 0;
for(;i<quizForm.elements.length;i++)
{
if(("cc" ==
quizForm.elements[i].name) &&
(quizForm.elements[i].checked))
{
s = quizForm.elements[i].value;
}
}
if("?" == s)
{
alert("Please make a selection.");
return false;
}
if(s == theAnswer)
{
alert("'"+s+"' is correct!");
}
else
{
alert("'"+s+"' is incorrect.");
if( urlWrong )
{
document.location.href = urlWrong;
}
}
return false;
}
</SCRIPT>
<body bgcolor="gray">
<b>What is JavaScript?</b>
<FORM method="POST"
onsubmit="return checkAnswer(this,'B');">
<INPUT TYPE="RADIO" VALUE="A" NAME="cc">
A. Another name for Java<BR>
<INPUT TYPE="RADIO" VALUE="B" NAME="cc">
B. A scripting language mostly for the web<BR>
<INPUT TYPE="RADIO" VALUE="C" NAME="cc">
C. When you use Java without compiling<BR>
<INPUT TYPE="Submit" VALUE="Submit Answer">
</FORM>
<hr>
<b>Which symbol is used to make comments ?</b>
<FORM method="POST"
onsubmit="return checkAnswer(this,'C');">
<INPUT TYPE="RADIO" VALUE="A" NAME="cc">
A. !!<BR>
<INPUT TYPE="RADIO" VALUE="B" NAME="cc">
B. #<BR>
<INPUT TYPE="RADIO" VALUE="C" NAME="cc">
C. //<BR>
<INPUT TYPE="Submit" VALUE="Submit Answer">
</FORM>
<hr>
<b>Which of the following languages can be used to write server side scripting in ASP.NET?</b>
<FORM method="POST"
onsubmit="return checkAnswer(this,'A');">
<INPUT TYPE="RADIO" VALUE="A" NAME="cc">
A. C-sharp <BR>
<INPUT TYPE="RADIO" VALUE="B" NAME="cc">
B. VB <BR>
<INPUT TYPE="RADIO" VALUE="C" NAME="cc">
C. C++ <BR>
<INPUT TYPE="Submit" VALUE="Submit Answer">
</FORM>
<hr>
<b>When an .aspx page is requested from the web server, the out put will be rendered to browser in following format.</b>
<FORM method="POST"
onsubmit="return checkAnswer(this,'A');">
<INPUT TYPE="RADIO" VALUE="A" NAME="cc">
A. HTML<BR>
<INPUT TYPE="RADIO" VALUE="B" NAME="cc">
B. XML<BR>
<INPUT TYPE="RADIO" VALUE="C" NAME="cc">
C. JSP<BR>
<INPUT TYPE="Submit" VALUE="Submit Answer">
</FORM>
<FORM method="POST"
onsubmit="return checkAnswer(this,'B');">
<INPUT TYPE="RADIO" VALUE="A" NAME="cc">
A. Another name for Java<BR>
<INPUT TYPE="RADIO" VALUE="B" NAME="cc">
B. A scripting language mostly for the web<BR>
<INPUT TYPE="RADIO" VALUE="C" NAME="cc">
C. When you use Java without compiling<BR>
<INPUT TYPE="Submit" VALUE="Submit Answer">
</FORM>
</body>
</html>
|
|
|
|
|
Good luck with this....You'll need it as this is a COM forum.
Steve
|
|
|
|
|
Hi
I had BHO developed in vs2005. I work on IE6.
I do all the things when the progresschange event fires...
http://msdn.microsoft.com/en-us/library/aa768283(VS.85).aspx[^]
The main thing is
when I open 3 instances of IE,
consider
in first instance, http://www.google.co.in/[^] is opened,
in second instance, http://www.msn.com/[^] is opened,
in third instance, http://in.yahoo.com/?p=us[^] is opened.
when these are opened the ProgressChangeEvent is fired,
but when return back to the window of 2nd instance (i.e.,http://www.msn.com/[^]) and refresh it, no progresschangeevent is fired.
which event can be fired when changing the focus from one window to other,
"WindowStateChanged" event should be fired, but when I open solution explorer of my project, this event is not visible in intellisense. Why WindowStateChanged event is not obtained in my Project solution.
And, using the BHO can't we get the handle of previously opened instance(which is currently active, like 2nd instance after openeing three instances of IE.)
I had already posted this in http://www.codeproject.com/Messages/3165774/Csharp-BHO-problem.aspx[^]
but I think this is the forum that I can get some suggestions.
I was doing all these in Windows XP Service Pack 2 (SP2).
|
|
|
|
|
Hi,
i think,but not sure,
WindowStateChanged event is registered for the current instance
and once you come out of that IE then it wont fire.
For example.
You take IE7 there WindowStateChanged fires while you open a new tab. and switch over the tabs as well.and there u can get the active tab details using he Acessability interface.
( i am also looking for the solution)
|
|
|
|
|
I am developing an application that has to act on external data that is both described and provided by the user, the client.
Currently I have created a wizard and the user can choose either to provide an SQL database (thus asking him for the DSN and the SQL query) or an XML file (thus asking him to for the appropriate xQuery query) or a CSV file (thus asking him for the file where it resides and the delimiting caracater).
Now, this may not be sufficient : I can imagine a plenty of complex scenario such the data cannot fall within those 3 types.
What I am tempted to do then is to make it possible for the application to call an external code provided by the user and which will be responsible for retrieving the data so that the application can deal with it.
My application is written in unmanaged C++, but the user may want to write that portion of code in JAVA, C# etc.
My only idea, which is unfortunately still not clear (regarding implementation) is to write a sort of specification of a COM object : user must write his data-code following that spec. and my application should be able to load available COM objects that fall with particular class and allow the user to select his implementation. Then the application is capable of calling that COM object and retrieving data passed by it.
(I am not even good at COM development)
So do you have suggestion, is there a sample application I can inspire from ?
Thank you in advance.
Easy Profiler : a compile-time profiler for C++
www.potatosoftware.com
|
|
|
|
|
If the COM-based idea is possible, the question then how would I deploy the specs ?
Would it be in form of an IDL file ?
Is it then possible to take an IDL file and construct a COM project from it ?
Easy Profiler : a compile-time profiler for C++
www.potatosoftware.com
|
|
|
|
|
This is really interesting, and it sounds like an enormous amount of work.
About a year ago, I was getting familiar with MIDI (a computer music format), and there was a company that was promoting a DirectX COM interface standard for creating what is known as a software synthesizer (which could process MIDI messages into sound). This component would be loaded into an application that would stream MIDI messages (which comprised a musical composition) to the synthesizer component, the COM interface would process the MIDI format and return a stream of what was essentially a continuous stream of WAVE format digital signals, which the application would then send to its own audio driver. Pretty complicated stuff. Anyway, the company (Cakewalk) that develops the music software, offers developers an SDK package (including source code for both minmal server and compatible client, and lots of html documentation) demonstrating the utility of the server component and the interface that the COM In-Process server must present to the Executable, and all the associated data structures, interfaces, callbacks, and related mechanisms required to make the whole thing work.
Admittedly, it is probably more complicated that what you are suggesting. But, the point is that the COM structure must be provided and thoroughly tested, and the documentation must be clear to the client developer, before they can even begin to design a component that will interface with your server correctly.
In the above mentioned example, I had to study the source code for several weeks before I completely understood how it worked, and especially, how the server-client connections were implemented. What you realize is that, the more complex the code model is, the more difficult it is to get it to work.
|
|
|
|
|
Hi and I appreciate your reply.
Hoepfully I do'nt have data structures to expose ! only simple methods (and no events as well !)
Look I was given the following link by Pallini in the C++/MFC forum, and indeed it's just what I am looking for, so I started creating my IDL file :
http://msdn.microsoft.com/en-us/library/ms680078(VS.85).aspx[^]
Respectfully,
Easy Profiler : a compile-time profiler for C++
www.potatosoftware.com
|
|
|
|
|
I read your other post in the C++/MFC forum. Pallini is correct (always is, in fact), you must start with MIDL.
You might also find this online book useful: Inside COM++[^]. It's quite similar to Don Box's, "Essential COM".
|
|
|
|
|
A free book !
Thanks indeed.
Easy Profiler : a compile-time profiler for C++
www.potatosoftware.com
|
|
|
|
|
how to convert
IPictureDisp* to byte array
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
One way would be to render it into a bitmap created using the CreateDIBSection[^] function. You could also try looking at the GetDIBits[^] function. With both of these you use the handle returned by the get_Handle method.
Steve
|
|
|
|
|
As a rule, the object implemented IPictureDisp implements also IPersist**** interface (IPersistStream, seems) which can help you.
With best wishes,
Vita
|
|
|
|
|
That's an interesting suggestion, but if the implementation persists the image (say a compressed .jpg) as a compressed .jpeg you haven't got yourself a ready-to-use byte-array.
Steve
|
|
|
|
|
Hi everyone!
I have a COM control that makes also use of some COM server.
Within the control I am receiveing a COM exception from the server and I have to report this error again to the control's parent.
So my naive approach was something like this:
<br />
try { ... } catch( _com_error &e)<br />
{<br />
std::string description = e.Description();<br />
Log(ERROR, "COM error: " << description);<br />
return Error(description.c_str(), IID_MY_CONTROL);<br />
}<br />
But this statement makes the control's container crash without any message!
If I replace my description string with some harcoded message, it works just fine. But whenever I rely somehow on the e.Description, bang, it crashs.
I assumed it could already be freed the time it would be read on the container side, so in a further step I tried to copy the description in a new allocated variable, to save it somewhere within the control instead of locally within the catch-block, etc. But nothing works.
What are the reasons why I cannot "forward" this errror description? It can be logged correctly, but I have no chance to bring it on the containers side.
Best regards, Roland
|
|
|
|
|
Found the problem myself.
Thank god it was not my fault, but the container that embedded my control cannot handle long error descriptions.
The common ActiveX Testcontainer could receive those COM error message without any problem, but the application that instantiated my control killed itself whenever it got long messages. Seems like they are using a small buffer and try to copy the long message into a small character array or whatever.
As workaround I simply truncate my error messages. (Ok, over 1000 characters error description is perhaps really very very long )
But is there are maximum size for error descriptions defined? I could not find any restriction regarding the length... and TstCon32 can handle long messages. Hm
|
|
|
|
|
Hello All!
How can I add .net control to ATL window?
I don't need to pass any message between ATL and C#,
only "paste" the control on ATL window.
thanks!
|
|
|
|
|
You give only little information about the .net control... there are several possible ways, but most are simply dirty hacks (e.g. using SetParent on the .NET control's window handle and embedding it into your c++ ATL window. Ah, don't do this!)
In general I would say that's no COM question, but anyway:
Best way (in my opinion) would be to build a C++/CLI wrapper around your control. You could write a C++ control and create an instance of your .NET control on top of it. Mixed-mode at its best!
Best regards,
Roland
|
|
|
|
|
I am having problems converting a System.__ComObject to a serialized class.
I am running two separate applications, both C#.
App #1 is a winform with a ListView.
App #2 is a C# extension inside another application. The extension is a winform.
I am dragging a ListViewItem onto the extension on App #2.
In App #1 I am looking at the ListView_ItemDrag event
I have two serialized classes - DragClass() and Transport() {from examples I found on net}
DragClass holds the ListViewItem name and also the actual ListViewItem
Transport is a collection class that holds the DragClass
Inside this event I am creating a new instance of DragClass and populating it
Create a new instance of Transport and populate that.
I then call DoDragDrop passing in the Transport as parameter.
On App #2 - In DragDrop event the e.Data returns System.__ComObject
I am using this code to try and cast it:
Transport trans = e.Data.GetData(typeof(Transport)) as Transport;
Transport class is a serialized class on App #2 as well.
is this proper way of doing this? I seem to keep getting null back with error Cannot cast System.__ComObject to System.Type.
Any suggestions?
Thanks
|
|
|
|
|
If you're using .NET Framework 3.5 or previous for your applications, you're going to be forced to break out Reflection[^] to either manually deserialize the COM object into your custom types, or to just manually access the members themselves. If you're using .NET Framework 4, you can use C#'s new dynamic keyword to do the same thing with little excess code.
Adam Maras | Software Developer
Microsoft Certified Professional Developer
|
|
|
|
|
yea this is in 3.5, I can go the Reflection route and see where that leads me. I've been trying to Marshal it, then read about needing an interface but can't for the life of me think of why or how I would implement an interface in this design type. Just doesn't fit with what im wanting to do.
But thanks for the time and reply. I'll do some tests and see if it works using that.
|
|
|
|
|
Hi,
Iam also trying to do a similar cast, but not able to figure out the way to do this. Can you please give me some code snippet for doing this using reflection as you have suggested ? Thanks.
|
|
|
|
|
Hi All,
We have implemented a Method type of WMI Provider.
1) It is a coupled provider and its loading / unloading is handled by WMI. Specifically it is loaded in WMIPrvSE.
2) UnLoadTimeout is set to NULL and Pure property has been set to TRUE
3) The WMI provider methods have been declared static in the MOF file also.
In this context, we have a requirement where the client needs to call one method on the WMI provider and when we call the next method, it needs to "remember its state". The client application holds the connection to the object and tries to call the next method. However we are noticing that the provider is being unloaded and the next method call happens on a different object itself.
Please let us know your suggestions on resolving this problem. Can we achieve this functionality with method type of provider at all??
Thanks in advance for your help,
Regards,
Srikanth
|
|
|
|
|
I am developing an application to play mp3 files using directshow .I want to show visualization like windows media player .But I am not getting how do i this . Is there any filter or any technique to show visualization in custom mp3 player.
modified on Monday, August 17, 2009 2:13 AM
|
|
|
|
|