Solved

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

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

A short article about a problem I had getting the GPS LocationListener working.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
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 …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now