Thread: Taskbar Icons

  1. #1
    Registered User mikeman118's Avatar
    Join Date
    Aug 2007
    Posts
    183

    Taskbar Icons

    Hi,

    I have been trying to implement a taskbar icon into my application. I'm trying to use the class I found here. I so far just have the dialog show up, and create a CSysTrayIcon object. That's all. However, when I compile I get these errors:

    Code:
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(43) : error C2504: 'CWnd' : base class undefined
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(45) : error C2143: syntax error : missing ';' before 'public'
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(45) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(45) : warning C4183: 'DECLARE_MESSAGE_MAP': missing return type; assumed to be a member function returning 'int'
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(64) : error C2146: syntax error : missing ';' before identifier 'LRESULT'
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(64) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(66) : error C2146: syntax error : missing ';' before identifier 'GetMouseScreenPt'
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(66) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(66) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(66) : warning C4183: 'GetMouseScreenPt': missing return type; assumed to be a member function returning 'int'
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(110) : error C2061: syntax error : identifier 'CMenu'
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(111) : error C2061: syntax error : identifier 'CPoint'
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(112) : error C2061: syntax error : identifier 'CPoint'
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(113) : error C2061: syntax error : identifier 'CPoint'
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(114) : error C2061: syntax error : identifier 'CPoint'
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(115) : error C2061: syntax error : identifier 'CPoint'
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(116) : error C2061: syntax error : identifier 'CPoint'
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(117) : error C2061: syntax error : identifier 'CPoint'
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(118) : error C2061: syntax error : identifier 'CPoint'
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(119) : error C2061: syntax error : identifier 'CPoint'
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(120) : error C2061: syntax error : identifier 'CPoint'
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\time watcher.cpp(4) : error C2248: 'CSysTrayIcon::CSysTrayIcon' : cannot access protected member declared in class 'CSysTrayIcon'
    1>        c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(106) : see declaration of 'CSysTrayIcon::CSysTrayIcon'
    1>        c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(85) : see declaration of 'CSysTrayIcon'
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\time watcher.cpp(4) : error C2248: 'CSysTrayIcon::~CSysTrayIcon' : cannot access protected member declared in class 'CSysTrayIcon'
    1>        c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(107) : see declaration of 'CSysTrayIcon::~CSysTrayIcon'
    1>        c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\systrayicon.h(85) : see declaration of 'CSysTrayIcon'
    1>c:\documents and settings\michael\michael's documents\visual studio 2008\projects\time watcher\time watcher.cpp(13) : warning C4060: switch statement contains no 'case' or 'default' labels
    1>Build log was saved at "file://c:\Documents and Settings\Michael\Michael's Documents\Visual Studio 2008\Projects\Time Watcher\Debug\BuildLog.htm"
    1>Time Watcher - 21 error(s), 3 warning(s)
    I have the platform SDK installed. Can anyone tell me what's wrong? Thanks.

  2. #2
    Registered User
    Join Date
    Mar 2007
    Posts
    416
    Some of those are simple like the missing ';' before/after something. The other ones that say syntax error look like errors that happens in a resource file. Did you properly declare all the variables from the CodeProject snippets? Some even say missing type specifier. Some thing I've noticed with the CodeProject's examples is they are not always plug and play. Read the errors carefully and look through your code.

  3. #3
    Registered User mikeman118's Avatar
    Join Date
    Aug 2007
    Posts
    183
    Ok, I've found out what was wrong: I was including something that was already included, which I guess must cause problems. However, I have one more question. Now, I don't know if anyone will be able to answer this since I doubt that many have messed around with this code, but I'll try anyway. I'm trying to create a "CSysTrayIcon" object, and here is a quote from the website:
    Create an object of class CSysTrayIcon.
    Now, I try to do that and I get "missing type specifier" errors. I assume that I'm not supposed to be creating that type of object, but then I'm not sure what the documentation meant. Can anyone clear this up? Thanks.

  4. #4
    Registered User mikeman118's Avatar
    Join Date
    Aug 2007
    Posts
    183
    I also have one other problem. When I try to compile it without trying to create an object, it first told me that I was missing "mfc42d.lib". I searched for that file, found it, and added the directory to VC++. However, I now get the following error:
    Code:
    mfc42d.lib(MFC42D.DLL) : fatal error LNK1112: module machine type 'IA64' conflicts with target machine type 'X86'
    I know that this is an MFC library, but I don't know how that affects anything. Can anyone help? Thanks.

  5. #5
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    In case you're still having problems:

    The missing classes etc. from your first post are part of MFC, which is a Microsoft wrapper around the Windows API.

    >>Now, I try to do that and I get "missing type specifier" errors.
    Are you including systrayicon.h?

    >>module machine type 'IA64' conflicts with target machine type 'X86'
    Looks like the library is built for a 64-bit platform, while you're trying to compile for 32-bit.

    Sorry I can't be of more help; I've never used MFC before myself.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Hunter2 View Post
    >>module machine type 'IA64' conflicts with target machine type 'X86'
    Looks like the library is built for a 64-bit platform, while you're trying to compile for 32-bit.
    More specifically, the OP is trying to build for Itanium, and linking that with X86 32-bit code. Obviously, ALL of the code for a particular project needs to be compiled for ONE architecture, either X86, X64 or IA64 (or Alpha if you have an old compiler).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. [C] Problem with icons in a toolbar
    By pc2-brazil in forum Windows Programming
    Replies: 3
    Last Post: 12-22-2008, 11:04 PM
  2. Getting Icons from the Desktop
    By Mastadex in forum Windows Programming
    Replies: 6
    Last Post: 08-29-2007, 04:33 PM
  3. Replies: 0
    Last Post: 11-08-2005, 02:28 AM
  4. Taskbar
    By publikum in forum Windows Programming
    Replies: 3
    Last Post: 11-12-2004, 12:57 PM
  5. Problem with an icon in the TaskBar status area
    By dit6a9 in forum Windows Programming
    Replies: 2
    Last Post: 08-16-2004, 10:33 PM