Urgent: Calling an MFC ActiveX dll hosting CHtmlView from C# Class Library

Hi,

I have wriiten a MFC ActiveX Control using Visual Studio .Net. By
defaut it gave me ocx file as an output.
Based on my readings, ActiveX Ocx and Dll are a same thing, so i just
changed the file extension
to DLL in the project output file option under Project Properties. It
generated a dll and registrered it and i am able browse it properly in
the Object Browser.

I added a reference to it in a C# Class Library Project and it made the
wrapper ending with control's name ending with Lib.
Problem is when i call an ordinary method of the ActiveX from the C#
Libarary, it works fine but
when i call the ActiveX method which creates a temporary CHtmlView
object for browsing, I
get

Debug Assertion Failed in oledisp1.cpp line 402

when  line below is reached:

//****************** Code *************************

pTempHtmlView->Create(NULL, NULL, WS_VISIBLE|WS_OVERLAPPED,(const
RECT&)rect, this,NULL )

//****************** ***** *************************

ActiveX works fine when used on an Aspx Page.
Can any1 tell me wat am i doing wrong here.

Regards,

Hameer

0
11/16/2005 7:21:17 AM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
898 Views

Similar Articles

[PageSpeed] 44

OCX files are DLLs with the TLB lib bound to it.  By naming it DLL you
are telling programs that the TLB is not bound so they won't attempt
to do late binding.  Therefore anything that relies on reading the
typelib would fail.

Is there some reason why you can't just leave the name as OCX?

-Kurt

On 15 Nov 2005 23:21:17 -0800, "Hameer" <hameer.saleem@amzxs.com>
wrote:

>Hi,
>
>I have wriiten a MFC ActiveX Control using Visual Studio .Net. By
>defaut it gave me ocx file as an output.
>Based on my readings, ActiveX Ocx and Dll are a same thing, so i just
>changed the file extension
>to DLL in the project output file option under Project Properties. It
>generated a dll and registrered it and i am able browse it properly in
>the Object Browser.
>
>I added a reference to it in a C# Class Library Project and it made the
>wrapper ending with control's name ending with Lib.
>Problem is when i call an ordinary method of the ActiveX from the C#
>Libarary, it works fine but
>when i call the ActiveX method which creates a temporary CHtmlView
>object for browsing, I
>get
>
>Debug Assertion Failed in oledisp1.cpp line 402
>
>when  line below is reached:
>
>//****************** Code *************************
>
>pTempHtmlView->Create(NULL, NULL, WS_VISIBLE|WS_OVERLAPPED,(const
>RECT&)rect, this,NULL )
>
>//****************** ***** *************************
>
>ActiveX works fine when used on an Aspx Page.
>Can any1 tell me wat am i doing wrong here.
>
>Regards,
>
>Hameer
0
11/16/2005 8:03:30 PM
Hi Kurt,

Thanx for your reply.

I have to use the DLL extension because I have read somewhere that
ActiveX Dlls
require no container. Actually I want to host the ActiveX in a dll and
that is a must requirement. Can you help me out on this further.

Best Regards,
Hameer

0
11/17/2005 6:17:31 AM
Hi Hameer,

Well, your information is correct. OCX files are merely DLLs with the
TypeLib contained as a resource.  However, the OCX extension is a
significant clue to other programs.

In order to ascertain if you have an ordinary bug, or if some other
program is confused by the lack of the clue which it could gain from
the OCX file type, you need to perform an experiment.  Name it back to
the default OCX and see if the problem goes away.  If the problem
persists, then it is just and ordinary bug.

Hope this helps,
-Kurt


On 16 Nov 2005 22:17:31 -0800, "Hameer" <hameer.saleem@amzxs.com>
wrote:

>Hi Kurt,
>
>Thanx for your reply.
>
>I have to use the DLL extension because I have read somewhere that
>ActiveX Dlls
>require no container. Actually I want to host the ActiveX in a dll and
>that is a must requirement. Can you help me out on this further.
>
>Best Regards,
>Hameer
0
11/17/2005 3:39:07 PM
Thnx for the reply,

The problem is that if ill make it ocx it won't work under c# dll.
Remeber Ocx require container.

Best Regards

0
11/26/2005 6:55:26 AM
Reply:

Similar Artilces:

How can I get schema from a class/object at runtime
Hello all, I have the following serializable class. ---------------------------------------------------------------------------- -- Public Class Test _testID as int32 _testName as String Public Sub New() MyBase.New() End Sub <XmlAttributeAttribute()> Public Property TestID() As int32 Get Return _testID End Get Set(ByVal Value As int32) _testID= value End Set End Property <XmlAttributeAttribute()> Public Property TestName() As String Get Return _testName End Get Set(ByVal Value As String) _testName= value End Set...

C/C++/VC++/MFC/SDK,Coding contest at StreamNet(India)Pvt Ltd #2
This coding test is primarily on C/C++/VC++/MFC/SDK related technologies and is designed to pick the very best of developers to work on our cutting edge technologies. The winner of the first prize takes home a cool Rs.1 lac! There are other consolation prizes to be won as well with a special token of appreciation for the 1st and 2nd runners up! Top 10 candidates will get the offer from Streamnet India Pvt. Ltd. To participate you need to apply to our following Email id with your resume codingcontest@streamnet.com The candidate should possess a B.E./BTech./MCA degree from reputed university ...

Trying to figure out what is making this call
I am getting the following call to my Database and it seems to be running extremely long. Does anyone know anything about this specific call? Query in SQL 2005 "(@ActivityPartyId0 uniqueidentifier,@PartyId0 uniqueidentifier,@PartyObjectTypeCode0 int,@ActivityId0 uniqueidentifier,@ParticipationTypeMask0 int)insert into ActivityPartyBase(ActivityPartyId, PartyId, PartyObjectTypeCode, ActivityId, ParticipationTypeMask) values (@ActivityPartyId0, @PartyId0, @PartyObjectTypeCode0, @ActivityId0, @ParticipationTypeMask0)" Thanks Al Hi Al, Tough to say for sure, but it's writing rec...

osetup.dll digital signature does not validate or is not present
When I click on the setup icon on the disk I receive the following error message: E:\proplus.ww\osetup.dll digital signature does not validate or is not present. Any suggestions? Disc is corrupt. Get a new disc to install office "Janine" wrote: > When I click on the setup icon on the disk I receive the following error > message: E:\proplus.ww\osetup.dll digital signature does not validate or is > not present. Any suggestions? > "Sudhi" wrote: > Disc is corrupt. Get a new disc to install office > > "Janine" wro...

Cross platform C++ base library?
Hello, I am looking for a good cross platform C++ 'base class' library for things such as strings, containers, and utility functions that are typically found in MFC, Qt, etc. It doesn't need to support GUI. This is for a C++ middleware project. I realize the default choice is STL, available with standard C++. But I really hate that, as well as the TR9 and upcoming C++0x standards. I am looking for a simpler and more sane alternative similar to the classes found in MFC or Qt (but that don't require a licensing or are necessarily part of a GUI framework). Thanks for ...

Is overriding a function of a library in accordance with C++ standard?
Is overriding a function of a library in accordance with C++ standard? The following code is passed by the VS 2005 and Dev C++. #include <cstdlib> #include <iostream> using namespace std; size_t strlen(const char* p) { return 0; } // !!! Note this !!! The standard library function strlen is deliberately overriden. int main(int argc, char *argv[]) { system("PAUSE"); return EXIT_SUCCESS; } There is even no warning after compiling the code. In front of the fact, I have to make a guess that all the C++ compilers are conformed to the following rules: 1) Th...

Re:CAsyncSocket class
Hi,all: I want to send a message to the client finally in these statements: char lastMsg[30]; memset(lastMsg,0,sizeof(lastMsg)); strcpy(lastMsg,"The server will close you."); pSocket->Send(lastMsg,sizeof(lastMsg)); Then,I want to close the socket. If I immediately call this, the lastMsg data can not be sended. When should I call this statement:"pSocket->Close ();"? See the article 'Graceful Shutdown, Linger Options, and Socket Closure' in the Platform SDK doco. Scott An wrote: > Hi,all: > I want to send a message to the client finally in these st...

problem invoke an MFC callback function from Non MFC app
Hi i am having problem invoking an mfc callback function from a non mfc dll. any samples that I can look at? What is happening is when I call function (not callbacks) in this MFC dll from my non MFC app it works fine. But when i try to invoke the callbacks nothing seems to happen. It doesn't fail/not exception. When i cut and paste the same code into an MFC app (ie; call the mfc dll from and MFC app) the callbacks get invoked without any problem. Now my question is do i need to do something different as i am calling it from a non mfc app?like a message map? if so how do i do that? T...

MFC #3
What will be the best book to read the VC++ MFC in depth? "Programming Windows with MFC" by Jeff Prosise is pretty good. It is published by Microsoft Press w/ ISBN:1572316950 "HariKaran" <anonymous@discussions.microsoft.com> wrote in message news:0b3a01c39d3d$8ce4b2f0$a301280a@phx.gbl... > What will be the best book to read the VC++ MFC in depth? MFC Internals "HariKaran" <anonymous@discussions.microsoft.com> wrote in message news:0b3a01c39d3d$8ce4b2f0$a301280a@phx.gbl... > What will be the best book to read the VC++ MFC in depth? ...

MFC and .NET #3
Can I develop an application in MFC using Visual Studio .NET and deploy it to my customers without requiring them to have the .NET framework or me having to provide it? I basically want to be same to do the same as I have with VS 6 and just send them the EXE and DLLs. >Can I develop an application in MFC using Visual Studio .NET and deploy it >to my customers without requiring them to have the .NET framework or me >having to provide it? Yes you can William. VC++ is the only VS.Net language that still lets you produce unmanaged code. Dave -- MVP VC++ FAQ: http://www.mvps.org/vcf...

Express-2005/8 and MFC with Platform-SDK?
Sorry if this has been asked before. My understanding has been that Express-2005 and Express-2008 were unable to build MFC projects ... that such usage was restricted and unauthorized. My speculation was that it was technically possible to change some undocumented settings, but that would be a violation of the eula. However, I came across the following information: > All of the libraries are free. The reason they aren't distributed with > express editions is to keep the download size low. >You can freely download all of the files you need from Microsoft. > They are all i...

I published and a folder that was empty did not get copied to the host
I don't know if this is just a fluke but I published to my host many times and a certain folder always had files in it and everything worked. The last time I published that folder was empty and it did not get copied to the host. That is, when my site tried to copy a file into it the site bombed because the folder was not there. Is that to be expected. That is, publishing will not create a empty folder on the host. I will of course check for the existence in my code but I was wondering if what I saw is the expected behavior. Thanks ...

Creating new class on the basis of second dialog window.
One has the second dialog window, which takes in editbox - CString variable value. On the basis of it he creates the class CMsgDlg. As a rule, he must create in the main dialog window class member-variable m_dMsgDlg with the type CMsgDlg. Then he insert into file main_dialog_window.cpp before main_dialog_window.H - MsgDlg.H. Then with the help of the member-variable m_dMsgDlg, from main dialog window he calls the second dialog window : if(m_dMsgDlg.DoModal()==IDOK) and so on. It's nessesary to use this second dialog window class in the other applications. For those ...

C# code generation with xsd.exe "how to ?"
Actually, the very first question I should ask is "does it make sense at all?". For 2 days I've been trying to generate C# classes using XML schema and xsd.exe tool. So far the results are not exciting but I assume I am seriously short of knowledge, so here I am - asking for help. My current situation is that I can define schemas that will generate very simple classes but I have two major problems: (1) I do not know how to write a schema, so that my classes can get properties with skeletons for getter and setter, as opposed to public fields ? Right now, for every generated clas...

Call & Get Paid $$$
Q2FsbCAmIEdldCBQYWlkICQkJCAhISEKCmh0dHA6Ly93d3cuZ29vZ2luYy5jb20vdW5saW1pdGVk Y2FsbAoKWW91IE1ha2UgTW9uZXkgV2hlbiBPdGhlciBQZW9wbGUgTWFrZSBBIENhbGwgISEhCgrl iKXkurrmiZPpm7voqbHvuZDkvaDlsLHos7rpjKLjgILjgILjgILjgIIKCk1ha2UgVVNEIDUsMDAw L21vbnRoCg== ...

VC/MFC world status request
I wonder if someone here would care to let me know what the current "position" regarding VC and MFC in connection with the following points I'm well out of the software loop. I last programmed (anything) over 5++ years ago. At that time I'd been using VC/MFC for several years and the version I used was 6.0 professional.. Is VC/MFC still alive and well (supported by M$? Has it ceased to be the "tool of choice" (as it used to be)? I'd also written a certain amount (not a lot) using D/COM which I found tough going. Last I heard there was something called COM+ t...

Reports not printing
I am trying to print reports and after clicking either the Print button on the toolbar or using the File menu, Print, Ok, the Printing window opens like its sending it to the printer, but the report never prints. The printer icon appears in my system tray, but the job just shows as spooling. I can then cancel the print, if needed. This happens on any report within the database. When I am logged in as an admin (using the shift key), the reports will print, but if I am logged in as a user, I cannot. I am the administrator of this database and my end users cannot to print the reports they ...

Re: Excel - MATCH, INDEX or VLOOKUP - That is the Question
Hi, Here asking for your help again. This place is so useful. Heres the situation: (Also see attachment) If the user were to pick answers from a series of questions is i possible to match up the answers and return the relevant result. i. A7+B7+C7+D7+E7 = G7. How can this be done, please. Thanks Andrew :confused Attachment filename: multipl eg.xls Download attachment: http://www.excelforum.com/attachment.php?postid=55677 -- Message posted from http://www.ExcelForum.com Perhaps the quiz template on my website can help or point you in useful direction: ht...

MFC GDI Resource leak reintroduced in WinXP SP2?
G'day, I've been testing with WinXP sp2 and have noticed that the bug fix in in WinXP SP1 desribed to this article http://support. microsoft.com/?kbid=319740 seems to be undone. It relates to any MDI MFC application leaking 6 GDI resources everytime a child window is created, when XP theming is turned on. The culprit was UXTheme.dll. Win 2003 server with theming turned on also exhibits this leak. Can anyone else confirm this? Thanks, Barnaby Just some further information on UXTheme.dll shipped in the various OS versions: FIXED: XP SP1 = 6.0.2800.116 Date Created: 16/10/2...

Can a vbscript identify the program/process that called a vbscript
I would like to code a vbscript ("ActionScript.vbs") in such a way that it would do X, if ActionScript.vbs were called by "TriggerScriptA.vbs", but do something else if ActionScript.vbs were called by "TriggerScriptAB.vbs". Is there some way by which ActionScript.vbs could identify the program/process that called ActionScript.vbs? If the answer is "yes", that would be useful in many contexts. For example, it would be useful in the context of Hta programming, where (I think) a button (that calls a vbscript inside the Hta file) cannot se...

Porting from VC6, Class Wizard Comments
Am I correct in assuming that all the Class Wizard comment insertions, //{{AFX_ , are ignored by VS2008, and can be safely removed prior to porting a project from VC6 to VS2008? I have been doing that in VS2005. I take code worked in VS6 and remove the #ifdef blocks, replace them with #pragma once, and then cut out all the classwizard specific comments. I haven't had any problems doing it and I like the cleaner look. Andy "AVee" <AVee@community.nospam> wrote in message news:uADGqehLJHA.5660@TK2MSFTNGP03.phx.gbl... > Am I correct in assuming that all the Clas...

Exchange2003 server hosts multiple mail domains
I have a scenario, were an Exchange2003 server hosts multiple mail domains, e.g. domain1.com, domain2.com,domain3.com. The Exchange server is a member of the Active Directory domain ad.domain0.com. If the Exchange server generates a Non-Delivery Report, for example because someone has sent a message to wrongaddress@domain2.com, then the sender address of this NDR is always postmaster@ad.domain0.com. so that a NDR related to domain2.com will be sent from postmaster@domain2.com, and a NDR related to domain3.com will be sent from postmaster@domain3.com. How to acheive this .... please He...

Invalid root element with C++ XML generation tool
I have a very strange problem. I created an XSD file with the following root: <Database> </Database> However, since C++ does not allow you to have a property with the same name as the class, when it generates the Strongly typed Dataset, it appends the text "Schema" to the end of the root element. So the Strongly Typed class name is DatabaseSchema. It does this by looking at the id property of the schema. However, this causes a lot of problems when I do a WriteXML on the dataset. It basically generates this: <?xml version="1.0" standalone="yes"?>...

Ex2003 smar host can't get mail to Ex 2007
I had a perfectly working Ex2003 server and added a new Ex2007 server to my organization. Moved my mailbox to the Ex2007 and got on with my work. First thing I noticed is that I didn't get any new mail. Mail would go out OK, but none came in. 'Fixed' it by removing the smart host I had set on the Ex2003. From what I can tell, mail would come in to the Ex2003 then was sent (via SMTP?) to the Ex2007. However it looks to me like it was sent via the smart host, so out into the big wide world again. My aim is to remove the Ex2003 someday, but for now, how can I resolve this?...

urgent help needed 05-22-05
We are doing migration of data to our newcrm system. We made a mistake in mapping the data because of which the subject of the activities was not transferred properly. Now the issue is we have 500000 activities (all with closed state)) with the wrong subject name. We know what the subject should be but do not have enough time to delete all these all these activities and transfer data again. Since we do not use offline capabilities, is it safe to directly update the activity subject in the CRM database? If you are just updating the Subject, this should be safe, however it is not "...