Runprogram behaviour

Just starting out? Need help? Post your questions and find answers here.
Cor
Enthusiast
Enthusiast
Posts: 124
Joined: Fri Apr 25, 2003 7:52 pm
Location: Netherlands
Contact:

Runprogram behaviour

Post by Cor »

Textgadget
#txtURL contains --> http://www.ready4music.com

Runprogram(Getgadgettext(#txtURL),"","",2) does not fire the url

The following does work

temp.s = Getgadgettext(#txtURL)

Runprogram(temp,"","",2) does not fire the url

Am I missing something or is it a bug?
Cor de Visser

Registered PureBasic user

Author of ChordPlanet
Made with PureBasic
http://www.chordplanet.com
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: Runprogram behaviour

Post by PB »

> Runprogram(Getgadgettext(#txtURL),"","",2) does not fire the url

Yep, it fires fine for me with this code:

Code: Select all

If OpenWindow(1,300,250,400,200,#PB_Window_SystemMenu,"Window")
  CreateGadgetList(WindowID())
  ButtonGadget(1,20,50,60,25,"Button")
  StringGadget(2,20,100,300,20,"http://www.ready4music.com/")
  Repeat
    ev=WaitWindowEvent()
    If ev=#PB_Event_Gadget
      Select EventGadgetID()
        Case 1 ; Button.
          RunProgram(GetGadgetText(2),"","",2)
      EndSelect
    EndIf
  Until ev=#PB_EventCloseWindow
EndIf
Cor
Enthusiast
Enthusiast
Posts: 124
Joined: Fri Apr 25, 2003 7:52 pm
Location: Netherlands
Contact:

Post by Cor »

It does not fire on win95
Cor de Visser

Registered PureBasic user

Author of ChordPlanet
Made with PureBasic
http://www.chordplanet.com
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> It does not fire on win95

True! :) Use ShellExecute instead of RunProgram like so, and it works:

Code: Select all

ShellExecute_(0,"open",GetGadgetText(2),"","",#SW_SHOW)
I think Fred intended RunProgram to be for apps only, and not web pages,
which may be why RunProgram doesn't work in this case on Win 95.
TronDoc
Enthusiast
Enthusiast
Posts: 310
Joined: Wed Apr 30, 2003 3:50 am
Location: 3DoorsDown

Post by TronDoc »

the RunProgram(GetGadgetText(2),"","",2) version
doesn't work here on WinDoze '98 1st Ed either;
but the ShellExecute_(0,"open",GetGadgetText(2),"","",#SW_SHOW)
works just fine.
Joe
P.S. Cor! what a way to get folks to visit your site!!! <kidding> :lol:
oldefoxx
Enthusiast
Enthusiast
Posts: 532
Joined: Fri Jul 25, 2003 11:24 pm

ShellExecute()

Post by oldefoxx »

This is the Second of Two Threads I have found that mention ShellExecute(), but I do not find it in the Help, nor does the IDE highlight or case-correct an entry of ShellExecute(). What gives?

--Never mind. I just noted the following underscore (ShellExecute_()), meaning it is a Windows API call. Dern! I wish my eyes were better.
has-been wanna-be (You may not agree with what I say, but it will make you think).
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Re: ShellExecute()

Post by Pupil »

oldefoxx wrote:This is the Second of Two Threads I have found that mention ShellExecute(), but I do not find it in the Help, nor does the IDE highlight or case-correct an entry of ShellExecute(). What gives?
It's a Win32 API command. If you place a win32.hlp file in the help folder in your PB installation you'll be able to use F1 to get help. All commands ending with an underscore '_' are API commands and as such aren't included in the PB help file.
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

Get one of the latest Win32.hlp here:

http://www.garyw.uklinux.net/PB/WIN32.zip

:D
--Kale

Image
Post Reply