?
Solved

Creating an application in a DLL - Is it possible??

Posted on 2000-04-26
1
Medium Priority
?
249 Views
Last Modified: 2013-11-13
Hi,

      I am writing a java based application that needs to control a PCI Card (TV card to be exact). The card offers two SDK API's, one is an activeX component (ocx file) the other is C++. In both API's the card requires a window to be opened in order to initialise. Using the activeX API this requires an MFC SDI app to be created (window with doc/view). The C++ API requires a Win32 app to be created.

     What I want to know is can I create the required application within a DLL (no exe) using either threads or the dll entry points? I have managed to create a window that is launched from the dll using a class derived from CWinThread but I was unable to create the doc/view required.

     Can anyone help with this? What I want to do is create a windows application that can be launched from a DLL. Are there any alternatives (taking into account that the java program must be able to control the card?) Thanks in advance to anyone who has any idea of how to go about this..

    Darren.

0
Comment
Question by:Darren_B
1 Comment
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 600 total points
ID: 2757558
If you want to do this within a DLL, I would skip the MFC version. This way, you don't have to worry about the Doc/View model. I would instead use CreateWindow() API call and try to get the C++ API to work with that window. Typically, you shouldn't need to use a separate thread. You can usually assume that whatever thread called your DLL would have a UI thread on it. That way you don't have to worry about a message loop for that thread.

One way to do this is that if there is a C++ class that does most of the work, then I would create a global instance of the DLL and then provide functions in the DLL to manipulate the global instance. For example,

CCard g_Card;

__declspec(export) void UseMethodA()
{
  g_Card.MethodA();
}

You can do the same for the rest of the methods.
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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

840 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