Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

From EXE to OCX

Posted on 2000-02-15
9
Medium Priority
?
278 Views
Last Modified: 2013-11-20
I am using MSVC6.0 on Win NT 4.0 + SP5
for devlopment and Win 98 for testing.


IE 5.0 security settings are default.

I have source code for MFC applications that compiles to give executable files.
Now the boss needs the program to run from the browser page.
Is there any quick way to make the program compiles to OCX. Or is there a way to wrap the program into Java applet or ActiveX?
0
Comment
Question by:soso071898
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 2

Expert Comment

by:Gandalf32
ID: 2527504
It all really depends on what kind of output the program has, and what kind of input (aka database access). You could theoretically create a blank ActiveX or OLE document project, and paste your code in.
0
 

Author Comment

by:soso071898
ID: 2528205
Thanks a lot.
The program is a kind of interactive editor. GUI is a dialog that takes input from the user and creat a text file. The text file needs to be saved locally on HDD or uploaded to a server SQL DB.
The program can also read old text files from HDD or from SQL server DB.

If I create a balnk ActiveX, I have to modify all the classes and functions which I am trying to avoid. I do not know if it will be different with OLE document cause i have experience with ActiveX only. However, I will consider any solution/technology that enables me to minimze the required code changes.
0
 
LVL 4

Expert Comment

by:mandhjo
ID: 2536412
Check the following article to see if it helps you.  If all of your code is encapsulated within your dialog class, you could potentially use the approach explained in this article with very little pain (cutting and pasting the dialog resource and the class into a new MFC ActiveX project).

http://www.codeguru.com/atl/dialogctrl.shtml
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Accepted Solution

by:
cclain earned 800 total points
ID: 2542819
If your program is in a dialog box, you can do it:

-Create a new MFC ActiveX ControlWizard project with default option
(ex: NewApp.dsw)

-Copy your dialog ressource (IDD_OLDAPP)to the new project

-Add your dialog .cpp and .h files to the new project (OldAppDlg.cpp and OldAppDlg.h)

-Declare a COldAppDlg object in NewAppCtrl.h:
  public:
    COldAppDlg dlg;

-Override WM_CREATE message in NewAppCtrl class:
int CNewAppCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
  if (COleControl::OnCreate(lpCreateStruct) == -1)
    return -1;
      
  dlg.Create(IDD_OLDAPP,this);

  CRect rect;
  GetWindowRect(&rect);
  ScreenToClient(rect);
  dlg.SetWindowPos(0,rect.left,rect.top,rect.right,rect.bottom,0);
  return 0;
}

-Compile and test
NewApp.ocx can be put in IE
0
 
LVL 3

Expert Comment

by:mitrakis
ID: 2547004
Listener
0
 

Expert Comment

by:cclain
ID: 2549495
you mean ?
0
 
LVL 3

Expert Comment

by:mitrakis
ID: 2549613
I just wanted to get an email notification on any action herein since I'm interested in this topic, too.
BTW, I cannot see a significant difference between mandhjo's link at codeguru and your posted code fragment...

-Stavi-
0
 

Expert Comment

by:cclain
ID: 2550384
Actually, I had to do this in several projects. Moreover, there is a lot of answers in codeguru which speak about this subject and which helped me but no one was working perfectly.
For the WM_PAINT message for instance, I found this method was good if you have to use your activeX in IE and in Visual C++ editor:

void CNewAppCtrl::OnDraw(
                  CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
  if (IsWindow(dlg.m_hWnd))
    dlg.RedrawWindow(rcBounds,NULL,RDW_INVALIDATE|RDW_ERASE|RDW_UPDATENOW);
  else
  {
    pdc->FillRect(rcBounds,CBrush::FromHandle((HBRUSH)GetStockObject(GRAY_BRUSH)));
    pdc->TextOut(10,10,"NewAppCtrl.ocx");
    pdc->TextOut(10,30,"ActiveX NewAppCtrl");
  }
}
0
 
LVL 4

Expert Comment

by:mandhjo
ID: 2551212
mitrakis:  Thanks for pointing that out.  By the way, you can click on 'Submit' without adding a comment and it will add you to the list of people who are notified when comments and answers are provided.  Just thought I'd let you know.

cclain:  You are right about the OnDraw method.  You must be certain that the dialog is created before attempting to call RedrawWindow...otherwise (as you have found out) an assertion will occur in DEBUG mode and the control will fault in release mode.

soso:  Have these suggestions helped?  Are you running into other difficulties?
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question