• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

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

Ranch Hand
Posts: 494
Eclipse IDE Postgres Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

Best regards,

Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic