Guidance
指路人
g.yi.org
software / rapidq / Examples / Tools - IDE, Designer, Builder / FreeQ IDE src / inc ide / AppInstance.inc

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
'code contribution by Eodor Natase

     $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              'app handle for single instance

      ini.Section = "IDE_Variables"
      IDE.SingleInstanceOnly = VAL(ini.GET("SingleInstanceOnly", "null"))

      IF IDE.SingleInstanceOnly THEN
       FreeQHandle = Findwindow("TForm", FREEQVERSIONSTR)                        'find if program is running
       IF FreeQHandle <> 0 THEN
        IF COMMANDCOUNT > 0 THEN        'get the command line, 1st entry -COMMAND$(0)- is always the application path
         DIM CD AS COPYDATASTRUCT
         DEFSTR s
         FOR zzz = 1 TO COMMANDCOUNT         'zzz is global
          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


掌柜推荐
 
 
¥1,800.00 ·
 
 
¥489.00 ·
 
 
¥288.00 ·
 
 
¥908.00 ·
 
 
¥748.00 ·
 
 
¥264.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2010-12-07 21:18:03