1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
#include <windows.h>
#include <commctrl.h>
HINSTANCE hinst;
LRESULT CALLBACK MainWndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
...
InitCommonControls();
hinst = hinstance;
HINSTANCE richDll = LoadLibrary("RICHED20.DLL");
...
}
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static HWND hEdit;
static HWND hsb;
static BOOL EditNotChg = TRUE;
switch (uMsg)
{
case WM_CREATE:
//Edit RICHTEXT
{
HFONT hFont;
hEdit = CreateWindow( "RichEdit20A", "Je suis un RichEdit !", WS_CHILD | WS_VISIBLE | ES_MULTILINE,10, 10, 300, 300, hwnd, 0, hinst, 0);
hFont = (HFONT)GetStockObject(ANSI_FIXED_FONT);
SendMessage(hEdit,WM_SETFONT,(UINT)hFont,TRUE);
SendMessage(hEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(5, 5));
//DEBUT Init ToolBar
hsb = CreateStatusWindow(WS_CHILD | WS_VISIBLE, "MsgEditeur 2005", hwnd, FALSE);
// FIN Init ToolBar
return 0;
} |