How to check system default browser?

VB.NET

    Next

  • 1. Parameterizing Return Types
    Hi I am storing data type information in a config file as a string. I think the queation I want to ask is "Is it possible to convert it into a Generic Type". So, e.g., I may have a selection of objects in a dictionary Object 1 holds and returns a Boolean Object 2 holds and returns a String Object 3 holds and returns an Integer However, each object gets it return type from the config file. I know that I will have to do a Select Case on the config value at some stage, e.g. Select Case Config.ReturnType Case "Boolean" Return GetType(Boolean) Case "String" Return GetType(String) etc etc I was wanting to store this information so I could issue, e.g. dim myvar = Object1.DataValue(Of Object1.DataType) (yes I know this command is illegal but it sort of shows what I am trying to achieve) so all the type information is completely in each object and I don't have to expose If Object1.IsBoolean Then Return Object1.BooleanValue etc etc I was hoping not to have to implement "DataValue() as Object" but have "stronger" typing on it I don't know whether this is possible, or in fact whether I am going round the houses to something which could be implemented in a much easier way. Thx in advance Simon
  • 2. Type casting
    Hi there, Is there anyone that knows how to do the following? I have a class A and a class B, that 100% inherits from class A (this means that I don't have other code in class B, than the Inherit statement). Now I want to make a Type Casting on an object of the type A, so that object become a B type. I have tryied it, but gets the error 'System.InvalidCastException: Specified cast is not valid.', so want am I missing. Please give a hint. Ren
  • 3. Q Type casting
    Another quick q - sorry to trouble, again ... If I have a class as follows: Public Class MyClass(Of T) Private _myValue as T Public Property MyValue() as T Get Return _myValue End Get Set (value as T) _myValue = value End Set End Property Public Readonly Property MyValue1() as Object Get Return _myValue End Get End Property End Class Dim _myClass as New MyClass(Of String) What is happening, in terms of typecasting/performance (or perhaps wrapping), when I retrieve the _myValue out of the MyValue1 Getter. Thx Simon
  • 4. Textbox Question VS 2008
    I've used textboxes forever in VB but I'm having a problem now with VS 2008. I put a text box on my form and when I tried to reference it in my program, it says I can't refer to an instance member of a class from within a shared method or shared member initializer without an explict instance of the class. I just left the name as TextBox1. I tried to enter TextBox1.text = data, but that doesn't work. Am I missing something obvious?

How to check system default browser?

Postby Tee » Thu, 28 Jul 2005 17:31:25 GMT

Hi,

I need to open a .xml file with system default browser.
But whenever I open the file using Process.Start, it will open the default 
program that handles .xml.

Anyone knows how to detect the default browser so I can use it to open the 
.xml?


Thanks,
Tee 



Re: How to check system default browser?

Postby Fabien Bezagu » Thu, 28 Jul 2005 17:44:01 GMT

Tee,

One idea would be to read the registry the application handling the file 
type htm or html. With Windows XP, this registry key is (for html files)

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\OpenWithList

That's not very elegant but it should work.

Fabien.




% XXXX@XXXXX.COM ...



Re: How to check system default browser?

Postby Herfried K. Wagner [MVP] » Thu, 28 Jul 2005 20:15:36 GMT

"Tee" < XXXX@XXXXX.COM > schrieb:

You could determine the application which is associated with the ".html" 
extension, for example:

Determining a file's associated application
<URL: http://www.**--****.com/ ;

'Process.Start(<file name>)' will open the application associated with the 
file type of the file you pass to the 'Start' method automatically.

-- 
 M S   Herfried K. Wagner
M V P  <URL: http://www.**--****.com/ ;
 V B   <URL: http://www.**--****.com/ ; 


Re: How to check system default browser?

Postby Tee » Fri, 29 Jul 2005 10:51:23 GMT

Thanks for the help guys.









Similar Threads:

1.Making IE / NETSCAPE browser the default browser question?

2.Checking Operating System of Client Browser

This is usually (at least for IE) part of the user agent string. Try
Request.UserAgent.

Patrice

-- 

"rhg68" < XXXX@XXXXX.COM > a crit dans le message de
news: XXXX@XXXXX.COM ...
> Does anyone know if there is a good way to check what operating system is
being used by the client browser and how to get that information back to the
app on the server ????  Is there a way to do this without javascript???
>
> I appreciate any assistance.. Thanks....

3.System.Byte[] And System.__ComObject in AD LDAP Browser

Hello,

 I have a small issue with some of the information returned in an LDAP 
browser. On certain attributes it returns either System.Byte[] And 
System.__ComObject

 I suspect this is a result of the data held. For example i know that 
PwdLastSet attrib attrib is stored as  Int64 values. How do i determine what 
System.Byte[] And System.__ComObject are??

 A little research has yielded the following:

If you use the DirectorySearcher, it marshals AD INTEGER8 types to .NET 
Int64 automatically, so no work needs to be done. This is by far the easiest 
way.

If you use the DirectoryEntry, it marshals the value as an ADSI 
IADsLargeInteger type, which at runtime is a System.__ComObject. This is 
annoying, but you can get the value with a little interop and some data 
munging. This works for me:

dim entry as new DirectoryEntry("LDAP://yourdn here")
dim pwd as object = entry.Properties("pwdLastSet").Value
dim pwdDate as DateTime
pwdDate = DateTime.FromFileTimeUtc(GetInt64FromLargeInteger( pwd))

Function GetInt64FromLargeInteger(byval largeInteger as Object) as Int64

dim low as int32
dim high as int32
dim valBytes(7) as byte

dim longInt as IADsLargeInteger = Ctype(largeInteger, IADsLargeInteger)
low = longInt.LowPart
high = longInt.HighPart

BitConverter.GetBytes(low).CopyTo(valBytes, 0)
BitConverter.GetBytes(high).CopyTo(valBytes, 4)

Return BitConverter.ToInt64(valBytes, 0)

End Function


<ComImport(), Guid("9068270b-0939-11D1-8be1-00c04fd8d503"),
InterfaceTypeAttribute(ComInterfaceType.InterfaceI sDual)> _
public interface IADsLargeInteger
property HighPart as int32
property LowPart as int32
end interface

Note that you can also get the high and low values via reflection and late 
binding or by importing the activeds.dll COM object into .NET.

 Qn: I am new to Vb.net and still learning. How can i incorporate the above 
to return what i need????

MANY MANY THANKS


------------------------------------------------------------- MY CODE 
---------------------------------------------------------------------

Imports System
Imports System.DirectoryServices
Imports System.DirectoryServices.ActiveDirectory
Imports System.Windows.Forms


Public Class LDAPBrowser

    Private Base As DirectoryEntry
    Private str As String()

    Private Sub LDAPBrowser_Load(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles MyBase.Load

        Connect()

    End Sub

    Private Sub tvwADStructure_AfterSelect(ByVal sender As System.Object, 
ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles 
tvwADStructure.AfterSelect

        'Fill the TreeView dynamic after Click 
        If e.Node.Nodes.Count = 0 Then

            Dim parent As DirectoryEntry = DirectCast(e.Node.Tag, 
DirectoryEntry)

            If parent IsNot Nothing Then

                If parent.Children IsNot Nothing Then

                    For Each Iter As DirectoryEntry In parent.Children

                        Dim childNode As TreeNode = 
e.Node.Nodes.Add(Iter.Name)

                        childNode.Tag = Iter

                    Next
                End If
            End If
        End If

        'Fill the ListView Element 
        Try

            Dim list As DirectoryEntry = DirectCast(e.Node.Tag, 
DirectoryEntry)

            If list IsNot Nothing Then

                lstAttribs.Clear()

                'Add some information to ListView ELement 
                lstAttribs.Columns.Add("Attribute", 90, 
HorizontalAlignment.Left)
                lstAttribs.Columns.Add("Value", 350, HorizontalAlignment.Left)


                For Each listIter As Object In list.Properties.PropertyNames

                    For Each Iter As Object In 
list.Properties(listIter.ToString())
                        Dim item As New 
System.Windows.Forms.ListViewItem(listIter.ToString(), 0)

                        item.SubItems.Add(Iter.ToString())

                        lstAttribs.Items.AddRange(New ListViewItem() {item})

                    Next
                Next
            End If

        Catch ex As System.Exception

            MessageBox.Show(ex.Message)

        End Try

    End Sub

    Private Sub Connect()

        'Pass Connect info to DirectoryEntry object: 

        Base = New DirectoryEntry("LDAP://XX.XXXXX.com")

        'Read the root: 
        If Base IsNot Nothing Then

            tvwADStructure.Nodes.Clear()
            tvwADStructure.BeginUpdate()

            Dim childNode As TreeNode = tvwADStructure.Nodes.Add(Base.Name)
            childNode.Tag = Base

            Try
                For Each rootIter As DirectoryEntry In Base.Children

                    Dim RootNode As TreeNode = 
childNode.Nodes.Add(rootIter.Name)

                    RootNode.Tag = rootIter
                Next
            Finally

                childNode.Expand()

                tvwADStructure.EndUpdate()

            End Try
        End If

    End Sub

End Class

4.How to change the system default printer to Landscape system wide

I want to programmatically change the paper orientation of the systems 
default printer in such a way that the new orientation shows for the printer 
under:

Start/Printer and Faxes

Can anyone tell me how to do that?


I have some unmanaged code that no longer works for some unknown reason.



Thanks 


5.TREE VIEW DEFAULT NODE CHECK IF ANY ONE CHECK

hi all ,

i m trying to make such a tree view which specify some
folder structure  for installation

i mean there is some folders mandatory. This is installation software.
is based upon user choice, what he will check only
those folders will be install not others.

A--|
   |-A1
   |-A2
   |-A3
   |-A4

B--|
   |-B1
   |-B2
   |-B3
   |-B4
C--|
   |-C1
   |-C2
   |-C3
   |-C4

suppose all 2's mean A2,B2,C2 are mandatory mean they should install
in theire respective field like A ,B , C installtion.

at start we are not showing any check mark with mandatory folder

but if user chek A1 then A2 should be automatic checked at that time
(bcoz its mandatory
)same concept
if user uncheck A1 then A2 unchecked bcoz he doesnt want to install
any part of folder A.

one more example when he check
B3 then B2 will automatic chek(mandatory folder) but since user
chechked
 B3 so now
he cant unchek B2 untill he unchecks B3.

suppose he cheks B3 then B2 must cheked now he can check any number of
folder here.like B4 and B1 also but
conclusion is that if any node  checked apart from mandatory node
then mandatory will be checked otherwise not

hope u got my problem .. can anyone suggest me some idea or code
for any help i would like to thanks in advance.

6. Opening Default Browser to a specific page

7. Email attachments using default browser

8. Launch web site with default browser....



Return to VB.NET

 

Who is online

Users browsing this forum: No registered users and 26 guest