Solved

TASKBAR/ICON INCLUSION

Posted on 2001-06-13
7
240 Views
Last Modified: 2010-05-18
Got this thing to run, compile, and package...even installs and runs on other machines...but would be nice to have an icon on the desktop, and better yet, to show up on the taskbar when the application is running...how to I make this happen


(thanks for the help...the points a almost gone, but the program almost works!!)

0
Comment
Question by:phred_the_cat
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 2

Expert Comment

by:kiprimshot
ID: 6187568
You can set the icon for your project by going to Project on the menu and choosing the properties of it..  Go to the make tab and then there should be a drop down to choose the icon of the form you would like to use..

Then remake your exe and that should do the trick!

hope this helps
0
 

Author Comment

by:phred_the_cat
ID: 6187717
But How do I get the install to put icon on desktop?
0
 
LVL 2

Expert Comment

by:kiprimshot
ID: 6187898
That is trickier than you think...there is no simple way to do that.  All I do is create the shortcut and put it on the desktop.  

Its not impossible though
0
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 
LVL 3

Expert Comment

by:jrspano
ID: 6187980
what kind of install package are you using?
0
 
LVL 2

Expert Comment

by:Microsoft
ID: 6188965
easy to put a icon on the desktop.

if you are writing this to a cd rom

alls you do is create a batch file called install.bat

in the batch file firstly make sure you put the SETUP.EXE in there which will start to unpack your project.

to put an icon create on your computer the icon and shortcut on your desk top where the project unpacks to.

the go to c:\windows\desktop\

your should see your icon short cut name .LNK

make sure you copy that to your cd rom and then insert this into your install.bat file copy *.lnk c:\windows\desktop.
so what you should have

a file called
 INSTALL.BAT
COPY *.LNK C:\WINDOWS\DESKTOP
SETUP.EXE

that file will unpack your project cab file from off the cd rom and copy the lnk file which includes the icol to the new pc's desktop upon finishing installation.

but remember you must create this on your pc first and copy the lnk file from out of the desktop directory and create the install.bat file and write it to your cd rom.

that will do the trick

how do i know

because thats what i do to my programs which i write. and that works really well for me.

well it must do the job as my programs are sold to commercial company's.

Many Thanks

Andy
0
 
LVL 2

Accepted Solution

by:
Microsoft earned 50 total points
ID: 6189134
ps the following code allows you to add an icon to the task tray in otherwords the taskbar by the clock

'Declare a user-defined variable to pass to the Shell_NotifyIcon
'function.
Private Type NOTIFYICONDATA
   cbSize As Long
   hWnd As Long
   uId As Long
   uFlags As Long
   uCallBackMessage As Long
   hIcon As Long
   szTip As String * 64
End Type

'Declare the constants for the API function. These constants can be
'found in the header file Shellapi.h.

'The following constants are the messages sent to the
'Shell_NotifyIcon function to add, modify, or delete an icon from the
'taskbar status area.
Private Const NIM_ADD = &H0
Private Const NIM_MODIFY = &H1
Private Const NIM_DELETE = &H2

'The following constant is the message sent when a mouse event occurs
'within the rectangular boundaries of the icon in the taskbar status
'area.
Private Const WM_MOUSEMOVE = &H200

'The following constants are the flags that indicate the valid
'members of the NOTIFYICONDATA data type.
Private Const NIF_MESSAGE = &H1
Private Const NIF_ICON = &H2
Private Const NIF_TIP = &H4

'The following constants are used to determine the mouse input on the
'the icon in the taskbar status area.

'Left-click constants.
Private Const WM_LBUTTONDBLCLK = &H203   'Double-click
Private Const WM_LBUTTONDOWN = &H201     'Button down
Private Const WM_LBUTTONUP = &H202       'Button up

'Right-click constants.
Private Const WM_RBUTTONDBLCLK = &H206   'Double-click
Private Const WM_RBUTTONDOWN = &H204     'Button down
Private Const WM_RBUTTONUP = &H205       'Button up

'Declare the API function call.
Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean

'Dimension a variable as the user-defined data type.
Dim nid As NOTIFYICONDATA

' create a form named Form1
' add a commond dialog control named CommonDialog1
' add two command buttons named Command1 and Command2

Private Sub Command1_Click()
   'Click this button to add an icon to the taskbar status area.

   'Set the individual values of the NOTIFYICONDATA data type.
   nid.cbSize = Len(nid)
   nid.hWnd = Form1.hWnd
   nid.uId = vbNull
   nid.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
   nid.uCallBackMessage = WM_MOUSEMOVE
   nid.hIcon = Form1.Icon
   nid.szTip = "Taskbar Status Area Sample Program" & vbNullChar

   'Call the Shell_NotifyIcon function to add the icon to the taskbar
   'status area.
   Shell_NotifyIcon NIM_ADD, nid
End Sub

Private Sub Command2_Click()
   'Click this button to delete the added icon from the taskbar
   'status area by calling the Shell_NotifyIcon function.
   Shell_NotifyIcon NIM_DELETE, nid
End Sub

Private Sub Form_Load()
   'Set the captions of the command button when the form loads.
   Command1.Caption = "Add an Icon"
   Command2.Caption = "Delete Icon"
End Sub

Private Sub Form_Terminate()
   'Delete the added icon from the taskbar status area when the
   'program ends.
   Shell_NotifyIcon NIM_DELETE, nid
End Sub

Private Sub Form_MouseMove _
   (Button As Integer, _
    Shift As Integer, _
    X As Single, _
    Y As Single)
    'Event occurs when the mouse pointer is within the rectangular
    'boundaries of the icon in the taskbar status area.
    Dim msg As Long
    Dim sFilter As String
    msg = X / Screen.TwipsPerPixelX
    Select Case msg
       Case WM_LBUTTONDOWN
       Case WM_LBUTTONUP
       Case WM_LBUTTONDBLCLK
       CommonDialog1.DialogTitle = "Select an Icon"
       sFilter = "Icon Files (*.ico)|*.ico"
       sFilter = sFilter & "|All Files (*.*)|*.*"
       CommonDialog1.Filter = sFilter
       CommonDialog1.ShowOpen
       If CommonDialog1.FileName <> "" Then
          Form1.Icon = LoadPicture(CommonDialog1.FileName)
          nid.hIcon = Form1.Icon
          Shell_NotifyIcon NIM_MODIFY, nid
       End If
       Case WM_RBUTTONDOWN
          Dim ToolTipString As String
          ToolTipString = InputBox("Enter the new ToolTip:", "Change ToolTip")
          If ToolTipString <> "" Then
             nid.szTip = ToolTipString & vbNullChar
             Shell_NotifyIcon NIM_MODIFY, nid
          End If
       Case WM_RBUTTONUP
       Case WM_RBUTTONDBLCLK
    End Select
End Sub

and that should do it.

cut & paste the code but follow my instructions to what to setup on your form. this will give you some idea how add an icon to the task bar.


dont listen to what others tell you that it aint possible to add icons to the task tray because it is really easy,

cheers
Andy
0
 

Author Comment

by:phred_the_cat
ID: 6191177
Thanks man!...worked great...but till I can not get it to show up on the bar at the bottom (the one that appears when a program is running, and goes away when you close it...still working this one)

thanks
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
DIR issue 7 54
Cannot Load VB6 on Windows 10. Installed OK but error on opening existing project. 7 87
Automatic Email Reminder 4 38
RUNRMTCMD from AS/400 12 47
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question