Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 23rd, 2024, 8:07 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Value types for DLLs (V6.0)
PostPosted: October 17th, 2007, 7:13 pm 
Offline

Joined: October 11th, 2007, 2:53 pm
Posts: 3
I am trying to use an external DLL function from a 3rd party supplier but am not sure what Value type to use.

Both the return value and the parameters to be set are specified by the DLL supplier as being string, boolean or integer.

String is OK
If I read the manual correctly the boolean is entered with no type or quotes
Which value type do I use for an integer?


The function being called has 7 parameters and returns an integer

file=string
key=string
moduleID=string
name=String
User=Boolean
Quit=Boolean
Tag=String


A sample line of java code looks like this:

mytest res = testfunction(location, readKey, "QHD001", "", true, false, tag);


Here is my interpretation within Opus. The DLL loads fine, its the function call that gives a NULL result.

var MyDLL = LoadDLL( SYSTEM_PUBLICATION_DIR + "mytest.dll" );

readkey="abc123"
location=SYSTEM_PUBLICATION_DIR+"demofile.fil"


if (MyDLL)
{
test_return = MyDLL.CallFn("testfunction",false,"sshort","string",location,"string",readkey,"string","DQH001","none","",false,false,"string","tagvar");


Debug.trace(test_return); // this gives a NULL return


If I break this down this is what I think I am requesting:

test_return = MyDLL.CallFn // call the function from MyDLL
("testfunction", //the function is called testfunction
false, // there is no screen element
"sshort", //The return value will be of the type sshort
"string",location, // location is a string held in a variable
"string",readkey, //readkey is a string held in a variable
"string","DQH001", //DQH001 is a string
"none","", // this value is not required and is null
false, // this value is boolean false
false, // this value is boolena false
"string","tagvar"); //this value is text

Can anyone help me make sense of this?????


Top
 Profile  
 
 Post subject:
PostPosted: October 18th, 2007, 8:51 am 
Offline

Joined: November 25th, 2004, 1:24 pm
Posts: 512
Location: Scotland
Opus: 9.75
OS: Win 10
System: Asus i7-7700K 16Gb
first, have a look at
viewtopic.php?t=2756&highlight=unmanaged and viewtopic.php?t=2674&highlight=unmanaged

If the DLL was created in a managed environment such as visual 'something' it probably won't work in Opus. Opus needs DLLs created in native WIN32 applications such as PowerBasic, Delphi, and standard C++ environments which produce unmanaged code.

I have seen a DLL load successfully but not run.

In your DLL call, I think the false should be within quotes "false"


also try "none" in place of the last two false types




Can you attach the DLL to have a try with it?? I find the best way to solve a problem like this is just to hack it---you can apply logic, but when that doesn't work, it comes down to trying all the combinations.
For integer values, I use the 'ULONG' type, so try that in place of the sshort.



Are you sure there are no syntax errors in your script, for example there is a curly missing in the DLL call, but I assume it's the way you cut and paste, you would normally get an error, but not always.

_________________
Whoever designed this, never actually used it!


Top
 Profile  
 
 Post subject:
PostPosted: October 18th, 2007, 9:22 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Hi 1Vision,

Sandyn is right about reviewing the other posts. He pointed me in the right direction originally and after much (and I mean much) hard work I've developed a decent undertsanding of both DLLs and using them in Opus.

One big must is to download the DLL Export Viewer - from http://www.nirsoft.net/utils/dll_export_viewer.html

If you can't see the function calls in that, then they are not available in Opus even if the DLL does load. If the FCs are there, then as Sandyn says, you can normally 'hack' together the correct code to get the information to / from the DLL.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: Value types for DLLs (V6.0)
PostPosted: October 19th, 2007, 9:41 pm 
Offline

Joined: October 26th, 2004, 10:23 am
Posts: 666
Location: Digital Workshop
Without having the exact details, I would suggest something like this:
Code:
test_return = MyDLL.CallFn(
"testfunction",  // the function is called testfunction
false,   // there is no screen element
"slong",  // The return value
"string",location,  // location is a string held in a variable
"string",readkey,  //readkey is a string held in a variable
"string","DQH001", //DQH001 is a string
"string","", // this value is not required and is an empty string
"ulong",false, // this value is boolean false
"ulong",false, // this value is boolena false
"string","tagvar"); //this value is text

Did your supplier give you a header file or other documentation of the exact types the function uses?

_________________
ddww Opus Developer


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 42 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group