Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Leonardo Carreira
Ranch Hand
Posts: 494
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mike Blaszczak
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic