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. how would i

how would i

Scheduled Pinned Locked Moved C / C++ / MFC
graphics
10 Posts 3 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.
  • M Offline
    M Offline
    MMaines2005
    wrote on last edited by
    #1

    = "WindowsApp"; int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil) { HWND hwnd; /* This is the handle for our window */ MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ /* The Window structure */ wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS; /* Catch double-clicks */ wincl.cbSize = sizeof (WNDCLASSEX); /* Use default icon and mouse-pointer */ wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION); wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION); wincl.hCursor = LoadCursor (NULL, IDC_ARROW); wincl.lpszMenuName = NULL; /* No menu */ wincl.cbClsExtra = 0; /* No extra bytes after the window class */ wincl.cbWndExtra = 0; /* structure or the window instance */ /* Use Windows's default color as the background of the window */ wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND; /* Register the window class, and if it fails quit the program */ if (!RegisterClassEx (&wincl)) return 0; /* The class is registered, let's create the program*/ hwnd = CreateWindowEx ( 0, /* Extended possibilites for variation */ szClassName, /* Classname */ "Windows App", /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ 544, /* The programs width */ 375, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL

    M H 2 Replies Last reply
    0
    • M MMaines2005

      = "WindowsApp"; int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil) { HWND hwnd; /* This is the handle for our window */ MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ /* The Window structure */ wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS; /* Catch double-clicks */ wincl.cbSize = sizeof (WNDCLASSEX); /* Use default icon and mouse-pointer */ wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION); wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION); wincl.hCursor = LoadCursor (NULL, IDC_ARROW); wincl.lpszMenuName = NULL; /* No menu */ wincl.cbClsExtra = 0; /* No extra bytes after the window class */ wincl.cbWndExtra = 0; /* structure or the window instance */ /* Use Windows's default color as the background of the window */ wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND; /* Register the window class, and if it fails quit the program */ if (!RegisterClassEx (&wincl)) return 0; /* The class is registered, let's create the program*/ hwnd = CreateWindowEx ( 0, /* Extended possibilites for variation */ szClassName, /* Classname */ "Windows App", /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ 544, /* The programs width */ 375, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      You can add a bitmap to the EXE's resources or it can be in a stand-alone file. Which method are you interested in?  Also, how is the code you posted relevant?  Are you wondering where in the code to do the load? Mark

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      H M 2 Replies Last reply
      0
      • M MMaines2005

        = "WindowsApp"; int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil) { HWND hwnd; /* This is the handle for our window */ MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ /* The Window structure */ wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS; /* Catch double-clicks */ wincl.cbSize = sizeof (WNDCLASSEX); /* Use default icon and mouse-pointer */ wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION); wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION); wincl.hCursor = LoadCursor (NULL, IDC_ARROW); wincl.lpszMenuName = NULL; /* No menu */ wincl.cbClsExtra = 0; /* No extra bytes after the window class */ wincl.cbWndExtra = 0; /* structure or the window instance */ /* Use Windows's default color as the background of the window */ wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND; /* Register the window class, and if it fails quit the program */ if (!RegisterClassEx (&wincl)) return 0; /* The class is registered, let's create the program*/ hwnd = CreateWindowEx ( 0, /* Extended possibilites for variation */ szClassName, /* Classname */ "Windows App", /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ 544, /* The programs width */ 375, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL

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

        I dont know is this your question you can enter code of bitamp on the source code of your project.

        M 1 Reply Last reply
        0
        • M Mark Salsbery

          You can add a bitmap to the EXE's resources or it can be in a stand-alone file. Which method are you interested in?  Also, how is the code you posted relevant?  Are you wondering where in the code to do the load? Mark

          Mark Salsbery Microsoft MVP - Visual C++ :java:

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

          I think if he used of dll file for enter bitmap is better than exe file(for size of exe file).

          M 1 Reply Last reply
          0
          • H Hamid Taebi

            I think if he used of dll file for enter bitmap is better than exe file(for size of exe file).

            M Offline
            M Offline
            Mark Salsbery
            wrote on last edited by
            #5

            Yeah.  IMO that's a matter of implementation need/choice.  Pretty much the same amount of data gets added to the overall solution.  The DLL will need to be loaded eventually but I suppose if startup performance was a real issue... :) Cheers, Mark

            Mark Salsbery Microsoft MVP - Visual C++ :java:

            1 Reply Last reply
            0
            • M Mark Salsbery

              You can add a bitmap to the EXE's resources or it can be in a stand-alone file. Which method are you interested in?  Also, how is the code you posted relevant?  Are you wondering where in the code to do the load? Mark

              Mark Salsbery Microsoft MVP - Visual C++ :java:

              M Offline
              M Offline
              MMaines2005
              wrote on last edited by
              #6

              Yes where in the code to load it, and how would i phrase if for my C++ compiler to pull it up in the app window?

              Michael (Up and coming Game programmer) EST

              H M 2 Replies Last reply
              0
              • M MMaines2005

                Yes where in the code to load it, and how would i phrase if for my C++ compiler to pull it up in the app window?

                Michael (Up and coming Game programmer) EST

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

                If you want to eneter bitmap on the resource then you can use of CBitmap::Load for load it.

                1 Reply Last reply
                0
                • M MMaines2005

                  Yes where in the code to load it, and how would i phrase if for my C++ compiler to pull it up in the app window?

                  Michael (Up and coming Game programmer) EST

                  M Offline
                  M Offline
                  Mark Salsbery
                  wrote on last edited by
                  #8

                  So you want to load it and display it? Loading can be done any time, usually before whe window that will display the bitmap gets its first WM_PAINT message. Displaying should be done in response to WM_PAINT. How you load the bitmap depends on where it's stored and what format it's in. Displaying the bitmap depends on what format you load it in.

                  Mark Salsbery Microsoft MVP - Visual C++ :java:

                  1 Reply Last reply
                  0
                  • H Hamid Taebi

                    I dont know is this your question you can enter code of bitamp on the source code of your project.

                    M Offline
                    M Offline
                    MMaines2005
                    wrote on last edited by
                    #9

                    Really i need the starting of the script to add the bitmap and to know where to add it to the exe file format. But the information given already give me and idea. < might be a bad idea but worth a try>

                    Hamid. wrote:

                    I dont know is this your question you can enter code of bitamp on the source code of your project

                    Michael (Up and coming Game programmer) EST

                    H 1 Reply Last reply
                    0
                    • M MMaines2005

                      Really i need the starting of the script to add the bitmap and to know where to add it to the exe file format. But the information given already give me and idea. < might be a bad idea but worth a try>

                      Hamid. wrote:

                      I dont know is this your question you can enter code of bitamp on the source code of your project

                      Michael (Up and coming Game programmer) EST

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

                      You can import bitmap file to resource of exe file but here a problem that it increase size of exe file but you can load bmp of a foreign file but it depends to your program after select way if you have any question you can ask of me.;)(but I dont know why I got vote 1 on previous reply)

                      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