bug in my prog which I cannot figure out...

This is a discussion on bug in my prog which I cannot figure out... within the Windows Programming forums, part of the Platform Specific Boards category; It was a bit too big so I uploaded it... hope you have MSVC++ if you download/compile it!...

  1. #1
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052

    Thumbs up bug in my prog which I cannot figure out...

    It was a bit too big so I uploaded it...hope you have MSVC++ if you download/compile it!
    Last edited by face_master; 02-13-2002 at 11:57 PM.

  2. #2
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    oops, forgot to upload it (why do I always do that? )
    Attached Files Attached Files

  3. #3
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    the error in my code is around the part where it check each value that was inputted by the user, but it keeps producing my error message even when there shouldn't be an error!!

    I hope that this post helps things along with it...it's really got me stumped

  4. #4
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    I just thought of something: I could be getting the error becuase the values might not change from 0 to the user inputted value becuase the program mightn't be storing the values into the variables (ie. GetDlgItemInt() mightn't be doing its job), but why is this happening??

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    You are right, GetDlgItemInt() is failing as you have not given it the correct HWND, in fact any HWND. Use break points and watch the values asthe program runs. Took me 2 mins to find the problem.

    hDlg is declared globally, shame on you, pass it into the function from the call (as a param) or use GetActiveWindow().
    "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

  6. #6
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    I already had hDlg as the first parameter of GetDlgItemInt and I changed it to GetActiveWindow(), but that didn't seem to do anything and I'm still getting my error so I used break-points to spy on the values and they looked fine. I'm really confused.

  7. #7
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    I changed CreateGraph's declaration to

    CreateGraph(HWND hDlg);

    the call to include the parameter and the function to receive it, then ran the program (with all values, remember - you are erroring out if there is a zero...), and the message box does not appear.

    It doesn't draw a graph, but that's another problem...

    Also your tab order is wron, after entering the 10 values, the cursor moves to the Create button rather than the range edit box.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  8. #8
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    Yeah I know about the tab order, I was just gonna wait untill I had the major porblems solved before I attempted to do small things like that...

    I doing what you did with my CreateGraph function, but it gave me a weird error in winuser.h. I don't think that i'll continue this graph creator. The only reason I started it was becuase I had no ideas for programs to work on.

    Has anybody got any ideas for me to work with? (better than some crappy graph creator which is a pain in the but...)

    Thanks
    -Chris

  9. #9
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    >>> but it gave me a weird error in winuser.h

    Didn't for me. I literally changed 4 lines, the prototype, the call and the function lines and commented out the global declaraction of hDlg.

    >>> (better than some crappy graph creator which is a pain in the but...)

    Fix the one you've started. You learn by finding and fixing mistakes. It does not matter what the application does eventually, right now, it is a learning exercise. Think of it as such - no more no less.

    If you want to become a pro, you've got to learn that...

    1: Not all applications you're going to have to work on are going to interest you
    2: As an pro, giving up because you can't make something work is not an option if you want to keep your job
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  10. #10
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    I agree 100% with Adrianxw.
    Never give up.

    In saying that though sometime need a little help / encoragement.
    I have fixed some of the major problems with the code, quiet few minutes here after the cyclone.

    Still will not correctly draw the graph but now has frame buffer system, paint functions and modless dialog.
    Attached Files Attached Files
    "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

  11. #11
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    thanks for that, but I think I need to learn more about GDI before I attempt anything majorly big (I always seem to do that...). But thanks anyway. I agree that I would never learn if I gave up every time a challange was placed before me.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. gaks bug?
    By Yarin in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 08-31-2008, 03:47 PM
  2. ATL bug of CComPtr?
    By George2 in forum Windows Programming
    Replies: 6
    Last Post: 04-07-2008, 08:52 AM
  3. Sleep question and a bug I can't figure out
    By ac251404 in forum Windows Programming
    Replies: 10
    Last Post: 08-08-2006, 09:24 AM
  4. newb to C, cant figure something out.
    By Phate4219 in forum C Programming
    Replies: 16
    Last Post: 03-06-2006, 01:47 AM
  5. Try my prog...
    By Commander in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 05-09-2002, 08:43 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21