CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Windows Central > General Windows and DNA Programming
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    General Windows and DNA Programming Discuss Windows programming related issues that do not fit into one of the other categories.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old February 16th, 2000, 06:25 PM
    evilduck evilduck is offline
    Junior Member
     
    Join Date: Feb 2000
    Posts: 4
    evilduck is an unknown quantity at this point (<10)
    Using res protocol in MFC

    I'm writing an MFC app that uses HTML files as a way to graphically navigate my program menus. I found that you can put html resources into a DLL and access them using the res protocol (which is like the html, ftl, gopher protocols). For example, I can put in my html file

    &lt;body background="res://mydll.dll/#2/#131"&gt;

    And this will read bitmap with resource #131 from mydll and use it as my tiled background. My problem is this only seems to work for predefined types. I want I can add a GIF type to the dll but can't figure out how to reference it. Any chance anyone out there has any example code for this? Thanks

    Reply With Quote
      #2    
    Old February 18th, 2000, 02:27 AM
    Radracr Radracr is offline
    Member
     
    Join Date: Jun 1999
    Location: Washington
    Posts: 32
    Radracr is an unknown quantity at this point (<10)
    Re: Using res protocol in MFC

    Here is what you do:

    The DLL that has your contained HTML can also contain your images. Import your images under the 2110 resource folder. If it has quotes around it then you will need to edit the resource file manually to remove the quotes. By default when you import images, the images are assigned a value and IDR_*. You can replace this with an actual string "background.gif". That way when your HTML file is loaded from the DLL it can reference the images contained there in.

    So an example:
    You have a DLL called "projectres.dll"

    The resources include a tree format as folllows

    projectres resources
    + "REGISTRY"
    - 2110
    "background.gif"
    - HTML
    "page.html"

    Page.html looks something like below

    In your MFC project you have a web browser control and you tell it to navigate to "res://projectres.dll/page.html" page.html will then load background.gif from the DLL and whalla you have your graphical resources displayed.

    If you are still having troubles, email me and I will reply to this posting with a quick example.

    Hope this clears things up,
    -Erik

    Reply With Quote
      #3    
    Old February 21st, 2000, 07:50 PM
    Rick Leinecker Rick Leinecker is offline
    Member
     
    Join Date: Jan 2000
    Posts: 43
    Rick Leinecker is an unknown quantity at this point (<10)
    Re: Using res protocol in MFC

    That sounds pretty useful. Any chance you can post a quick example so that everyone can take a look?

    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Windows Central > General Windows and DNA Programming


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 07:07 AM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009