Minor problem...bad stuff

This is a discussion on Minor problem...bad stuff within the Windows Programming forums, part of the Platform Specific Boards category; Hi all. I have written a 'edit' program and it has a status bar, toolbar, edit space, but the only ...

  1. #1
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321

    Minor problem...bad stuff

    Hi all.
    I have written a 'edit' program and it has a status bar, toolbar, edit space, but the only thing that works is the edit space....I have no errors either...
    I will attatch the code.
    Attached Files Attached Files

  2. #2
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321

    Bad stuff...

    Hi
    I sort of expanded the other program that i attatched in the last thread, but when i get to compiling it i get 1 error.

    Code:
    menu.rc [Resource error] parse error
    I get the error line at:

    Code:
    MENUITEM "N&ew",     ID_FILE_NEW
    I will attatch the main.c since that is quite a big file and i'll just type in the other files:

    Code:
    //toolbar.h
    #define IDR_MYMENU 101
    #define IDC_MAIN_TOOL 201
    #define IDC_MAIN_EDIT 301
    #define IDC_MAIN_STATUS 401
    #define ID_FILE_EXIT 9001
    #define ID_FILE_NEW 9002
    #define ID_FILE_OPEN 9003
    #define ID_FILE_SAVEAS 9004
    #define ID_HELP_NO 9005
    Code:
    //menu.rc
    #include "resource.h"
    
    IDR_MYMENU MENU
    BEGIN
        POPUP "&File"
        BEGIN
            MENUITEM "&Exit",    ID_FILE_EXIT
            MENUITEM "N&ew",     ID_FILE_NEW 
            MENUITEM "O&pen",    ID_FILE_OPEN
            MENUITEM "S&ave_as", ID_FILE_SAVEAS
        END
    
        POPUP "&Help"
        BEGIN
            MENUITEM "N&o", ID_HELP_NO
        END
    END
    any ideas, thanks in advance!
    Attached Files Attached Files

  3. #3
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321
    I have found one of the problems, i needed to take away a section of code. Here is my .rc file now:

    Code:
    //menu.rc
    #include "resource.h"
    
    IDR_MYMENU MENU
    BEGIN
        POPUP "&File"
        BEGIN
            MENUITEM "&Exit",    ID_FILE_EXIT
            MENUITEM "N&ew",     
            MENUITEM "O&pen",    
            MENUITEM "S&ave_as", 
        END
    
        POPUP "&Help"
        BEGIN
            MENUITEM "N&o", ID_HELP_NO
        END
    END
    But now the problem shows up on the next line, and it's the same error

  4. #4
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321
    It's allright all, i didn't nead the resource file, so i recoded it

  5. #5
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321
    ok, thank you

  6. #6
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321
    well, back to the first problem again.
    Has anybody got any ideas?
    Here is the header file:

    Code:
    //toolbar.h
    #define IDR_MYMENU 101
    #define IDC_MAIN_TOOL 201
    #define IDC_MAIN_EDIT 301
    #define IDC_MAIN_STATUS 401
    #define ID_FILE_EXIT 9001
    #define ID_FILE_NEW 9002
    #define ID_FILE_OPEN 9003
    #define ID_FILE_SAVEAS 9004
    #define ID_HELP_NO 9005
    Attached Files Attached Files

  7. #7
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    It's allright all, i didn't nead the resource file, so i recoded it
    It isn't allright anymore?
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  8. #8
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    - Your original resource file looks fine, except that it is including resource.h rather than toolbar.h which seems to be where the defines are.

    - The trouble with the code in main.c is that it creates the child windows before the parent window, passing the uninitialised variable hwnd as their parent. The parent window should be created first. Some compilers, with the appropriate settings, will warn about the use of uninitialised variables (this is how I spotted the error without having to study the code). Without that warning, I would suggest you do a search for hwnd and make sure it is not used before its value is set.

    - The sizing doesn't work yet, but your approach is correct, so I don't think you need help with it.

  9. #9
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321
    what do you meen?

  10. #10
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321
    i don't see where i am going wrong, i can't see where i need to recode the parent/child window

  11. #11
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321
    oh, and by the way, i have added more to my main.c
    Attached Files Attached Files

  12. #12
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321
    I fixed it, thanks for all of your help!

  13. #13
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321
    Oh no...
    Da status bar isn't visible...

  14. #14
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321
    I keep fidling about with the code, but the status bar is'nt visible, and the edit window is a bit 'skew-wif' anyway...
    can anyone give me any ideas what to do, here is the updated code:
    Attached Files Attached Files
    Last edited by beene; 10-20-2006 at 02:22 PM.

  15. #15
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    12 of 15 replies in this post have been made by you. Learn to use edit.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Poker bad beats
    By PJYelton in forum A Brief History of Cprogramming.com
    Replies: 21
    Last Post: 01-15-2005, 11:42 PM
  2. How bad is bad
    By caroundw5h in forum A Brief History of Cprogramming.com
    Replies: 21
    Last Post: 11-12-2004, 09:26 AM
  3. good news and bad news
    By Garfield in forum A Brief History of Cprogramming.com
    Replies: 25
    Last Post: 10-27-2001, 08:31 AM
  4. Bad code or bad compiler?
    By musayume in forum C Programming
    Replies: 3
    Last Post: 10-22-2001, 10:08 PM
  5. Stocks 'n' stuff...
    By Cheeze-It in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 09-20-2001, 06:36 PM

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