wood burning stoves 2.0*
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
Author

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.

Thanks,
Best regards,

Leonardo


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

Joined: Sep 02, 2013
Posts: 22

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Is it possible GUI inside C or C++ DLL?