1 Replies - 397 Views - Last Post: 23 June 2013 - 01:15 PM Rate Topic: -----

#1 Zulumander  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 23-June 13

Catch: "Invalid Base." (Convert IntPtr)

Posted 23 June 2013 - 01:00 PM

Hi.


I've got this DLL File I'm working with, trying to combine it with a simple VS 2012 GUI, minor good stuff. But I'm sort of at a 'dead end'.

I know the functions inside the DLL file, and the one I'm working on now is;

[b]sqpUnpack (IntPtr archiveName, IntPtr destFolder);[/b]
archiveName  pointer to archive name
destFolder  pointer to destination folder


I've declared it by

 Declare Function unpack Lib "SQPE.dll" Alias "sqpUnpack" (ByRef archiveName As IntPtr, ByRef destFolder As IntPtr)



So in order to do this, I've used

selected = SelectFileDialog.FileName
 path = selected.ToString().Split("\")
        Dim count As Integer = path.Length
        Dim x As Integer = 0
        ReDim Preserve path(UBound(path) - 1)
        While (x < (count - 1))
            final = final & path(x) & "\"
            x += 1
        End While
        final = final & "_Unpack\"

[b]So final = (selected - Filename+Format) + \_Unpack[/b]



These would be strings, for now.

And then, I'm trying to convert them into useable variables for the function inside the DLL file;

Try
Dim test As IntPtr = New IntPtr(Convert.ToInt32(Marshal.StringToHGlobalAuto(selected), 32))
 Dim test2 As IntPtr = New IntPtr(Convert.ToInt32(Marshal.StringToHGlobalAuto(final), 32))
 unpack(test, test2)
 Catch ex As Exception
 MsgBox(ex.Message())
 End Try



And this results with this;

Posted Image


First time working with VS 2012 & DLL Files, so trying to learn. Anyone got a clue why it's doing this?

Is This A Good Question/Topic? 0
  • +

Replies To: Catch: "Invalid Base." (Convert IntPtr)

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8364
  • View blog
  • Posts: 31,070
  • Joined: 12-June 08

Re: Catch: "Invalid Base." (Convert IntPtr)

Posted 23 June 2013 - 01:15 PM

Please do not open duplicate topics, and also check if your code is VB.NET or VB6. Closing.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1