Page 1 sur 1
Lancer le navigateur par défaut
Publié : mer. 30/nov./2005 12:40
par Progi1984
Slt
Pourquoi ce code ne fonctionne til pas ?
Code : Tout sélectionner
hwnd.l=OpenWindow(0,0,0,270,160,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"HyperlinkGadget")
If CreateGadgetList(WindowID(0))
ButtonGadget(10, 10, 10,250,20,"Lien rouge")
Repeat
Event = WindowEvent()
If Event=#PB_Event_Gadget
gadget=EventGadgetID()
If gadget =10
ShellExecute_(hWnd.l, "Open", "http:\\www.purebasic.com", "", "",1)
EndIf
EndIf
Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
Publié : mer. 30/nov./2005 13:14
par Chris
Faudrait savoir ce que tu veux utiliser, WindowEvent() ou WaitWindowEvent()
C'est l'un ou l'autre, mais pas les deux.
Publié : mer. 30/nov./2005 13:16
par lionel_om
Peut-être un oubli ou un copier/coller trop rapide ...
Publié : mer. 30/nov./2005 13:18
par olivier
Comme cela :
Code : Tout sélectionner
hWnd.l=OpenWindow(0,0,0,270,160,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"HyperlinkGadget")
If CreateGadgetList(WindowID(0))
ButtonGadget(10, 10, 10,250,20,"Lien rouge")
Repeat
event = WindowEvent()
If event=#PB_Event_Gadget
gadget=EventGadgetID()
If gadget =10
ShellExecute_(hWnd.l, "Open", "http:\\www.purebasic.com", "", "",1)
EndIf
EndIf
Until event =#PB_Event_CloseWindow
EndIf
Mais il sera préférable d'utiliser WaitwindowEvent(), comme cela :
Code : Tout sélectionner
hWnd.l=OpenWindow(0,0,0,270,160,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"HyperlinkGadget")
If CreateGadgetList(WindowID(0))
ButtonGadget(10, 10, 10,250,20,"Lien rouge")
Repeat
event = WaitWindowEvent()
If event=#PB_Event_Gadget
gadget=EventGadgetID()
If gadget =10
ShellExecute_(hWnd.l, "Open", "http:\\www.purebasic.com", "", "",1)
EndIf
EndIf
Until event =#PB_Event_CloseWindow
EndIf
Publié : mer. 30/nov./2005 13:22
par lionel_om
olivier a écrit :
Code : Tout sélectionner
hWnd.l=OpenWindow(0,0,0,270,160,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"HyperlinkGadget")
If CreateGadgetList(WindowID(0))
ButtonGadget(10, 10, 10,250,20,"Lien rouge")
Repeat
event = WindowEvent()
If event=#PB_Event_Gadget
gadget=EventGadgetID()
If gadget =10
ShellExecute_(hWnd.l, "Open", "http:\\www.purebasic.com", "", "",1)
EndIf
EndIf
Until event =#PB_Event_CloseWindow
EndIf
Faut rajouter un Dalay(2) ou un Sleep_(2) car sinon tu vas bouffer tout l'UC ...
Publié : mer. 30/nov./2005 13:22
par Chris
Ben ouais, c'est exactement ce que j'ai dit !

Publié : mer. 30/nov./2005 13:28
par Progi1984
Oh le con ! J'ai fait une modif du code de hyperlinkgagdget, et j'ai rajouté un truc par dessus , que j'ai modifié et
Merci !

Publié : mer. 30/nov./2005 15:26
par Jacobus
et un RunProgram() c'est pas suffisant?
ex :