Utilizing a DLL not in System32 - c

I am running on a system which I don't have administrative access on
An exe I am trying to run utilizes msvcp140.dll, and currently upon running will not run and throw an error message specifying that msvpc140.dll is missing.
Normally I would just install the dll to system32 and be done with it, however in this case I do not have administrative privileges.
Is there a way to map to this dll when running it? Some sort of batch command? Would this have to be somehow linked when compiling? Any advice?
Thanks!

you have the following options:
add the .dll to the directory where your .exe is located. This particular .dll is redistributable, meaning you can include it with your installer, although the proper way is to invoke MS VC++ redistributable installer.
recompile your application to use static linking to C++ runtime. In this case you won't need the .dll at all

I dont think you should copy msvcp140.dll into the system folder in case. System32 is a global folder, so any change of dlls in this directory can affect all installed applications.
This article from MSDN:
Describes how to deploy a Visual C++ application by copying files to
its folder.
Copy the appropriate MFC and C Run-Time (CRT) library files from the Visual Studio installation directory in the \VC\redist\version folder, and then paste them in the \Release\ folder of your MFC project.
This is also relevant for non MFC applications deployment.

Related

WPF application installed in program files just exits - but runs in another folder

Using Visual Studio 2017 on Windows 10, I have a WPF application with an installer created using the Visual Studio Installer extension. When I install it on another PC, the application starts but then exits within the same second. Nothing in logs.
If I add a manifest to force admin mode, its starts correct.
If I copy the files to another folder (outside program files) it starts correct.
Apparently the "program files" is restricted or something? Am I missing something in my setup/installer project? Any other ideas more than welcome!
EDIT:
I've tried to create the installer using WIX and then it runs fine. Seems to be some settings in the VS Installer extension.
You can modify the ACLs on the folder in question to allow write access by regular users (not great) or you could write the settings file somewhere else where write permission for users is standard.
There are many ways: Resolve lacking permissions.
There is another, similar answer here.
Adding a couple further links:
WiX and deployment links, various topics.

Program done how can I use it on other PCs?

I just finished coding my c program in visual studio (VS) and what I had done is just drag the compiled .exe file out of the folder to run it on other computers, except on other computers for that to work I guess I need VS since it says the MSVCR110D.dll is missing which is from VS. So how can I run my program on other computers that don't have VS?
You can use IExpress which is used for distributing self-contained installation packages. It is there in every windows machine preinstalled. Using this utility you can make the executable .exe which will be incorporated with dependent dlls. You can see Step by step guide, to see how to use it.
Follow these steps
https://msdn.microsoft.com/en-us/library/3w7axy17.aspx
In your output window it will show you where you can find the exe file, usually something like "ProjectName/Debug/Release/"
If you have added any external libraries you will have to copy any DLL files in that folder with the exe (You can combine them with some applications if needed)
You will also have to make sure that you have the correct version of the .NET Framework on the PC that you are trying to run your program on

What is needed to run a WPF app?

I copied my .exe, plus its vshost.exe, plus the sqlite database file it uses, but it won't run outside of Visual Studio. There's no err msg when I 2-click my .exe - it just won't run. What is it lacking?
If you're on your local box, you would need:
The main application.exe (NOT vshost.exe - These are for Visual Studio debugging only.)
application.exe.config if there are any settings associated with the app.
Any DLLs the application references. Since you're using SQLite, you likely have a dependency on some SQLite library.
If you're deploying to another computer, then you should also consider the following:
Is the .NET Framework you're targeting installed on the target computer?
You should also build in "Release" instead of "Debug", since debug DLLs may be missing.
Generally, the following files are NOT necessary:
.pdb files
Any vshost files

EXE generated in obj\Debug folder

I have inherited a Windows Forms application and I have found that a .EXE file gets generated into the obj\Debug folder everytime I compile.
I am more a Web Forms kind of developer so I am a little confused as to what is happening here. Why is it a .EXE and not a .DLL? What does this file actually represent? Is this the default behaviour for Windows Forms applications? Or, did my predecessor have to set it up up somehow?
As far as I can tell, the solution does not have a deployment project.
Their are many types of win application in delhpi. If u create windows form, .exe will be craeted in the debug folder similarly if you are creating Dynamic Link Liberary (DLL) .dll files will b created. These files are created each time when you compile the application.
Why this is a problem? Console application projects have exe file in the obj/Debug folder too. The obj folders are NOT used for running the application - they are used for creating the end binaries in the bin folders.
If the question is about exe vs dll then compiled exe file is used to run the application. In the web environment you used dll because ASP.NET new how to run code from it. But Windows knows how to run exe files, so any of your code actually can be compiled to an executable.
Every application be it web or windows would have an entry-point for execution. Anything in compiled form in .Net is an assembly which need not always be a DLL file. An EXE file is a .Net assembly with an entry point and few headers in the beginning of the file that identifies itself as a stand-alone executable to the windows operating system. In case of your web-application your asp.net pages are the entry points that users would type in a browser and start the application. In case of a stand-alone windows forms desktop application, it is an EXECUTABLE file, which user can click on run.
I am more a Web Forms kind of developer so I am a little confused as to what is happening here. Why is it a .EXE and not a .DLL?
Having said this, It is also important to note that, just like the asp.net is not the only platform to develop web-applications [you have php, jsp, etc.], .Net windows forms is also not the only way to create stand-alone executables. You can make EXEs in C, C++, VB, Delhpi, etc. only difference would be that they will not be .Net assemblies but all of them including .Net executables will have an entry-point to start execution from and the EXE header that identifies them as executables on the host windows operating system.
Why would it be a DLL? It's an application - it has to be launchable, unlike a website which lives "inside" a web server (effectively). The exe file is the application (along with any libraries it requires, of course). You double-click on it, it will launch the application. No problem.
Having said that, you should pretty much ignore the obj directory - it's just an intermediate directory. The bin directory is the one you should be taking build results from.

Eclipse and Windows 7

I have reinstalled my computer with Windows 7, and Eclipse 3.5.1 (Galileo).
The weird thing is that I can not see any files that Eclipse produces.
I can not find the workspace, can not find the files from the SVN after check out.
It seems like Windows 7 can not read the files produced by Eclipse ... wierd
What could be the reason for this?
Where do you have Eclipse installed? Where is your workspace?
In Windows 7 (Vista, actually), a lot of security policies that existed only on paper in earlier versions of Windows, are now actually enforced by the operating system. For example, according to Microsoft's documentation, it has been pretty much illegal to write to C:\Program Files for decades now, but if you actually tried it, it still worked. Not anymore. As of Vista, C:\Program Files is off-limits.
However, in order not to break existing (broken) applications, Microsoft introduced filesystem virtualization. If an application tries to write to C:\Program Files, it gets silently redirected to C:\Users\%Username%\AppData\Local\VirtualStore\Program Files. So, this specific application sees all the files it created or changed in C:\Program Files, but other applications, and this includes the Explorer, see only the unchanged / empty directory.
This does not just apply to C:\Program Files but also to other system directories as well. Also, it applies to system parts of the registry, like HKEY_LOCAL_MACHINE for example.
In order to sidestep all of this, I simply installed my copy of Eclipse in %LocalAppData%\eclipse (that's C:\Users\%Username%\AppData\Local\eclipse) and created my workspace in %AppData%\eclipse (that's C:\Users\%Username%\AppData\Roaming\eclipse). That Just Works™.
You can launch eclipse with the -showlocation option, which will display the path of the workspace in the title bar.
(See this eclipse.ini for instance)
From there, you can check if you find that workspace, and its eclipse projects within it.
You can also configure your shortcut:

Resources