Announcement

Collapse
No announcement yet.

Re: Launch Default Browser (all-terrain) in Source Code forum

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Re: Launch Default Browser (all-terrain) in Source Code forum

    ive posted code at http://www.powerbasic.com/support/pb...ad.php?t=23079
    its working fine on my nt4 and 98 boxes here, can anybody tell if it fails to work on any of your computers? i'd like to make it as good as possible
    thanks


    ------------------
    -

  • #2
    Wayne -

    a) I don't understand, what's wrong in ordinary Shellexecute.
    b) Guess that ShellExecute doesn't look to htmlfiles, when you specify http:
    It looks "extention" http.

    Below is a sample of .reg (win2000) to registrate "gavn:..." for ShellExecute
    Code:
    [HKEY_CLASSES_ROOT\gavn]
    @=""
    "URL Protocol"=""
    [HKEY_CLASSES_ROOT\gavn\shell]
    [HKEY_CLASSES_ROOT\gavn\shell\open]
    [HKEY_CLASSES_ROOT\gavn\shell\open\command]
    @="C:\\ltr.01\\ltr.exe" <------------- CHANGE
    ------------------
    E-MAIL: [email protected]

    Comment


    • #3
      Semen, like this?
      Code:
       #COMPILE EXE
       #INCLUDE "win32api.inc"
       FUNCTION PBMAIN() AS LONG
         DIM ret as long
         ret = ShellExecute(ByVal %NULL, "open", "http://www.powerbasic.com" + Chr$(0), ByVal %NULL, ByVal %NULL, %SW_SHOWNORMAL)
       END FUNCTION
      that doesn't work on my NT4 box, but i know it works on other systems including my 98 box so Ive included it


      [This message has been edited by Wayne Diamond (edited July 22, 2001).]
      -

      Comment


      • #4
        I built an address bar, and it did work on NT 4.0, here's some of the code:

        Code:
        'In Wndproc
                Case %IDCOMBOBOX
                      If LoWrd(CbCtlMsg) = %CBN_SELENDOK Then
                           ComboBox Get Text hDlg ,%IDCOMBOBOX To g_szDestURL
                           Array Scan HistArray(1), = g_szDestURL, To HistIndex
                           ComboBox Select hDlg, %IDCOMBOBOX, HistIndex
                           g_Result = ShellExecute(ByVal %NULL, "open", g_szDestURL + Chr$(0), ByVal %NULL, ByVal %NULL,%SW_SHOWMAXIMIZED)
        
                       End If
                       Function = 1
                       Exit Function
        
        'This is if they type it in:
        
        Function CBProc(ByVal hWnd As Long, ByVal wMsg As Long, _
                        ByVal wParam As Long, ByVal lParam As Long) As Long
        Local KeyNum As Long
        
        Select Case wMsg
            Case %WM_KEYDOWN
            Case %WM_CHAR
            Case %WM_KEYUP
            Case %CB_GETDROPPEDSTATE 'get enter key from a %CBS_DROPDOWN combo
                 Control Get Text hDlg ,%IDCOMBOBOX To g_szDestURL
                 Incr lCount
                 HistArray(lCount) = g_szDestURL 'Add to array to write to disk.
        '         ComboBox Add hDlg, %IDCOMBOBOX, g_szDestURL
                 g_Result = ShellExecute(ByVal %NULL, "open", g_szDestURL + Chr$(0), ByVal %NULL, ByVal %NULL,%SW_SHOWMAXIMIZED)
        End Select
        Function = CallWindowProc(OldCBProc, hWnd, wMsg, wParam, lParam)
        End Function
        ------------------
        Scott
        Scott Turchin
        MCSE, MCP+I
        http://www.tngbbs.com
        ----------------------
        True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

        Comment


        • #5
          Scott, could you please post a compileable version of that so i can test it? thanks


          ------------------
          -

          Comment


          • #6
            Which IE release do you use under NT4 ?
            BTW, + CHR$(0) not necessary

            ------------------
            E-MAIL: [email protected]

            Comment


            • #7
              I don't understand, what's wrong in ordinary Shellexecute
              I seem to recall reading somewhere that it may be limited by command-line length constraints of whatever OS your program happens to be running in (e.g. Q198429, Q121059). If you are only planning on using short URLs, it should be sufficient.
              If you try to make something idiot-proof, someone will invent a better idiot.

              Comment


              • #8
                Matthew,
                Thanks for those URLs - they seem to indicate that this would be a more preferential way of calling ShellExecute:
                Code:
                 #COMPILE EXE
                 #INCLUDE "win32api.inc"
                 FUNCTION PBMAIN() AS LONG
                  DIM ret as long
                  DIM szURL AS ASCIIZ * 80
                  szURL = "http://www.powerbasic.com"
                  ret = ShellExecute(ByVal %NULL, "open", szURL, ByVal %NULL, ByVal %NULL, %SW_SHOWNORMAL)
                 END FUNCTION
                But that doesnt work either! Hrmm

                Semen, Im using IE 5.5.0.4522.1800
                I may be able to test it on other machines later tonight, but if it doesn't work on my machine then there's no way I'd release a program with that code to the public, that's why I wanted to get that "all-terrain" version up and running... and so far at least nobody has reported back saying that it DOESNT work (touch wood)


                ------------------
                -

                Comment


                • #9
                  > Im using IE 5.5.0.4522.1800
                  Wayne --
                  Under NT4 (+SP6) I have 5.00.2314.1003 (Rus) and
                  Code:
                  #Compile Exe
                  #Include "WIN32API.INC"
                  Function PbMain() As Long
                   ShellExecute 0, "open", "http://ltr.perevozki.ru", ByVal 0&, ByVal 0&, %SW_SHOWNORMAL
                  End Function
                  works w/o problems.
                  [/B][/QUOTE]

                  Something wrong in your registry. In my I see

                  Code:
                  REGEDIT4
                  
                  [HKEY_CLASSES_ROOT\http]
                  @="URL:Ïðîòîêîë HTTP"
                  "EditFlags"=dword:00000002
                  "Source Filter"="{E436EBB6-524F-11CE-9F53-0020AF0BA770}"
                  "URL Protocol"=""
                  
                  [HKEY_CLASSES_ROOT\http\AnimExtensions]
                  ".ASF"="dxmasf.dll,150"
                  ".ASX"="dxmasf.dll,150"
                  ".ASP"="dxmasf.dll,150"
                  ".LSF"="dxmasf.dll,150"
                  ".NSC"="dxmasf.dll,150"
                  "."="dxmasf.dll,150"
                  
                  [HKEY_CLASSES_ROOT\http\DefaultIcon]
                  @=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,73,79,73,74,65,6d,33,32,5c,75,\
                    72,6c,2e,64,6c,6c,2c,30,00
                  
                  [HKEY_CLASSES_ROOT\http\Extensions]
                  ".ASF"="{6B6D0800-9ADA-11d0-A520-00A0D10129C0}"
                  ".ASX"="{4B428940-263C-11d1-A520-000000000000}"
                  ".ASP"="{4B428940-263C-11d1-A520-000000000000}"
                  ".LSF"="{6B6D0800-9ADA-11d0-A520-00A0D10129C0}"
                  ".NSC"="{4B428940-263C-11d1-A520-000000000000}"
                  ".BECK"="{6B6D0800-9ADA-11d0-A520-00A0D10129C0}"
                  
                  [HKEY_CLASSES_ROOT\http\shell]
                  
                  [HKEY_CLASSES_ROOT\http\shell\open]
                  
                  [HKEY_CLASSES_ROOT\http\shell\open\command]
                  @="\"I:\\PROGRA~1\\INTERN~1\\iexplore.exe\" -nohome"
                  
                  [HKEY_CLASSES_ROOT\http\shell\open\ddeexec]
                  @="\"%1\",,-1,0,,,,"
                  "NoActivateHandler"=""
                  
                  [HKEY_CLASSES_ROOT\http\shell\open\ddeexec\Application]
                  @="IExplore"
                  
                  [HKEY_CLASSES_ROOT\http\shell\open\ddeexec\Topic]
                  @="WWW_OpenURL"
                  ------------------
                  E-MAIL: [email protected]

                  Comment


                  • #10
                    Semen, interesting...
                    If I go Start | Run | www.powerbasic.com, that fails.
                    If i go Start | Run | iexplore.exe www.powerbasic.com, that works

                    "C:\PROGRA~1\MI332F~1\iexplore.exe" -nohome http://www.diamondcs.com.au

                    here's my dump of HKEY_CLASSES_ROOT\http ...

                    Code:
                    [HKEY_CLASSES_ROOT\http]
                    @="URL:HyperText Transfer Protocol"
                    "EditFlags"=dword:00000002
                    "Source Filter"="{E436EBB6-524F-11CE-9F53-0020AF0BA770}"
                    "URL Protocol"=""
                    
                    [HKEY_CLASSES_ROOT\http\AnimExtensions]
                    ".ASF"="dxmasf.dll,150"
                    ".ASX"="dxmasf.dll,150"
                    ".ASP"="dxmasf.dll,150"
                    ".LSF"="dxmasf.dll,150"
                    ".NSC"="dxmasf.dll,150"
                    "."="dxmasf.dll,150"
                    ".ra"="dxmasf.dll,150"
                    ".ram"="dxmasf.dll,150"
                    ".rm"="dxmasf.dll,150"
                    ".rmm"="dxmasf.dll,150"
                    ".wax"="dxmasf.dll,150"
                    ".wm"="dxmasf.dll,150"
                    ".wma"="dxmasf.dll,150"
                    ".wmv"="dxmasf.dll,150"
                    ".wvx"="dxmasf.dll,150"
                    
                    [HKEY_CLASSES_ROOT\http\DefaultIcon]
                    @=hex(2):25,53,79,73,74,65,6d,52,6f,6f,74,25,5c,73,79,73,74,65,6d,33,32,5c,75,\
                      72,6c,2e,64,6c,6c,2c,30,00
                    
                    [HKEY_CLASSES_ROOT\http\Extensions]
                    ".ASF"="{6B6D0800-9ADA-11d0-A520-00A0D10129C0}"
                    ".ASX"="{4B428940-263C-11d1-A520-000000000000}"
                    ".ASP"="{4B428940-263C-11d1-A520-000000000000}"
                    ".LSF"="{6B6D0800-9ADA-11d0-A520-00A0D10129C0}"
                    ".NSC"="{4B428940-263C-11d1-A520-000000000000}"
                    ".BECK"="{6B6D0800-9ADA-11d0-A520-00A0D10129C0}"
                    ".IVF"="{C69E8F40-D5C8-11D0-A520-145405C10000}"
                    ".WAX"="{4B428940-263C-11d1-A520-000000000000}"
                    ".WM"="{6B6D0800-9ADA-11d0-A520-00A0D10129C0}"
                    ".WMA"="{6B6D0800-9ADA-11d0-A520-00A0D10129C0}"
                    ".WVX"="{4B428940-263C-11d1-A520-000000000000}"
                    ".WMV"="{6B6D0800-9ADA-11d0-A520-00A0D10129C0}"
                    
                    [HKEY_CLASSES_ROOT\http\shell]
                    
                    [HKEY_CLASSES_ROOT\http\shell\open]
                    
                    [HKEY_CLASSES_ROOT\http\shell\open\command]
                    @="\"C:\\PROGRA~1\\MI332F~1\\iexplore.exe\" -nohome"
                    
                    [HKEY_CLASSES_ROOT\http\shell\open\ddeexec]
                    @="\"%1\",,-1,0,,,,"
                    
                    [HKEY_CLASSES_ROOT\http\shell\open\ddeexec\Application]
                    @="IExplore"
                    
                    [HKEY_CLASSES_ROOT\http\shell\open\ddeexec\Topic]
                    @="WWW_OpenURL"

                    ------------------
                    -

                    Comment


                    • #11
                      Looks similar to my ... Probably, a problem in another settings.
                      Run uses ShellExecure, so results are the same and on my PC Run works fine also.
                      I see one "simple" way - clean re-installing (NT4 + SP + IE update).
                      To test and then to install all other.




                      ------------------
                      E-MAIL: [email protected]

                      Comment


                      • #12
                        Well rather than reinstalling my operating system I'd rather get some code together that works on all systems including mine (mine might not be the only machine that has this problem), which I've done although Im wondering if I should probably make it use ShellExecute first, and then only if that fails go to the registry, then files etc. Thats probably a better working order
                        I'll post an update soon, thanks Semen


                        [This message has been edited by Wayne Diamond (edited July 23, 2001).]
                        -

                        Comment


                        • #13
                          Originally posted by Wayne Diamond:
                          Well rather than reinstalling my operating system I'd rather get some code together that works on all systems...
                          Please test to see if this works:


                          Code:
                           #Compile Exe
                           #Include "win32api.inc"
                           
                           
                           Function PbMain() As Long
                              Local ret As Long
                              ret = ShellExecute(ByVal %NULL, "open", "C:\redir.htm" + Chr$(0), ByVal %NULL, ByVal %NULL, %SW_SHOWNORMAL)
                           End Function

                          Here is the html file to shell:

                          Code:
                          <html>
                          <head>
                          <title>Test</title>
                          <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
                           <META HTTP-EQUIV="REFRESH" CONTENT="2; URL=http://www.powerbasic.com/">
                          </head>
                          
                          <body bgcolor="#FFFFFF">
                          <center>
                            <p>&nbsp;</p>
                            <p>&nbsp;</p>
                          
                            <b>Connecting to:</b><br>
                          
                            <h1>www.powerbasic.com </h1>
                          
                            <b>&nbsp;&nbsp;&nbsp;&nbsp;p l e a s e&nbsp;&nbsp; w a i t . . .</b> 
                          
                          <br>
                            <a href="http://www.powerbasic.com">Click here if your browser doesn't support 
                            refresh.</a> 
                          </center>
                          <br>
                          <br>
                          </body>
                          </html>


                          ------------------
                          Best Regards
                          Peter Scheutz
                          Best Regards
                          Peter Scheutz

                          Comment


                          • #14
                            Wayne -
                            Could you give the code I posted, a spin on your NT4?
                            I'd really like to know, because we've use it in the past, with no known errors.
                            The html file can be included in distribution or written to a temp file at runtime.



                            ------------------
                            Best Regards
                            Peter Scheutz
                            Best Regards
                            Peter Scheutz

                            Comment

                            Working...
                            X