Calling DLL functions with structs
malkishtini at gmail.com
malkishtini at gmail.com
Fri Aug 18 13:36:52 UTC 2023
Hi Dean,
If you are dealing with a dotnet dll, then you could try using the dotnet
object in Omnis and see if that will work with you, since you can
instantiate it and then pass params to it and so on.
HTH,
Mayada
-----Original Message-----
From: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> On Behalf Of
Dean Leggo
Sent: Thursday, August 17, 2023 9:49 PM
To: omnisdev-en at lists.omnis-dev.com
Subject: Calling DLL functions with structs
Hey everyone
I am working on a project to convert some Visual Basic code to Omnis and the
code block makes a number of DLL calls with structs. But Omnis'
[Register
DLL](https://www.omnis.net/developers/resources/onlinedocs/index.jsp?detail=
CommandRef/Commands_A-Z/register_dll.html)
does not support structs.
Has anyone passed a struct to a DLL or how can I call the DLL function?
An example could be
[GetDiskSpaceinformationA](https://learn.microsoft.com/en-us/windows/win32/a
pi/fileapi/nf-fileapi-getdiskspaceinformationa)
I want to call it like the code below. This won't work as you cannot declare
structs and the types are probably wrong. But this is want I am wanting to
do.
Register DLL ("KERNEL32.DLL","CreateFileA","AC(RRRRRRRRRJJ)")
Do
lrowDiskSpace.$define(int64,int64,int64,int64,int64,int64,int64,int64,int64,
int64,int64,char4,char4)
Calculate lsDirectory as '%localappdata%\Omnis Software'
Call DLL ("KERNEL32.DLL","CreateFileA",lsDirectory,lrowDiskSpace)
Returns lbOK
Cheers,
Dean Leggo
--
Logical Developments Logo <https://www.logicaldevelopments.com.au> Dean
Leggo
Logical Developments
Customised Software Solutions
Ph: 08 9458 3889
We Don't Do Simple Pty Ltd
trading as
Logical Developments
ACN: 161 009 374
Facebook logo <https://www.facebook.com/logicaldevelopmentswa/>
Twitter logo <https://twitter.com/WeDontDoSimple> LinkedIn logo
<https://www.linkedin.com/company/logicaldevelopments/> YouTube logo
<https://www.youtube.com/channel/UCPldVVgWR05WX3cVrR5WUQw>
_____________________________________________________________
Manage your list subscriptions at https://lists.omnis-dev.com Start a new
message -> mailto:omnisdev-en at lists.omnis-dev.com
More information about the omnisdev-en
mailing list