Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

Internet address bar

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

  • Internet address bar

    Much like the Win98 Address bar on the taskbar (If you enable it), this does about the same thing with no history.

    Just something I threw together because I was bored, under NT though this might come in handy.

    Code:
    ' ** Eliminate unnecessary macros
    %NOANIMATE    = 1
    %NODRAGLIST   = 1
    %NOHEADER     = 1
    %NOIMAGELIST  = 1
    %NOLISTVIEW   = 1
    %NOTABCONTROL = 1
    %NOTRACKBAR   = 1
    %NOTREEVIEW   = 1
    %NOUPDOWN     = 1
    
    '------------------------------------------------------------------------------
    #Dim All
    #Compile Exe
    #Option Version4
    #Register None
    #Include "CCS.INC"
    #Include "commctrl.inc"
    #Resource "ADDRBAR.PBR"
    
    %PROGRAM = 1024
    %HAND    = 2005
    %WM_TRAYICON    = %WM_USER + 400
    
    '* FILE
    %IDM_EXIT            = %WM_USER       + 2048
    '* HELP
    %IDM_HELP             = %IDM_EXIT     + 1       ' Help
    %IDM_ABOUT            = %IDM_HELP     + 1       ' About Program.Exe
    
    
    %ID_URLTEXT           = %WM_USER + 101
    %ID_HIDDEN            = %WM_USER + 102
    Global g_hInst      As Long
    Global hDlg         As Long
    Global aDlg         As Long
    Global hEdit        As Long
    Global hMenu        As Long
    Global pMenu        As Long
    Global hIcon        As Long
    Global hStatus      As Long
    Global g_Result     As Long
    
    Global g_szURL      As String 'My URL
    Global g_szDestURL  As String
    '------------------------------------------------------------------------------
    Declare CallBack Function DialogProc() As Long
    
    
    '------------------------------------------------------------------------------
    
    Function WinMain (ByVal hInstance     As Long, _
                      ByVal hPrevInstance As Long, _
                      lpCmdLine           As Asciiz Ptr, _
                      ByVal iCmdShow      As Long) As Long
    
    Local szClassName As Asciiz * 80
    Local wndclass          As WndClassEx
    InitCommonControls
    Call InitUrlCtrl
    
    
      g_szCCS                = "Computer Creations Software"
      g_szMine               = "Internet Address Bar"
      g_hInst                = hInstance
      szClassName            = "ADDRBAR"
      g_szVer                = "v1.10"
      g_szCopyrite           = "Copyright © 2000"
      g_szURL                = "http://www.tngbbs.com"
      %HK                    = %HKEY_LOCAL_MACHINE
    
      hIcon = LoadIcon(g_hInst, ByVal %PROGRAM)
    
      wndclass.cbSize        = SizeOf(WndClass)
      wndclass.style         = %CS_HREDRAW Or %CS_VREDRAW
      wndclass.lpfnWndProc   = CodePtr( DialogProc )
      wndclass.cbClsExtra    = 0
      wndclass.cbWndExtra    = 0
      wndclass.hInstance     = hInstance
      wndclass.hIcon         = hIcon
      wndclass.hCursor       = LoadCursor( %NULL, ByVal %IDC_ARROW )
      wndclass.hbrBackground = GetStockObject( %HOLLOW_BRUSH )
      wndclass.lpszMenuName  = %NULL
      wndclass.lpszClassName = VarPtr( szClassName )
      wndclass.hIconSm       = LoadIcon( hInstance, ByVal %IDI_APPLICATION )
      RegisterClassEx wndclass
    
    hMenu = LoadMenu(g_hInst, "MAINMENU")
    pMenu = GetSubMenu(LoadMenu(g_hInst, "POPUPMENU"), 0)
    
    Dialog New 0, g_szMine,0,0, 300,30, %WS_MINIMIZEBOX Or %WS_CAPTION Or %WS_SYSMENU Or %WS_EX_LEFT  To hDlg
    Control Add TextBox, hDlg,%ID_URLTEXT,"", 5,1,290,14
    Control Add Button, hDlg, %ID_HIDDEN,"&Launch",5,50,45,14,%BS_DEFAULT
    Dialog Send hDlg, %WM_SETICON, %ICON_BIG, hIcon
    Menu Attach hMenu, hDlg
    Dialog Show Modal hDlg Call DialogProc To g_Result
    End Function  ' WinMain
    
    '------------------------------------------------------------------------------
    CallBack Function DialogProc() As Long
    Local wMsg            As Long
    Local wParam          As Long
    Local lParam          As Long
    Static zText           As Asciiz * 255
    Static ti    As NOTIFYICONDATA
    Static p     As POINTAPI
    
    
    wMsg = CbMsg
    lParam = CbLparam
    wparam = CbWparam
    
      Select Case wMsg
    
        Case %WM_CREATE
        Case %WM_INITDIALOG
    '        SetWindowPos hDlg, %HWND_NOTOPMOST, 0, 0, 0, 0, %SWP_NOMOVE Or %SWP_NOSIZE
            SetWindowPos hDlg, %HWND_TOPMOST, 0, 0, 0, 0, %SWP_NOMOVE Or %SWP_NOSIZE
            ' ** Add tray icon
            ti.cbSize           = SizeOf(ti)
            ti.hWnd             = hDlg
            ti.uID              = g_hInst
            ti.uFlags           = %NIF_ICON Or %NIF_MESSAGE Or %NIF_TIP
            ti.uCallbackMessage = %WM_TRAYICON
            ti.hIcon            = hIcon
            ti.szTip            = g_szMine + " " + g_szVer
            Shell_NotifyIcon %NIM_ADD, ti
            DestroyIcon ti.hIcon
    
    
        Case %WM_DESTROY
          Function = 0
          Exit Function
    
        Case %WM_SETFOCUS
    
        Case %WM_MENUSELECT
    
        Case %WM_SIZE
    
        Case %WM_COMMAND
          Select Case LoWrd(wParam)
            Case %ID_HIDDEN   'Launch
              Control Get Text hDlg, %ID_URLTEXT To g_szDestURL
              g_Result = ShellExecute(ByVal %NULL, "open", g_szDestURL + Chr$(0), ByVal %NULL, ByVal %NULL,%SW_SHOWMAXIMIZED)
    
    
            Case %IDM_EXIT
                     Select Case CbCtlMsg
                         Case %BN_CLICKED
                              Shell_NotifyIcon %NIM_DELETE, ti
                              Dialog End hDlg,1
                     End Select
    
            Case %IDM_HELP
    
                 Function = 0
                 Exit Function
            Case %IDM_ABOUT
                 g_Result = CCSShellAbout(hDlg, _
                                 %FALSE,_
                                 g_szMine,_
                                 g_szVer,_
                                 g_szCCS,_
                                 g_szCopyrite,_
                                 g_szURL,_
                                 hIcon)
              Function = 0
              Exit Function
    
          End Select
    
        Case %WM_TRAYICON
    
          Select Case LoWrd(lParam)
    
            ' ** Left button press
            Case %WM_LBUTTONDOWN
            Case %WM_LBUTTONUP, %WM_LBUTTONDBLCLK
              If IsWindowVisible(hDlg) = %FALSE Then
                ShowWindow hDlg, %SW_SHOW Or %SW_SHOWNORMAL
              End If
    
            ' ** Right button press
            Case %WM_RBUTTONDOWN
              If IsWindowVisible(hDlg) = %FALSE Then
                SetForegroundWindow hDlg
                GetCursorPos p
                TrackPopupMenu pMenu, 0, p.x, p.y, 0, hDlg, ByVal %NULL
                Postmessage hDlg, %WM_NULL, 0, 0
              End If
            Function = 1
    
          End Select
    
        Case %WM_SYSCOMMAND
    
          ' ** If either the minimize or close buttons are pressed, hide the
          '    window so it doesn't appear in the task bar.
    
          Select Case LoWrd(wParam)
    
            Case %SC_MINIMIZE
              ShowWindow hDlg, %SW_HIDE
              Function = 1
              Exit Function
    
            Case %SC_CLOSE
              Shell_NotifyIcon %NIM_DELETE, ti
              Dialog End CbHndl, 1
              Exit Function
    
          End Select
    
      End Select
    End Function

    ------------------
    Scott
    mailto:[email protected][email protected]</A>
    MCSE, MCP+Internet
    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

  • #2
    Also note, you can download the entire package including icon etc at http://www.tngbbs.com/pb/pbaddrbar.zip

    And one other note, the CCSSHELLABOUT is in a DLL, you'll have to create your own or use the Winapi call.
    Replace #Include "CCS.INC" with #Include "Win32api.inc".


    The Resource file for it:

    Code:
    #include "resource.h"
    #define PROGRAM 1024
    #define HAND     2005
    
    PROGRAM  ICON    DISCARDABLE     "GLOBE4.ICO"
    HAND     CURSOR    "HNODROP.CUR"
    
    
    //* FILE
    #define IDM_EXIT              WM_USER + 2048
    //* HELP
    #define IDM_HELP              IDM_EXIT      + 1       // Help
    #define IDM_ABOUT             IDM_HELP      + 1       // About box
    
    
    STRINGTABLE LOADONCALL MOVEABLE
      BEGIN
        IDM_EXIT,       "Exit"
        IDM_HELP,       "Help"
        IDM_ABOUT,      "About Address Bar"
      END
    
    MAINMENU MENU LOADONCALL MOVEABLE
      BEGIN
        POPUP "&File"
          BEGIN
            MENUITEM "E&xit",                        IDM_EXIT
          END
        POPUP "&Help", HELP
          BEGIN
            MENUITEM "&Help",                        IDM_HELP
            MENUITEM "&About",                       IDM_ABOUT
          END
      END
    
    VS_VERSION_INFO VERSIONINFO
    FILEVERSION 1, 1, 0, 0
    PRODUCTVERSION 1, 1, 0, 0
    FILEOS VOS_WINDOWS32
    FILETYPE VFT_APP
    BEGIN
      BLOCK "StringFileInfo"
      BEGIN
        BLOCK "040904E4"
        BEGIN
          VALUE "CompanyName",      "Computer Creations Software\000"
          VALUE "FileDescription",  "Application\000"
          VALUE "FileVersion",      "01.10\000"
          VALUE "InternalName",     "ADDRBAR\000"
          VALUE "OriginalFilename", "ADDRBAR.EXE\000"
          VALUE "LegalCopyright",   "Copyright © 1999 Computer Creations Software\000"
          VALUE "LegalTrademarks",  "\000"
          VALUE "ProductName",      "Address Bar\000"
          VALUE "ProductVersion",   "01.10\000"
          VALUE "Comment",		"This is an unsupported FreeWare application"
        End
      End
    End
    
    POPUPMENU MENU
      BEGIN
        POPUP "&Tray"
          BEGIN
            MENUITEM "&About Address Bar",					IDM_ABOUT
            MENUITEM SEPARATOR
            MENUITEM "Exit Address Bar",		  			IDM_EXIT
          END
      END
    ------------------
    Scott
    mailto:[email protected][email protected]</A>
    MCSE, MCP+Internet
    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


    • #3
      Scott,

      The file is missing from your web site.

      --Dave


      ------------------
      Home of the BASIC Gurus
      www.basicguru.com
      Home of the BASIC Gurus
      www.basicguru.com

      Comment

      Working...
      X