Hi, John,

VC6 does support CArray. Just try to add  

#include   "afxtempl.h"

in the 2nd line of layoutHelper.h. There is no additional pre-processor definitions in the project.

Layouthelper is a very simple window management class. By this class, we divide the parent window into four regions and attach the child window in one of them. This program will show you
1. glut/freeglut doesn't attach the window in the proper position.
2. resizing behavior is not correct

BR,
CZC

On Mon, Dec 12, 2011 at 10:22 AM, John F. Fay <johnffay@cybertron.com> wrote:
OK, it gets worse:  the "CArray" is not supported any earlier than Microsoft ".Net" 2003.  I am running MSVC 6.0 vintage 1998.

As they may say in France, "je suis dans le potage."  ("I am in the soup.")  I have a fair idea that I will not be able to do anything about this problem.

        - John


On 12/11/2011 3:57 PM, John F. Fay wrote:
OK, I am not much closer even to reproducing the problem, let alone solving it.  I've gotten the files (thank you, CZC), downloaded and installed 7-zip to unlock the files, and found that the project files are from a later version of Visual Studio.  I've tried creating an MFC project using my MSVC 6.0 and have evidently missed a definition somewhere as several files (glutwinDlg, LayoutHelper, and triplanes) were missing and there are a couple that are extra.  When I try to build, I get 127 errors, many of them revolving around an undefined type called "CArray".

What kind of MFC application is this?  What options are supposed to be set or unset when creating it?

        - John


On 11/25/2011 2:55 AM, czc.tmp czc wrote:
Hi,

I explain more details.

I have a main MFC window whose handle is denoted as hParent.  Then I create a thread inside which the glut window opens. I attach the glut window to the MFC window as a child in the thread. Below is the attached codes. They are all related to the window style configuration.

============ code ===============
glutCreateWindow(GLUT_WINDOW_TITLE);

hOglWnd = FindWindow(NULL, GLUT_WINDOW_TITLE); 

LONG style = ::GetWindowLong(hWnd , GWL_STYLE);
style = style | WS_CHILD|WS_CLIPCHILDREN|WS_CLIPSIBLINGS;
style = style &~ (WS_CAPTION | WS_BORDER);
::SetWindowLong(hWnd , GWL_STYLE, style); 
::SetWindowPos( m_hOpenglWin, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED);

::SetParent(hOglWnd , hParent);
============ code ===============

OK. Now I got the glut window successfully attached to the mfc window. The glut runs inside the thread till I send WM_CLOSE message.

BUT 2 problems happen:

1. The child  window is not properly attached to the correct position 

In freeglut 2.6, the right boundary is larger than the actual attached area and the upper boundary is one caption size lower.
In freeglut 2.8, the right boundary is correct but the upper boundary is still one caption size lower.
It happens also in the original glut.

I then tested using GLFW (another candidate of freeglut). The window is attached OK.

2. The child window is resizing incorrectly.

When I slowly resize the main window, the child window immediately correctly attached to the correct position with the correct size, but then suddenly jumps to the incorrect position. 

It'll be great helpful if you can provide any advice.

Thanks.


On Thu, Nov 24, 2011 at 7:59 PM, Diederick C. Niehorster <dcnieho@gmail.com> wrote:
resizing and such shouldn't lead to a change of style. Check out the
freeglut code for glutcreatewindow in freeglut_window.c. Style is set
there once in the functions it calls and not changed again. The
various operation triggered from the windowproc should not result in a
change of style. Style is not stored internally either, unless going
fullscreen so it can be restored correctly.

Hope that helps!

Best,
Dee

On 24/11/2011, czc.tmp czc <czc.tmp@gmail.com> wrote:
> haha, still far away, I think.
>
> Regarding the window style (bordless, captionless, etc.), are there any
> differences between glut API and windows API?
>
> I'm afraid that settings through windows api may cause strange behaviors
> when resizing, restoring, ....
>
> On Thu, Nov 24, 2011 at 6:03 PM, Diederick C. Niehorster
> <dcnieho@gmail.com>wrote:
>
>> Ah, so you're getting closer to what you need?
>>
>> did you use/set GLUT_BORDERLESS in glutInitDisplayMode()?
>>
>> Otherwise I'm not too sure what could be going wrong. It seems you are
>> knowledgeable about the windows API, if you want to have a look at the
>> freeglut code related to opening, resizign and positioning windows,
>> that'd be very welcome!
>>
>> Best,
>> Dee
>>
>> On Thu, Nov 24, 2011 at 17:12, czc.tmp czc <czc.tmp@gmail.com> wrote:
>> > The attached window is different in this version (2.8 rc2, vs 2.6).
>> > The initial position is partially correct. There is a caption bar gap
>> though
>> > the style indicates it's been ignored.
>> > The resizing is incorrect. The attached window will jump to a fixed
>> position
>> > which is associated with the parent window position. But the window size
>> > seems correct. Maybe client rect is wrong? I guess.
>> >
>> > On Thu, Nov 24, 2011 at 4:36 PM, czc.tmp czc <czc.tmp@gmail.com> wrote:
>> >>
>> >> Thanks.
>> >> Actually we're developing a software. It's not designed to involve big
>> 3D
>> >> features. We just simply need a small function unit to show sth.
>> >> The design is to firstly create a glut window, and then attach it to
>> >> the
>> >> main window built by MFC.
>> >> "glutCreateSubWindow" seems to create a child window for an existing
>> glut
>> >> window. But our purpose is to create a child window for an existing MFC
>> >> window.
>> >> Actually we attached it. But the initial positions, sizes and resizing
>> >> behaviors are all incorrect.
>> >> I will update the latest freeglut codes.
>> >>
>> >> On Thu, Nov 24, 2011 at 4:20 PM, Diederick C. Niehorster
>> >> <dcnieho@gmail.com> wrote:
>> >>>
>> >>> Hi,
>> >>>
>> >>> Freeglut does child windows already, you don't have to do it yourself.
>> >>> See glutCreateSubWindow
>> >>>
>> >>> This doesn't have the SetParent() call however. Just for personal
>> >>> curiosity, could you tell me what thats for?
>> >>>
>> >>> Also, please get the latest trunk version, there have been some
>> >>> changes in window creation internally. There were some small problems
>> >>> with child windows before.
>> >>>
>> >>> Best,
>> >>> Dee
>> >>>
>> >>> On Thu, Nov 24, 2011 at 16:13, czc.tmp czc <czc.tmp@gmail.com> wrote:
>> >>> > Hi,
>> >>> > I'm using freeglut 2.6 in windows 7.
>> >>> > I want to create a window using glut and attach it to an existing
>> >>> > window. I
>> >>> > think this scenario may be common. However, I found very strange
>> >>> > behaviors
>> >>> > when calling following codes.
>> >>> > ======================
>> >>> > glutCreateWindow(GLUT_WINDOW_TITLE); // i create a window using glut
>> >>> > hWnd = FindWindow(NULL, GLUT_WINDOW_TITLE); // then I get the hwnd
>> >>> > using API
>> >>> > LONG style = ::GetWindowLong(hWnd , GWL_STYLE); // get and change
>> style
>> >>> > style = style | WS_CHILD|WS_CLIPCHILDREN|WS_CLIPSIBLINGS;
>> >>> > style = style &~ (WS_CAPTION | WS_BORDER);
>> >>> > ::SetWindowLong(hWnd , GWL_STYLE, style); // set style
>> >>> > ::SetWindowPos( m_hOpenglWin, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE
>> |
>> >>> > SWP_NOZORDER | SWP_FRAMECHANGED);
>> >>> > ::SetParent(m_hOpenglWin, hParent);
>> >>> > ....
>> >>> >
>> >>> >
>> ------------------------------------------------------------------------------
>> >>> > All the data continuously generated in your IT infrastructure
>> >>> > contains a definitive record of customers, application performance,
>> >>> > security threats, fraudulent activity, and more. Splunk takes this
>> >>> > data and makes sense of it. IT sense. And common sense.
>> >>> > http://p.sf.net/sfu/splunk-novd2d
>> >>> > _______________________________________________
>> >>> > Freeglut-developer mailing list
>> >>> > Freeglut-developer@lists.sourceforge.net
>> >>> > https://lists.sourceforge.net/lists/listinfo/freeglut-developer
>> >>> >
>> >>> >
>> >>>
>> >>>
>> >>>
>> ------------------------------------------------------------------------------
>> >>> All the data continuously generated in your IT infrastructure
>> >>> contains a definitive record of customers, application performance,
>> >>> security threats, fraudulent activity, and more. Splunk takes this
>> >>> data and makes sense of it. IT sense. And common sense.
>> >>> http://p.sf.net/sfu/splunk-novd2d
>> >>> _______________________________________________
>> >>> Freeglut-developer mailing list
>> >>> Freeglut-developer@lists.sourceforge.net
>> >>> https://lists.sourceforge.net/lists/listinfo/freeglut-developer
>> >>
>> >
>> >
>> >
>> ------------------------------------------------------------------------------
>> > All the data continuously generated in your IT infrastructure
>> > contains a definitive record of customers, application performance,
>> > security threats, fraudulent activity, and more. Splunk takes this
>> > data and makes sense of it. IT sense. And common sense.
>> > http://p.sf.net/sfu/splunk-novd2d
>> > _______________________________________________
>> > Freeglut-developer mailing list
>> > Freeglut-developer@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/freeglut-developer
>> >
>> >
>>
>>
>> ------------------------------------------------------------------------------
>> All the data continuously generated in your IT infrastructure
>> contains a definitive record of customers, application performance,
>> security threats, fraudulent activity, and more. Splunk takes this
>> data and makes sense of it. IT sense. And common sense.
>> http://p.sf.net/sfu/splunk-novd2d
>> _______________________________________________
>> Freeglut-developer mailing list
>> Freeglut-developer@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/freeglut-developer
>>
>

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Freeglut-developer mailing list
Freeglut-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freeglut-developer

------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-novd2d
_______________________________________________ Freeglut-developer mailing list Freeglut-developer@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freeglut-developer

------------------------------------------------------------------------------
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for
developers. It will provide a great way to learn Windows Azure and what it
provides. You can attend the event by watching it streamed LIVE online.
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Freeglut-developer mailing list
Freeglut-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freeglut-developer