9 Replies - 4291 Views - Last Post: 13 January 2009 - 10:39 AM Rate Topic: -----

#1 skorn1999   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-January 09

How to start process from URL

Posted 10 January 2009 - 04:41 PM

hey

This post has been edited by Jayman: 12 January 2009 - 12:28 PM

Is This A Good Question/Topic? 0
  • +

Replies To: How to start process from URL

#2 skorn1999   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-January 09

Re: How to start process from URL

Posted 10 January 2009 - 07:05 PM

Im sorry I submitted before I said everything I wanted to say. I'm new to visual basic and I'm very interested with learning more. I look forward to receiving help from all of you.

This post has been edited by skorn1999: 10 January 2009 - 10:15 PM

Was This Post Helpful? 0
  • +
  • -

#3 DmS1ckwit1t   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 77
  • Joined: 05-January 09

Re: How to start process from URL

Posted 11 January 2009 - 09:23 AM

View Postskorn1999, on 10 Jan, 2009 - 06:05 PM, said:

Im sorry I submitted before I said everything I wanted to say. I'm new to visual basic and I'm very interested with learning more. I look forward to receiving help from all of you.

Well what kind of help are you exactly looking for?
Was This Post Helpful? 0
  • +
  • -

#4 skorn1999   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-January 09

Re: How to start process from URL

Posted 11 January 2009 - 04:55 PM

View PostDmS1ckwit1t, on 11 Jan, 2009 - 08:23 AM, said:

View Postskorn1999, on 10 Jan, 2009 - 06:05 PM, said:

Im sorry I submitted before I said everything I wanted to say. I'm new to visual basic and I'm very interested with learning more. I look forward to receiving help from all of you.

Well what kind of help are you exactly looking for?


Currently I am encountering a problem when it comes to starting a couple of processes. Heres the code.


  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

		Dim url As String
	   
		 url = "www.google.com"
		System.Diagnostics.Process.Start(url)

		url = "www.yahoo.com"
		System.Diagnostics.Process.Start(url)

	End Sub



Now this code works to load both of those pages, but what I want to do is delay the second process from happening until the first process is done. So I was wondering if there is any way to give processes a time interval to go in. And for future reference is there anyway to terminate a process once it is done? Not that it makes sense to do but say google.com got done loading can I get the process to close after it gets done being loaded? Thank you for your time.
Was This Post Helpful? 0
  • +
  • -

#5 Senseika   User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 66
  • Joined: 09-January 09

Re: How to start process from URL

Posted 12 January 2009 - 07:51 AM

Ok. I think this WILL work.
and always remember this :code:
Remember to keep my credits in there!

Prereqs for this program: Knowledge of Copy and Paste, Creating a Button, Creating a Timer and changing its "Interval" to 1000
Option Explicit
'Programmed by Senseika

Private Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Const SW_SHOWNORMAL As Long = 1

Dim URL As String
Dim COUNTER As Integer

Private Sub Command1_Click()
URL = "http://www.google.com/"
Call HYPERLINK(URL)
Timer1.Enabled = True
End Sub

Private Sub Form_Load()
Timer1.Enabled = False
URL = ""
COUNTER = 0
End Sub

Private Sub Timer1_Timer()
COUNTER = COUNTER + 1
URL = "http://www.yahoo.com/"
If COUNTER = 5 Then
	Call HYPERLINK(URL)
ElseIf COUNTER >= 6 Then
	Unload Me
End If
End Sub

' Procedures
Public Sub HYPERLINK(ByVal ADDRESS As String)
Call RunShellExecute("open", ADDRESS, 0&, 0&, SW_SHOWNORMAL)
End Sub

Private Sub RunShellExecute(sTopic As String, sFile As Variant, _
							sParams As Variant, sDirectory As Variant, _
							nShowCmd As Long)

  'execute the passed operation, passing
  'the desktop as the window to receive
  'any error messages
   Call ShellExecute(GetDesktopWindow(), _
					 sTopic, _
					 sFile, _
					 sParams, _
					 sDirectory, _
					 nShowCmd)

End Sub


Was This Post Helpful? 0
  • +
  • -

#6 Jayman   User is offline

  • Student of Life
  • member icon

Reputation: 423
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: How to start process from URL

Posted 12 January 2009 - 12:29 PM

Moved to VB.NET.

Modified title to be more descriptive of the problem..
Was This Post Helpful? 0
  • +
  • -

#7 AdamR   User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 144
  • Joined: 23-September 08

Re: How to start process from URL

Posted 12 January 2009 - 12:45 PM

Edit **

Delete This Please, Accidental

This post has been edited by AdamR: 12 January 2009 - 12:47 PM

Was This Post Helpful? 0
  • +
  • -

#8 skorn1999   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-January 09

Re: How to start process from URL

Posted 12 January 2009 - 01:06 PM

View PostSenseika, on 12 Jan, 2009 - 06:51 AM, said:

Ok. I think this WILL work.
and always remember this :code:
Remember to keep my credits in there!

Prereqs for this program: Knowledge of Copy and Paste, Creating a Button, Creating a Timer and changing its "Interval" to 1000
Option Explicit
'Programmed by Senseika

Private Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Const SW_SHOWNORMAL As Long = 1

Dim URL As String
Dim COUNTER As Integer

Private Sub Command1_Click()
URL = "http://www.google.com/"
Call HYPERLINK(URL)
Timer1.Enabled = True
End Sub

Private Sub Form_Load()
Timer1.Enabled = False
URL = ""
COUNTER = 0
End Sub

Private Sub Timer1_Timer()
COUNTER = COUNTER + 1
URL = "http://www.yahoo.com/"
If COUNTER = 5 Then
	Call HYPERLINK(URL)
ElseIf COUNTER >= 6 Then
	Unload Me
End If
End Sub

' Procedures
Public Sub HYPERLINK(ByVal ADDRESS As String)
Call RunShellExecute("open", ADDRESS, 0&, 0&, SW_SHOWNORMAL)
End Sub

Private Sub RunShellExecute(sTopic As String, sFile As Variant, _
							sParams As Variant, sDirectory As Variant, _
							nShowCmd As Long)

  'execute the passed operation, passing
  'the desktop as the window to receive
  'any error messages
   Call ShellExecute(GetDesktopWindow(), _
					 sTopic, _
					 sFile, _
					 sParams, _
					 sDirectory, _
					 nShowCmd)

End Sub



Now I went to start a new program with a button and I entered your code and it is saying that Unload(Me) is not declared unload(Me) is found under Timer1_Timer(). And I'm not sure if that screws everything up and how the program runs, but I noticed that if I want to load the second page I have to hit the button again. What I wanted was to learn how to click the button once, have the timer keep track of the time since button is clicked and lets say after 2 seconds the second url gets loaded and the first url gets closed and keep the timer on a loop so that every 2 seconds, or whatever interval set; a new url opens and the last one closes. If this is possible IDK. I've been looking for a solution for over a week now and no end in sight. Thank you for your time I really appreciate it.

P.S. "Remember to keep my credits in there!" (I would never think of claiming your code my own).
Was This Post Helpful? 0
  • +
  • -

#9 Senseika   User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 66
  • Joined: 09-January 09

Re: How to start process from URL

Posted 12 January 2009 - 09:31 PM

View Postskorn1999, on 12 Jan, 2009 - 12:06 PM, said:

View PostSenseika, on 12 Jan, 2009 - 06:51 AM, said:

Ok. I think this WILL work.
and always remember this :code:
Remember to keep my credits in there!

Prereqs for this program: Knowledge of Copy and Paste, Creating a Button, Creating a Timer and changing its "Interval" to 1000


Now I went to start a new program with a button and I entered your code and it is saying that Unload(Me) is not declared unload(Me) is found under Timer1_Timer(). And I'm not sure if that screws everything up and how the program runs, but I noticed that if I want to load the second page I have to hit the button again. What I wanted was to learn how to click the button once, have the timer keep track of the time since button is clicked and lets say after 2 seconds the second url gets loaded and the first url gets closed and keep the timer on a loop so that every 2 seconds, or whatever interval set; a new url opens and the last one closes. If this is possible IDK. I've been looking for a solution for over a week now and no end in sight. Thank you for your time I really appreciate it.

P.S. "Remember to keep my credits in there!" (I would never think of claiming your code my own).

Thanks for the PS, are u using VB.Net? and do NOT change the code when creating this is vb 6, create the required components, then copy and paste the code. i pre tested this before submitting, as i would always do, i wudnt give people who really need help false code
Was This Post Helpful? 0
  • +
  • -

#10 skorn1999   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 10-January 09

Re: How to start process from URL

Posted 13 January 2009 - 10:39 AM

Thanks for the PS, are u using VB.Net? and do NOT change the code when creating this is vb 6, create the required components, then copy and paste the code. i pre tested this before submitting, as i would always do, i wudnt give people who really need help false code
[/quote]

I created the button and timer changed the time interval to 1000 do I have to do anything with the button? change anything on that? do I have to change any of the code to the name of the button? and does visual studio 2005 have different languages to it? See I originally posted this topic under visual basic and someone switched it to VB.Net so if Visual basic and VB.net are the same then yes I'm using VB.Net If not then I guess I'm in the wrong section of this site. How do I open a form to use VB.Net if it is offered in visual studio? Because it is still telling me that Unload(me) is not declared. Sorry for confusion and wasting your time. LOL like I said I'm new to programming and there's many things I want to learn. I learn best if I see the code and understand what every part does I do this by screwing around with the code to see what it changes. Of course after it works to begin with :) I've been catching on just timers are completely new to me. Thanks again.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1