Guidance
指路人
g.yi.org
software / RapidQ / Examples / Registry & INI / QIniFile - by rqwork / SysUtils.inc

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

  
'SysUtils.inc component for Rapidq
'Copyright @ 2009 Nastase Eodor
'mail : rqwork@evonet.ro
'http://rqwork.evonet.ro

     $DEFINE __RQSYSUTILS

     FUNCTION ExtractFileName(File AS STRING) AS STRING
      DEFINT Sl,i
      IF File = "" THEN EXIT FUNCTION
      Sl = 0
      FOR i = 1 TO LEN(File)
       IF File[i] = "\" THEN Sl = i
      NEXT i
      IF Sl = 0 THEN
       Result = File
      ELSE
       Result = MID$(File,Sl + 1,LEN(File))
      END IF
     END FUNCTION

     FUNCTION ExtractFilePath(File AS STRING) AS STRING
      DEFINT Sl,i
      IF File = "" THEN EXIT FUNCTION
      Sl = 0
      FOR i = 1 TO LEN(File)
       IF File[i] = "\" THEN Sl = i
      NEXT i
      IF Sl = 0 THEN
       Result = ""
      ELSE
       Result = MID$(File,1,Sl -1)
      END IF
     END FUNCTION

     FUNCTION ExtractFileExt(File AS STRING) AS STRING
      DEFINT Pt,i
      IF File = "" THEN EXIT FUNCTION
      Pt = 0
      FOR i = 1 TO LEN(File)
       IF File[i] = "." THEN Pt = i
      NEXT i
      IF Pt = 0 THEN
       Result = ""
      ELSE
       Result = MID$(File,Pt + 1,LEN(File))
      END IF
     END FUNCTION

     FUNCTION DelFileExt(File AS STRING) AS STRING
      DEFINT Pt,i
      IF File = "" THEN EXIT FUNCTION
      Pt = 0
      FOR i = 1 TO LEN(File)
       IF File[i] = "." THEN Pt = i
      NEXT i
      IF Pt = 0 THEN
       Result = File
      ELSE
       Result = MID$(File,1,Pt - 1)
      END IF
     END FUNCTION

     FUNCTION ChangeFileExt(File AS STRING,Ext AS STRING) AS STRING
      DEFINT Pt,i
      IF File = "" THEN EXIT FUNCTION
      Pt = 0
      FOR i = 1 TO LEN(File)
       IF File[i] = "." THEN Pt = i
      NEXT i
      IF Pt = 0 THEN
       IF LEN(File) > 0 THEN
        IF INSTR(Ext,".") THEN
         Result = File + Ext
        ELSE
         IF LEN(Ext) THEN
          Result = File + "." + Ext
         ELSE
          Result = File  + Ext
         END IF
        END IF
       ELSE
        Result = File
       END IF
      ELSE
       IF INSTR(Ext,".") THEN
        Result = MID$(File,1,Pt -1) + Ext
       ELSE
        IF LEN(Ext) THEN
         Result = MID$(File,1,Pt -1) + "." + Ext
        ELSE
         Result = MID$(File,1,Pt -1) + Ext
        END IF
       END IF
      END IF
     END FUNCTION

     FUNCTION Trim$(s AS STRING) AS STRING
      Result = LTRIM$(RTRIM$(s)) -CHR$(10)-CHR$(13)
     END FUNCTION

     FUNCTION LoWord(Value AS LONG) AS INTEGER
      IF (Value AND &H8000) = 0 THEN
       Result = Value AND &HFFFF
      ELSE
       Result = Value OR &HFFFF0000
      END IF
     END FUNCTION

     FUNCTION HiWord(Value AS LONG) AS INTEGER
      Result = (Value AND  &HFFFF0000) \ &H10000
     END FUNCTION

     FUNCTION MakeLong(a AS WORD, b AS WORD) AS LONG
      Result = a + (b SHL 16)
     END FUNCTION

     FUNCTION SysErrorMessage(ERROR AS INTEGER) AS STRING
      DIM Buffer AS STRING
      Buffer = SPACE$(256)
      $IFDEF __WIN32API
       FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, ERROR, LANG_NEUTRAL, @Buffer, 200, 0)
      $ENDIF
      Result = RTRIM$(Buffer)
     END FUNCTION
掌柜推荐
 
 
¥477.00 ·
 
 
¥918.00 ·
 
 
¥370.00 ·
 
 
¥271.00 ·
 
 
¥995.00 ·
 
 
¥1,580.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2009-03-15 10:50:44