New topic: Using and calling a DLL from with Real Basic
<http://forums.realsoftware.com/viewtopic.php?t=47725> Page 1 of 1 [ 3 posts ] Previous topic | Next topic Author Message p0wn3d Post subject: Using and calling a DLL from with Real BasicPosted: Sun Apr 28, 2013 2:23 am Joined: Sun Oct 28, 2012 4:54 am Posts: 226 Location: Herts, UK Hi, Been through the LR but it's not too helpful on this subject. I have created a simple windows dll in VB.NET named wmi.dll Public Class wmi Public Shared Function GetHDDSerialNumber(ByVal drive As String) As String 'check to see if the user provided a drive letter 'if not default it to "C" If drive = "" OrElse drive Is Nothing Then drive = "C" End If 'create our ManagementObject, passing it the drive letter to the 'DevideID using WQL Dim disk As New ManagementObject("Win32_LogicalDisk.DeviceID=""" + drive + ":""") 'bind our management object disk.[Get]() 'return the serial number Return disk("VolumeSerialNumber").ToString() End Function End Class How would I go about calling and using this from RB Thanks _________________ Real Studio 2012 R2 SysInfo BackTrack Linux/BackBox Linux/Debian Lenny/Windows 7/Windows 8/OpenWRT/OpenBSD & Yes it's me in the Avatar Top pixe656 Post subject: Re: Using and calling a DLL from with Real BasicPosted: Sun Apr 28, 2013 10:30 am Joined: Wed May 20, 2009 11:02 am Posts: 420 Something like this should work (bnot tested, I am not an expert at all...): Declare Function GetH DDSerialNumberLib "wmi.dll" (Drive as string) as string msgbox GetHDDSerialNumber("C") I wouldn't know how to handle an optional parameter (the drive letter) in a call to a function in a dll, though. Another issue that comes to my mind is that if you use a dll created using VB.NET, there is a possibility that it requires the corresponding framework to be installed on the machine running your application, which could be problematic. If that's the case, I would think it is better to use a direct windows API call. Have you checked the Windows Functionality Suite? Pixe _________________ Using RS2011r4.3 on Windows7. Top Paul Lefebvre Post subject: Re: Using and calling a DLL from with Real BasicPosted: Sun Apr 28, 2013 6:11 pm Site Admin Joined: Fri Sep 30, 2005 9:35 am Posts: 971 Location: South Portland, Maine Real Studio cannot directly access managed .NET code. Real Studio can only access standard Win32 DLLs, which you do using a simple declare to the function call in the DLL. _________________ Paul Lefebvre Developer Evangelist Real Software, Inc. The Real Studio Developer Conference is back: April 23rd-26th, 2013 in Orlando, FL. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 3 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
