Get the current URL and Set URL in Creo Browser Window using VB API

Using VB API we can get and set the URL in the browser window.

To Get URL use the following API function

Function GetURL() as String

Returns the URL displayed in the embedded web browser.

Returns:
The URL.

To Set URL use the following API function

Sub SetURL (URL as String)
 
Sets the URL displayed in the embedded web browser.
Parameters:
URL
The URL to display in the browser

Code Sample

Get & Set Browser URL using VB API
	' VARIABLE DECLARATION REQUIRED

	Public AConnection As IpfcAsyncConnection
	Public BSession As IpfcBaseSession


    Private Sub btn_GetURL_Click(sender As Object, e As RoutedEventArgs)
        Try

        ' AConnection must be declared at the time of Creo Connect or Creo Start function
  
            BSession = AConnection.Session
            Dim IWindows As IpfcWindow = BSession.CurrentWindow
            lb_URLWindow.Content = "URL : " & IWindows.GetURL
        Catch ex As Exception
            MessageBox.Show(ex.ToString, "Failure")
        End Try
    End Sub

    Private Sub btn_SetURL_Click(sender As Object, e As RoutedEventArgs)
        Try

        ' AConnection must be declared at the time of Creo Connect or Creo Start function
  
  
            BSession = AConnection.Session
            Dim IWindows As IpfcWindow = BSession.CurrentWindow
            IWindows.SetURL(tb_SetURL.Text)
        Catch ex As Exception
            MessageBox.Show(ex.ToString, "Failure")
        End Try
    End Sub

 

Thanks & Regards

Parthiban Kannan

Follow me in Linkedin!

 

Share Now
  •  
  •  
  •  
  •  
  •  
  •  

Leave a Reply