Creating a window causes a trackbar to stop working?

This is a discussion on Creating a window causes a trackbar to stop working? within the Windows Programming forums, part of the Platform Specific Boards category; I have a problem (which I have posted on these forums before, but that was a long time ago). Two ...

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    43

    Creating a window causes a trackbar to stop working?

    I have a problem (which I have posted on these forums before, but that was a long time ago). Two completely unrelated parts of my program seem to be affecting each other. Simply opening a window (i.e. calling CreateWindow), actually stops a trackbar from working, which is created later on in the program.

    If anyone can help me with this, it would be GREATLY appreciated. It has been plaguing me for more than 6 months now. The actual program itself is to display fractals, but the details are not really important. The source code is available here: http://www.projects.hawknetwork.org/DrawIFS-190907.zip. If you run the compiled program under Windows, and then click the "Merge Paint" button, it runs fine and displays a pre-built fractal (the Sierpinski Triangle). Now click the "Add" button; at the bottom you will see a trackbar, and if you drag it, the number above the trackbar changes. Now go into the source code, file ifschooserwindow.cpp, and add the following line immediately before the line SetupTriangle(); in the constructor:

    Code:
    MessageBox(NULL, "Hello", "Hello", MB_OK);
    which simply displays a message box. Now compile, and go through the procedure again. This time, the number does not change when the trackbar is dragged.

    I am not entirely sure what is causing this, this is a fairly large program but even so, I can't see why creating a window at this stage would cause the behaviour detailed, later in the execution. Incidentally, this behaviour occurs no matter what window you create (you can create a more complicated window via CreateWindow and so on rather than using ShowMessage, but the behaviour still occurs). Please note that a lot of the parts of the interface do not work yet, they are pretty insignificant compared with this bug.

    If anyone can provide me with even a clue as to why this kind of random behaviour could occur, I would owe a great debt to you.
    Windows XP Professional SP2, Code::Blocks Studio 1.0rc2, GCC/G++ 3.4.2 (20040916-1), mingw32-make 3.80.0-3, GDB 5.2.1-1, W32API 3.6

    MingW Runtime 3.9, BinUitls 2.15.91 (20040904-1), MingW Utilities 0.3, Tcl/Tk 8.4.1-1

  2. #2
    Registered User
    Join Date
    Dec 2006
    Location
    Scranton, Pa
    Posts
    252
    Don't have my glasses with me, so limited reading for me (and I'm not certain that I even read the post right), but personally I always create all my windows at the front-end of the code. If you don't want the window to appear on startup, just use ShowWindow (HANDLE, SW_HIDE) after creation.

    Just a quick, simple suggestion. There are quite a few experienced windows programmers here which could probably answer more intuitively, experts I'd call 'em, though I'm not one of them.

  3. #3
    Registered User
    Join Date
    Oct 2005
    Posts
    43
    Quote Originally Posted by Oldman47 View Post
    Don't have my glasses with me, so limited reading for me (and I'm not certain that I even read the post right), but personally I always create all my windows at the front-end of the code. If you don't want the window to appear on startup, just use ShowWindow (HANDLE, SW_HIDE) after creation.

    Just a quick, simple suggestion. There are quite a few experienced windows programmers here which could probably answer more intuitively, experts I'd call 'em, though I'm not one of them.
    Yes, I am trying to create the window at the start of the code. The problem is that if I try to create a window at the start of the code (no matter what that window is), and in particular, before the SetupTriangle() function, it causes the program to stop working later on.
    Windows XP Professional SP2, Code::Blocks Studio 1.0rc2, GCC/G++ 3.4.2 (20040916-1), mingw32-make 3.80.0-3, GDB 5.2.1-1, W32API 3.6

    MingW Runtime 3.9, BinUitls 2.15.91 (20040904-1), MingW Utilities 0.3, Tcl/Tk 8.4.1-1

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. My Window Class
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 07-10-2005, 03:33 PM
  2. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 11:12 PM
  3. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 11:14 PM
  4. How to change window style at runtime?
    By Mr. Bitmap in forum Windows Programming
    Replies: 5
    Last Post: 06-09-2002, 05:49 PM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM

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