Thread: program won't create status bar

  1. #1
    Unregistered
    Guest

    Question program won't create status bar

    First of all, I am using Bloodshed's DevC++ to create a win32 app.
    In my program I am trying to add a statusbar but it won't create the window. I tried getting the last error but there isn't one relating to the status bar. Does anybody have any information as to why the window wouldn't be created? All of my code should be correct because I just copied "hStatus=CreateWindow("msctls_statusbar32", "Ready",WS_CHILD|WS_VISIBLE,0,0,0,0,hwnd,(HMENU)NU LL,hInst, NULL);" from my other project. It works in my other project, but not this one. Any suggestions would be appreciated. I basically need to know what would stop a window of any kind from being created.
    thanks
    alandrums

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    72
    the only thing which may cause the problems here is the
    'hwnd' which is passed to the CreateWindow. if it is not valid or it refer to other window.

  3. #3
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    I always use the CreateStatusWindow() API function to create status windows. With your code, are you not telling it to create a zero sized window?
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  4. #4
    Registered User Esss's Avatar
    Join Date
    Aug 2001
    Posts
    133
    Have you called InitCommonControls or InitCommonControlsEx?
    Ess
    Like a rat in a maze who says,
    "Watch me choose my own direction"
    Are you under the illusion
    The path is winding your way?
    - Rush

  5. #5
    Unregistered
    Guest

    Post

    i tried using CreateStatusWindow(), but it doesn't work. It says that there is an undefined reference to CreateStatusWindow and I included the commctrl.h header file. Something may be wrong with my include files.
    it also says that there is an undefined reference to InitCommonControls if i try to call that (also with the commctrl.h file included)
    is there another file that i need to include? or some compiler setting?

    alandrums

  6. #6
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    >>is there another file that i need to include? or some compiler setting?



    Comctl32.lib??

    Have you included this as a library??

  7. #7
    alandrums
    Guest

    Thumbs up

    well, i got it to work. just like fordy said i had to link with the comctl32.lib library. i also included commctrl.h and then called InitCommonControls(). i have a status bar now, it's great!
    the reason why it worked on my other program without doing all of this was because i included the shlobj.h file and used that to load the "Browse for folder" dialog box. the shlobj.h header file included commctrl.h, and the code that was required to open the dialog box must have somehow called InitCommonControls() so it kind of did it behind my back.
    thanks for all of your help.

    alandrums

  8. #8
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Cool - I love a happy ending......

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Create a file from c++ program
    By Dan17 in forum C++ Programming
    Replies: 2
    Last Post: 05-08-2006, 04:25 PM
  2. Progress bar in a Status bar...
    By Devil Panther in forum Windows Programming
    Replies: 8
    Last Post: 07-21-2005, 02:24 AM
  3. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 12:39 PM
  4. Status bar covering parent window....by the way, thanks Ward
    By Unregistered in forum Windows Programming
    Replies: 1
    Last Post: 10-02-2001, 08:16 PM
  5. Status bar and toolbar positioning
    By SMurf in forum Windows Programming
    Replies: 3
    Last Post: 09-30-2001, 05:18 PM