How to get started with directshow? - c++

I'm having a great trouble trying to understand this,
what's the least set up to compile/run directshow apps?
I've already installed visual c++ 2008 express.
A hello world will be nice,
RGS!

Setting up Your Environment
Setting up the environment is a cumbersome process, since DirectShow has now been buried deep in the Windows 7 SDK. If you don't already have the baseclasses built, which you'lll need to do any DirectShow development, you must first compile the DirectShow baseclasses.
You'll find the baseclasses in the Windows SDK. The latest Windows SDK is v7.1.
You can download the Windows SDK from microsoft's website.
If you install the Windows SDK to it's default folder, you'll find the baseclasses here:
C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\multimedia\directshow\baseclasses
In that folder, you'll find a Visual Studio solution file. Open that solution in Visual Studio and compile it for both Debug and Release modes.
Next, in Visual Studio, go to the following menu option:
Tools -> Options,
Projects & Solutions -> VC++ Directories
Show directories for -> Include files
Add this:
C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\multimedia\directshow\baseclasses
Show directories for -> Library files
Add these:
C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\multimedia\directshow\baseclasses\Debug
C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\multimedia\directshow\baseclasses\Release
You should now be all set to build DirectShow programs. You may also want to add extra libraries like the DirectX libraries, (which you'll need if you're doing more advanced rendering with VMR9) and the WMFSDK (if you're working with Windows Media Format stuff).
Writing a Hello World program is a little long for pasting into Stack Overflow. I'll have a look at posting one sometime this weekend, but you might like to check out CodeProject in the meantime, which is bound to have oodles of DirectShow examples.
DirectShow has an active community of developers, where you can discuss problems and solutions.
Good luck!

Try downloading SDK such as Windows SDK "http://www.microsoft.com/downloads/details.aspx?FamilyID=6b6c21d2-2006-4afa-9702-529fa782d63b&displaylang=en".
There are usually a bunch of samples for directshow. But, mainly they either use commandline "nmake" (not make) or "cl" (not cc or gcc) to build. Sometimes they provide *.sln files to be used under VS.
Your vcam package is only a dll and you still need to write an application to test this.
Based on the samples from there, I believe you can be able to cook up one hello-world app for your vcam ;)

To get the vcam example, you basically have to create a fresh new "dll" project in VC 2010, add the old files into it, then setup the .def file to export all the methods you need.
Here's some links for ya:
http://betterlogic.com/roger/?p=3096
To make it easier on ya, I add a "visual studio express 2010 project" to the vcam_vs_2010 folder of
http://github.com/rdp/directshow-demo-audio-input-source
(checkout its README.txt)
GL.
-r

Related

Installing a library in Visual Studio 2019 C++

I am trying to install this library in Visual Studio 2019
https://github.com/alex-87/HyperGraphLib
The instructions only show how to do so for linux/unix I was curious how I would do this for windows. I can download the .zip but where would I extract this and how do I get Visual Studio to install the library.
Visual Studio can directly open a CMake project (CMakelists.txt indicates that).
That said, very often projects are in theory "cross platform" but in practise they don't work in Windows because no one has bothered to test them there (mostly because an alternative would already exist or the actual developers do not care much). Projects that have better chances to work with Windows usually come also with a .vcxproj/.sln.
click on project, properties, link editors , input and add the dependencies (with keyboards only )

Visual Studio: copy installation folder and setup it up to be auto-detected by Qt Creator

I wiped out an old Windows 10 and replaced it with a new Windows 10 by ISO image.
Before wiping out, I copied the folder of Microsoft Visual Studio 2017 Community Edition on old Windows to an external hard disk:
xcopy /E "C:\Program Files (x86)\Microsoft Visual Studio" D:\
Now after reinstalling Windows 10, I copied the VS 2017 folder from external the hard disk to the C:\Program Files (x86)\ folder of new operating system.
I did so to avoid having to download VS 2017 again on new OS.
The problem is other software, like Qt Creator, cannot auto-detect the VS C/C++ compilers. I guess that's because the VS 2017 isn't added to path.
The questions are:
What path should I add to system path in order to VS 2017 to be auto-detected by other software like Qt Creator?
Is there any script which I can run to automatically integrate the VS 2017 to the rest of the operating system.
To answer the questions in your issue:
Copying the content of C:\Program Files (x86)\Microsoft Visual Studio folder is not a recommended way to install VS.
(The complete installation will not only set the Environment variables but also set the related registry keys and values. A simple copy may break this process)
So we always suggest that users install the VS by vs-installer or offline installation package. (Same like what Zlatomir suggests.)
To your actual requirements:
It seems you're just trying to use VC++ compiler in QT Creator instead of developing QT projects in Visual Studio. So build tools for VS package is enough for you.
See this related issue, if we download Build Tools for VS package with corresponding C++ workload, then we can get the compiler the QT needs. There's no need to install the VS IDE for this situation.
And if we need C++ compiler from VS2017, download the Build Tools for VS2017, if we need C++ compiler from VS2015, download the Build Tools for VS2015 Update3. Link of old version about VS Tools see here.
Update:
From the the link older downloads we can see:
Choose the download button according to which version we need. We can find both VS2017 build tools package and VS2015's there.
Usually programs on Windows don't work after you just copy the installation folder.
So right now there is little you can do to fix it, even if you partially fix, you have no way to know if something else will be broken in the future.
So the recommended solution is to download the installer again and create an offline installer for the next time this happens, you can do that by running the online installer with the following parameters: vs_community.exe --layout c:\vslayout --lang en-US (replace vs_community.exe with the actual name of the online installer file, or rename it), for more options, that might require a smaller download (example if you only need native and don't need .net) check the documentation here for the full set of options you have.

Can I bundle the Visual Studio 2015 C++ Redistributable DLL's with my application?

I've built a C++ application using Microsoft Visual Studio 2015 Community Edition. I'm using Advanced Installer to make sure that the Visual C++ Redistributable for Visual Studio 2015 is a prerequisite.
However, the redistributable's installer isn't perfect. Some of my users have reported that the redistributable installer hangs, or it fails to install when it says it does, and then users get the "This program can't start because MSVCP140.dll is missing from your computer" error.
According to Microsoft, I can now package the redistributable DLLs along with my application, though they don't recommend it (1, 2):
To deploy redistributable Visual C++ files, you can use the Visual C++ Redistributable Packages (VCRedist_x86.exe, VCRedist_x64.exe, or VCRedist_arm.exe) that are included in Visual Studio. ... It's also possible to directly install redistributable Visual C++ DLLs in the application local folder, which is the folder that contains your executable application file. For servicing reasons, we do not recommend that you use this installation location.
There are 4 files in C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\x64\Microsoft.VC140.CRT. Does that mean I just need to copy them to my application's directory during the install process?
MyApp.exe
concrt140.dll
msvcp140.dll
vccorlib140.dll
vcruntime140.dll
Is this OK to do? Do I need to show a license? Why aren't more people doing this instead of requiring yet another preinstall of the redistributable?
There are 4 files in C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\x64\Microsoft.VC140.CRT. Does that mean I just need to copy them to my application's directory during the install process?
Yes, and the paragraph you quoted means just that.
Is this OK to do? Do I need to show a license? Why aren't more people doing this instead of requiring yet another preinstall of the redistributable?
Technically, that's OK to do. If you want to be pedantic about it, you may include a note in the readme or help/about to the effect that VC++ 2015 redistributables provided in "local deployment" mode as explicitly allowed by Microsoft's Deployment in Visual C++ (with more links to the file lists and licenses at Redistributing Visual C++ Files).
As to why more people don't do it, I'd guess that (among those who care at all):
for a single module app like MyApp.exe it's easier to build it with everything linked statically as to eliminate external dependencies to begin with;
not including those files saves 1+ MB from the distribution (presumably download) size;
running with private copies of the runtime ("local deployment") shifts the responsibility of updates to the maintainer, so that in case of a critical/security fix the package would have to be reissued timely - as opposed to "central deployment" where it would likely be delivered via Windows Update, with both the good and bad that may bring.
If you have problems with the prerequisites installer you also have the option to install the redistributables as merge modules. As the same MSDN article mentions:
Another option is to use redistributable merge modules (.msm files), which can be found in Program Files [(x86)]\Common Files\Merge Modules.
Using merge modules it is a much cleaner option than manually adding the files. The files can be deleted accidentally by another colleague which does not know why they are there, or one of them might not get installed, etc...
All editions of Advanced Installer have support to include merge modules, including the free edition.
how to add a merge module into an Advanced Installer project/package
Visual Studio Community 2022
Go to: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.32.31326\x64\Microsoft.VC143.CRT
Copy the contents into the search path of your project

Visual Studio 2013 and Kinect SDK 2.0 Cannot find or include <NuiApi.h>

I am learning Kinect development using C++ in Visual Studio 2013 (Desktop version on Windows 8.1). I have downloaded the Kinect SDK 2.0 from Microsoft. According to my understanding, NuiApi.h is part of Kinect SDK 2.0. However, I cannot include it (#include says Cannot open source file). Have searched my computer for the file but couldn't find it. Reinstalled Kinect SDK with no luck. Below is the related part of the code:
#include<iostream>
#include<Windows.h>
#include<kinect.h>
#include<NuiApi.h>
A similar header, NuiKinectFusionApi.h, can be included without a problem.
You are mixing the 2 kinect versions!
for the kinect v1, you need to download kinect v1.8 drivers and then use the NuiApi.h
for the kinect v2, you need to download kinect v2.0 drivers and then use the kinect.h
You need to follow these steps to include #include.
1)Include windows.h in your source code.
2)To use the NUI API, include MSR_NuiApi.h. Location: Program Files\Microsoft Research KinectSDK\inc
To do this, you probably want to add that path to your project
Right-click on your project, properties, VC++ directories
Add ;C:\Program Files\Microsoft Research KinectSDK\inc to the end of the include paths
Add ;C:\Program Files\Microsoft Research KinectSDK\lib to the end of the libraries paths
then add #include <MSR_NuiApi.h>
to the includes at top of your source file. If you're using precompiled headers then you should put it below the stdafx.h include, or just add it to stdafx.h instead.
3) To use the Kinect Audio API, include MSRKinectAudio.h. Location: Program Files\Microsoft Research KinectSDK\inc
4)Link to MSRKinectNUI.lib. Location: Program Files\Microsoft Research KinectSDK\lib
5.Ensure that the beta SDK DLLs are on your path when you run your project. Location: \Program Files\Microsoft Research KinectSDK
This means that your binary needs to be able to find these files at runtime.
The easiest way to do this is to add them to your system path; go to
start menu
right-click computer, properties
advanced system settings
environment variables
PATH, in your user or system settings - edit and append ; then the path given
You may then need to restart Visual Studio to pick this up, or it should be registered when you open a new command prompt.
Or, if you don't want to change the system settings, you can e.g. add it to an open command prompt with
PATH=%PATH%;C:\Program Files\Microsoft Research KinectSDK
or you can work out exactly which files there are necessary and copy them into the same directory as your binary, etc.
Source : Getting the Kinect SDK to work with visual studio 2010 in c++
Hope that helps :)

missing DLL file when i run my application on another machine?

I am using visual studio 2013 with ISLE 2013 to create a windows form application,
it is the first time i use this style,
I successfully built the application but the problem comes after i setup the application on another PC is says msvcp120.dll is missing!
I have searched the web for this problem and I could not find anything?
any ideas?
I am not a windows guy but I will try to answer, as I did some small research. I found information here. It says:
"This file is the dynamic linking library designed as a Microsoft C Runtime Library, usually comming with Microsoft® Visual Studio®. It is a collection of link libraries that contains instructions for the standard C library functions. It is used by almost all Windows programs compiled from C or C++ source code. This library is used for the applications written under Visual Studio."
So, I am guessing it is a microsoft thing. A runtime library that is required to run c/c++ projects built with visual studios. Download the .dll from a source online (just google) and include it into your project directory. If it helps, include that file in your installation file.
Until anybody who is working with windows and has any idea about that dll answers you question, this answer can help you to get started.
found the solution I should add the Visual C++ runtime library installer
Don't download single DLL's from which you know hardly anything from random sites.
From your Visual Studio 2013 installation directory, check C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\1033 and you'll see vcredist_x64.exe and vcredist_x86.exe files that need to be run on your target system.
Use the x64 variant for 64 bit apps. It will install MSVCP120.dll for one, and some other DLL's as well.
Msvcp120.dll is the dll for standard c++ library. When you develop an application using standard c++ in VS 2013, the application defaults to Msvcp120.dll(Msvcp110.dll in VS2012). The client computer should install Visual c++ 2013 Redistributable.
Some dependencies that are on your system because you have Visual Studio installed will not be on the target system. You will need to include them in your installer or install a redistributable package on the target machine.
As there are many options and listing them all here would be too much and also redundant, you may want to visit the Microsoft site for this task and read up on all those options before you decide which you chose.
You can download the .dll file from DLL Store and paste that file into the directory where you have installed the setup.
Hope it will help you.