how to use dll at Runtime

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • samonnet99
    New Member
    • Sep 2007
    • 5

    how to use dll at Runtime

    I have dll in my system , bt how 2 use it runtime

    means ,,,,,we r create the Referece 2 dll in project & use the functions with in that dll

    BUT i want 2 Use the dll .........( dynamically ) means the DLL WILL GET ATTACH 2 RUNNING PROCESS ( EXE ) ............
    help me it is IMP FOR ME
  • pootle
    New Member
    • Apr 2008
    • 68

    #2
    Originally posted by samonnet99
    I have dll in my system , bt how 2 use it runtime

    means ,,,,,we r create the Referece 2 dll in project & use the functions with in that dll

    BUT i want 2 Use the dll .........( dynamically ) means the DLL WILL GET ATTACH 2 RUNNING PROCESS ( EXE ) ............
    help me it is IMP FOR ME
    Hi samonnet

    It is a bit hard to understand what you want. Perhaps if you describe your situation a bit more clearly...

    Comment

    • ShahbazAshraf
      New Member
      • Mar 2008
      • 36

      #3
      What iam understanding that u want to load the dll dynimaclly (i.e. on runtime) for that u can use the Reflection to load the dll and its function on run time.

      Here is sample code:

      using System.Reflecti on;


      Assembly a = Assembly.Load(" assembly.dll"); // Dll Name
      Type t = a.GetType("name space.classname "); //Class Name
      object obj = Activator.Creat eInstance(t);
      MethodInfo mi = t.GetMethod("fo o"); // Function Name
      mi.Invoke(obj, Parameters); //Invoke methods

      Comment

      • NitinSawant
        Contributor
        • Oct 2007
        • 271

        #4
        thnx bro i understood what u hav told

        but can u pls tell me how to import and use "user32.dll " located in "C:\windows\Sys tem32"

        thnx in advance

        Comment

        • ShahbazAshraf
          New Member
          • Mar 2008
          • 36

          #5
          Simple Dear, use

          Assembly a = Assembly.Load(" C:\windows\Syst em32\user32.dll "); // Dll Name


          and call the class name in user32.dll and its function for operation

          Comment

          Working...