Table of Contents

Introduction

WinDLL 1.0
matthewwalkerlewis@yahoo.com

OVERVIEW

This libary is meant to be a way for code compiled into a DLL to use the instance of Win32Lib included in a main application. It was developed using Win32Lib v0.59.1. Other versions might work, but using a different version of Win32Lib is done at your own risk.

LICENSE AND DISCLAIMER

This software is freeware, but you must give me credit for any applications developed with WinDLL. You can modify any of the code, so long as you do not take credit for any of the original source, and any modifications must be marked as such.

THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFIT; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Table of Contents

Topic

Description

IndexAlphabetical list of all items.
DemoA simple example
DLLHow to write the DLL
Main ProgramHow to use this from your application

Table of Contents

Demo

A simple example


The included demo is a very simple example of how to use this library. The main program, mainapp.exw, opens a window and connects to the DLL, testdll.dll. The DLL was built using the unregistered version of the Euphoria to C translator, so you'll have to wait for the built-in delay to go away before the DLL actually does anything.

Once the delay is gone, the DLL will create a button in the window, and will pop up a message box when the button is clicked. You will notice in testdll.ew (the source for the DLL) that the creation is actually done within a procedure that is called by mainapp.exw in its main window's w32Activate event. It is important to not have any Win32Lib calls at the top level of your DLL code, because this will be executed when open_dll() is called, before it has become aware of Win32Lib.

The code for the DLL is very simple. There are only two include files, windll_c.ew and msgbox.e. windll_c.ew is the interface between your DLL and the instance of Win32Lib contained within your main program. You can call and use all of the global routines contained within Win32Lib v0.59.1 as you would if you had included Win32Lib.ew, instead of windll_c.ew.


Table of Contents

DLL

How to write the DLL


You will be able to write the code for the DLL almost as though Win32Lib were included in the project. There are some important things to remember. First, you'll need to use the retrieve() function in order to get any control ids from your main program. You'll need to move all Win32Lib calls into functions or procedures. Top level statements are executed when your main program calls open_dll(), which is before the call to register_dll(). You'll probably want to have some sort of an initializing routine that your main program can call. At current, the only constants defined for you are the control names (Window, PushButton, etc.) and the events (w32HEvent, w32HClick, etc.).

  • func retrieve( sequence key )   Get data from the main program for use in the DLL

    Table of Contents

    Main Program

    How to use this from your application


    In order to allow a DLL to access your application's instance of Win32Lib, there are two things you need to do. First is to call open_dll() to open the DLL, and pass the handle to register_dll(). Then you can publish() data, such as the id's of key controls and windows so that the DLL can operate as though it were included in your main program.

  • proc publish( sequence key, object val )   Communicates between your program and your DLL
  • func register_dll( atom handle )   Initializes the connection between your program and your DLL

    Table of Contents

    []
    Miscellaneous Notes

    Category: Miscellaneous Notes


    Table of Contents

    [proc]
    publish
    ( sequence key, object val )

    Communicates between your program and your DLL

    Category: Main Program

    This is how you communicate information to all DLL's that are registered. It is an easy way to pass the control id's contained within your program.

      ex:
          -- Main program
             main = create( Window, "The Main Window", 0, 100, 100, 500, 300, 0 )
             publish( "main", main )
    

    -- From the DLL... main = retrieve( "main" )

    See Also: register_dll


    Table of Contents

    [func]
    register_dll
    ( atom handle )

    Initializes the connection between your program and your DLL

    Category: Main Program

    This function sets up communication between your main application and the DLL. handle is the value returned by open_dll(). register_dll() returns 1 if successful, and 0 if unsuccessful.

    See Also: publish


    Table of Contents

    [func]
    retrieve
    ( sequence key )

    Get data from the main program for use in the DLL

    Category: DLL

    This function is meant to be an easy way to pass data from your main application to the DLL. From within the DLL, you can get any data that the main program has publish()'ed by passing the same key that the main program used.


    Index

    Demo
    DLL
    Main Program
    Miscellaneous Notes []
    publish [proc] Communicates between your program and your DLL
    register_dll [func] Initializes the connection between your program and your DLL
    retrieve [func] Get data from the main program for use in the DLL