Posts

Showing posts from August, 2008

Example Microsoft Unity Block Configuration : Passing Value to Constructor

This is a sample of our configuration file that allows us to initialize value to our constructor. /// Our Constructor //// [InjectionConstructor] public MyClass(string myParam, string myParam2) { string p1 = myParam; string p2 = myParam2; }

Example : Using Microsoft Unity Block from Configuration File

/// Client code /// using Microsoft.Practices.Unity.Configuration; using System.Configuration; using Microsoft.Practices.Unity; namespace unityman { class Program { static void Main(string[] args) { IUnityContainer mycontainer = new UnityContainer(); UnityConfigurationSection config = (UnityConfigurationSection)ConfigurationManager.GetSection("unity"); config.Containers.Default.Configure(mycontainer); MyInterface proxy = mycontainer.Resolve (); proxy.SayHello(); } } } ////// App.config Configuration File //// Optionally you can change MyClass from FriendClass to see it's effects. //// MyInterface, MyClass and FriendClass codes using System; using System.Collections.Generic; using System.Text; using Microsoft.Practices.Unity; namespace myunityclass { public class MyClass : MyInterface { public MyClass(MyParam myParam) { myParam.UserAddress = "1111"; ...

FFMpeg on MSVC++

Instead of building FFMPEG using Cygwin and Msys you can get the libraries from here . Next goto you need to extract this into a folder. Once you have extracted you need to create a simple Win32 console application in Visual Studio and configure its properties. Under Configuration Properties C/C++->Additional Include Directories = C:\del\ffmpeg\include\libavcodec;C:\del\ffmpeg\include\libavutil;C:\del\ffmpeg\include\libavformat; C:\del\ffmpeg\include\libswscale Linker->General->Additional Libraries Directory = C:\del\ffmpeg\lib Linker->Input->swscale-0.lib avdevice-52.lib avformat-52.lib avcodec-51.lib avutil-49.lib To test your project out, use to following codes and see if you can compile it . extern "C" { #include #include #include #include } int _tmain(int argc, _TCHAR* argv[]) { //// Just to load the codes /// av_register_all(); } Next please make sure you copy the required *.dll (from the distribution above) to your project folder...