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. set wallpaper

set wallpaper

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
17 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.
  • A ashish dogra

    thanks sir but can you tell me the code for this Ashish Dogra MCA Noida

    H Offline
    H Offline
    Hamid Taebi
    wrote on last edited by
    #4

    you answerd always "can you tell me the code for this" yes include atlImage.h CImage m_Image; m_Image.Load(filename); m_Image.BitBlt(dc.m_hDC,CRect(0,0,800,600),CPoint(0,0)); use this code in WM_PAINT_**


    **_

    whitesky


    A 1 Reply Last reply
    0
    • H Hamid Taebi

      you answerd always "can you tell me the code for this" yes include atlImage.h CImage m_Image; m_Image.Load(filename); m_Image.BitBlt(dc.m_hDC,CRect(0,0,800,600),CPoint(0,0)); use this code in WM_PAINT_**


      **_

      whitesky


      A Offline
      A Offline
      ashish dogra
      wrote on last edited by
      #5

      sir this will give error as : fatal error C1083: Cannot open include file: 'AtlImage.g': No such file or directory as i use 'AtlImage.h' Ashish Dogra MCA Noida -- modified at 6:41 Tuesday 11th July, 2006

      H 1 Reply Last reply
      0
      • A ashish dogra

        thanks sir but can you tell me the code for this Ashish Dogra MCA Noida

        P Offline
        P Offline
        Parthi_Appu
        wrote on last edited by
        #6

        You can do it by handling WM_CTLCOLOR Follow the below steps, CBitmap m_hBitmap; //Declare in class m_hBitmap.LoadBitmap(filename); // Add this in Constructor m_hBitmap.DeleteObject(); // Add this in Destructor Use the following code in WM_CTLCOLOR handler, before the return statement if (CTLCOLOR_DLG == nCtlColor) //nCtlColor is the 'in' parameter { hbr = ::CreatePatternBrush((HBITMAP)m_hBitmap.m_hObject); }

        A 1 Reply Last reply
        0
        • A ashish dogra

          sir this will give error as : fatal error C1083: Cannot open include file: 'AtlImage.g': No such file or directory as i use 'AtlImage.h' Ashish Dogra MCA Noida -- modified at 6:41 Tuesday 11th July, 2006

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #7

          You need to include AtlImage.h_**


          **_

          whitesky


          A 2 Replies Last reply
          0
          • H Hamid Taebi

            You need to include AtlImage.h_**


            **_

            whitesky


            A Offline
            A Offline
            ashish dogra
            wrote on last edited by
            #8

            yes sir i include AtlImage.h plz solve my problem Ashish Dogra MCA Noida -- modified at 8:01 Tuesday 11th July, 2006

            D 1 Reply Last reply
            0
            • P Parthi_Appu

              You can do it by handling WM_CTLCOLOR Follow the below steps, CBitmap m_hBitmap; //Declare in class m_hBitmap.LoadBitmap(filename); // Add this in Constructor m_hBitmap.DeleteObject(); // Add this in Destructor Use the following code in WM_CTLCOLOR handler, before the return statement if (CTLCOLOR_DLG == nCtlColor) //nCtlColor is the 'in' parameter { hbr = ::CreatePatternBrush((HBITMAP)m_hBitmap.m_hObject); }

              A Offline
              A Offline
              ashish dogra
              wrote on last edited by
              #9

              thanks but it does not work but i use this code and no wallpaper is appeared CBitmap m_hBitmap; //Declare in class m_hBitmap.LoadBitmap("D:\\pics\\image001.jpg); if (CTLCOLOR_DLG == nCtlColor) //nCtlColor is the 'in' parameter { hbr = ::CreatePatternBrush((HBITMAP)m_hBitmap.m_hObject); } Ashish Dogra MCA Noida -- modified at 7:48 Tuesday 11th July, 2006

              P 1 Reply Last reply
              0
              • A ashish dogra

                thanks but it does not work but i use this code and no wallpaper is appeared CBitmap m_hBitmap; //Declare in class m_hBitmap.LoadBitmap("D:\\pics\\image001.jpg); if (CTLCOLOR_DLG == nCtlColor) //nCtlColor is the 'in' parameter { hbr = ::CreatePatternBrush((HBITMAP)m_hBitmap.m_hObject); } Ashish Dogra MCA Noida -- modified at 7:48 Tuesday 11th July, 2006

                P Offline
                P Offline
                Parthi_Appu
                wrote on last edited by
                #10

                that will work if you have the bitmap in the resource. if you are using the bitmap from file, then use the following code, HBITMAP hBitmap; //Declare in Class hBitmap = (HBITMAP)::LoadImage(NULL, "C:\\filename.bmp", IMAGE_BITMAP, 0,0,LR_LOADFROMFILE); //in Constructor ::DeleteObject(hBitmap); //in destructor //Add in WM_CTLCOLOR handler if (CTLCOLOR_DLG == nCtlColor) hbr = ::CreatePatterhBrush(hBitmap);

                A 1 Reply Last reply
                0
                • P Parthi_Appu

                  that will work if you have the bitmap in the resource. if you are using the bitmap from file, then use the following code, HBITMAP hBitmap; //Declare in Class hBitmap = (HBITMAP)::LoadImage(NULL, "C:\\filename.bmp", IMAGE_BITMAP, 0,0,LR_LOADFROMFILE); //in Constructor ::DeleteObject(hBitmap); //in destructor //Add in WM_CTLCOLOR handler if (CTLCOLOR_DLG == nCtlColor) hbr = ::CreatePatterhBrush(hBitmap);

                  A Offline
                  A Offline
                  ashish dogra
                  wrote on last edited by
                  #11

                  thanks but these are errors 'CreatePatterhBrush' : is not a member of '`global namespace'' 'CreatePatterhBrush' : undeclared identifier '=' : cannot convert from 'int' to 'struct HBRUSH__ *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast Error executing cl.exe. in the hbr = ::CreatePatterhBrush(hBitmap); Ashish Dogra MCA Noida

                  D P H 3 Replies Last reply
                  0
                  • H Hamid Taebi

                    You need to include AtlImage.h_**


                    **_

                    whitesky


                    A Offline
                    A Offline
                    ashish dogra
                    wrote on last edited by
                    #12

                    sir plz tell me why my application does not include AtlImage.h sirplz fast Ashish Dogra MCA Noida

                    H 1 Reply Last reply
                    0
                    • A ashish dogra

                      yes sir i include AtlImage.h plz solve my problem Ashish Dogra MCA Noida -- modified at 8:01 Tuesday 11th July, 2006

                      D Offline
                      D Offline
                      David Crow
                      wrote on last edited by
                      #13

                      ashish dogra wrote:

                      yes sir i include AtlImage.h plz solve my problem

                      Did you even bother to search for a solution? It is assumed that you will at least put forth some effort to go along with the suggestons you receive here. http://www.codeguru.com/Cpp/COM-Tech/atl/graphics/article.php/c3597/[^]


                      "The largest fire starts but with the smallest spark." - David Crow

                      "Judge not by the eye but by the heart." - Native American Proverb

                      1 Reply Last reply
                      0
                      • A ashish dogra

                        thanks but these are errors 'CreatePatterhBrush' : is not a member of '`global namespace'' 'CreatePatterhBrush' : undeclared identifier '=' : cannot convert from 'int' to 'struct HBRUSH__ *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast Error executing cl.exe. in the hbr = ::CreatePatterhBrush(hBitmap); Ashish Dogra MCA Noida

                        D Offline
                        D Offline
                        David Crow
                        wrote on last edited by
                        #14

                        ashish dogra wrote:

                        'CreatePatterhBrush' : is not a member of '`global namespace'' 'CreatePatterhBrush' : undeclared identifier

                        It helps to spell the function correctly. :rolleyes:


                        "The largest fire starts but with the smallest spark." - David Crow

                        "Judge not by the eye but by the heart." - Native American Proverb

                        1 Reply Last reply
                        0
                        • A ashish dogra

                          thanks but these are errors 'CreatePatterhBrush' : is not a member of '`global namespace'' 'CreatePatterhBrush' : undeclared identifier '=' : cannot convert from 'int' to 'struct HBRUSH__ *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast Error executing cl.exe. in the hbr = ::CreatePatterhBrush(hBitmap); Ashish Dogra MCA Noida

                          P Offline
                          P Offline
                          Parthi_Appu
                          wrote on last edited by
                          #15

                          thats ::CreatePatternBrush(..)

                          1 Reply Last reply
                          0
                          • A ashish dogra

                            thanks but these are errors 'CreatePatterhBrush' : is not a member of '`global namespace'' 'CreatePatterhBrush' : undeclared identifier '=' : cannot convert from 'int' to 'struct HBRUSH__ *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast Error executing cl.exe. in the hbr = ::CreatePatterhBrush(hBitmap); Ashish Dogra MCA Noida

                            H Offline
                            H Offline
                            Hamid Taebi
                            wrote on last edited by
                            #16

                            if you want to use brush in ctlcolor use CBrush *m_brush; CBitmap m_Bitmap; m_Bitmap.Attach(LoadImage(...)); m_brush=new CBitmap(&m_Bitmap); now in ctlcolor return m_brush->GetSafeHandle();//i think this (GetSafeHandle) i dont have vc now in the end delete m_brush_**


                            **_

                            whitesky


                            1 Reply Last reply
                            0
                            • A ashish dogra

                              sir plz tell me why my application does not include AtlImage.h sirplz fast Ashish Dogra MCA Noida

                              H Offline
                              H Offline
                              Hamid Taebi
                              wrote on last edited by
                              #17

                              if you get this error so you dont have this file in your computer and you can see msdn for it_**


                              **_

                              whitesky


                              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