Solved

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

Posted on 2000-04-26
1
230 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 200 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
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…

830 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