unregistered dll?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: unregistered dll?

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    unregistered dll?

    [Originally posted by gnznroses123]

    i had someone write a dll for me and it can't be added as a reference, so i'm not sure how to use it. he says:

    "it's not optimized so it's a bit bloated for so few functions, 88 kb. (that's way more than needed, but i didn't particulary feel the need to strip of any wrappers)
    Just load it implictely, no need to register it via regsvr32 or anything. (actually i didn't feel the need to make a handler for it so you probably couldn't register it, even if you wanted to)"

    so when i try to add it as a reference it says it can't be registered (or something to that effect).


    also, he says:

    "The two functions that format strings takes nullterminated c-style strings as input arguments.
    This i don't know how vb handles, i have a vague recollection that vb has it's own kind of strings, but you should be able to convert them to c type strings and back as you please. (that is an array of characters that ends with a #0 (null))."

    so would i do that just like thestring = thestring & vbNull, or will it just use the strings how they are?

    the readme he provided says the function is:

    function reform called with a pchar (nullterm. str), via StdCall, returns integer

    what it does is load a file, format the linebreaks, then re-save it.

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:unregistered dll?

    [Originally posted by m.posseth]

    if you put a c dll in the app path
    you can call it in your VB aplication like this

    Public Declare Function functionname Lib "dllname.dll" (values to pass )returnvalue


    c strings are null terminated strings so passing a vbnull at the end of the string should be sufficient

    mystring=mystring & vbNull


    the only thing i don`t understand is why would you use a C dll˙ for a task that is probably
    much easier to acomplish in VB



  3. #3
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:unregistered dll?

    [Originally posted by gnznroses123]

    well, i can't get it to work properly in VB. what i'm doing is fixing the linebreaks of an html file that is unix formatted. so i was using Replace and replacing all Chr($10) characters with a 13 (which is the same as vbNewLine according to Asc(vbNewLine)). but it wouldn't work, even though i have been doing the same exact thing by testing the value of each character in the file and if it's a 10 then i would do thestring = thestring & vbNewLine. but anyways i was talking to him about the problem and he said he could do it in one line of code, so i said go for it.

  4. #4
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:unregistered dll?

    [Originally posted by m.posseth]

    this should do the trick



    Sub ConvertFile(File$)
    Dim f%, ff%, t As String * 2048, ct&, x%, nxt%


    ˙
    ˙
    ˙ f% = FreeFile
    ˙ Open File$ For Binary As #f%
    ˙ ˙ ˙ ff% = FreeFile
    ˙ ˙ ˙ Open Left$(File$, InStr(File$, ".")) & "dos" For Output As #ff%
    ˙ ˙ ˙ ˙ Do While Not EOF(f%)
    ˙ ˙ ˙ ˙ ˙ ˙ Get #f%, , t$
    ˙ ˙ ˙ ˙ ˙ ˙ x% = 1
    ˙ ˙ ˙ ˙ ˙ ˙ Do While x% < Len(t$)
    ˙ ˙ ˙ ˙ ˙ ˙ ˙ ct& = ct& + 1
    ˙ ˙ ˙ ˙ ˙ ˙ ˙ x% = InStr(x%, t$, Chr$(10))
    ˙ ˙ ˙ ˙ ˙ ˙ ˙ If x% = 0 Then Exit Do
    ˙ ˙ ˙ ˙ ˙ ˙ ˙ Print #ff%, Left$(t$, x% - 1)
    ˙ ˙ ˙ ˙ ˙ ˙ ˙ t$ = Right$(t$, Len(t$) - x%)
    ˙ ˙ ˙ ˙ ˙ ˙ Loop
    ˙ ˙ ˙ ˙ ˙ ˙
    ˙ ˙ ˙ ˙ Loop
    ˙ ˙ ˙ Close #ff%
    ˙ Close #f%




    End Sub



    not one line of code :-)

    but it should work


    in C++ with one line ???? yeahhhh and pigs can fly˙ :-)



  5. #5
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Re:Re:Re:unregistered dll?

    [Originally posted by gnznroses123]

    thanks for the code, but i figured out the problem. i thought

    Replace thetext,Chr($10),vbNewLine

    would just replace the text in thestring, but it wasn't. i just had to change it to

    thetext = Replace (thetext,Chr($10),vbNewLine)

    and before i call that i use

    Dim tenthrtn As String
    tenthrtn = Chr$(13) & Chr$(10)
    thetext = Replace (thetext,tenthrtn,vbNewLine)

    just in case the file is already formatted correctly. but that guy did give me the source of his dll (i think it may be pascal, not C) and it is only like two lines i think. he gave me a sample exe that uses it and it works perfectly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center