Index: cprs/branches/HealthSevak-CPRS/CPRS-Chart/Vitals/uVitals.pas
===================================================================
--- cprs/branches/HealthSevak-CPRS/CPRS-Chart/Vitals/uVitals.pas	(revision 1676)
+++ cprs/branches/HealthSevak-CPRS/CPRS-Chart/Vitals/uVitals.pas	(revision 1693)
@@ -2,10 +2,11 @@
 { Old class TVital currently not used - commented out at bottom of unit }
 
+{$DEFINE CCOWBROKER}
+
 interface
 
 uses
   SysUtils, Dialogs, Controls, Windows, Classes, ORClasses, ORCtrls, ORFn, Forms
-  , TRPCB
-  ;
+  , TRPCB ;
 
 const
@@ -86,10 +87,10 @@
 
   TGMV_VitalsEnterForm = function(
-        aBroker:TRPCBroker;
+         RPCBrokerV: TRPCBroker;
         aPatient, aLocation, aTemplate,aSignature:String;
         aDateTime:TDateTime): TCustomForm; stdcall;
 
   TGMV_VitalsEnterDLG = function(
-        aBroker:TRPCBroker;
+         RPCBrokerV: TRPCBroker;
         aDFN, aLocation, aTemplate,aSignature:String;
         aDateTime:TDateTime;
@@ -97,5 +98,5 @@
 
   TGFM_VitalsViewDLG = function(
-        aBroker:TRPCBroker;
+         RPCBrokerV: TRPCBroker;
         aDFN, aLocation,
         DateStart, DateStop,
@@ -105,5 +106,5 @@
 
   TGMV_VitalsViewForm = function(
-        aBroker:TRPCBroker;
+         RPCBrokerV: TRPCBroker;
         aDFN, aLocation,
         DateStart, DateStop,
@@ -114,5 +115,5 @@
 
   TGMV_LatestVitalsList = function (
-        aBroker:TRPCBroker;
+         RPCBrokerV: TRPCBroker;
         aDFN,
         aDelim:String;
@@ -124,6 +125,10 @@
 var
   VitalsDLLHandle : THandle = 0;
-//  DLLForceClose : Boolean = False;  // jm - removed as part of timeout fix
-
+
+const
+  VitalsDLLName = 'GMV_VitalsViewEnter.dll';
+
+procedure LoadVitalsDLL;
+procedure UnloadVitalsDLL;
 
 const
@@ -188,7 +193,5 @@
     if assigned(VitalsExit) then
       VitalsExit();
-    FreeLibrary(VitalsDLLHandle);
-    VitalsDLLHandle := 0;
-//    DLLForceClose := True;   // jm - removed as part of timeout fix
+    UnloadVitalsDLL;
   end;
 end;
@@ -619,4 +622,26 @@
   for i := 1 to Length(x) do if not (x[i] in ['0'..'9','.']) then Result := False;
 end;
+
+procedure LoadVitalsDLL;
+var
+  GMV_LibName: String;
+
+begin
+  if VitalsDLLHandle = 0 then
+  begin
+    GMV_LibName := GetProgramFilesPath + SHARE_DIR + VitalsDLLName;
+    VitalsDLLHandle := LoadLibrary(PChar(GMV_LibName));
+  end;
+end;
+
+procedure UnloadVitalsDLL;
+begin
+  if VitalsDLLHandle <> 0 then
+  begin
+    FreeLibrary(VitalsDLLHandle);
+    VitalsDLLHandle := 0;
+  end;
+end;
+
 (* Old class currently not used
 {$OPTIMIZATION OFF}                              // REMOVE AFTER UNIT IS DEBUGGED
