Hello
I have a static window control & I want to make the text inside that static window centre aligned.
Is is possible to do that with a static window?
Or should I use another function?
static window:
stBox = CreateWindowEx(
0,
"Static",
s.c_str(),
WS_BORDER | WS_CHILD | WS_VISIBLE, // maybe I can put TF_RIGHTALIGN ??
x,y,
w+totalW+5,h+10,
hwnd, NULL,
gInstance,NULL);
Another question, I have a dialog using OPENFILENAME that closes when I select a file. Is there a way to make the dialog close when I select a folder instead of a file?
void doFileOpen(HWND hwnd,UINT msg)
{
OPENFILENAME ofn;
char szFileName[MAX_PATH] = "";
char folderPath[MAX_PATH] = "";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hwnd;
ofn.lpstrFilter = "Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0";
ofn.lpstrFile = szFileName;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
ofn.lpstrDefExt = "txt";
if(GetOpenFileName(&ofn))
{
//CommDlg_OpenSave_GetFolderPath(hwnd,sizeof(folderPath),(WPARAM)folderPath); // This doesn't work
SendMessage(hwnd,CDM_GETFOLDERPATH,sizeof(folderPath),(LPARAM)folderPath);
SetDlgItemText(hwnd,msg,folderPath);
}
}