Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Error specify the lpszIcon in the MSGBOXPARAM using ::LoadIcon

Error specify the lpszIcon in the MSGBOXPARAM using ::LoadIcon

Scheduled Pinned Locked Moved C / C++ / MFC
helplearning
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fantasy1215
    wrote on last edited by
    #1

    In the MSDN, it says below: lpszIcon Identifies an icon resource. This parameter can be either a null-terminated string or an integer resource identifier passed to the MAKEINTRESOURCE macro. To load one of the standard system-defined icons, set the hInstance member to NULL and set lpszIcon to one of the values listed with the LoadIcon function. This member is ignored if the dwStyle member does not specify the MB_USERICON flag.

        MSGBOXPARAMS msgparam = {0};
    msgparam.cbSize = sizeof(MSGBOXPARAMS);
    msgparam.hwndOwner = NULL;
    msgparam.lpszText = \_T("text");
    msgparam.lpszCaption = \_T("caption");
    msgparam.dwStyle = MB\_USERICON | MB\_OK;
    msgparam.hInstance = NULL;
    msgparam.lpszIcon = ::LoadIcon(NULL, IDI\_WINLOGO); I want to use as the MSDN says.Actually I know it will compile error.
    ::MessageBoxIndirect(&msgparam);
    
    C C X 3 Replies Last reply
    0
    • F fantasy1215

      In the MSDN, it says below: lpszIcon Identifies an icon resource. This parameter can be either a null-terminated string or an integer resource identifier passed to the MAKEINTRESOURCE macro. To load one of the standard system-defined icons, set the hInstance member to NULL and set lpszIcon to one of the values listed with the LoadIcon function. This member is ignored if the dwStyle member does not specify the MB_USERICON flag.

          MSGBOXPARAMS msgparam = {0};
      msgparam.cbSize = sizeof(MSGBOXPARAMS);
      msgparam.hwndOwner = NULL;
      msgparam.lpszText = \_T("text");
      msgparam.lpszCaption = \_T("caption");
      msgparam.dwStyle = MB\_USERICON | MB\_OK;
      msgparam.hInstance = NULL;
      msgparam.lpszIcon = ::LoadIcon(NULL, IDI\_WINLOGO); I want to use as the MSDN says.Actually I know it will compile error.
      ::MessageBoxIndirect(&msgparam);
      
      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      :confused: What is the problem ? What is your question in fact ? Di you have a compilation error ? If yes, why don't you simply put the exact error message so we can try to help you ?

      Cédric Moonen Software developer
      Charting control [v1.4] OpenGL game tutorial in C++

      F 1 Reply Last reply
      0
      • F fantasy1215

        In the MSDN, it says below: lpszIcon Identifies an icon resource. This parameter can be either a null-terminated string or an integer resource identifier passed to the MAKEINTRESOURCE macro. To load one of the standard system-defined icons, set the hInstance member to NULL and set lpszIcon to one of the values listed with the LoadIcon function. This member is ignored if the dwStyle member does not specify the MB_USERICON flag.

            MSGBOXPARAMS msgparam = {0};
        msgparam.cbSize = sizeof(MSGBOXPARAMS);
        msgparam.hwndOwner = NULL;
        msgparam.lpszText = \_T("text");
        msgparam.lpszCaption = \_T("caption");
        msgparam.dwStyle = MB\_USERICON | MB\_OK;
        msgparam.hInstance = NULL;
        msgparam.lpszIcon = ::LoadIcon(NULL, IDI\_WINLOGO); I want to use as the MSDN says.Actually I know it will compile error.
        ::MessageBoxIndirect(&msgparam);
        
        C Offline
        C Offline
        CPallini
        wrote on last edited by
        #3

        msgparam.lpszIcon = (LPCTSTR)::LoadIcon(NULL, IDI_WINLOGO);

        ;) [added] BTW: see here [^]. [/added] [added] BTW2: Xing Chen's solution [^] actually works. [/added]

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        modified on Friday, August 1, 2008 3:52 AM

        1 Reply Last reply
        0
        • C Cedric Moonen

          :confused: What is the problem ? What is your question in fact ? Di you have a compilation error ? If yes, why don't you simply put the exact error message so we can try to help you ?

          Cédric Moonen Software developer
          Charting control [v1.4] OpenGL game tutorial in C++

          F Offline
          F Offline
          fantasy1215
          wrote on last edited by
          #4

          //msgparam.lpszIcon = ::LoadIcon(NULL, IDI_WINLOGO); msgparam.lpszIcon = MAKEINTRESOURCE(IDI_WINLOGO); The MSDN has fooled me, or I misunderstand the MSDN words, I should just use MAKEINTRESOURCE, not using ::LoadIcon.

          1 Reply Last reply
          0
          • F fantasy1215

            In the MSDN, it says below: lpszIcon Identifies an icon resource. This parameter can be either a null-terminated string or an integer resource identifier passed to the MAKEINTRESOURCE macro. To load one of the standard system-defined icons, set the hInstance member to NULL and set lpszIcon to one of the values listed with the LoadIcon function. This member is ignored if the dwStyle member does not specify the MB_USERICON flag.

                MSGBOXPARAMS msgparam = {0};
            msgparam.cbSize = sizeof(MSGBOXPARAMS);
            msgparam.hwndOwner = NULL;
            msgparam.lpszText = \_T("text");
            msgparam.lpszCaption = \_T("caption");
            msgparam.dwStyle = MB\_USERICON | MB\_OK;
            msgparam.hInstance = NULL;
            msgparam.lpszIcon = ::LoadIcon(NULL, IDI\_WINLOGO); I want to use as the MSDN says.Actually I know it will compile error.
            ::MessageBoxIndirect(&msgparam);
            
            X Offline
            X Offline
            Xing Chen
            wrote on last edited by
            #5

            set lpszIcon to one of the values listed with the LoadIcon function means: lpszIcon can be one of these value: IDI_APPLICATION IDI_ASTERISK IDI_ERROR IDI_EXCLAMATION IDI_HAND IDI_INFORMATION IDI_QUESTION IDI_WARNING IDI_WINLOGO so you can use them directly. msgparam.lpszIcon = IDI_WINLOGO;

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups