Solved

InstallShield: Register Keys

Posted on 1998-04-21
2
872 Views
Last Modified: 2013-12-03
Why does function RegDBCreateKeyEx not work after calling SDRegisterUserEx (InstallShield 5.0)? What do I have to do to write to Registry after that?
0
Comment
Question by:Heinig
2 Comments
 

Accepted Solution

by:
ljadams earned 120 total points
ID: 1298848
I tried this and RegDBCreateKeyEx works fine after calling SdRegisterUserEx.  (Of course, I had some compile errors until I made the 'D' lowercase in "SdRegisterUserEx.)  Did you call RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE) before you call RegDBCreateKeyEx? The default path that your key will be created is under HKEY_CLASSES_ROOT.
Here's a sample of what I did:

declare
 #include "Sddialog.h"
 #define PRODUCT_NAME            "MyApp"
 #define PRODUCT_VERSION         "1.0"
 #define DEINSTALL_KEY           "MyDeinstallKey"
 #define UNINSTALL_NAME          "MyApp"
 #define PRODUCT_KEY             "appName.exe"
 #define MYAPP_PATH              "MyCompany\\MyAppDir\\"


 STRING  svTarget, svUninstLogFile, szMsg, svName;
 STRING  svCompany, svSerial, szKey, szClass;

program
start:
  Disable( BACKGROUND );
  szMsg = "Enter your information:";
  SdRegisterUserEx( "Register", szMsg, svName, svCompany, svSerial );
  // You could also hardcode the path below if you want.
  // szKey = "SOFTWARE\\YourCompany\\TheKeyYouWantToCreate";
  szKey = "SOFTWARE" ^ svCompany ^ UNINSTALL_NAME;
  szClass = "";
  RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
  RegDBCreateKeyEx(szKey, szClass);
  InstallationInfo( svCompany, PRODUCT_NAME, PRODUCT_VERSION, PRODUCT_KEY );
  svTarget = PROGRAMFILES ^ MYAPP_PATH;
  DeinstallStart( svTarget, svUninstLogFile, DEINSTALL_KEY, 0 );
  RegDBSetItem( REGDB_UNINSTALL_NAME, UNINSTALL_NAME );

// Rest of your Setup.

  exit;

 #include "Sddialog.rul"


If this does not work, I would have to see more of your code to see what you are doing.  Does your code compile okay?  Does the SdRegisterUserEx dialog appear with your default user name and company name?  You could also be having trouble if the key you are using for RegDBCreateKeyEx already exists or conflicts with the key created by DeinstallStart.

Good Luck!
L. Jay

Note: All the information above represents my own opinions and my own knowlege based on my limited experience, and does not in any way reflect those of Intel Corp.
0
 

Author Comment

by:Heinig
ID: 1298849
Wondering why I should set the default path (should have been set already by system), I found out that this is a bug in Installshield. Works okay with Build 219 or higher. But till the patch arrives, ljadams workaround works great.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question