Thread: LoadImage() fooled me!

  1. #1
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708

    LoadImage() fooled me!

    After all this time of being so carefull to call LoadImage with the proper HINSTANCE and X, Y maximums, I tried this on a whim-and it works the same ?!!!! How strange! Can anyone explain this?


    Code:
    HBITMAP LoadPic(char *name )
    {
      return (HBITMAP)LoadImage(NULL, name, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
    }
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    You are loading from file so it does not need to know the HINST to find the image.
    Try that with an image stored in the exe (ie an image that is a resource like an icon)
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. LoadImage()
    By Gordon in forum Windows Programming
    Replies: 15
    Last Post: 12-22-2007, 06:16 PM
  2. LoadImage()
    By SniperSAS in forum Windows Programming
    Replies: 6
    Last Post: 04-19-2006, 06:39 PM
  3. LoadImage() Problem
    By punkrockguy318 in forum C++ Programming
    Replies: 3
    Last Post: 01-02-2004, 08:46 AM
  4. LoadImage doesn't work when my program is accesing the hardrive
    By pinkcheese in forum Windows Programming
    Replies: 2
    Last Post: 04-20-2002, 12:39 AM
  5. 'The parameter is incorrect' - LoadImage
    By DarkAvenger in forum Windows Programming
    Replies: 1
    Last Post: 04-12-2002, 02:53 PM