Solved

InstallShield: Register Keys

Posted on 1998-04-21
2
878 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
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…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

828 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