File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes C / C++ and the fly likes Is it possible GUI inside C or C++ DLL? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » C / C++
Bookmark "Is it possible GUI inside C or C++ DLL?" Watch "Is it possible GUI inside C or C++ DLL?" New topic

Is it possible GUI inside C or C++ DLL?

Leonardo Carreira
Ranch Hand

Joined: Apr 07, 2009
Posts: 489

Hi All,

Currently i'm tasked to modify DLL application, by adding Dialog / User Interface hardcoded in the DLL.
The requirement is before the DLL can start its functions, user has to do some selection on the user interface, and the DLL will run with based options selected.
As far as i've done, i can only display MessageBox from DLL, to display an error when the process is failed or an error occurred.
I want to add some buttons and images and checkbox-es on that GUI.
Sorry, i'm quite stuck. Could you please tell me how to achieve that? I have no idea at all.

Best regards,


Sorry, perhaps my english language isn't too good.. Prepare for SCJP 6, Please God help me.. ☼
References : [Java.Boot] [JavaChamp] [JavaPrepare]
Mike Blaszczak

Joined: Sep 02, 2013
Posts: 25

It's possible for a DLL to display a UI, but it's not easy particularly given your requirement that the UI has to appear "before the DLL can start its functions".

When a DLL loads, its DllMain() entry point is called. That function is guaranteed to be called before any other function in the DLL is called. However, DllMain is not an appropriate place to implement any kind of UI. There are architectural ramifications in Windows to doing so and they're not pleasant. Plus, you'll present your UI each time your DLL is loaded from each application that references it. It will be very difficult your your user to understand why the UI keeps reappearing, and your UI will have a hard time giving the user any context for their interaction as it doesn't know what application loaded it or why.

There's probably a better way to solve your problem, so you should investigate alternative approaches.
I agree. Here's the link:
subject: Is it possible GUI inside C or C++ DLL?
It's not a secret anymore!