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.

DarkBASIC Professional Discussion / IP Address in DB without DLL

Author
Message
heartbone
21
Years of Service
User Offline
Joined: 9th Nov 2002
Location:
Posted: 12th Dec 2002 07:17
I think I found a way. (whew!)
And it works for both DB1 & DBP (on my Win98SE install).

Would anyone running one or more of these
Win 95 - Win ME - Win XP - Win 2K
please D/L this zip of a DBP exe
http://www.heartbone.com/download/getip.zip
and run it?
Then post here your results.
If it works for the other versions of the OS
(especially XP),
I'll post my code on the appropriate board.
AsylumHunter
21
Years of Service
User Offline
Joined: 3rd Oct 2002
Location: United States
Posted: 12th Dec 2002 12:01
XP SP1

all I got was Error in line 12 - Hope this helps

AsylumHunter

still falling out of my binary tree most evenings (hicup!)
Kangaroo2
21
Years of Service
User Offline
Joined: 26th Sep 2002
Location: United Kingdom
Posted: 12th Dec 2002 15:26
XP Home, no SP sorry it didn't work for me either

* If the apocalypse comes, email me *
heartbone
21
Years of Service
User Offline
Joined: 9th Nov 2002
Location:
Posted: 12th Dec 2002 19:31
Thanks AsylumHunter and Kangaroo2 it helps.

I feel that I may be able to get XP working once I get access to a box for development work.

Win2K doesn't work either. Is there a way to determine what OS a DBPro app is running in? Preferably without using a DLL, but if that is the only way it will do. Otherwise I can't use my method.
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 12th Dec 2002 19:33
I'm sure someone would be able to do a plug-in...

Good news everybody! I really am THAT good...
Kale
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: United Kingdom
Posted: 12th Dec 2002 19:35
can you post the code?

What the flame does not consume, consumes the flame.
------------------------------------------------------------------------
AMD XP2100+, Geforce4Ti 4400, 512Mb DDR, Abit KX7, WinXP Home
heartbone
21
Years of Service
User Offline
Joined: 9th Nov 2002
Location:
Posted: 12th Dec 2002 20:25
ROOT$= Windir$()
Rem A$ is unique to Win9X, must exist pathname
A$= ROOT$+"\command.com"

Rem B$ is unique to WinXP, must exist pathname
B$= ROOT$+"\??????????????????????"

Rem C$ is unique to Win2K, must exist pathname
C$= ROOT$+"\??????????????????????"


If FIle Exist(A$) Then OS$="Win9X/ME"
If File Exist(B$) Then OS$="WinXP"
If File Exist(C$) Then OS$="Win2000"

-----------------------------------------------------------------------

1) Is my assignment of A$ a correct assumption in this context?

2) Will someone kindly supply me with B$ and C$?
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 12th Dec 2002 21:34
I'm sure I'll be able to do a plug-in...

I'll let you know whe its finished.

Good news everybody! I really am THAT good...
heartbone
21
Years of Service
User Offline
Joined: 9th Nov 2002
Location:
Posted: 12th Dec 2002 21:56
Thanks MrTAToad, but I am creating a function that DB1 users can use as well.
My code blows up in Windows2000 and XP. I maybe able to figure out a way to make it work in these other versions of WIndows, but first I need my function to be aware of what code to (not) execute.

Does anyone running either Win2000 or WinXP or both have a suggestion for a unique and must exist path name to use for the test?
MrTAToad
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 12th Dec 2002 23:42
Ah - if its for DB1, then my plug-in wont work...

You can't really look for paths to work out which OS is running (mainly because anyone can create/copy the directories and files that you look at) - the best way would be to use a DLL to do it (if you've got MSDN, then swipe the code from that)

Good news everybody! I really am THAT good...
swdave
21
Years of Service
User Offline
Joined: 6th Oct 2002
Location: United States
Posted: 13th Dec 2002 01:45
How bout like this.



Bighead
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location:
Posted: 13th Dec 2002 03:52
swdave, I modified your code just a little bit, mainly, so that it can be used by non-english coders.

See the comments inside:

heartbone
21
Years of Service
User Offline
Joined: 9th Nov 2002
Location:
Posted: 13th Dec 2002 03:57
It looks like we had the same idea.
Basically.....


But my code does not work on WinXP and Win2K.
I am not sure if this will either.
Bighead
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location:
Posted: 13th Dec 2002 04:16
The problem is that "winipcfg.exe" isn't a file of WinNT-based OS (like Win XP), as I guess "ipconfig.exe" isn't a file of Win9x (I really don't remember the latter).
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 13th Dec 2002 04:35
the current IP is stored in the registry (in XP PRO it is Here)

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001 \Services\Tcpip\Parameters\Interfaces\{3C775B08-CF16-476F-96B8-C184BC3459D6}

also the same path but substitute ControlSet001 for just "ControlSet"

Now of course the folder after \Interfaces\may be different on other machines, but in one of the folders under interfaces, you can search for the "Name"
DhcpIPAddress
The "Type" of
RG_SZ
and the "Data" there is the IP Address of the current internet connection (I'm on dialup, others may vary, but no doubt the IP address can be locacted somewhere in the following folders under *\interfaces\

A "Find" thru the registry only turns up a few hits for: DhcpIPAddress

the one (or 2) whose data does not = 0.0.0.0 is the one you want.

now..figure out how to grab that registry entry, and you'll have the users IP.

Zep--

indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 13th Dec 2002 05:16
u guys let me know how much i dont know regarding the finder aspects of windows with your technical expertise.

fly on the wall

Login to post a reply

Server time is: 2024-05-07 13:13:00
Your offset time is: 2024-05-07 13:13:00