BOOL GetFileName(HWND hwnd, LPSTR pszFileName, BOOL bSave)
{
OPENFILENAME ofn;
ZeroMemory(&ofn, sizeof(ofn));
pszFileName[0] = 0;
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
ofn.lpstrFilter = "Fichiers Texte (*.txt)\0*.txt\0";
ofn.lpstrFile = pszFileName;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrDefExt = "txt";
if(bSave)
{
ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY |
OFN_OVERWRITEPROMPT;
if(!GetSaveFileName(&ofn))
return FALSE;
}
else
{
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
if(!GetOpenFileName(&ofn))
return FALSE;
}
return TRUE;
}

Telecharger l'exemple ouverture et sauvegarde de fichiers
void choifont()
{
CHOOSEFONT cf;
ZeroMemory(&cf, sizeof(CHOOSEFONT));
cf.lStructSize = sizeof (CHOOSEFONT);
cf.lpLogFont = &lf;
cf.Flags = CF_SCREENFONTS | CF_INITTOLOGFONTSTRUCT;
if (ChooseFont(&cf))
{
DeleteObject(hFont);
hFont = CreateFontIndirect(&lf);
SendMessage(hEdit,WM_SETFONT,(UINT)hFont,TRUE);
}
}

Telecharger l'exemple choix de polices de caractères
void choicouleur()
{
CHOOSECOLOR cc;
static COLORREF acrCustClr[16];
ZeroMemory(&cc, sizeof(CHOOSECOLOR));
cc.lStructSize = sizeof(CHOOSECOLOR);
cc.lpCustColors = NULL;
cc.lpCustColors = (LPDWORD) acrCustClr;
cc.rgbResult = TextColor;
cc.Flags = CC_FULLOPEN | CC_RGBINIT;
if (ChooseColor(&cc)==TRUE)
{
TextColor = cc.rgbResult;
PostMessage(hEdit,WM_SETREDRAW,TRUE,0);
}
}

Telecharger l'exemple choix de couleurs