Thread: Programs works one way, not another. VC++ 6.0 help.

  1. #1
    Ecologist
    Join Date
    Aug 2001
    Location
    Utah.
    Posts
    1,291

    Programs works one way, not another. VC++ 6.0 help.

    I don't know if this is on the right board or not...

    I have no idea what could be wrong..

    I'm using Visual C++ 6.0. When I compile my project, then execute
    it (Ctrl +F5), everything works fine. The program does what it's
    suppose to do.

    But when I execute the program from outside of VC++ (by just
    clicking on the .exe), it appears to hang. Like it's getting stuck
    in a loop or something.

    I have a function in my Bitmapclass called "DrawtoBuffer()." If I
    comment-out this line, the program works (when I click on the
    .exe).

    But, I don't think anything is wong with my function. I mean, it
    works correctly when I execute from inside VC++ (ctrl +f5)... I'm
    confused. Why would it work when I launch it one way, but not
    another?

    Here's my function, but I don't know if the problem is in here. You
    know, what with it working sometimes...

    Code:
    void cBITMAP::DrawToBuffer(cXYCOORD Position, cBUFFER &buffer)
    {
        //Edited out. Embarassed by my code. It didn't have anything to
        //do with my problem, anway. :)
    Last edited by Cheeze-It; 12-10-2002 at 02:21 PM.
    Staying away from General.

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    If you're loading a bitmap externally, make sure you have the bmp file in the same directory as your exe. You can put it in the main directory and run your program within VS ( ctrl f5) no problem, but if you go in release/debug directories without moving the bmp it will not work. So just check that first.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    Ecologist
    Join Date
    Aug 2001
    Location
    Utah.
    Posts
    1,291
    Thanks a lot. That must have been the problem. It works now..

    I had this:

    MyProject:
    -PicData (folder)
    -Debug (folder)
    ---MyProject.exe

    I moved the PicData folder into the Debug folder.

    Thanks again.
    Staying away from General.

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Anytime

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Try a messagebox or similar to tell you that the resource was not found.



    Check the returns from the macros / functions and if they return an error or fail use

    GetLastError()

    and print this into a messagebox. Will help your debugging.
    "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. Compiling x64 code in VC++ 6.0?
    By cpjust in forum Windows Programming
    Replies: 7
    Last Post: 07-29-2008, 09:36 AM
  2. Visual C++ 6.0 Pro vs Visual C++ 6.0 Enterprise
    By Joelito in forum Tech Board
    Replies: 5
    Last Post: 01-23-2007, 07:00 PM
  3. makefile exported by vc 6.0 doesn't work
    By wow in forum Windows Programming
    Replies: 7
    Last Post: 03-24-2006, 04:20 PM
  4. Programs Communicating
    By Drek in forum C++ Programming
    Replies: 1
    Last Post: 01-26-2002, 04:47 PM
  5. programming in C with VC++ 6.0
    By Korn1699 in forum C Programming
    Replies: 4
    Last Post: 12-07-2001, 12:56 PM