CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10

Thread: Copy Ressources

  1. #1
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    153

    Copy Ressources

    Hi,

    i have a mfc-dll with some dialogs in it.

    Now i want to make a little redesign, and having another mfc-dll, in which
    i want to have some of the dialogs of the first mentioned mfc-dll.

    But unfortunateley i dont manage it, to copy the dialog ressources from the one project to the other.

    Is there any other way, as to copy the binary-data from the one project to the other.

    Any hint is welcome, as there are more than a few dialogs to copy.
    Thanks in advance,
    Matze

  2. #2
    Join Date
    Nov 2001
    Location
    Kerala,India
    Posts
    650

    Re: Copy Ressources

    I dont think that there is some method to do that using VC editor. i too face this problem many times. the dialog resource code is not stored as binary information in the application. you can find the declaration for the dialog resource in resource.h file, i think you will find 3 references for a particular dialog in that file. the thing you can do is manualy copy that entries in to your new application. i dont think there is some other method for doing it easily. if there is any easy method i too interested to know that

  3. #3
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815

    Re: Copy Ressources

    Quote Originally Posted by matze42
    But unfortunateley i dont manage it, to copy the dialog ressources from the one project to the other.

    Is there any other way, as to copy the binary-data from the one project to the other.
    For some strange reason, the VC++ IDE does not support the external clipboard when copying resources from one running instance of the IDE to another. What you can do, however, is to open the "foreign" resources as a file (File / Open, select the resources (either the compiled DLL, or the .rc, or the .res) and open it. The resources will appear as a tree (in an own MDI child window), and you will be able to copy resources from there to your project workspace.

  4. #4
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815

    Re: Copy Ressources

    Quote Originally Posted by Vinod S
    I dont think that there is some method to do that using VC editor.
    Yes, there is - see above.
    Quote Originally Posted by Vinod S
    the dialog resource code is not stored as binary information in the application.
    Yes, it is. All resources are stored in binary format in the executable.
    Quote Originally Posted by Vinod S
    you can find the declaration for the dialog resource in resource.h file, i think you will find 3 references for a particular dialog in that file.
    That's not the "declaration" - it's just a preprocessor constant for the resource ID.
    Quote Originally Posted by Vinod S
    the thing you can do is manualy copy that entries in to your new application.
    That won't help - you would need to copy the actual definitions from the .rc file, and you still had to make sure that the resource IDs are unique.

  5. #5
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    153

    Re: Copy Ressources

    Hi gstercken,

    Quote Originally Posted by gstercken
    For some strange reason, the VC++ IDE does not support the external clipboard when copying resources from one running instance of the IDE to another. What you can do, however, is to open the "foreign" resources as a file (File / Open, select the resources (either the compiled DLL, or the .rc, or the .res) and open it. The resources will appear as a tree (in an own MDI child window), and you will be able to copy resources from there to your project workspace.
    This way works.
    But only if i create a new (empty) Dialog, copy the binary-data of my source and overwrite the binary-data of my target with the copy.

    As a remark: One should not forget to copy ( or recreate if already existant ) the IDs of the Dialog-Controls in the Resource.h-File, too.

    Many thanks,
    Matze

  6. #6
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815

    Re: Copy Ressources

    Quote Originally Posted by matze42
    This way works.But only if i create a new (empty) Dialog, copy the binary-data of my source and overwrite the binary-data of my target with the copy.
    No, you can copy entire dialog resource templates, or inidividual controls. The IDs will be recreated automagically.

  7. #7
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    153

    Re: Copy Ressources

    Quote Originally Posted by gstercken
    No, you can copy entire dialog resource templates, or inidividual controls. The IDs will be recreated automagically.
    AHA !?!

    I will try this.
    Copying the Ressource-Template worked.
    But where can I past it ?

    Matze

  8. #8
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815

    Re: Copy Ressources

    Quote Originally Posted by matze42
    Copying the Ressource-Template worked.
    But where can I past it ?
    As said above: Into the resource view of your project workspace (usually on the left hand side).

  9. #9
    Join Date
    Feb 2004
    Location
    Germany
    Posts
    153

    Re: Copy Ressources

    OK, works.

    Although i'm almost sure, it didn't work the first time i tried it.

    Thank you very much,
    Matze

  10. #10
    Join Date
    Dec 2001
    Posts
    9

    Re: Copy Ressources

    I am trying to do the same thing. Copying dialogs in Visual Studio .NET 2003. I have opened the "source" .rc file and see the tree in my destiation project. I drag a dialog from the "source" and paste it into the Resource View. When my mouse crosses the line into the resource view it gives me the circle with a line through it. No way to copy.

    What am I doing wrong?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured