Visual Basic 6 - Windows DLL

Visual Basic interferes...

Page 1 of 1

0 Replies - 1652 Views - Last Post: 16 May 2008 - 02:25 PM Rate Topic: -----

#1 rot740  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 5
  • Joined: 18-July 07

Visual Basic 6 - Windows DLL

Post icon  Posted 16 May 2008 - 02:25 PM

Well, this is my first post here but I am not new to forums. I also do code a bit but mostly in GML. Keep that in mind!

Well, Game Maker has never been able to use anything in VB because it was defined as "impossible" because it compiles it's DLLs as an ActiveX DLL but a few people and I on the Game Maker Community have learned about that plug-in "vbAdvance" and that it's able to create a Windows Specific DLL. It works great until we got one major issue...Arguments...

I got it to work and all except there is a problem on one side or just incapability...I have made a simple DLL that shows a message box with the message as argument0 and the title as argument1. Some code:

Visual Basic (Called Function)
Public Function Msg(ByVal txt As String, ByVal ttl As String) As String
	MsgBox txt, , ttl
End Function

I used the default Modules and Class Modules the Non-VB Caller should use, they are included in vbAdvance's folder.

Game Maker Language (Caller)
global.MsgBoxS = external_define("exports_res.dll","Msg",dll_stdcall,ty_string,2,ty_string,ty_string);

The GML Help for those Functions:


external_define(dll,name,calltype,restype,argnumb,arg1type,arg2type, ...) Defines an external function. dll is the name of the dll file. name is the name of the functions. calltype is the calling convention used. For this use either dll_cdecl or dll_stdcall. restype is the type of the result. For this use either ty_real or ty_string. argnumb is the number of arguments (0-11). Next, for each argument you must specify its type. For this again use either ty_real or ty_string. When there are more than 4 arguments all of them must be of type ty_real.

external_call(id,arg1,arg2,...) Calls the external function with the given id, and the given arguments. You need to provide the correct number of arguments of the correct type (real or string). The function returns the result of the external function.

Now the problem is quite easy to see but quite odd too... Let's say I use "Message" as the title and "Hello" as the message itself. It calls perfectly until it displays the title as "???e" and the message as "??o". It groups two letters together replacing it with a question mark. Now I have tried changing things in the VB code and the GML code but it stays the same...

Can anyone help? :blink:

This post has been edited by rot740: 16 May 2008 - 06:32 PM

Is This A Good Question/Topic? 0
  • +

Page 1 of 1