Convert MFC .exe to ActiveX (ocx dll)

Any ideas how to do that? I've created an MFC app with buttons,
comboboxes and other controls and now I need to convert it to ocx
control to put it easily in some other apps, but only mfc .exe apps
not for web.
0
7/22/2008 8:01:23 AM
vc.mfc 33608 articles. 0 followers. Follow

12 Replies
1612 Views

Similar Articles

[PageSpeed] 11

[sadam]

> I've created an MFC app with buttons,
> comboboxes and other controls and now I need to convert it to ocx
> control to put it easily in some other apps, but only mfc .exe apps
> not for web.

MFC gives good support to OCX development.
I would suggest you to use MFC AppWizard to create a new OCX project, then 
you can reuse your old existing MFC app code, with proper modification, into 
the new OCX project.

If you designed your MFC application well, with proper decoupling and 
factorization of classes, you can easily insert the "business logic" classes 
into the OCX project, and call these classes' methods from the OCX.

Another approach could be to give OLE Automation support to your MFC 
application, such that other .EXEs can "pilot" your application (note that 
Word, Excel, PowerPoint etc. offer an object model that can be controlled 
from the outside using OLE Automation technology).

Giovanni


0
Giovanni
7/22/2008 11:00:55 AM
Ok I've created new OCX project, but I have no idea where to put my
code, becouse the only thing it does is drawing the elipse on the
white background? I don't need to use my app in excel it's only for my
internal usage. So my question now is how to insert the "business
logic" classes into the OCX project (for example button, combo box
etc...)
0
7/22/2008 11:45:48 AM
You can't convert an executable to a .ocx; the concept does not exist.

What you need to do is create a .ocx control with all those buttons and other controls as
a completely separate project (most of the code would be copy-and-paste) and you have to
provide the ActiveX interfaces (methods and event notifications).  Then you take your
current project, gut it, and replace all the controls with the new activex control you
have created.
					joe

On Tue, 22 Jul 2008 01:01:23 -0700 (PDT), sadam <adamsalata@gmail.com> wrote:

>Any ideas how to do that? I've created an MFC app with buttons,
>comboboxes and other controls and now I need to convert it to ocx
>control to put it easily in some other apps, but only mfc .exe apps
>not for web.
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
7/22/2008 2:22:44 PM
As others have pointed out, there is no direct way to do this. You will need 
to refactor the code away from your app that needs to go in OCX. Also, why 
do you need OCX?

--
Ajay

"sadam" <adamsalata@gmail.com> wrote in message 
news:b0c3c4fb-d0e5-48e5-a906-e26a763d771a@8g2000hse.googlegroups.com...
> Any ideas how to do that? I've created an MFC app with buttons,
> comboboxes and other controls and now I need to convert it to ocx
> control to put it easily in some other apps, but only mfc .exe apps
> not for web. 

0
ajaykalra (6842)
7/23/2008 3:41:27 AM
Ok, thank you for help, I'll try to do it ;]
> What you need to do is create a .ocx control with all those buttons and o=
ther controls as
> a completely separate project (most of the code would be copy-and-paste) =
and you have to
> provide the ActiveX interfaces (methods and event notifications). =A0Then=
 you take your
> current project, gut it, and replace all the controls with the new active=
x control you
> have created.
0
7/23/2008 6:15:01 AM
Could you tell me how to draw button on this ocx control?
0
7/23/2008 6:56:00 AM
Just create a button; it draws itself.  I'm not an ActiveX expert; I'm barely on speaking
terms with the technology.  Perhaps you should ask in the ActiveX newsgroup.
				joe

On Tue, 22 Jul 2008 23:56:00 -0700 (PDT), sadam <adamsalata@gmail.com> wrote:

>Could you tell me how to draw button on this ocx control?
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
7/23/2008 12:32:19 PM
An activeX control which is an .OCX is simple a DLL with it's TYPELIB
bound as a resource.  It paints a window and requires a container
object to live in.  These things are supposed to be single window
deals, and they go on a dialog (or other container).  If you want to
have your control be both a container and a DLL you in into the
advanced area of OLE2.  You might be better off making a dialog app.
and putting your control as one of the windows on it.  Then put your
other buttons on the same dialog.

-GB

On Tue, 22 Jul 2008 23:56:00 -0700 (PDT), sadam <adamsalata@gmail.com>
wrote:

>Could you tell me how to draw button on this ocx control?
0
spamhater1 (35)
7/23/2008 1:40:14 PM
Actually, they are not restricted to being a "single window"; they can contain multiple
controls, and in fact one of the powers of ActiveX is that it allows you to group controls
into a single functioning abstraction.
				joe

On Wed, 23 Jul 2008 08:40:14 -0500, Geeky Badger <spamhater@superunlikelyurl.net> wrote:

>An activeX control which is an .OCX is simple a DLL with it's TYPELIB
>bound as a resource.  It paints a window and requires a container
>object to live in.  These things are supposed to be single window
>deals, and they go on a dialog (or other container).  If you want to
>have your control be both a container and a DLL you in into the
>advanced area of OLE2.  You might be better off making a dialog app.
>and putting your control as one of the windows on it.  Then put your
>other buttons on the same dialog.
>
>-GB
>
>On Tue, 22 Jul 2008 23:56:00 -0700 (PDT), sadam <adamsalata@gmail.com>
>wrote:
>
>>Could you tell me how to draw button on this ocx control?
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
7/23/2008 5:21:34 PM
Ok I need OCX becouse this is my task, so how to refactor my code to
create from it ocx? I just need a simple example with ocx control and
one button on it, the rest I'll figure out.
> As others have pointed out, there is no direct way to do this. You will need
> to refactor the code away from your app that needs to go in OCX. Also, why
> do you need OCX?

0
7/24/2008 6:40:45 AM
Oh I have to start my app rom matlab mex function and I don't know is
it possible to start mfc app?
0
7/24/2008 7:19:29 AM
Ok, I have the solution it's very easy :)
0
7/24/2008 10:22:55 AM
Reply:

Similar Artilces:

problem converting
I recently purchased Money 2004 Deluxe in order to upgrade from Money 2001. When I installed the program, it said something about the anti-virus program and refers me to the more info section, which contained no information. After installing, I open the program and it begins to convert my data andthen i receive an error message and the program closes. Any suggestions would be helpful. will this also solve the file conversion problem? >-----Original Message----- >In microsoft.public.money, Nicpalos wrote: > >>I recently purchased Money 2004 Deluxe in order to upgrade &g...

How to convert or express numeric value in words
How one can convert or express a numeric value in words? Suppose a numeric value of 30 is to be express in word like Thirty. Thanx Vijay Here are two postings from a similar question from the last day or so: http://www.microsoftexceltraining.com/VBA/ValueToWords.htm http://www.barasch.com/excel/numb2words.htm If you try searching Google first, you'll probably find the answer quicker!! Andy. "Vijay V Palakkal" <vijaypvv@hotmail.com> wrote in message news:00ab01c37833$32d5bf40$3501280a@phx.gbl... > How one can convert or express a numeric value in words? > Supp...

DLL-Hell: delay-load dependency problems only the second time
I have a problem with strange symptoms. My application loads my DLL the following way: typedef bool (*FooPtr) (void); { HINSTANCE hInstDll = AfxLoadLibrary(lpszModuleName); if (!hInstDll) return; // fails the second time we come here FooPtr pFoo = (FooPtr) GetProcAddress(hInstDll, "Foo"); bool bRetVal = (pFoo)(); AfxFreeLibrary(hInstDll); } It works fine on many computers, it works the first time executed on every machine tested. On some machines, executing this code after a short time again, it fails. I have observed it on both Win2k and WinXP. Using DependencyWalker...

Need Quattro Pro download to convert a QPW file to Excel.
Is there anywhere I can get a free Quattro Pro trial download to convert a QPW file? I can't find a converter utility to read a QPW file. Marjiec, If this is a one-time thing with one file, I'll do it for you. I have Quattro Pro here. I'm converting a bunch of qpw files to Excel files for a client. -- Earl Kiosterud mvpearl omitthisword at verizon period net ------------------------------------------- "marjiec" <marjiec@discussions.microsoft.com> wrote in message news:8D3055F5-EC6A-4BFB-853A-5DA7F521DA5E@microsoft.com... > Is there anywhere I can get a...

Converting Publisher 2003 to PDF
When I convert a 2003 Publisher document to Adobe 6 Standard my Hyperlinks are not active, any ideas, when I convert a Word doc it works fine. Thanks What program are you using to create the pdf file? I use PDF-XChange to create a pfd file out of a Publisher file and my hyperlinks are active. -- Don Vancouver, USA "Blake" <Blake@discussions.microsoft.com> wrote in message news:AF891A30-893D-4ABB-8DE3-4668927EDDB7@microsoft.com... > When I convert a 2003 Publisher document to Adobe 6 Standard my Hyperlinks > are not active, any ideas, when I convert a Word doc i...

CPropertyPage in DLL asserts in AfxStaticDownCast
Using the debug version of (Microsoft Visual C++ .NET 69586-335-0000007-18925VS 2003.NET). I have a CPropertySheet in one DLL and I add pages from a second DLL. I get an assert in AfxStaticDownCast that the runtime class for the property page is not CPropertyPage. For test purposes I create an instance of CPropertyPage. I am able to access the runtime class info from the first DLL (I can examine it immediately the AddPage call). If I move the CPropertyPage object into the 1st DLL everything is happy. Is the problem I'm seeing due to window handles being specific to the applic...

Convert to Outlook 2003
We are receiving new pc's which have Windows XP and Office 2003. Users vary on operating systems and Office Versions. What are the correct step to bring over there pst files? Or maybe we shouldn't. But I need to know what the steps are to install there Old Messages/Folders/Contacts/Tasks/Calendar Items etc. from old pc(various Outlook versions 2000 prior) to new pc which now have Outlook 2003. I have tried a couple of ways but I keep getting a duplicate personal folder which is also active. (Example if they get a new mail message it goes to both inboxes in both personal fol...

ActiveX App from dll?
The Problem: We have an application framework that is compiled as a DLL and sits on top of MFC. Basically it looks like this: MFC.dll Our MainFramework.dll Client.exe We NEED this to run inside of a window on a browser. Ideally, this would run inside a window that is placed in a browser and it would run it's own thread and pump it's own messages. It's only interaction with the browser window would probably be to get resize information and other basic events. Later we may want to communicate between the javascript and the C++ app, but that is much less important right ...

event sink in MFC dll
Hi, I need some help regarding MFC dll. I have a COM component which exposes some event interface. I want to write an MFC regular dll in which i can use event sink to catch those COM events. This dll will be used in VC++ console application (MFC support). I don't know how to activate event sink in DFC dll. I wonder whether this is possible. Your help is highly appreciated. If possible proide me an example. Thx. Regards, Manohar "Manu" <manoharbasireddy@gmail.com> wrote in message news:b2b0c74b-c614-4ec7-b432-4b7c9efb3f75@m34g2000hsf.googlegroups.com... > Hi...

xsd.exe generating multiple enums for simple type of included schema file
Hi, I'm just discovering the power of xsd.exe, so maybe I'm doing something wrong. >From an external provider of a web service I received several xsd schema files describing requests and responses. So there is an extra xsd file for each response and each request as well as some base schemas, i.e. defining a data type for a result element. Among others this result element contains a simple enumeration type "ResultState" which can either be "OK" or "FAILED". If I use xsd.exe to generate .cs files from the xsd files definining the complex elements for t...

convert a power point slide index to publisher
How can I convert a power point program to publisher. Copy and paste -- JoAnn Paules MVP Microsoft [Publisher] Tech Editor for "Microsoft Publisher 2007 For Dummies" "mike" <mike@discussions.microsoft.com> wrote in message news:59F29BB7-2C39-48C5-95AF-75BE5854144F@microsoft.com... > How can I convert a power point program to publisher. ...

convert web addresses
I need to convert a lot of jpg.images-urls are in my spreadsheet. Is there a batch command that will save the images to my hard drive?? Thanks, rooniwife -- rooniwife ------------------------------------------------------------------------ rooniwife's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=24904 View this thread: http://www.excelforum.com/showthread.php?threadid=385936 Hi! A really great guy, who can pop in here and take credit any time he likes, created just this tool for me. http://www.myexpertsonline.com/freedls/xlddownloader.zip It's VERY co...

Convert Compile Split Compact DB
What should I do? I created an app in A2003. Want to distribute as MDE Split in 2000. MDB file created in A2003 as A2000 file. From what I understand, I should: Take db to my A2000 machine. Compact and Repair Compile Compact and Repair Create MDE File Compact and Repair Spilt Database Compact and Repair Souond about right? Split the database first. Only convert the front-end to an MDE (there's no advantage to making the back-end an MDE) -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no e-mails, please!) "MBoozer" <MBoozer@discussions.microsoft.com>...

Convert lower case charecters to upper case
Is there a way that we can convert lower case charecters to upper case in MS Excel cells? I have more than 150 User ID's written down in Excel using both Upper case and Lower case. But now I need to convert them in to upper case. Is there an option for that? Dinesh, there is an upper function, you could put this in a nother column and copy down, =UPPER(A1) , then paste special back over the data or you could use a macro like this and do it all at once Sub Change_To_Uppercase() 'select range and run this to change to all CAPS Dim cel As Range For Each cel In Intersect(Selection, _...

OPC server & MFC
Is there and can anyone point me to some references addressing an OPC server with the handy ODBC classes of MFC? Or am I wishing for too much? Ron H. -- This eMail has been scanned by Norton´┐Ż 360 and found to be virus free! On Jun 29, 2:11=A0am, "Ron H" <rnha...@nospam.net> wrote: > Is there and can anyone point me to some references addressing an OPC ser= ver > with the handy ODBC classes of MFC? Or am I wishing for too much? > No takers? Ok, I'll give it a shot, but I might be mostly talking out of my backside... What exactly do yo...

Converting Cad R14
When I insert the cad file and do the "convert" process I end up with all the varous layers in "display". However only the "cad drawing" layer is a visible layer. All the others are blank. Problem is the cad layer is one "grouped" layer and you cannot work with it. Any advise on how to work successfully with cad r14 would be appreciated. Cheers !!! Alan, ...

convert AUTOCAD file to a shape
How do i convert a autocad file to a shape in visio process engineering shart. When i try the created stencil that is supposed to contain my new shape, is emty. Anyone know how to solve this? Hi Isabella, Did you use the Convert CAD Library add-on? Its located under Tools > Add-ons > Visio Extras. -- Hope this helps, Chris Roth Visio MVP Free Visio shapes: http://www.visguy.com/category/shapes Visio programming info: http://www.visguy.com/category/programming/ Other Visio resources: http://www.visguy.com/visio-links/ "Isabella" <Isabella@discussions.microsof...

Converting a string date field/node in an XML document to Date type in a dataset
I am having problems with Date Strings when using VS.net method of converting an XML document to a dataset. I need the the date nodes to be of date type. As I am loading the Dataset to a datagrid, and I using the sort facility to sort by date. Currently the dates are being treated as strings. ree32@hotmail.com (ree32) wrote in message news:<7606ccc8.0409192108.3cbebe24@posting.google.com>... > I am having problems with Date Strings when using VS.net method of > converting an XML document to a dataset. > > I need the the date nodes to be of date type. As I am loading the ...

mnybb.exe + Norton Internet Security
Hi- I have MS Money 2005 on my computer and Norton Internet Security 2005 is always prompting me that mnybb.exe (the ms money background banking program) is trying to connect to the internet and it asks what I want to do. I always select Always Allow and click OK but it will just ask me again in about 5 secs. I check the program list inside norton and it says Permit All for Money Background Banking. Does anyone have any idea what I can do or what I think will be more helpful - any ideas why this is occuring as I think the problem may be with Norton IS. Thanks- -Dan ...

Converting from page-layout program to Word
I'm using Microsoft Office Word 2003. I have a document that was formatted for some ancient page-layout program that won't even run under Windows XP, so I'd like to put it all into Word. It's currently in a tag-style format; for example, to italicize some section, it needs surrounding tags, like this: <W0I>Passage to be italicized.<D> The document is huge, so I need to use Replace all to turn all of these into italics in Word. Is there a way to turn such passages, wherever they occur, into italicized text in Word, dropping the tags on either sid...

Why does excel convert my text "6990011011234" to "6.99E+12"?
Why does excel convert my text for example "6990011011234" to "6.99E+12"? I am runing a "import to excell" from a web site. When imported, the identification # is changed to #.###E+##. Excel doesn't know it's text. Either put an apostrophe in front of it: '6990011011234 or change the number format of the cell: Format>Cells>Number tab Category: Text Does that help? *********** Regards, Ron XL2002, WinXP-Pro "pj" wrote: > Why does excel convert my text for example "6990011011234" to "6.99E+12"? > I am ...

Dll function....undeclared identifier
I am trying to call dll function for my project but whenever i call that function i got error..."undeclared identifier" I have include dlll header file in .cpp file where i am calling that function....how to solve this Is that function/class exported from that DLL? You can use Depends.exe and load that DLL to see what all is exported. Most likely thats the case. -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com "priyanka" <priyanka.surjan@yahoo.com> wrote in message news:1163731385.312638.80190@b28g2000cwb.googlegroups.com... > I am trying to call dll function ...

dellinks.exe Puts All Graphs in One Place
Hello, I just downloaded and started using the dellinks.exe file from Microsoft. It seems to be working, but I have problems when there is more than one graph on a page. All of the graphs are layered on top of each other so that only one is visible. Is there a way to fix this? Thanks. Sincerely, Tom ...

Parameter of dll's function
Hi all, I write a MFC application, in this application I load a dll and call its function by use GetProcAddress function. The function of dll that I need invoke has an output parameter which is a pointer of CString class. In dll's function I asign the value of local variable to the content CString pointer parameter. After performing this asign operation my application is halted. What is wrong in my asign operator. Please help me. Thanks. What is the type of your local variable ? Does exe and dll use the same version of MFC ? Generally speaking, following code should work: void...

std STL with MFC
This may seem a very odd Question, but one I must ask. Do many programmers use Std C++ STL data structures like Vector<>, List<>, Queue<>, etc when programming MFC (or even win32 API) projects? To me It just seems weird. I like to keep MS code with MS stuff (eg use CString instead of std::String when using MFC), and standard C++ stuff (like STL and std::String) with UNIX and other non - MS developments. Do I make sense? So do many MFC projects contain, (use) STL? What is your opinion? Thanks. "Simon Flannery" <support@bigpond.com> wrote in message news:Oe...