Archived

This topic is now archived and is closed to further replies.

Statusbar on dialog, what am I doing wrong?

This topic is 5434 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to write a client for my server. I don''t have much Win32 experience. So far I am trying to create an Dialogbox(As main window) containing an Richedit control, edit control and a statusbas. When I add the statusbar as ActiveX control on the dialog and test it, it works. However, when I compile to the program, it doesn''t work anymore for some reason. This is how stuff look: main.cpp
  
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int iShowCmd)
{
    INITCOMMONCONTROLSEX InitCCEx;

    // Load the Rich Edit 1.0 control

    LoadLibrary("RICHED32.DLL");

    // Set up stuff to register common control things

    InitCCEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
    InitCCEx.dwICC  = ICC_WIN95_CLASSES;
    if (!InitCommonControlsEx(&InitCCEx))
    {
        MessageBox(NULL, "Unable to register common controls.", "TClient", MB_ICONSTOP | MB_ICONSTOP);
        return (0);
    }

    // Class for the statusbar and stuff

    InitCCEx.dwICC  = ICC_BAR_CLASSES;
    if (!InitCommonControlsEx(&InitCCEx))
    {
        MessageBox(NULL, "Unable to register common controls.", "TClient", MB_ICONSTOP | MB_ICONSTOP);
        return (0);
    }

    // Register some common controls stuff


    // Open the dialogbox for the client

    DialogBox(hInstance, "Main", 0, TClientDlgProc);
    return (0);
}
  
This is the resource file, created by the Dialog editor inside MSVC++:
  
//Microsoft Developer Studio generated resource script.

//

#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////

//

// Generated from the TEXTINCLUDE 2 resource.

//

#include "afxres.h"

/////////////////////////////////////////////////////////////////////////////

#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////

// Dutch (Netherlands) resources


#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NLD)
#ifdef _WIN32
LANGUAGE LANG_DUTCH, SUBLANG_DUTCH
#pragma code_page(1252)
#endif //_WIN32


/////////////////////////////////////////////////////////////////////////////

//

// Dialog

//


MAIN DIALOG DISCARDABLE  0, 0, 328, 199
STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "TClient"
FONT 8, "MS Sans Serif"
BEGIN
    EDITTEXT        IDC_SENDTEXT,0,156,328,29,ES_MULTILINE | ES_AUTOHSCROLL
    CONTROL         "",IDC_RECEIVED,"RICHEDIT",ES_MULTILINE | ES_AUTOVSCROLL | 
                    ES_AUTOHSCROLL | ES_READONLY | WS_BORDER | WS_VSCROLL | 
                    WS_TABSTOP,0,10,328,145
    CONTROL         "",IDC_SBARCTRL1,"{8E3867A3-8586-11D1-B16A-00C0F0283628}",
                    0x0,0,186,327,12
END


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

//

// TEXTINCLUDE

//


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

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

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

#endif    // APSTUDIO_INVOKED



/////////////////////////////////////////////////////////////////////////////

//

// DESIGNINFO

//


#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE 
BEGIN
    "MAIN", DIALOG
    BEGIN
        LEFTMARGIN, 1
        RIGHTMARGIN, 327
        TOPMARGIN, 7
    END
END
#endif    // APSTUDIO_INVOKED



/////////////////////////////////////////////////////////////////////////////

//

// Dialog Info

//


MAIN DLGINIT
BEGIN
    IDC_SBARCTRL1, 0x376, 180, 0
0x0024, 0x0000, 0x0039, 0x0033, 0x0036, 0x0038, 0x0032, 0x0036, 0x0035, 
0x0045, 0x002d, 0x0038, 0x0035, 0x0046, 0x0045, 0x002d, 0x0031, 0x0031, 
0x0064, 0x0031, 0x002d, 0x0038, 0x0042, 0x0045, 0x0033, 0x002d, 0x0030, 
0x0030, 0x0030, 0x0030, 0x0046, 0x0038, 0x0037, 0x0035, 0x0034, 0x0044, 
0x0041, 0x0031, 0x4321, 0x1234, 0x0008, 0x0000, 0x32bf, 0x0000, 0x0211, 
0x0000, 0x7e88, 0xe6e1, 0x0000, 0x0006, 0x0034, 0x0000, 0x0001, 0x0000, 
0xffff, 0x0013, 0xef01, 0xabcd, 0x0000, 0x0005, 0x0ba0, 0x001b, 0x0006, 
0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 
0x0001, 0x0000, 0x04a0, 0x0039, 0x09ec, 0x0000, 0x09ec, 0x0000, 0x0000, 
0x0000, 0x0000, 0x0000, 0xde1f, 0xbdec, 0x0001, 0x0005, 0x0000, 0x0000, 

    0
END

#endif    // Dutch (Netherlands) resources

/////////////////////////////////////////////////////////////////////////////




#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////

//

// Generated from the TEXTINCLUDE 3 resource.

//



/////////////////////////////////////////////////////////////////////////////

#endif    // not APSTUDIO_INVOKED



  
What am I doing wrong here? I added COMCTL32.LIB to my project. Sand Hawk ---------------- (Inspired by Pouya)

Share this post


Link to post
Share on other sites