Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. static library resource dialogs not working in linking applications

static library resource dialogs not working in linking applications

Scheduled Pinned Locked Moved C / C++ / MFC
questionlearning
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KASR1
    wrote on last edited by
    #1

    I have created a static library(Test.lib) and it has some resource dialogs and some classes say CMyDialog etc., . Created a sample application(Test.exe) which links with static library(Test.lib). Now I am creating a instance in my application and calling DoModal() did not work why? CMyDialog mydlg; mydlg.DoModal(); //No dialog shown

    A K C 3 Replies Last reply
    0
    • K KASR1

      I have created a static library(Test.lib) and it has some resource dialogs and some classes say CMyDialog etc., . Created a sample application(Test.exe) which links with static library(Test.lib). Now I am creating a instance in my application and calling DoModal() did not work why? CMyDialog mydlg; mydlg.DoModal(); //No dialog shown

      A Offline
      A Offline
      Adam Roderick J
      wrote on last edited by
      #2

      I think your CDialog resource may not available to the client text.exe. Since static library cannot contain the resource files, either you have add the resource file of the dialog in test.exe with the help of IDE or create the dialog dynamically in the static library, whichever you like.

      Величие не Бога может быть недооценена.

      1 Reply Last reply
      0
      • K KASR1

        I have created a static library(Test.lib) and it has some resource dialogs and some classes say CMyDialog etc., . Created a sample application(Test.exe) which links with static library(Test.lib). Now I am creating a instance in my application and calling DoModal() did not work why? CMyDialog mydlg; mydlg.DoModal(); //No dialog shown

        K Offline
        K Offline
        KASR1
        wrote on last edited by
        #3

        Actually the DoModal() call done inside the static library itself. The test.exe calls a method written inside static lib which creates the dialog dynamically.

        1 Reply Last reply
        0
        • K KASR1

          I have created a static library(Test.lib) and it has some resource dialogs and some classes say CMyDialog etc., . Created a sample application(Test.exe) which links with static library(Test.lib). Now I am creating a instance in my application and calling DoModal() did not work why? CMyDialog mydlg; mydlg.DoModal(); //No dialog shown

          C Offline
          C Offline
          cmk
          wrote on last edited by
          #4

          You need to include the .rc from the static library in your .exe list of resource includes. e.g. Test.lib has TestLib.rc with all resources for static lib i.e. dialog template. Test.exe: - in VC++ goto resource view for project - right-click on TestExe.rc - select Resource Includes ... - add #include "TestLib.rc" to Compile-time directives Test.exe will now pull-in resources from Test.lib when built.

          ...cmk The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying. - John Carmack

          K 1 Reply Last reply
          0
          • C cmk

            You need to include the .rc from the static library in your .exe list of resource includes. e.g. Test.lib has TestLib.rc with all resources for static lib i.e. dialog template. Test.exe: - in VC++ goto resource view for project - right-click on TestExe.rc - select Resource Includes ... - add #include "TestLib.rc" to Compile-time directives Test.exe will now pull-in resources from Test.lib when built.

            ...cmk The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying. - John Carmack

            K Offline
            K Offline
            KASR1
            wrote on last edited by
            #5

            Since the lib is used in many applications using .rc file in the static library is not correct way.

            A 1 Reply Last reply
            0
            • K KASR1

              Since the lib is used in many applications using .rc file in the static library is not correct way.

              A Offline
              A Offline
              Adam Roderick J
              wrote on last edited by
              #6

              Well you cannot include .rc in static lib. cmk too said to include in exe. It is not possible so as we suggested you can either create the dialog dynamically or include .rc file in exe. These are the only options in front of you. :)

              Величие не Бога может быть недооценена.

              K 1 Reply Last reply
              0
              • A Adam Roderick J

                Well you cannot include .rc in static lib. cmk too said to include in exe. It is not possible so as we suggested you can either create the dialog dynamically or include .rc file in exe. These are the only options in front of you. :)

                Величие не Бога может быть недооценена.

                K Offline
                K Offline
                KASR1
                wrote on last edited by
                #7

                That fine. Its not easy to create dialog dynamically as we have lots of dialogs(with so many controls in it) in the .rc file.

                A 1 Reply Last reply
                0
                • K KASR1

                  That fine. Its not easy to create dialog dynamically as we have lots of dialogs(with so many controls in it) in the .rc file.

                  A Offline
                  A Offline
                  Adam Roderick J
                  wrote on last edited by
                  #8

                  Then you have include your .rc file to test.exe workspace. Unfortunately you cannot add .rc in static lib, it wont work :rolleyes:

                  Величие не Бога может быть недооценена.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups