$IFNDEF __RQMEMORY
FUNCTION NewZStr(S AS STRING) AS INTEGER
DEFSTR cs = s + CHR$(0)
DEFINT PTR = HeapAlloc(GetProcessHeap,HEAP_NO_SERIALIZE OR HEAP_ZERO_MEMORY,LEN(cs))
IF PTR THEN MemCpy PTR,VARPTR(cs),LEN(cs)
Result = PTR
END FUNCTION
$ENDIF
SUB InstanceInit
DEFINT TmpInt, FreeQHandle = 0
ini.Section = "IDE_Variables"
IDE.SingleInstanceOnly = VAL(ini.GET("SingleInstanceOnly", "null"))
IF IDE.SingleInstanceOnly THEN
FreeQHandle = Findwindow("TForm", FREEQVERSIONSTR)
IF FreeQHandle <> 0 THEN
IF COMMANDCOUNT > 0 THEN
DIM CD AS COPYDATASTRUCT
DEFSTR s
FOR zzz = 1 TO COMMANDCOUNT
s = COMMAND$(zzz)
CD.cbData = LEN(s)
CD.lpData = NewZStr(s)
SendMessage(FreeQHandle, WM_COPYDATA, Application.Handle, CD)
NEXT zzz
END IF
Application.Terminate
END IF
END IF
END SUB
|