Purchased pure basic almost a few years ago now and been using it for various things since then. never registered on the forum or posted here before so this is my first post. One of my first things I did with exploring pure basic back then and getting use to the various things about it was play around with the command prompt some via using RunProgram. So anyway, was looking through my old snippets of code and came across one of those things that works in Windows 7 64 and 32 bit but does not work at all in Windows 8 or 8.1. I expected it to continue working with Windows 8 so i just ran it in the compiler to check and was surprised it did not work. This is the code:
Code: Select all
Procedure.s GetIPAddrCmdPmt()
workdir$ = "C:\Windows\System32\"
Compilertrdns = RunProgram("nslookup.exe", " myip.opendns.com resolver1.opendns.com", workdir$, #PB_Program_Hide|#PB_Program_Open|#PB_Program_Read)
Outns$ = ""
If Compilertrdns
While ProgramRunning(Compilertrdns)
Outns$=ReadProgramString(Compilertrdns)
keepdns$ = keepdns$ + Outns$ + #CRLF$
Wend
CloseProgram(Compilertrdns)
EndIf
Resultg$ = Trim(keepdns$, " ")
Resulte$ = RemoveString(Resultg$, Chr(10), #PB_String_NoCase, 1)
Resultf$ = RemoveString(Resulte$, Chr(13), #PB_String_NoCase, 1)
Resultg$ = Trim(Resultf$, " ")
Position = FindString(Resultg$, "Name", 1, #PB_String_NoCase)
Resultxz$ = Mid(Resultg$, Position)
Result1$ = RemoveString(Resultxz$, "myip.opendns.com", #PB_String_NoCase, 1)
Result2$ = RemoveString(Result1$, "Name:", #PB_String_NoCase, 1)
Result3$ = RemoveString(Result2$, "Address:", #PB_String_NoCase, 1)
Result4$ = Trim(Result3$, " ")
ProcedureReturn Result4$
EndProcedure
Debug GetIPAddrCmdPmt()
yes, I know its not the best but it was an early 'something to experiment with' code. Anyway, it starts up but just keeps running, never returns anything and never ends on Windows 8. Why is this? Is there something about the 'RunProgram' going on here, or is there some type of change for Windows 8 that renders the use of 'nslookup' here as I have it useless?
Windows 8 is new to me and havn't done anything with Pure Basic in windows 8 yet.
Like i said, works fine in windows 7 32 and 64 bit, but in Windows 8 nope. Any suggestions?
Thank You



