Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 13 of 13
  1. #1
    Join Date
    Dec 2007
    Location
    Missouri, United States
    Posts
    476

    Worm HELP......LOL...plz =p

    Code:
    ProcedureDLL.s ConvertBytes(FSbytes.l)
      FileSize.l = FSbytes
      If FileSize < 1024
        sTEXT.s = "Bytes"
        FileSize.l = FSbytes
      ElseIf FileSize >= 1024 And FileSize < 1048576
        sTEXT.s = "Kilobytes"
        FileSize.l = FSbytes / 1024
      ElseIf FileSize >= 1048576 And FileSize < 1073741824
        sTEXT.s = "Megabytes"
        FileSize.l = FSbytes / 1048576
      ElseIf FileSize >= 1073741824 And FileSize < 1099511627776
        sTEXT.s = "Gigabytes"
        FileSize.l = FSbytes / 1073741824
      ElseIf FileSize >= 1099511627776
        sTEXT.s = "Terabytes"
        FileSize.l = FSbytes / 1099511627776
      EndIf
      ProcedureReturn StrD(FileSize,2) + " " + sText
    EndProcedure
    That my purebasic4 code im having a problem getting it to work though lol it works fine for bytes and kilobytes its the rest of it thats not working. any thoughts bro?

  2. #2
    Join Date
    Dec 2007
    Location
    Missouri, United States
    Posts
    476
    if even tried using double and quad rather then long and still no go. the **** thing works fine if call it from within itself im so lost.....

  3. #3
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Code:
    ProcedureDLL.s ConvertBytes(FSbytes.d)
      sTEXT.s = ""
      If FSbytes < 1024
        sTEXT = "Bytes"
      ElseIf FSbytes >= 1024 And FSbytes < 1048576
        sTEXT = "Kilobytes"
        FSbytes = FSbytes / 1024
      ElseIf FSbytes >= 1048576 And FSbytes < 1073741824
        sTEXT = "Megabytes"
        FSbytes = FSbytes / 1048576
      ElseIf FSbytes >= 1073741824 And FSbytes < 1099511627776
        sTEXT = "Gigabytes"
        FSbytes = FSbytes / 1073741824
      ElseIf FSbytes >= 1099511627776
        sTEXT = "Terabytes"
        FSbytes = FSbytes / 1099511627776
      EndIf
      ProcedureReturn StrD(FSbytes,2) + " " + sTEXT
    EndProcedure

  4. #4
    Join Date
    Dec 2007
    Location
    Missouri, United States
    Posts
    476
    i tried your fix worm yet im still having problems if the variable input is too large it wont work. like if i try to call the conversion for 1 gigabyte it doesnt display anything yet it seems to work for byte, kb , and mb ive heard this is due to the restriction of long but yet double as youve tried and quad ive tried and still nothing for gb or tb im so confused everything tells me this should work

  5. #5
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Maybe pass it in as a string, then use ValD to convert it to a double.
    Code:
    ProcedureDLL.s ConvertBytes(BytesIn.s)
      FSbytes.d = ValD(BytesIn)
      sTEXT.s = ""
      If FSbytes < 1024
        sTEXT = "Bytes"
      ElseIf FSbytes >= 1024 And FSbytes < 1048576
        sTEXT = "Kilobytes"
        FSbytes = FSbytes / 1024
      ElseIf FSbytes >= 1048576 And FSbytes < 1073741824
        sTEXT = "Megabytes"
        FSbytes = FSbytes / 1048576
      ElseIf FSbytes >= 1073741824 And FSbytes < 1099511627776
        sTEXT = "Gigabytes"
        FSbytes = FSbytes / 1073741824
      ElseIf FSbytes >= 1099511627776
        sTEXT = "Terabytes"
        FSbytes = FSbytes / 1099511627776
      EndIf
      ProcedureReturn StrD(FSbytes,2) + " " + sTEXT
    EndProcedure

  6. #6
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Your call would look similar to this
    Code:
    nVal = 1099511627776
    sReturn = DLL.CallFunction("AutoPlay\\Docs\\Bytes.dll", "ConvertBytes", "\""..nVal.."\"", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)

  7. #7
    Join Date
    Dec 2007
    Location
    Missouri, United States
    Posts
    476
    ahh ok....I see thanks worm appreciate it

  8. #8
    Join Date
    Dec 2007
    Location
    Missouri, United States
    Posts
    476
    very wierd still doesnt work.

    on page show code

    Code:
    nVal = 1099511627776
    sReturn = DLL.CallFunction("AutoPlay\\Docs\\Bytes.dll", "ConvertBytes", "\""..nVal.."\"", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
    Label.SetText("Label1", sReturn);
    when i run the app it makes the label go blank. very very wierd.
    like i said though it seems to work for bytes,kilobytes, and megabytes. just not gigabytes or terabytes for some reason. [the dll only works for b,kb,mb if i change the procedure from double to long. otherwise i get same results as when i use double. it shows nothing]

  9. #9
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    Works for me... is your DLL names Bytes like mine was?
    Attached Files

  10. #10
    Join Date
    Dec 2007
    Location
    Missouri, United States
    Posts
    476
    oops lol i feel like a complete idiot now. lol, i completely left out the convert long to double. thanks worm i appreciate the help.

  11. #11
    Join Date
    Dec 2007
    Location
    Missouri, United States
    Posts
    476
    hey worm this should work too right?

    Code:
    ProcedureDLL.s ConvertBytes(BytesIn.s,BytesDis.l)
      FSbytes.d = ValD(BytesIn)
      sTEXT.s = ""
      If FSbytes < 1024
        If BytesDis = 1
          sTEXT = "Bytes"
        ElseIf BytesDis = 2
          sTEXT = "b"
        ElseIf BytesDis = 3
          sTEXT = "B"
        EndIf
      ElseIf FSbytes >= 1024 And FSbytes < 1048576
        If BytesDis = 1
          sTEXT = "Kilobytes"
        ElseIf BytesDis = 2
          sTEXT = "kb"
        ElseIf BytesDis = 3
          sTEXT = "KB"
        EndIf
        FSbytes = FSbytes / 1024
      ElseIf FSbytes >= 1048576 And FSbytes < 1073741824
        If BytesDis = 1
          sTEXT = "Megabytes"
        ElseIf BytesDis = 2
          sTEXT = "mb"
        ElseIf BytesDis = 3
          sTEXT = "MB"
        EndIf
        FSbytes = FSbytes / 1048576
      ElseIf FSbytes >= 1073741824 And FSbytes < 1099511627776
        If BytesDis = 1
          sTEXT = "Gigabytes"
        ElseIf BytesDis = 2
          sTEXT = "gb"
        ElseIf BytesDis = 3
          sTEXT = "GB"
        EndIf
        FSbytes = FSbytes / 1073741824
      ElseIf FSbytes >= 1099511627776
        If BytesDis = 1
          sTEXT = "Terabytes"
        ElseIf BytesDis = 2
          sTEXT = "tb"
        ElseIf BytesDis = 3
          sTEXT = "TB"
        EndIf
        FSbytes = FSbytes / 1099511627776
      EndIf
      ProcedureReturn StrD(FSbytes,2) + " " + sTEXT
    EndProcedure
    im calling it like this

    Code:
    FSbytes = 1099511627776
    FStype = 1
    sReturn = DLL.CallFunction("AutoPlay\\Docs\\bytes.dll", "ConvertBytes", "\""..FSbytes..","..FStype.."\"", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL);
    did i screw it up?

  12. #12
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    You need to enclose the parameter you are passing as a string withing quotes, if its numeric, do not encose it.
    Code:
    FSbytes = 1099511627776
    FStype = 1
    sReturn = DLL.CallFunction("AutoPlay\\Docs\\bytes.dll", "ConvertBytes", "\""..FSbytes.."\","..FStype, DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL);

  13. #13
    Join Date
    Dec 2007
    Location
    Missouri, United States
    Posts
    476
    K i think i get it now. strings must be enclosed numerics arent. thanks again worm. I dont think Id know what to do without your help bro. Guess thats why they call you the WORMINATOR =p

Similar Threads

  1. What is the error in this project . plz help me ..
    By vijay4781 in forum AutoPlay Media Studio 6.0
    Replies: 2
    Last Post: 06-02-2007, 09:13 PM
  2. Worm, your wTrans.dll
    By rhosk in forum AutoPlay Media Studio 5.0
    Replies: 5
    Last Post: 04-02-2004, 07:49 AM
  3. Worm: Help! I need info on GetFiles.DLL again
    By nim in forum AutoPlay Media Studio 4.0
    Replies: 7
    Last Post: 08-30-2003, 01:25 PM
  4. Worm can i use your volume dll please
    By dj_flyer2000 in forum AutoPlay Media Studio 4.0
    Replies: 1
    Last Post: 04-06-2003, 04:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts