C++ extract .reg file to registry - c++

Can anyone tell me please how to extract the data from a .reg file into the registry?
I've tried:
system("regedit /s product.reg");
It doesn't work, I have also looked at various other questions on here but have had no joy and I have also trouble understanding them.
Can anyone shed any light or send me a link that has a good example please?
Thanks

The following things applies to Windows Vista / Windows 7 and later version.
You won't be able to successfully execute regedit.exe unless your application is not running with Administrator privilege.
If you're using Visual Studio 2005/2008/2010, go to the property window of your project, expand the 'Linker' options, and select 'Manifest File'. Change UAC Execution Level to 'requireAministrator'. Save your project and rebuild your project.

According to this, the correct command is:
reg IMPORT <FileName>

system("product.reg")
should also work. This is akin to double-clicking the file.

Since you're on Windows anyway: ShellExecuteA("product.reg"). Unlike system, this won't start a console window.

Related

Visual Studio isn’t running a Hello World script - even the one that it included in the build

I’ve began to use Visual Studio, and I’m trying to make a simple hello world script. However, when i try to run the hello world script that they included, nothing shows up - except for 437 errors, all along the lines of:
cannot open source file “ctype.h”
I assume that it’s doing this for every single one of the extra files, however, I’m not too sure. I’ve been looking everywhere for help on this - so some help here would be much appreciated! Thank you :)
It seems that you couldn't install or use the windows SDK correctly. I suggest you could try to reinstall the windows sdk. Open the VS Installer window, you could click on "Individual Components", then scroll quite a ways down to get to the "SDKs, libraries and frameworks" section. In there, you could choose download and install the SDK which you want.
And then right click the project-> Properties -> General -> Windows SDK Version to set the Windows SDK.

Windows cannot find hcw

I am trying to migrate an old MFC project to VS 2012 and one of the errors I get is this one:
From what I read is that it has something to do with Help Files, which are not supported on Windows 7.
I thought that maybe Windows is searching for the hcw path so I added to the Environment Variables, but I still get the error. From the code I can see that the command is called inside .mak files:
start /wait hcw /C /E /M "hlp\$(InputName).hpj"
Anyone has an idea how can I get rod of the error ?
Just ran into the same issue. VS 6 project promoted to VS2013.
To eliminate the error. remove the Projectname.hpj file from the project.
Your project requires Microsoft Help Workshop.
Could be a problem in the post build step.

WMI CreateProcess - spawned exes are stalling

I'm using WMI's CreateProcess() to run an installation bootstrapper process (setup.exe) on a remote machine. The setup.exe is happily able to run .msi packages but for some reason it is not able to run the vcredist.exe packages that are used to redistribute the MS VS 2008 SP1 C++ Runtimes.
What I'm seeing is that the redist package is able to extract itself into a temp folder in the root of the C:\ drive, e.g. C:\a26f91763649ecad76a09d or some such, but after that the process hangs around.
I don't know what to do to debug further - I suspect that there is a modal dialog in the hidden windows station awaiting dismissal, but I can't see what the text is. Process Explorer isn't yielding much either.
Anyone got any suggestion? The problem applies equally in Windows 2000 as in Windows 2008. We used to use a DCOM-based method to launch setup.exe remotely and this did not exhibit the problem.
Can anyone shed any light on what might be going on, or how to diagnose further.
Many thanks,
Stephen
User error! My suspicion about the modal dialog was correct. It seems that invoking the setup.exe files with a relative path somehow caused the command line arguments to get stripped when passed to the nested exe, so they ran in full UI mode! Invoking with a fully-qualified path resolved the problem.

Trying to install boost libraries, not working?

I download the file where it says 'download now' from:
http://sourceforge.net/projects/boost/files/boost/
when i unzip, there's a small .exe file. I run this (and also as administrator) a command prompt pops up and disappears instantly.
Yet everywhere i read i should be getting licence agreement etc.
Im on Win 7 64?
Help :)
That's just the boost jam build tool. You probably want the complete boost source archive. Then to build it, say for VS 2010, see my answer here.
Open cmd.exe as an administrator, then run the .exe. That way, you can see the output.
Use one of the installers provided by BoostPro computing. It is going to be much easier for you.

Windows 7 and the case of the missing regtlib

I've just discovered that regtlib.exe appears to be missing from Windows 7 (and apparently from Vista as well).
I've just installed Windows 7 RC in a VM and I'm attempting to build our existing projects on the new OS. The projects are c/c++ based and I'm using visual studio 2008. In order to build these projects I need to register several tlb files that are referenced within the code base.
Has anyone also encountered this problem? And, has anyone managed to solve this?
Thanks.
Yeah regtlib was removed from vista and up. As far as I know, all it does is call LoadTypeLibEx with the REGKIND_REGISTER flag (http://msdn.microsoft.com/en-us/library/ms221249.aspx). Maybe you could write a simple replacement.
Just came across this issue (couldn't add any components to a VB6 project on Win7). This post (Error accessing the system registry in VB 6 IDE) pointed to regtlib (which is missing from Win7). I just
set the VB6 start menu icon to 'Run As Administrator' and it worked fine for adding components and should fix any problems relating to updating the registry as well.
Regards
Ian
Finally got back to trying to build our code base on windows 7. Anyway, I went back to the installer for one of the dependencies that was causing me grief. The error message from the installer wasn't to helpful but it did point to a regasm that was being run from inside the installer.
I ran the regasm command from a cmd prompt and got more information. It appears that you need administrative credentials to perform this task and our current installers don't do the privilege escalation properly.
So, long story short, I got dlls registered and the build appears to be working.