RaiseValue ENDP

 

 

MyCom.dll, the server code

---------------------------------------------------------------------------------------------------------------------To build the COM server use the BLDDLL.BAT file provided in "masm32COMBIN" file under Quick Editor to compile. I suggest you change your editor menu settings to include a "Build DLL" option.

 

This project requires 5 files to build it:

 

MyCom.asm The main assembly code for the project

 

MyCom.idl Interface definition file, must be compiled to MyCom.tlb

 

MyCom.tlb Type Library, needed as a resource

 

rsrc.rc The resource file, just used to get the type library into the resource

 

MyCom.DEF Standard DLL export file

 

Once compiled, this code will do NOTHING, that is until you register it. The easiest way is to open a dos box to the folder where the dll is, and run: regsvr32 MyCom.dll.Alternatively, I have provided the bat files .r.bat and u.bat to register and unregister, respectivly, the MyCom component.

 

Running MyCom.dll through regsvr32 will invoke the DllRegisterServer export and write our information into the registry so we can...

 

 

Access the Server from Visual Basic

---------------------------------------------------------------------------------------------------------------------Make sure the blinds are drawn so the neighbors do not see you actually own Visual Basic. Open VB and start a Standard .Exe project. Look in the menu for Project | References and click it. Scroll through the list and check the box MyCom, and click OK. This adds the class ID to the VB application, and VB will look through the type library for further information on the server.

 

In the form designer, add textboxes Text1 and Text2 to the Form1, then add a command button Command1. Change the command caption to Raise. Now to the Form1 code area, and add the following: