Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Question Regarding Darkbasic and how to interface it with Windows.

Author
Message
Servant Saber
16
Years of Service
User Offline
Joined: 8th Aug 2008
Location:
Posted: 5th Sep 2009 23:08
hello all, This might be a strange question for some of you, but here goes...
I've Been working on a Darkbasic Pro project for some time now, but recently, I was wondering if it's possible to interface my code to certain windows components, such as having a program be able to read and output data from windows core settings like Ip settings, listing installed hardware, stuff like that.
I've been able to show the System time and date, but that's all I know how to do as far as windows integration.

Does anyone know how this can be done?
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 5th Sep 2009 23:43
Quote: "Does anyone know how this can be done? "

Through plugins, most definitively. All Windows libraries are readily available from C:\\System, so it's just a matter of learning how to use them.
If you have any specific thing you want to achieve, feel free to ask; somebody probably knows how to do it.

Servant Saber
16
Years of Service
User Offline
Joined: 8th Aug 2008
Location:
Posted: 5th Sep 2009 23:49 Edited at: 6th Sep 2009 22:40
Awesome, well I guess i might explain what I'm trying to do first to make things easier.

I'm attempting to make a program that can read and output operating system Data such as Network settings, Hardware used, and other things, and output it to my programs interface, allowing someone to bypass using the windows GUI completely if they want to simply look at the data.
And, if possible, Be able to read AND change windows values, all from the program itself.

My problem now is, I don't know what plugin I need or even how to use them, can anyone point me in the right direction?
Servant Saber
16
Years of Service
User Offline
Joined: 8th Aug 2008
Location:
Posted: 7th Sep 2009 19:53
So....Does anyone have any idea how to use windows .dlls or how to simply read from them?
I noticed the "Create a third party .Dll" tutorial But that focuses on creating commands, and I've looked for third party .dlls on the main Game Creator website, but it seems most of the links are down
If anyone knows anything regarding this, thank you in advance.
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 7th Sep 2009 20:33
Go to this directory:

C:\Windows\system

One of those DLLs will probably have the commands that you're looking for.
Servant Saber
16
Years of Service
User Offline
Joined: 8th Aug 2008
Location:
Posted: 7th Sep 2009 21:28
Would you happen to know a tutorial on how to use .dlls?
I know they expand functionality of Darkbasic, but as for the windows .Dlls, I really just don't have a clue, I don't even know how to open them(I tired opening them with wordpad, no luck)
My problem is I don't know enough about .Dlls or how to use the windows .dlls and read/edit them.
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 7th Sep 2009 22:00
Look the dlls up on MSDN (Microsoft Developer Network). It usually has lists of functions in each dll.

Once you know the name and the parameters, you can use CALL DLL to call the function.



Servant Saber
16
Years of Service
User Offline
Joined: 8th Aug 2008
Location:
Posted: 9th Sep 2009 02:26
I looked on the site from the links you guys gave me, Really usefull to say the least.
I guess I'm still new to programming, and I didn't know what I was getting myself into regarding .Dll files.
I have another question if you guys don't mind..
I don't exactly understand how to interface with .dlls yet, from what i understand I have to call the dll with the command "Call Dll"
And I'm guessing that points my program to the .dll file itself, allowing me to call a function that exists in it.
If I want to use a certain function inside a .dll file after it's been called, how would I go about it?
And from what i've seen of some .dll files I opened, it baffles me how to even display a variable from a called function.

Bear with me guys^^
For example, if I were to call a .Dll that was capable of showing and editing network settings on the local PC, and I called the correct function, how would I display the settings or data, or whatever method the .dll uses?

My apology's in advance for this long post, I just can't find much info on interfacing with .dlls, and now I'm trying to integrate things with windows...
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 9th Sep 2009 03:27
An example is probably what you need. Here's one that just gets a number of different facts about the computer:



You use CALL DLL as if you were simply using the function itself, and it returns anything the function would.

(You can't open DLLs in a text editor to view the source, they are written in C++ but compiled into machine code or something more arcane, that's why you have MSDN to tell you what the functions do and how to use them)

It's a bit of a "dark art" to call anything much more advanced than getting the user's name or the number of buttons on your mouse - my advice is to ask specifically about what you want to do and see if anybody can help you with that.



Servant Saber
16
Years of Service
User Offline
Joined: 8th Aug 2008
Location:
Posted: 9th Sep 2009 04:45
Being able to call System specs from a file native to windows is really something O_o
So let me see If I follow your code as it is.

Most of it I understand, but on lines One to Four:

MouseWheel = call dll(1, "GetSystemMetrics", 19)
MouseButtonsCount = call dll(1, "GetSystemMetrics", 43)
MouseButtonsInverted = call dll(1, "GetSystemMetrics", 23)
SlowProcessor = call dll(1, "GetSystemMetrics", 73)

Your calling the Function "GetSystemMetrics" from the "user32.Dll" and I'm also guessing that the numbers on the far left are the strings or data values inside that one Function?


One last thing, Since I have no idea what Windows .Dll holds the data im after, I guess I'll do as you said and ask.
I'm attempting to be able to access and view/edit Windows network settings(and at the worst case, simply see the network settings, such as what the ipconfig command does in the command prompt)
all from a simple program, the only thing holding me back is not knowing what .dll file holds and manages the Windows Network settings themselves(Not the underlying Protocol and such)

I browsed on MSDN (Microsoft Developer Network) and I found alot of .dlls under the network section, but there's so many, Would you recommend I go and look inside each one, or is there a better approach?

Once again, I know I'm a chatterbox, Don't shoot me^^
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 9th Sep 2009 05:58
Hehe, 's okay, we like answering questions around here, as long as you searched first . Anything that appears to the right of the function name (in this case GetSystemMetrics) is a parameter for the function. It looks like the GetSystemMetrics function takes one parameter - this parameter is an arbitrarily assigned number that represents a stat to return. For example, if you put in 23 it will return a 1 if the mouse buttons are inverted, and a 0 if they aren't.

This page looks pretty relevant, but looking at it...I'm 87% sure there's an easier way to do this. Wait for someone knowledgeable like IanM to come along, I'm sure they can help you a lot more than I can .
http://msdn.microsoft.com/en-us/library/aa366071(VS.85).aspx



Servant Saber
16
Years of Service
User Offline
Joined: 8th Aug 2008
Location:
Posted: 9th Sep 2009 06:42
Thanks alot BMacZero, You've helped me alot, It goes without saying I owe you one.

In any case, Guess I'll browse the MSDN to try to make some sense out of all this.

Thanks to Zero, I understand (I hope) How to call .DLL's now, now all i need is someone who knows how to link network code in basic, or know what .Dll I need to point to.
Servant Saber
16
Years of Service
User Offline
Joined: 8th Aug 2008
Location:
Posted: 10th Sep 2009 01:05
I browsed the MSDN website last night,
but for some reason the "IP helper" windows object kept popping up in the network section.
I have no idea how to call this windows item, or how it works, but all the functions it has are non-numerical, not to mention the site says the only way to call it is by calling a ".LIB" File.
(The site was using C++ to interface with it, so I have no idea what to do in DarkBasic)
Any Ideas guys?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 10th Sep 2009 15:48
Quote: "so I have no idea what to do in DarkBasic"

Nothing - you need to get the .lib compiled into a .dll to use it with DBPro.

In addition to everything you are looking at, you may want to take a look at some of the plug-ins available - a lot of these interface with Windows and can be used to get configuration information. For example, you can get all of the IP addresses for each network interface using the network plug-in in my plug-in set.

Servant Saber
16
Years of Service
User Offline
Joined: 8th Aug 2008
Location:
Posted: 10th Sep 2009 20:24
Hey there IamM.
I guess I don't know how to search, but where might your Plug-in set be located?
I looked at the third party .Dll list, but most of the links are down.
Are they located somewhere else?
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 10th Sep 2009 20:44
It's on his signature but here's a direct link to download IanM's Matrix 1 Utilities Plug-In:

https://forumfiles.thegamecreators.com/download/1794671

Servant Saber
16
Years of Service
User Offline
Joined: 8th Aug 2008
Location:
Posted: 11th Sep 2009 02:17 Edited at: 11th Sep 2009 19:04
I feel foolish now, My bad, My bad.
One thing though, IanM, In your Utility plug-ins collection,
Section 28 - Networking for IP and UDP, I can't seem to find a suitable command to simply print or display the PC's local IP address, or at least, not correctly.
I'm using your full utility Plug-in pack

When I enter in the code above, The interface count is correct, but the IP address printed is strange, something like "1185212081"
I've attached a screenshot showing the output from the code above.

Edit:
I did a Decimal to Binary conversion, and apparently the number for the Ip address it gives me IS my IP address, it simply cuts off the first 4 bits of the first octet, and then prints the Ip address in decimal form.
So if the program outputs "182575383", it means the Ip address is 10.255.255.23
Does anyone know how to add the first 4 zeros for the first octet, or simply how to correct this?

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-24 02:00:51
Your offset time is: 2024-11-24 02:00:51