Staredit Network

Staredit Network -> Computers and Technical -> Little problem using Starforge.dll
Report, edit, etc...Posted by fatimid08 on 2006-07-10 at 12:02:47
Ok, so here is my problem, I'm trying to use this function from Starforge.dll in vb.net :

VB 6 version (straight from the Starforge.dll specs put online by Heimdal):
Public Declare Function StringGetString Lib "StarForge.dll" (ByVal MapHandle As Long, ByVal StringID As Long, ByVal Str As String) As Long

VB.Net version:
Public Declare Function StringGetString Lib "StarForge.dll" (ByVal MapHandle As IntPtr, ByVal StringID As Integer, ByVal Str As String) As Integer

This, understandably, does not work, since the Str parameter is ByVal and it should be ByRef so it can be modified by the dll. (It gives an access violation error)

But when I put it as ByRef, it causes a stack imbalance because the signature does not match.

Then, I tried some stuff, I put the StringID parameter as ByRef, and now, it doesn't give any error, it just gives me a Null string for any value I put in. I've tried it with different maps that at least have 200 strings in them.
Report, edit, etc...Posted by JaFF on 2006-07-10 at 12:05:45
QUOTE(fatimid08 @ Jul 10 2006, 07:02 PM)
Ok, so here is my problem, I'm trying to use this function from Starforge.dll in vb.net :

VB 6 version (straight from the Starforge.dll specs put online by Heimdal):
Public Declare Function StringGetString Lib "StarForge.dll" (ByVal MapHandle As Long, ByVal StringID As Long, ByVal Str As String) As Long

VB.Net version:
Public Declare Function StringGetString Lib "StarForge.dll" (ByVal MapHandle As IntPtr, ByVal StringID As Integer, ByVal Str As String) As Integer

This, understandably, does not work, since the Str parameter is ByVal and it should be ByRef so it can be modified by the dll. (It gives an access violation error)

But when I put it as ByRef, it causes a stack imbalance because the signature does not match.

Then, I tried some stuff, I put the StringID parameter as ByRef, and now, it doesn't give any error, it just gives me a Null string for any value I put in. I've tried it with different maps that at least have 200 strings in them.
[right][snapback]521345[/snapback][/right]

I think this is for the Starforge Forum ... Or is it ? pinch.gif
Report, edit, etc...Posted by fatimid08 on 2006-07-10 at 12:07:22
I don't know, it is me doing a program that uses the dll, it's still a programming issue. It could go in both I think.
Report, edit, etc...Posted by Cole on 2006-07-11 at 12:13:19
It isn't starforge because this dosn't deal with starforge it deals with it's dll to open MPQ's and read map files.

So it is programming.

I'd help but I don't use Starforges dll for accessing map files or VB.
Next Page (1)