|
I tried this but its not working
CFileDialog dlg(TRUE,0,0,OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY);
dlg.m_ofn.lpstrFilter = _T("EXE Files (*.exe)\0*.exe\0");
if(dlg.DoModal()==IDCANCEL)
return;
|
|
|
|
|
You are missing a final \0 terminator in your filter string. The filter uses a single \0 to delimit each individual string, and then two terminators \0\0 to terminate the whole thing.
|
|
|
|
|
CFileDialog dlg(TRUE,0,0,OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY);
dlg.m_ofn.lpstrFilter = _T("EXE Files (*.exe)\0*.exe\0\0");
if(dlg.DoModal()==IDCANCEL)
return;
now its ok.
but its not working again.
|
|
|
|
|
try this then
dlg.m_ofn.lpstrFilter = "C++ Source Files (*.cpp;*.h)|*.cpp;*.h|All files (*.*)|*.*||"
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
|
The second \0 is put implicitly by the compiler.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hmm, you're right. I always specify the filter using the CFileDialog constructor, so I use the "|" and "||" delimiters in the filter string.
|
|
|
|
|
hi friends,
i wrote one protocal...facing problem...please help any bogy
before Lisening i am dedicating socket p.AsyncSelect(FD_ACCEPT);
i am Accepting All the Connections....
next i want to do Sent and recieve repately....but after Accepting Connections its not going sent..
i am using CAsyncSocket(OnAccept,OnSent,OnRecieve)...
|
|
|
|
|
Quick tip: Leave AsyncSelect() alone, most time you don't need to play with these values.
Socket objects inherit their notification event settings from the listening socket or more precisely from the socket that accepts them. If you use any of the notification handler OnSent/OnRecieve/OnClose in your socket objects you need the corresponding FD_WRITE/FD_READ/FD_CLOSE events[^] too. Until you do some superduper-fine-tuning, just stick with the defaults.
Hope this helps.
/M
|
|
|
|
|
I have a dialog in my application. When the application starts the dialog size should be the the system size. It should occupy the full screen size automatically. How can i do this?
|
|
|
|
|
One way is to use GetSystemMetrics() with SM_CXVIRTUALSCREEN and SM_CYVIRTUALSCREEN to retrieve the screen dimensions, then use SetWindowPos() to set your dialog to that size.
|
|
|
|
|
Small example:
UINT width = GetSystemMetrics(SM_CXSCREEN);
UINT height = GetSystemMetrics(SM_CYSCREEN);
SetWindowPos(hWnd, HWND_TOP, 0, 0, width, height, SWP_NOZORDER | SWP_SHOWWINDOW);
|
|
|
|
|
Just a comment: If you don't use SM_CXVIRTUALSCREEN and SM_CYVIRTUALSCREEN in the GetSystemMetrics() calls, on a multiple-monitor system only the primary monitor's dimension is obtained. It's hard to tell whether the original poster wanted to use the primary monitor, or the whole desktop, though.
|
|
|
|
|
ohh yeah, if author will use a multiple-monitor system, you're right of course
|
|
|
|
|
hai all . I am using a dialog based MFC application. How will I get the value of hwnd?
|
|
|
|
|
By default CWnd defined in afxwin.h. You should find same definition CWnd* m_pMainWnd;
|
|
|
|
|
hi I am trying to use it in InitDialog() but they are showing undeclared identifier m_pMainWnd
I saw this variable in the afxwin.h which is included by the StdAfx.h
|
|
|
|
|
What version of Visual Studio do you use? If 2010, there is another structure of default generated code. Anyways check that stdafx.h is include in your header file
|
|
|
|
|
hai , I am using this code in InitDialog()
int width=GetSystemMetrics(SM_CXSCREEN);
int height=GetSystemMetrics(SM_CYSCREEN);
SetWindowPos(AfxGetApp()->m_pMainWnd,0,0,width,height,SWP_SHOWWINDOW);
It is not working.
|
|
|
|
|
hey i got it .
I chaged the last parameter to SWP_NOZORDER|SWP_SHOWWINDOW .then it was working.
Thank u
|
|
|
|
|
|
On some multiple-monitor systems this only maximizes the window to one of the monitors, which may or may not be what the original poster wanted.
|
|
|
|
|
As the answers aboves, I want to ask a question for more. That is:
How can you let the buttons or text controls to suit the screen when the dialog fit the different screen size?
In another word, the buttons in dialog will stay unmove if you just let the dialog fit the screen, that will make the whole dialog look grotty.
Thanks, I wonder if I describe the question clearly.
|
|
|
|
|
At first you should determine controls position and form size, then on WM_SIZE event change position of controls that will depends on width and height of your form.
|
|
|
|
|
which functions can i use to do this?
|
|
|
|