Blackbox instal location

All except GUI problems
Post Reply
DU77
Posts: 2
Joined: Sun Dec 15, 2013 3:10 pm

Blackbox instal location

Post by DU77 »

Hi,

I have installed Blackbox (Version 1.6) on a Windows 7 64bit PC.
I have purchased a copy of "Stanley Warford : The Theory and Practice of Software Design with BlackBox Component Builder" and downloaded and books code from Component Pascal Collection website.

Blackbox was installed in the default directory "C:\Program Files (x86)\BlackBox Component Builder 1.6" but the books code was installed in C:\Users\XX\AppData\Local\VirtualStore\Program Files (x86)\BlackBox Component Builder 1.6\Pbox.
Could the location of installed modules cause any issues?
Any suggestions on a good ways to install BlackBox and downloaded components will be useful.

Regards,
Daniel
User avatar
Ivan Denisov
Posts: 362
Joined: Tue Sep 17, 2013 12:21 am
Location: Krasnoyarsk, Russia

Re: Blackbox instal location

Post by Ivan Denisov »

Hi, Daniel

The installation has no influence to the work of BlackBox, it is working from any folder or USB-stick.

However during installation there is the files association process in Windows Registry, so if you move BlackBox somethere after installation .odc files will not open.

There is the solution for the freshing of new location in Windows Registry.

Code: Select all

MODULE ToolsInstaller;

	IMPORT Files, Dialog, WinApi, HostFiles;

	CONST
		normalInstallation = 0;
		serverInstallation = 1;
		msgSuccess = "This BlackBox is now the default BlackBox installation.";
		msgFailure = "Failed to register this BlackBox as default BlackBox installation";

	PROCEDURE Set (IN key, subkey, val: ARRAY OF CHAR);
		VAR res: INTEGER; h: WinApi.HKEY;
	BEGIN
		res := WinApi.RegCreateKeyW(WinApi.HKEY_CLASSES_ROOT, key, h);
		IF res = WinApi.ERROR_SUCCESS THEN
			res := WinApi.RegSetValueW(h, subkey, WinApi.REG_SZ, val, LEN(val$));
			res := WinApi.RegCloseKey(h)
		END
	END Set;

	PROCEDURE SetRegistryValues (IN exe, clientdir: ARRAY OF CHAR);
		VAR exedir, opencmd, printcmd: ARRAY 1024 OF CHAR; i: INTEGER;
	BEGIN
		exedir := exe$;
		i := LEN(exedir$);
		WHILE (i # 0) & (exedir[i - 1] # "/") & (exedir[i - 1] # "\") DO DEC(i) END;
		ASSERT(i # 0, 0);
		exedir[i] := 0X;
		IF clientdir # "" THEN
			opencmd := '"' + exe + '" /USE "' + clientdir + '" /o "%1"'
		ELSE
			opencmd := '"' + exe + '" /o "%1"'
		END;
		printcmd := '"' + exe + '" /p "%1"';
		(* odc files *)
		Set(".odc", "", "odcfile");
		Set(".odc\ShellNew", "FileName", '"' + exedir + 'Empty.odc"');
		Set("odcfile", "", "BlackBox Document");
		Set("odcfile\DefaultIcon", "", exe + ",1");
		Set("odcfile\shell\open\command", "", opencmd);
		Set("odcfile\shell\print\command", "", printcmd);
		(* osf files *)
		Set(".osf", "", "osffile");
		Set("osffile", "", "BlackBox Symbol File");
		Set("osffile\DefaultIcon", "", exe + ",2");
		Set("osffile\shell\open\command", "", opencmd);
		Set("osffile\shell\print\command", "", printcmd);
		(* ocf files *)
		Set(".ocf", "", "ocffile");
		Set("ocffile", "", "BlackBox Code File");
		Set("ocffile\DefaultIcon", "", exe + ",3");
		Set("ocffile\shell\open\command", "", opencmd);
		Set("ocffile\shell\print\command", "", printcmd);
		(* OLE support *)
		Set("BlackBox.View", "", "BlackBox View");
		Set("BlackBox.View\CLSID", "", "{00000001-1000-11cf-adf0-444553540000}");
		Set("BlackBox.View\protocol\StdFileEditing\server", "", exe);
		Set("BlackBox.View\Insertable", "", "");
		Set("CLSID\{00000001-1000-11cf-adf0-444553540000}", "", "BlackBox View");
		Set("CLSID\{00000001-1000-11cf-adf0-444553540000}\ProgID", "", "BlackBox.View");
		Set("CLSID\{00000001-1000-11cf-adf0-444553540000}\LocalServer32", "", exe);
		Set("CLSID\{00000001-1000-11cf-adf0-444553540000}\InProcHandler32", "", "ole32.dll");
		Set("CLSID\{00000001-1000-11cf-adf0-444553540000}\DefaultIcon", "", exe + ",1");
		Set("CLSID\{00000001-1000-11cf-adf0-444553540000}\Insertable", "", "");
		Set("CLSID\{00000001-1000-11cf-adf0-444553540000}\AuxUserType\2", "", "BlackBox View");
		Set("CLSID\{00000001-1000-11cf-adf0-444553540000}\AuxUserType\3", "", "BlackBox");
		Set("CLSID\{00000001-1000-11cf-adf0-444553540000}\MiscStatus", "", "529");
		Set("CLSID\{00000001-1000-11cf-adf0-444553540000}\DataFormats\GetSet\0", "", "3,1,32,1");
		Set("CLSID\{00000001-1000-11cf-adf0-444553540000}\verb\-3", "", "Hide,0,0");
		Set("CLSID\{00000001-1000-11cf-adf0-444553540000}\verb\-2", "", "Open,0,0");
		Set("CLSID\{00000001-1000-11cf-adf0-444553540000}\verb\-1", "", "Show,0,0");
		Set("CLSID\{00000001-1000-11cf-adf0-444553540000}\verb\0", "", "&Edit,0,2");
		Set("CLSID\{00000001-1000-11cf-adf0-444553540000}\verb\1", "", "&Open,0,2")
	END SetRegistryValues;

	PROCEDURE Register (installation: INTEGER);
		VAR res: INTEGER; exe: ARRAY 256 OF CHAR; loc: Files.Locator;
	BEGIN
		res := WinApi.GetModuleFileNameW(0, exe, LEN(exe));
		IF res # 0 THEN
			IF installation = normalInstallation THEN
				SetRegistryValues(exe, "");
				Dialog.ShowMsg(msgSuccess)
			ELSIF installation = serverInstallation THEN
				loc := Files.dir.This("");
				IF loc IS HostFiles.Locator THEN
					SetRegistryValues(exe, loc(HostFiles.Locator).path);
					Dialog.ShowMsg(msgSuccess)
				ELSE
					Dialog.ShowMsg(msgFailure)
				END
			ELSE HALT(20)
			END
		ELSE
			Dialog.ShowMsg(msgFailure)
		END
	END Register;

	PROCEDURE RegisterNormalInstallation*;
	BEGIN
		Register(normalInstallation)
	END RegisterNormalInstallation;

	PROCEDURE RegisterServerInstallation*;
	BEGIN
		Register(serverInstallation)
	END RegisterServerInstallation;

END ToolsInstaller.
Compile this code and then run ToolsInstaller.RegisterNormalInstallation
DU77
Posts: 2
Joined: Sun Dec 15, 2013 3:10 pm

Re: Blackbox instal location

Post by DU77 »

Hi Ivan,

Thanks for the answer.
I will reinstall blackbox in different folder on my hard drive. I might use the module in your post if I ever have a second installation.
I had not used or even heard about component pascal or oberon until about a month ago, so I am still getting use to the syntax and environment.

Daniel.
Post Reply