Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Downloading a file from the Internet

    SDK Help
    0
    9
    741
    Loading More Posts
    • 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.
    • H
      Helper
      last edited by

      On 20/01/2014 at 06:54, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R15 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      I think I need to use HyperLinkCustomGui and HyperlinkData to download a file from the Internet.
      Not to display it (that is done with HTMLViewerCustomGui), but to read and process it.

      The manuals tells me "Hyper link data type (CUSTOMDATATYPE_HYPER_LINK_STATIC[URL-REMOVED]) for use with the HyperLinkCustomGui[URL-REMOVED] GUI. Has to be created with Alloc()[URL-REMOVED] and destroyed with Free()[URL-REMOVED]. You can useAutoAlloc[URL-REMOVED] to automate the allocation and destruction based on scope."

      However, I do not know how to use them and I cannot find an example.

      	BaseContainer hyperlinkc;
      	hlcgsibl = (HyperLinkCustomGui* )AddCustomGui(1002, CUSTOMGUI_HYPER_LINK_STATIC, "Hyperlink", BFH_SCALEFIT|BFV_SCALEFIT, 900, 200, hyperlinkc);
        
      	String linkTextsIBL = "http://www.hdrlabs.com/sibl/index.html";
      	String labelTextsIBL = "Smart IBL overview";
      	hlcgsibl->SetLinkString(&linkTextsIBL, &labelTextsIBL);
      

      Pim


      [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        On 20/01/2014 at 08:01, xxxxxxxx wrote:

        Hi Pim,

        You just need to set HYPERLINK_IS_LINK to true in the HyperLinkCustomGui container.

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          On 21/01/2014 at 04:01, xxxxxxxx wrote:

          Ok, then how do I tell cinema 4d where to store the downloaded data.
          Do I need to Alloc the HyperlinkData and put that somewhere in the container?

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            On 21/01/2014 at 05:52, xxxxxxxx wrote:

            Pim, do you want to download a file or display a link in a dialog where the user can download a file?

            1 Reply Last reply Reply Quote 0
            • H
              Helper
              last edited by

              On 21/01/2014 at 11:53, xxxxxxxx wrote:

              I want to download a file.
              After downloading I will display the contents of the file using the treeview as we discussed in another post.

              By the way, in Python it is very easy to do.
              In our lon-lat plugin we connect to OSM, query the site and use the result (the contents) in our plugin.

              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

                On 23/01/2014 at 05:53, xxxxxxxx wrote:

                Originally posted by xxxxxxxx

                Hi Pim,
                You just need to set HYPERLINK_IS_LINK to true in the HyperLinkCustomGui container.

                Setting a link now works.

                	//set labelText as link.
                	BaseContainer hyperlinkc;
                	hyperlinkc.SetBool(HYPERLINK_IS_LINK, true);
                	hlcgsibl = (HyperLinkCustomGui* )AddCustomGui(1002, CUSTOMGUI_HYPER_LINK_STATIC, "Hyperlink", BFH_SCALEFIT|BFV_SCALEFIT, 900, 200, hyperlinkc);
                  
                	String linkTextsIBL = "http://www.link.com/index.html";
                	String labelTextsIBL = "Link text";
                	hlcgsibl->SetLinkString(&linkTextsIBL, &labelTextsIBL);
                

                However still the question how to download data in a for C++ accessible form?
                E.g. I want to download http://www.grooff.eu/countries.txt and put the input of this file in a treeview.

                Use HyperlinkData, but how?

                1 Reply Last reply Reply Quote 0
                • H
                  Helper
                  last edited by

                  On 26/01/2014 at 06:52, xxxxxxxx wrote:

                  Still very unclear, how to download a file from the internet.
                  I can use HyperLinkCustomGui to define a link, but when clicked the file is openen in a browser and the file is not downloaded.
                  The manual tells to use HyperLinkData, but how?
                  In the example below, I do not use it.

                  	//set labelText as link.
                  	BaseContainer hyperlinkc;
                  	hyperlinkc.SetBool(HYPERLINK_IS_LINK, true);
                  	hlcgsibl = (HyperLinkCustomGui* )AddCustomGui(1002, CUSTOMGUI_HYPER_LINK_STATIC, "Hyperlink", BFH_SCALEFIT|BFV_SCALEFIT, 900, 200, hyperlinkc);
                    
                  	String linkTextsIBL = "http://www.grooff.eu/pictures/download.txt";
                  	String labelTextsIBL = "Download test file.";
                  	hlcgsibl->SetLinkString(&linkTextsIBL, &labelTextsIBL);
                    
                  	String pStrLink, pStrText;
                  	hlcgsibl->GetLinkString(&pStrLink, &pStrText);
                  
                  1 Reply Last reply Reply Quote 0
                  • H
                    Helper
                    last edited by

                    On 28/01/2014 at 00:51, xxxxxxxx wrote:

                    Originally posted by xxxxxxxx

                    Still very unclear, how to download a file from the internet.
                    I can use HyperLinkCustomGui to define a link, but when clicked the file is openen in a browser and the file is not downloaded.
                    The manual tells to use HyperLinkData, but how?
                    In the example below, I do not use it.

                    HyperLinkData is only useful if a HYPERLINK parameter is defined in a description resource.
                    It allows to get/set the hyperlink text and link strings.

                    HyperLinkCustomGui only displays a link. If you need to download a file from an internet URL take a look at these pages on Stackoverflow:
                    http://stackoverflow.com/questions/1129194/download-a-url-in-c

                    http://stackoverflow.com/questions/1636333/download-file-using-libcurl-in-c-c

                    1 Reply Last reply Reply Quote 0
                    • H
                      Helper
                      last edited by

                      On 01/02/2014 at 02:56, xxxxxxxx wrote:

                      Thanks, I can now run curl using a command file and thus download a file.
                      I can get curllib to work in win32 mode, but not in x64 mode.
                      Getting it to work in x64 is a lot of work (too much).
                      Note: I use visual studio c++ 2010 express.

                      Yannick also showed me how to run python scripts, so I will proceed in that direction.
                      Python and Internet is straightforward.

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post