Hi,

A question, I have the attached resource files which doesn't compile with
i386-mingw32ce-windres.

It seems the problem is TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE. Is this not
supported or do I miss a thing. 

Compile it with:
i386-mingw32ce-windres -D_WIN32_WCE=0x600 -DUNICODE=1 -D_UNICODE=1
-D_WINDOWS=1 -DCEVER -DWIN32 -D_WINSOCKAPI_ -o .obj/FaCE.rc.o FaCE.rc

When I remove these I execute a link using:
i386-mingw32ce-g++ -Wpointer-arith -mthreads  -Wno-attributes -Wall -W -O3
-g -pipe    -pipe -DACE_HAS_CEGCC  -D_WIN32_WCE=0x600 -DUNICODE=1
-D_UNICODE=1 -D_WINDOWS=1 -DCEVER -DWIN32 -AS_CUSTOM_EXPORT_MACROS=0
-I/home/build/ACE/cegcc/ACE_wrappers -DACE_HAS_EXCEPTIONS -DACE_NO_INLINE
-DNO_ACE  -Wl,--enable-auto-import -L/home/build/ACE/cegcc/ACE_wrappers/lib
-statie .obj/FaCE.o .obj/Main.o .obj/CE_ARGV.o .obj/CE_Screen_Output.o
.obj/FaCE.rc.o -laygshell -lcoredll -lmingw32 -lmingwex -lws2 -lsupc++
-liphlpapi

But then I get 
FaCE.cpp:391: undefined reference to `_CommandBar_Height' 

I have attached FaCE.cpp. Do I need to link with another library?

Johnny
// $Id: newres.h 80826 2008-03-04 14:51:23Z wotte $

#ifndef __NEWRES_H__
#define __NEWRES_H__

#if !defined(UNDER_CE)
#define UNDER_CE _WIN32_WCE
#endif
  ww
#if defined(_WIN32_WCE)
    #if !defined(WCEOLE_ENABLE_DIALOGEX)
        #define DIALOGEX DIALOG DISCARDABLE
    #endif
    #include <commctrl.h>
    #define  SHMENUBAR RCDATA
    #if defined(WIN32_PLATFORM_PSPC) && (_WIN32_WCE >= 300)
        #include <aygshell.h>
        #define AFXCE_IDR_SCRATCH_SHMENU  28700
    #else
        #define I_IMAGENONE     (-2)
        #define NOMENU          0xFFFF
        #define IDS_SHNEW       1

        #define IDM_SHAREDNEW        10
        #define IDM_SHAREDNEWDEFAULT 11
    #endif // _WIN32_WCE_PSPC
    #define AFXCE_IDD_SAVEMODIFIEDDLG 28701
#endif // _WIN32_WCE

#ifdef RC_INVOKED
#ifndef _INC_WINDOWS
#define _INC_WINDOWS
    #include "winuser.h"           // extract from windows header
    #include "winver.h"
#endif
#endif

#ifdef IDC_STATIC
#undef IDC_STATIC
#endif
#define IDC_STATIC      (-1)

#endif //__NEWRES_H__
// $Id: resource.h 80826 2008-03-04 14:51:23Z wotte $

//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by FaCE.rc
//
#define IDS_APP_TITLE                   1
#define IDC_FACE                        3
#define IDI_FACE                        101
#define IDM_MENU                        102
#define IDD_ABOUTBOX                    103
#define IDS_HELP                        104
#define IDD_CMDLINE                     104
#define IDD_OUTFILE                     105
#define IDD_ERRFILE                     107
#define IDD_FILEEXIST                   109
#define IDB_ACERACER                    113
#define IDB_TAO                         114
#define IDS_COMMAND1                    301
#define IDC_CMDEDIT                     1001
#define IDC_SAVEFILE                    1002
#define IDC_ERRFILE                     1003
#define IDOVERWRITE                     1004
#define IDC_APPEND                      1005
#define IDC_COPYRIGHT                   1007
#define IDC_TAO                         1008
#define IDM_MAIN_COMMAND1               40001
#define IDM_HELP_ABOUT                  40003
#define ID_SETTING                      40004
#define IDS_CAP_SETTING                 40006
#define ID_SETTING_COMMANDLINE          40007
#define ID_SETTING_RUN                  40008
#define ID_SETTING_EXIT                 40011
#define ID_TOOLS_SAVETOFILE             40012

// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        116
#define _APS_NEXT_COMMAND_VALUE         40013
#define _APS_NEXT_CONTROL_VALUE         1009
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "newres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_FACE                ICON    DISCARDABLE     "FACE.ico"

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE DISCARDABLE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE DISCARDABLE 
BEGIN
    "#include ""newres.h""\r\n"
    "\0"
END

3 TEXTINCLUDE DISCARDABLE 
BEGIN
    "\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Data
//

IDM_MENU SHMENUBAR MOVEABLE PURE 
BEGIN
    IDM_MENU, 2,
    I_IMAGENONE, ID_SETTING, TBSTATE_ENABLED, 
    TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, IDS_CAP_SETTING, 0, 0,
    I_IMAGENONE, IDM_MAIN_COMMAND1, TBSTATE_ENABLED, 
    TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, IDS_HELP, 0, 1,
END


/////////////////////////////////////////////////////////////////////////////
//
// Menubar
//

IDM_MENU MENU DISCARDABLE 
BEGIN
    POPUP "Setting"
    BEGIN
        MENUITEM "Command Line",                ID_SETTING_COMMANDLINE
        MENUITEM "Run",                         ID_SETTING_RUN
        MENUITEM SEPARATOR
        MENUITEM "Exit",                        ID_SETTING_EXIT
    END
    POPUP "Tools"
    BEGIN
        MENUITEM "About",                       IDM_HELP_ABOUT
        MENUITEM "Save To File",                ID_TOOLS_SAVETOFILE
    END
END


/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_ABOUTBOX DIALOG DISCARDABLE  0, 0, 148, 161
STYLE WS_POPUP | WS_CAPTION
EXSTYLE 0x80000000L
CAPTION "About FACE"
FONT 8, "System"
BEGIN
    CONTROL         113,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE,33,6,
                    69,52
    CTEXT           "Static",IDC_COPYRIGHT,7,86,128,68
    CONTROL         114,IDC_TAO,"Static",SS_BITMAP,7,61,134,22
END

IDD_CMDLINE DIALOG DISCARDABLE  0, 0, 125, 50
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Command Line"
FONT 8, "System"
BEGIN
    DEFPUSHBUTTON   "OK",IDOK,7,29,50,14
    PUSHBUTTON      "Cancel",IDCANCEL,68,29,50,14
    COMBOBOX        IDC_CMDEDIT,7,7,111,80,CBS_DROPDOWN | CBS_AUTOHSCROLL | 
                    CBS_OEMCONVERT | CBS_SORT | CBS_HASSTRINGS | WS_VSCROLL | 
                    WS_TABSTOP
END

IDD_OUTFILE DIALOG DISCARDABLE  0, 0, 127, 49
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Output File Name"
FONT 8, "System"
BEGIN
    DEFPUSHBUTTON   "OK",IDOK,7,28,50,14
    PUSHBUTTON      "Cancel",IDCANCEL,70,28,50,14
    EDITTEXT        IDC_SAVEFILE,7,7,113,14,ES_AUTOHSCROLL
END

IDD_ERRFILE DIALOG DISCARDABLE  0, 0, 124, 49
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "ERROR"
FONT 8, "System"
BEGIN
    DEFPUSHBUTTON   "OK",IDOK,37,28,50,14
    CTEXT           "File Creation Error!",IDC_ERRFILE,13,7,98,17,
                    SS_CENTERIMAGE
END

IDD_FILEEXIST DIALOG DISCARDABLE  0, 0, 114, 90
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "File Exists"
FONT 8, "System"
BEGIN
    DEFPUSHBUTTON   "Overwrite",IDOVERWRITE,32,32,50,14
    PUSHBUTTON      "Cancel",IDCANCEL,32,68,50,14
    PUSHBUTTON      "Append",IDC_APPEND,32,50,50,14
    CTEXT           "File already exists!",IDC_STATIC,7,15,100,11
END


/////////////////////////////////////////////////////////////////////////////
//
// Accelerator
//

IDC_FACE ACCELERATORS DISCARDABLE 
BEGIN
    "A",            IDM_HELP_ABOUT,         VIRTKEY, CONTROL, NOINVERT
    "Q",            IDOK,                   VIRTKEY, CONTROL, NOINVERT
END


/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE 
BEGIN
    IDD_ABOUTBOX, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 141
        TOPMARGIN, 6
        BOTTOMMARGIN, 154
    END

    IDD_CMDLINE, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 118
        TOPMARGIN, 7
        BOTTOMMARGIN, 43
    END

    IDD_OUTFILE, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 120
        TOPMARGIN, 7
        BOTTOMMARGIN, 42
    END

    IDD_ERRFILE, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 117
        TOPMARGIN, 7
        BOTTOMMARGIN, 42
    END

    IDD_FILEEXIST, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 107
        TOPMARGIN, 7
        BOTTOMMARGIN, 82
    END
END
#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//

IDB_ACERACER            BITMAP  DISCARDABLE     "ACE_Racer.bmp"
IDB_TAO                 BITMAP  DISCARDABLE     "TAO.bmp"

/////////////////////////////////////////////////////////////////////////////
//
// String Table
//

STRINGTABLE DISCARDABLE 
BEGIN
    IDS_APP_TITLE           "FaCE"
    IDC_FACE                "FaCE"
END

STRINGTABLE DISCARDABLE 
BEGIN
    IDS_HELP                "Tools"
END

STRINGTABLE DISCARDABLE 
BEGIN
    IDS_COMMAND1            "Done "
END

STRINGTABLE DISCARDABLE 
BEGIN
    IDS_CAP_SETTING         "Setting"
END

#endif    // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED

// $Id: FaCE.cpp 85396 2009-05-19 10:33:44Z johnnyw $

#include "FaCE.h"

#ifdef NO_ACE

#include "CE_ARGV.h"

#else

#include <ace/ACE.h>
#include <ace/ARGV.h>
#include <ace/Log_Msg.h>

#endif  // NO_ACE

#include <commctrl.h>
#include <aygshell.h>
#include <sipapi.h>

// This utility does not use ACE, and shouldn't.
//FUZZ: disable check_for_lack_ACE_OS

ACE_TCHAR* g_ParameterFileName = ACE_TEXT("Parameters.txt");

/**
 * This simple and small class manages user-input command line
 * parameters and parameter history file.
 *
 * @author Si Mong Park (sp...@ociweb.com)
 * @version $Revision: 85396 $ $Date: 2009-05-19 12:33:44 +0200 (di, 19 mei 
2009) $
 */
class ParameterList
{
public:
    /**
     * Default Ctor.
     */
    ParameterList() : next_(0), param_(0) {};

    /**
     * Dtor: deletes all sub-PameterList objects as well as
     *       memory block allocated for the param_ by _wcsdup().
     */
    ~ParameterList() { free(param_); delete next_; };

    /**
     * Add a new parameter to the list.
     */
    void addParameter(char*);

    /**
     * Add a new parameter to the list.
     */
    void addParameter(ACE_TCHAR*);

    /**
     * Save all parameters stored in the list to the
     * file.
     * Note that 'outputFile' is only for the internal use
     * and user must call this function without any parameter.
     */
    void saveParameter(FILE* outputFile = 0);

    /**
     * Send out windows message to load/update parameters.
     */
    void sendParameterMSG(HWND, UINT);

private:
    /**
     * A pointer to the next ParameterList object.
     * This attribute is totally hidden from user.
     */
    ParameterList* next_;

    /**
     * User-specified command line parameter.
     * This attribute is totally hidden from user.
     */
    ACE_TCHAR* param_;
};


void ParameterList::addParameter(char* newParameter)
{
#ifdef NO_ACE
    int len = MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, newParameter, -1, 
0, 0);
    wchar_t* w_output = new wchar_t[len];

    MultiByteToWideChar(CP_OEMCP, MB_PRECOMPOSED, newParameter, -1, w_output, 
len);
    this->addParameter(w_output);

    delete w_output;
#else
    this->addParameter(ACE_TEXT_CHAR_TO_TCHAR(newParameter));
#endif  // NO_ACE
}


void ParameterList::addParameter(ACE_TCHAR* newParameter)
{
    if (this->param_ == 0) {
        this->param_ = _wcsdup(newParameter);
        this->next_ = new ParameterList();  // create and add a new 
ParameterList object
    }
    else {
        if (wcscmp(this->param_, newParameter) != 0) {
            this->next_->addParameter(newParameter);
        }
    }
}


void ParameterList::saveParameter(FILE* outputFile)
{
    if ( (outputFile == 0) && (this->param_ != 0) ) {
        outputFile = _wfopen(g_ParameterFileName, ACE_TEXT("w+"));
    }

    if (outputFile != 0) {
        if (this->param_ != 0) {
            fwprintf(outputFile, ACE_TEXT("%s\n"), this->param_);
            this->next_->saveParameter(outputFile);
        }
        else {
            fclose(outputFile);
        }
    }
}


void ParameterList::sendParameterMSG(HWND hDlg, UINT message)
{
    if (param_ != 0) {
        SendDlgItemMessage(hDlg, IDC_CMDEDIT, message, 0, (LPARAM)this->param_);
        this->next_->sendParameterMSG(hDlg, message);
    }
}


// Global Variables:
HINSTANCE g_hInst;          // The current instance
HWND      g_hwndCB;         // The command bar handle
HWND      hWndEdit;         // Read only edit box for output display
FILE*     g_OutputFile;     // File handler for output save

ParameterList g_Parameter;  // command line parameter list

ACE_CE_Screen_Output cout;  // Replacement of std::cout

ACE_TCHAR g_CommandLine[MAX_COMMAND_LINE]; // User-specified command line 
parameter
ACE_TCHAR g_SaveFileName[MAX_LOADSTRING];      // Name of the output file

static SHACTIVATEINFO s_sai;

// Forward declarations of functions included in this code module:
ATOM                MyRegisterClass (HINSTANCE, ACE_TCHAR*);
BOOL                InitInstance    (HINSTANCE, int);
LRESULT CALLBACK    WndProc         (HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK    About           (HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK    CommandLine     (HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK    SaveFileName    (HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK    FileError       (HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK    FileExist       (HWND, UINT, WPARAM, LPARAM);
HWND                CreateRpCommandBar(HWND);


void InitSetup()
{
    g_OutputFile    = 0;
    memset(g_CommandLine,  0, MAX_COMMAND_LINE * sizeof(ACE_TCHAR));
    memset(g_SaveFileName, 0, MAX_LOADSTRING   * sizeof(ACE_TCHAR));
}


void LoadParameterHistory()
{
    FILE* parameterFile = _wfopen(g_ParameterFileName, ACE_TEXT("r"));

    if (parameterFile != 0) {
        while (feof(parameterFile) == 0) {
            // Note: Remember that fwprintf takes wide-character format 
specifier but
            // save string as ASCII.  Thus, history must be read as ASCII then 
converted
            // to wide-character (Unicode on WinCE).
            char singleParameter[MAX_COMMAND_LINE];
            int size = 0;
            fread(&singleParameter[size], sizeof(char), 1, parameterFile);

            // WinCE does not have function that reads upto the end of line.
            while (singleParameter[size] != '\n') {
                fread(&singleParameter[++size], sizeof(char), 1, parameterFile);
            }

            if (size > 0) {
                singleParameter[size] = 0;  // NULL terminator
                g_Parameter.addParameter(singleParameter);
            }
        }
        fclose(parameterFile);
    }
}


//
//  FUNCTION: MyRegisterClass()
//
//  PURPOSE: Registers the window class.
//
//  COMMENTS:
//
//    It is important to call this function so that the application
//    will get 'well formed' small icons associated with it.
//
ATOM MyRegisterClass(HINSTANCE hInstance, ACE_TCHAR* szWindowClass)
{
    WNDCLASS    wc;

    wc.style            = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc      = (WNDPROC) WndProc;
    wc.cbClsExtra       = 0;
    wc.cbWndExtra       = 0;
    wc.hInstance        = hInstance;
    wc.hIcon            = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_FACE));
    wc.hCursor          = 0;
    wc.hbrBackground    = (HBRUSH) GetStockObject(WHITE_BRUSH);
    wc.lpszMenuName     = 0;
    wc.lpszClassName    = szWindowClass;

    return RegisterClass(&wc);
}

//
//  FUNCTION: InitInstance(HANDLE, int)
//
//  PURPOSE: Saves instance handle and creates main window
//
//  COMMENTS:
//
//    In this function, we save the instance handle in a global variable and
//    create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
    HWND hWnd = 0;

    ACE_TCHAR szTitle[MAX_LOADSTRING];            // The title bar text
    ACE_TCHAR szWindowClass[MAX_LOADSTRING];      // The window class name

    g_hInst = hInstance;        // Store instance handle in our global variable
    // Initialize global strings
    LoadString(hInstance, IDC_FACE, szWindowClass, MAX_LOADSTRING);
    LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);

    //If it is already running, then focus on the window
    hWnd = FindWindow(szWindowClass, szTitle);
    if (hWnd)
    {
        // set focus to foremost child window
        // The "| 0x01" is used to bring any owned windows to the foreground and
        // activate them.
        SetForegroundWindow((HWND)((ULONG) hWnd | 0x00000001));
        return 0;
    }

    MyRegisterClass(hInstance, szWindowClass);

    RECT    rect;
    GetClientRect(hWnd, &rect);

    hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,
        CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, 
hInstance, 0);

    if (!hWnd)
    {
        int error = 0;
        error = GetLastError();
        return FALSE;
    }
    //When the main window is created using CW_USEDEFAULT the height of the 
menubar (if one
    // is created is not taken into account). So we resize the window after 
creating it
    // if a menubar is present
    {
        RECT rc;
        GetWindowRect(hWnd, &rc);
        rc.bottom -= MENU_HEIGHT;
        if (g_hwndCB)
            MoveWindow(hWnd, rc.left, rc.top, rc.right, rc.bottom, FALSE);
    }

    ShowWindow(hWnd, nCmdShow);
    UpdateWindow(hWnd);

    return TRUE;
}

//
//  FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_COMMAND  - process the application menu
//  WM_PAINT    - Paint the main window
//  WM_DESTROY  - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    HDC hdc;
    int wmId, wmEvent, nCmdHt;
    PAINTSTRUCT ps;
    RECT textRect;

    switch (message)
    {
        case WM_COMMAND:
            wmId    = LOWORD(wParam);
            wmEvent = HIWORD(wParam);
            // Parse the menu selections:
            switch (wmId)
            {
                case IDM_HELP_ABOUT:
                    DialogBox(g_hInst, (const ACE_TCHAR*)IDD_ABOUTBOX, hWnd, 
(DLGPROC)About);
                    break;

                case IDOK:
                    SendMessage(hWnd, WM_ACTIVATE, MAKEWPARAM(WA_INACTIVE, 0), 
(LPARAM)hWnd);
                    SendMessage(hWnd, WM_CLOSE, 0, 0);
                    break;

                case ID_SETTING_RUN:
                    {
#ifdef NO_ACE
                        cout << ACE_TEXT("START with command line: ") << 
g_CommandLine << endl;
                        CE_ARGV ce_argv(g_CommandLine);
                        main_i(ce_argv.argc(), ce_argv.argv());
                        cout << ACE_TEXT("END") << endl << endl;
#else
                        cout << ACE_TEXT("START with command line: ") << 
g_CommandLine << endl;
                        ACE_ARGV ce_argv(g_CommandLine);
                        ACE::init();
                        ACE_LOG_MSG->msg_callback(&cout);  // register call back
                        ACE_LOG_MSG->set_flags(ACE_Log_Msg::MSG_CALLBACK);  // 
set call back flag
                        ace_main_i(ce_argv.argc(), ce_argv.argv());
                        ACE::fini();
                        cout << ACE_TEXT("END") << endl << endl;
#endif  // NO_ACE
                    }
                    break;

                case ID_SETTING_EXIT:
                    SendMessage(hWnd, WM_DESTROY, 0, 0);
                    break;

                case ID_TOOLS_SAVETOFILE:
                    // create a dialog box to get the file name
                    DialogBox(g_hInst, (const ACE_TCHAR*)IDD_OUTFILE, hWnd, 
(DLGPROC)SaveFileName);
                    break;

                case ID_SETTING_COMMANDLINE:
                    // create a dialog box to get the command line
                    DialogBox(g_hInst, (const ACE_TCHAR*)IDD_CMDLINE, hWnd, 
(DLGPROC)CommandLine);
                    break;

                default:
                   return DefWindowProc(hWnd, message, wParam, lParam);
            }
            break;

        case WM_CREATE:
            SHMENUBARINFO mbi;

            memset(&mbi, 0, sizeof(SHMENUBARINFO));
            mbi.cbSize     = sizeof(SHMENUBARINFO);
            mbi.hwndParent = hWnd;
            mbi.nToolBarId = IDM_MENU;
            mbi.hInstRes   = g_hInst;
            mbi.nBmpId     = 0;
            mbi.cBmpImages = 0;

            if (!SHCreateMenuBar(&mbi))
                return 0;

            g_hwndCB = mbi.hwndMB;

            // Initialize the shell activate info structure
            memset (&s_sai, 0, sizeof (s_sai));
            s_sai.cbSize = sizeof (s_sai);

            GetClientRect(hWnd, &textRect);
            nCmdHt = CommandBar_Height(mbi.hwndMB);

            hWndEdit = CreateWindow(ACE_TEXT("EDIT"),
                                    0,
                                    WS_CHILD | WS_VISIBLE | ES_READONLY | 
ES_MULTILINE | WS_VSCROLL | WS_HSCROLL,
                                    0,
                                    0,
                                    textRect.right,
                                    textRect.bottom - MENU_HEIGHT,
                                    hWnd,
                                    0,
                                    g_hInst,
                                    0);
            cout.SetOutputWindow(hWndEdit);
            LoadParameterHistory();
            break;

        case WM_PAINT:
            RECT rt;
            hdc = BeginPaint(hWnd, &ps);
            GetClientRect(hWnd, &rt);
            EndPaint(hWnd, &ps);
            break;

        case WM_ACTIVATE:
            // Notify shell of our activate message
            SHHandleWMActivate(hWnd, wParam, lParam, &s_sai, FALSE);
            break;

        case WM_SETTINGCHANGE:
            SHHandleWMSettingChange(hWnd, wParam, lParam, &s_sai);
            break;

        case WM_HIBERNATE:  // low power
        case WM_CLOSE:
        case WM_DESTROY:
            g_Parameter.saveParameter();  // save parameters to history file
            CommandBar_Destroy(g_hwndCB);
            PostQuitMessage(0);
            break;

        default:
            return DefWindowProc(hWnd, message, wParam, lParam);
   }
   return 0;
}


HWND CreateRpCommandBar(HWND hwnd)
{
    SHMENUBARINFO mbi;

    memset(&mbi, 0, sizeof(SHMENUBARINFO));
    mbi.cbSize     = sizeof(SHMENUBARINFO);
    mbi.hwndParent = hwnd;
    mbi.nToolBarId = IDM_MENU;
    mbi.hInstRes   = g_hInst;
    mbi.nBmpId     = 0;
    mbi.cBmpImages = 0;

    if (!SHCreateMenuBar(&mbi))
        return 0;

    return mbi.hwndMB;
}

// Mesage handler for the About box.
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM)
{
    SHINITDLGINFO shidi;

    ACE_TCHAR* copyrightNote =
ACE_TEXT("ACE and TAO are copyrighted by Dr. Douglas C. Schmidt and Center for 
Distributed Object") \
ACE_TEXT("Computing at Washington University, 1993-2002, all rights reserved.") 
 \
ACE_TEXT("FaCE is copyrighted by Object Computing, Inc., 2002,\n all rights 
reserved.\n") \
ACE_TEXT("See License.txt for more information.");

    switch (message)
    {
        case WM_INITDIALOG:
            // Create a Done button and size it.
            shidi.dwMask = SHIDIM_FLAGS;
            shidi.dwFlags = SHIDIF_DONEBUTTON | SHIDIF_SIPDOWN | 
SHIDIF_SIZEDLGFULLSCREEN;
            shidi.hDlg = hDlg;
            SHInitDialog(&shidi);
            SetDlgItemText(hDlg, IDC_COPYRIGHT, copyrightNote);
            return TRUE;

        case WM_COMMAND:
            if (LOWORD(wParam) == IDOK)
            {
                EndDialog(hDlg, LOWORD(wParam));
                return TRUE;
            }
            break;
    }
    return FALSE;
}


LRESULT CALLBACK CommandLine(HWND hDlg, UINT message, WPARAM wParam, LPARAM)
{
    int wmId;
    int wmEvent;

    switch (message)
    {
    case WM_INITDIALOG:
        g_Parameter.sendParameterMSG(hDlg, CB_INSERTSTRING);
        SetDlgItemText(hDlg, IDC_CMDEDIT, g_CommandLine);  // pass existing 
command line for display
        return TRUE;

    case WM_COMMAND:
        wmId    = LOWORD(wParam);
        wmEvent = HIWORD(wParam);
        // Parse the menu selections:
        switch (wmId)
        {
        case IDOK:
            // new command line accepted
            GetDlgItemText(hDlg, IDC_CMDEDIT, g_CommandLine, MAX_COMMAND_LINE - 
1);
            EndDialog(hDlg, wmId);
            g_Parameter.addParameter(g_CommandLine);
            return TRUE;

        case IDCANCEL:
            EndDialog(hDlg, wmId);
            return TRUE;

        default:
            return FALSE;
        }
        break;
        default:
            return FALSE;
    }

    return FALSE;
}


LRESULT CALLBACK SaveFileName(HWND hDlg, UINT message, WPARAM wParam, LPARAM)
{
    int wmId;
    int wmEvent;

    ACE_TCHAR tempBuffer[MAX_LOADSTRING];
    ACE_TCHAR fileMode[3] = { 0, '+', 0 };  // mode will either be "a+" or "w+"
    FILE* tempFile;

    switch (message)
    {
    case WM_INITDIALOG:
        SetDlgItemText(hDlg, IDC_SAVEFILE, g_SaveFileName);
        return TRUE;

    case WM_COMMAND:
        wmId    = LOWORD(wParam);
        wmEvent = HIWORD(wParam);
        // Parse the menu selections:
        switch (wmId)
        {
        case IDOK:
            GetDlgItemText(hDlg, IDC_SAVEFILE, tempBuffer, MAX_LOADSTRING - 1);
            EndDialog(hDlg, wmId);

            tempFile = _wfopen(tempBuffer, ACE_TEXT("r"));

            if (tempFile != 0)  // if file exists
            {
                fclose(tempFile);  // close temp handler
                int choice = DialogBox(g_hInst, (const 
ACE_TCHAR*)IDD_FILEEXIST, hDlg, (DLGPROC)FileExist);
                switch (choice)
                {
                case IDOVERWRITE:  // overwrite existing file
                    fileMode[0] = 'w';
                    break;

                case IDC_APPEND:  // append to existing file
                    fileMode[0] = 'a';
                    break;

                case IDCANCEL:  // cancel operation without changing 
g_OutputFile
                    return TRUE;
                }
            }
            else  // if file does not exist
            {
                fileMode[0] = 'w';
            }

            tempFile = _wfopen(tempBuffer, fileMode);

            if (tempFile == 0)
            {
                DialogBox(g_hInst, (const ACE_TCHAR*)IDD_ERRFILE, hDlg, 
(DLGPROC)FileError);
            }
            else
            {
                wcscpy(g_SaveFileName, tempBuffer);

                if (g_OutputFile != 0)
                {
                    fclose(g_OutputFile);  // close any open file
                }

                g_OutputFile = tempFile;

                cout << g_OutputFile;  // update FILE* for the CE_Screen_Output 
class object.
            }

            return TRUE;

        case IDCANCEL:
            EndDialog(hDlg, wmId);
            return TRUE;

        default:
            return FALSE;
        }
        break;
        default:
            return FALSE;
    }

    return FALSE;
}


LRESULT CALLBACK FileError(HWND hDlg, UINT message, WPARAM wParam, LPARAM)
{
    switch (message)
    {
        case WM_INITDIALOG:
            return TRUE;

        case WM_COMMAND:
            if (LOWORD(wParam) == IDOK)
            {
                EndDialog(hDlg, LOWORD(wParam));
                return TRUE;
            }
            break;
    }

    return FALSE;
}


LRESULT CALLBACK FileExist(HWND hDlg, UINT message, WPARAM wParam, LPARAM)
{
    switch (message)
    {
    case WM_INITDIALOG:
        return TRUE;
    case WM_COMMAND:
        EndDialog(hDlg, LOWORD(wParam));
        return TRUE;
    default:
        return FALSE;
    }

    return FALSE;
}

//FUZZ: enable check_for_lack_ACE_OS
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to