Pelles C forum

C language => Windows questions => Topic started by: k1024k on August 01, 2008, 04:48:57 PM

Title: RichText Controls
Post by: k1024k on August 01, 2008, 04:48:57 PM
how can i use the Xp style (manifest) in my RichText edit control ?
   
someone could help me?

thank you.
Title: Re: RichText Controls
Post by: frankie on August 02, 2008, 07:58:52 PM
From the integrated resource editor create a manifest resorce and add it to the project.
Title: Re: RichText Controls
Post by: k1024k on August 03, 2008, 02:56:03 PM
for the RichText Controls the normal manifest not work !
Title: Re: RichText Controls
Post by: frankie on August 04, 2008, 02:18:20 PM
Did you used InitCommonControls at beginning of your program?
For more info http://msdn.microsoft.com/en-us/library/bb787877.aspx (http://msdn.microsoft.com/en-us/library/bb787877.aspx) (Leggi questo  ;) )
Title: Re: RichText Controls
Post by: k1024k on August 09, 2008, 02:25:00 AM
Code: [Select]
#include "main.h"

int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow) {
   
InitCommonControls();
LoadLibrary(TEXT("Riched20.dll"));


    WNDCLASSEX wcx;
    wcx.cbSize = sizeof(wcx);

    if (!GetClassInfoEx(NULL, MAKEINTRESOURCE(32770), &wcx))
        return MessageBox(0,"Inizializzazione Fallita !",0,MB_ICONERROR);

    wcx.hInstance = hInstance;
    wcx.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDR_ICO_MAIN));
    wcx.lpszClassName = _T("CLASS_WIN32_DIALOG");
   
if (!RegisterClassEx(&wcx))
        return MessageBox(0,"Inizializzazione Fallita !",0,MB_ICONERROR);

    // -- Crea il dialogo --
    return DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, (DLGPROC)main_DlgProcedure);
}

LRESULT CALLBACK main_DlgProcedure(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
HANDLE_MSG(hwnd, WM_INITDIALOG, _OnInitDialog);
HANDLE_MSG(hwnd, WM_CLOSE, _OnClose);
HANDLE_MSG(hwnd, WM_DESTROY, _OnDestroy);
HANDLE_MSG(hwnd, WM_COMMAND, _OnCommand);

default:
return FALSE;
}

}

BOOL _OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{

  HWND hwndEdit= CreateWindowEx(0, "RichEdit20W", TEXT("Type here"),
        ES_MULTILINE | WS_VISIBLE | WS_CHILD | WS_BORDER | WS_TABSTOP,
        0, 0, 400, 300,
        hwnd, (HMENU)1001, GetWindowInstance(hwnd), NULL);
return 1;
}

i have add manifest in resources project ... the program run ok but the visual style not work for the only control RichTextEdit.

Thank You All !