Solved

InstallShield: Register Keys

Posted on 1998-04-21
2
862 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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
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…
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…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now