[Top]  [Chapter]  [Previous]  [Next]

This static method is exclusive to the .NET assembly.


It loads and fixes the engine DLL in memory. It will be used for all the editors created by the application and unloaded only when the application closes or UnloadDLL() was explicitly called.


Please use it as early as possible in the program:


A good place to call SetDLLName is the Main() function of the application. The DLL will be loaded when the first instance of the WPDLLInt class in created.


You can use the path to the assembly:


// look in same directory as assembly

Assembly TextDynamicAssembly = Assembly.GetAssembly(typeof(WPDLLInt));

    string TextDynamicDLL = Path.GetDirectoryName(TextDynamicAssembly.Location

    + "\\WPTextDLL01.dll";

// If not existent there look in same directory as executable

if (!File.Exists(TextDynamicDLL))


   TextDynamicDLL = Path.GetDirectoryName(Application.ExecutablePath) + "\\WPTextDLL01.dll";


// Set the DLL name (preload the DLL)



If you are using Visual Basic.NET it is best to place the call into the New() method of the form. (The Form.OnLoad event cannot be used since at that time the handle would be already created)




To load the DLL from same direcory as the EXE use this code


  Public Sub New()

      ' Additional Code - look for DLL in same directory as EXE (bin directory)

       Me.WpdllInt1.SetDLLName(Application.StartupPath & "\WPTextDLL01.DLL")

      ' For Windows Form-Designer


  End Sub


It is possible to read the name from the registry: Specify the path to the registry key (type string) preceeded by {hkcu} to use HKEY_CURRENT_USER, or {hklm} to use HKEY_LOCAL_MACHINE. In this example the path is specified as reference to a registry entry using {hkcu}. Alternatively you can also sepecify a fully qualified pathname.



  static void Main()


    // Call static function to initialize the DLL






    Application.Run(new Form1());




Note: The key Software\WPCubed\TextDynamic\path is created by the TextDynamic setup script and must not be used in your application. We use it our example projects only.


Please don't mix up the engine DLL with the .NET assembly (WPTDynInt.dll or WPTDynInt2.dll). Only the engine DLL must be specified in SetDLLName!


[setdllname.htm]    Copyright © 2007 by WPCubed GmbH