Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Serial Numbers

    SDK Help
    0
    20
    1.7k
    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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 20/01/2010 at 13:05, xxxxxxxx wrote:

      OK, that's very useful, thank you.

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 20/01/2010 at 13:07, xxxxxxxx wrote:

        Thanks spedler and Matthias for the info.  I will put it to good use as soon as I get home tonight.

        ~Shawn

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 20/01/2010 at 17:44, xxxxxxxx wrote:

          Okay so This is the code I have in my .cpp file now for the serial number..

            
          ////////////////////////////////////////////////////////////////////////////////////  
          //const ID_PLANET_OBJECT_SERIAL  = 1024924;  
              
          class PlanetXSerial : public SNHookClass  
          {  
          public:  
            String name;  
            
            PlanetXSerial()  
            {  
                name = GeLoadString(IDS_SERIAL_HOOK);  
                if(!name.Content())  
                    name = "C++ SDK - Example Serial Hook";  
            }  
            
            virtual LONG SNCheck(const String &c4dsn,const String &sn,LONG regdate,LONG curdate)  
            {  
                return sn == String("123456789-abcdef") ? SN_OKAY : SN_WRONGNUMBER;  
            }  
            
            virtual const String& GetTitle()  
            {  
                return name;  
            }  
          };  
            
          PlanetXSerial *snhook = NULL;  
            
          Bool RegisterPlanetXSerial()  
          {  
            snhook = gNew PlanetXSerial;  
            if (!snhook->Register(450000241, SNFLAG_OWN))  
                return FALSE;  
            return TRUE;  
          }  
            
          void FreePlanetXSerial()  
          {  
            if (snhook)  
                gDelete(snhook);  
          }  
              
          ///////////////////////////////////////////////////////////////////////////////////////////////////////////  
          

          My question is, what am I supposed to do to prompt the user to put in their serial number, and where do I determine the algorithm for the serial number.    When I finally do determine that,  I will of course not post it on this forum .  LOL

          Also, shouldn't I see another serial field when I go to the personalize dialog box with the code I have?

          Once again I am new to this whole part of it so any help you can offer would be greatly appreciated.

          ~Shawn

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 21/01/2010 at 01:23, xxxxxxxx wrote:

            Originally posted by xxxxxxxx

            Also, shouldn't I see another serial field when I go to the personalize dialog box with the code I have?

            Did you call RegisterPlanetXSerial() during C4DPL_INIT_SYS to register the plugin with Cinema?

            cheers,
            Matthias

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

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 21/01/2010 at 02:40, xxxxxxxx wrote:

              Yes, I did,
              Here's my main.cpp

                
              /////////////////////////////////////////////////////////////  
              // Planet  
                
              // Starts the plugin registration  
                
              #include "c4d.h"  
              #include <string.h>  
                
              // forward declarations  
              Bool RegisterPlanet(void);  
              Bool RegisterSun(void);  
              Bool RegisterPlanetXSerial();  
              void FreePlanetXSerial();  
                
              C4D_CrashHandler old_handler;  
                
              void SDKCrashHandler(CHAR *crashinfo)  
              {  
                // don't forget to call the original handler!!!  
                if (old_handler) (*old_handler)(crashinfo);  
              }  
                
              void EnhanceMainMenu(void)   
              {  
                // do this only if necessary - otherwise the user will end up with dozens of menus!  
                
                if (!(GeGetVersionType()&VERSION_CINEMA4D)) // only if C4D is loaded  
                    return;  
                
                BaseContainer *bc = GetMenuResource(String("M_EDITOR"));  
                if (!bc) return;  
                
                // search for the most important menu entry. if present, the user has customized the settings  
                // -> don't add menu again  
                if (SearchMenuResource(bc,String("PLUGIN_CMD_1000472")))  
                    return;   
                
                GeData *last = SearchPluginMenuResource();  
                
                BaseContainer sc;  
                sc.InsData(MENURESOURCE_SUBTITLE,String("SDK Test"));  
                sc.InsData(MENURESOURCE_COMMAND,String("IDM_NEU")); // add C4D's new scene command to menu  
                sc.InsData(MENURESOURCE_SEPERATOR,TRUE);  
                sc.InsData(MENURESOURCE_COMMAND,String("PLUGIN_CMD_1000472")); // add ActiveObject dialog to menu  
                  
                if (last)  
                    bc->InsDataAfter(MENURESOURCE_STRING,sc,last);  
                else // user killed plugin menu - add as last overall entry  
                    bc->InsData(MENURESOURCE_STRING,sc);  
              }  
                
              Bool PluginStart(void)  
              {  
                // example of installing a crashhandler  
                old_handler = C4DOS.CrashHandler; // backup the original handler (must be called!)  
                C4DOS.CrashHandler = SDKCrashHandler; // insert the own handler  
                  
                // Planet Object  
                if (!RegisterPlanet()) return FALSE;  
                // Sun Object  
                if (!RegisterSun()) return FALSE;  
                
                return TRUE;  
              }  
                
              void PluginEnd(void)  
              {  
              FreePlanetXSerial();  
              }  
                
                
              Bool PluginMessage(LONG id, void *data)  
              {  
                //use the following lines to set a plugin priority  
                //  
                switch (id)  
                {  
                    case C4DPL_INIT_SYS:  
                        if (!resource.Init()) return FALSE; // don't start plugin without resource  
                        return TRUE;  
                        if (!RegisterPlanetXSerial()) return FALSE;  
                
                    case C4DPL_ENDACTIVITY:  
                        FreePlanetXSerial(); return TRUE;  
                
                    case C4DMSG_PRIORITY:   
                        return TRUE;  
                
                    case C4DPL_BUILDMENU:  
                        //EnhanceMainMenu();       
                        break;  
                          
                    case C4DPL_COMMANDLINEARGS:  
                        {  
                            C4DPL_CommandLineArgs *args = (C4DPL_CommandLineArgs* )data;  
                            LONG i;  
                
                            for (i=0;i<args->argc;i++)  
                            {  
                                if (!args->argv[i]) continue;  
                                  
                                if (!strcmp(args->argv[i],"--help") || !strcmp(args->argv[i],"-help"))  
                                {  
                                    // do not clear the entry so that other plugins can make their output!!!  
                                    GePrint("\x01-SDK is here :-)");  
                                }  
                                else if (!strcmp(args->argv[i],"-SDK"))  
                                {  
                                    args->argv[i] = NULL;  
                                    GePrint("\x01-SDK executed:-)");  
                                }  
                                else if (!strcmp(args->argv[i],"-plugincrash"))  
                                {  
                                    args->argv[i] = NULL;  
                                    *((LONG* )0) = 1234;  
                                }  
                            }  
                        }  
                        break;  
                
                    case C4DPL_EDITIMAGE:  
                        {  
                            GePrint("Something Changed");  
                            C4DPL_EditImage *editimage = (C4DPL_EditImage* )data;  
                            if (!data) break;  
                            if (editimage->return_processed) break;  
                            GePrint("C4DSDK - Edit Image Hook: "+editimage->imagefn->GetString());  
                            // editimage->return_processed = TRUE; if image was processed  
                        }  
                        return FALSE;  
                }  
                
                return FALSE;  
              }  
                
              
              1 Reply Last reply Reply Quote 0
              • H
                Helper
                last edited by

                THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                On 21/01/2010 at 03:34, xxxxxxxx wrote:

                Instead of

                  
                ...  
                case C4DPL_INIT_SYS:  
                  if (!resource.Init()) return FALSE; // don't start plugin without resource  
                  return TRUE;  
                  if (!RegisterPlanetXSerial()) return FALSE;  
                ...  
                

                do this

                  
                ...  
                case C4DPL_INIT_SYS:  
                  if (!resource.Init()) return FALSE; // don't start plugin without resource  
                  if (!RegisterPlanetXSerial()) return FALSE;  
                  return TRUE;  
                ...  
                

                Otherwise RegisterPlanetXSerial() will never be called.

                cheers,
                Matthias

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

                  THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                  On 21/01/2010 at 03:36, xxxxxxxx wrote:

                  LOL...  woops.  thanks Matthias

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

                    THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                    On 21/01/2010 at 17:56, xxxxxxxx wrote:

                    okay so here's the code I am using right now.   Just the code to get me started.

                      
                    //SERIAL CODE/////////////////////////////////  
                    //////////////////////////////////////////////  
                    #define ID_PLANET_OBJECT_SERIAL  = 1024924  
                        
                    class PlanetXSerial : public SNHookClass  
                    {  
                    public:  
                      String name;  
                      
                      PlanetXSerial()  
                      {  
                          name = GeLoadString(IDS_SERIAL_HOOK);  
                          if(!name.Content())  
                              name = "Planet X Generator";  
                      }  
                      
                      virtual LONG SNCheck(const String &c4dsn,const String &sn,LONG regdate,LONG curdate)  
                      {  
                          return sn == String(name) ? SN_OKAY : SN_WRONGNUMBER;  
                            
                      }  
                      
                      virtual const String& GetTitle()  
                      {  
                          return name;  
                      }  
                    };  
                      
                    PlanetXSerial *snhook = NULL;  
                      
                    Bool RegisterPlanetXSerial()  
                    {  
                      snhook = gNew PlanetXSerial;  
                      if (!snhook->Register(450000241, SNFLAG_OWN))  
                          return FALSE;  
                      return TRUE;  
                    }  
                      
                    void FreePlanetXSerial()  
                    {  
                      if (snhook)  
                          gDelete(snhook);  
                    }  
                        
                    ///////////////////////////////////////////////////////////////////////////////////////////////////////////  
                    

                    Here's the result I get when I look in the personalize dialog box. 
                    For some reason, it is saying "StrNotFound"  Where do I set the name.   And,  where do I check to see if the serial number they entered matches what they should enter?

                    Thanks,  Shawn

                    _<_img src="http://www.c4davenue.com/mag/wrong.jpg" height="291" width="703" border="0" /_>_

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

                      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                      On 22/01/2010 at 08:50, xxxxxxxx wrote:

                      Any thoughts on this?

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

                        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                        On 23/01/2010 at 08:59, xxxxxxxx wrote:

                        figured it out..  Thanks,

                        ~Shawn

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

                          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                          On 23/01/2010 at 09:26, xxxxxxxx wrote:

                          I am trying to use StringToLong()   to convert the serial number to a long so that I can perform an algorithm on it.

                          For some reason, even though I have included c4d_string.h,   I am getting the error.

                          'StringToLong': identifier not found

                          Can anyone tell me why this is?

                          ~Shawn

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

                            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

                            On 23/01/2010 at 19:56, xxxxxxxx wrote:

                            lol..  figured this one out too..    had to do

                            LONG lngMyLONG =  myString.StringToLong(&err);

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