|
Dear sangeetha,
I understood your problem. Currently I dont have any time to do a feasibility as you said that is why I have given the path.
You may have to do some work for the dynamic creation of controls and resizing the container window to accomodate new controls.
You can see whether the scrollbar need or not in WM_WINDOWPOSCHANGED Notification or you can have your own calculation on the same. if it bigger than the main window you should enable the scrollbar. you can get whether scrollbar enabled or not from the window style. call GetWindowLong to get the current style and & the result WM_VSCROLL (or the scrollbar you want to check it
Then you can set or remove using ModifyStyle function
e.g if(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_VSCROLL)
1. Hope you understood that you need to dynamically calclate the size of your container
2. Hope you need to place the container in a dialog.
3. Hope you know that scroollbar should enabled or disabled should be calculated according the main window size and container size
You are only needed to work on the 3rd point I have mentioned.
Just google at CP. You will get some inputs for it
SaRath.
"Do Next Thing..."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
Thank you a lot and i will work on it and let you know the result. Thank you for spending your time in giving tips to solve my problem.
All the best,
Sangeetha.
|
|
|
|
|
|
how to set background color to the Dlg??
|
|
|
|
|
Hello
In MFC application,we can call SetDialogBkColor() member at application InitInstance !
good luck!
|
|
|
|
|
Example
// AppWizard implements the InitInstance overridable function
// according to options you select. For example, the single document
// interface (SDI) option was chosen for the AppWizard code created
// below. You can add other per-instance initializations to the code
// created by AppWizard.
BOOL CMyApp::InitInstance()
{
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
SetDialogBkColor(COLORREF clrCtlBk = RGB(192, 192, 192), COLORREF clrCtlText = RGB(0, 0, 255) ); // Set dialog background color to gray
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMyDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CMyView));
AddDocTemplate(pDocTemplate);
// create a new (empty) document
OnFileNew();
if (m_lpCmdLine[0] != '\0')
{
// TODO: add command line processing here
}
return TRUE;
}
|
|
|
|
|
Since SetDialogBkColor is obsolete in new MFC, it has no effect. In order to change the background colour, I think the WM_ERASEBKGND notification has to be processed. The simplest handler can look like this:
BOOL CMyDialog::OnEraseBkgnd(CDC* pDC)
{
pDC->FillSolidRect(0, 0, 32000, 32000, RGB(0, 0, 255));
return TRUE;
}
-- modified at 4:39 Monday 26th June, 2006
|
|
|
|
|
You can use WM_PAINT instead OnEraseBkgnd
whitesky
|
|
|
|
|
In my opinion, changing of background colour in a WM_PAINT handler has a disadvantage: flickering. First the background is filled by the system colour in the WM_ERASEBKGND default handler, and then it is over-painted in WM_PAINT handler.
In order to avoid flickering, a new handler for WM_ERASEBKGND is to be provided, which simply does nothing and returns TRUE.
Therefore, the WM_ERASEBKGND message has to be handled anyway.
I think the WM_ERASEBKGND notification is the message which was originally designed for purpose under discussion.
|
|
|
|
|
You can use WM_CTLCOLOR or WM_PAINT
whitesky
|
|
|
|
|
|
I think yes but Onpaint is good
whitesky
|
|
|
|
|
|
I usually use ctlcolor and its good for me but i said WM_CTLCOLOR and WM_PAINT are possible SetDialogBkColor or WM_ERASEBKGND and...are possible
whitesky
|
|
|
|
|
Hi there,
Here is an exotic one:
BOOL CMyCoolApp::InitInstance()
{
WNDCLASS wc;
::GetClassInfo(m_hInstance, _T("#32770"), &wc);
wc.lpszClassName = _T("My cool Blue Dialog class");
CBrush brush(RGB(0,0,255));
wc.hbrBackground = brush;
brush.Detach();
wc.lpfnWndProc = DefWindowProc;
AfxRegisterClass(&wc);
}
Have fun!
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
How to apply "Force file output" option in Visual Studio.NET i.e. VC7. In Visual Studio 6.0, it is available in "Link-->Customize" option in Project Settings of VC++ project.
Can any one help me out please
|
|
|
|
|
I think you have to add the "/FORCE" option manually in Additional Options field of Project Properties --> Linker --> Command Line page.
Usually problems in your code should be solved without such options.
|
|
|
|
|
actually i want to select the folder.but iam able select the select only file.
so please help me,
sree
|
|
|
|
|
|
i selected the particular file by using following code
POSITION currPos;
char strFilter[] = { "Mp3 files (*.mp3)|*.mp3|All Files (*.*)|*.*||" };
CFileDialog avi(TRUE, ".mp3",NULL,OFN_ALLOWMULTISELECT | OFN_HIDEREADONLY, strFilter);
char drive[_MAX_DRIVE], middle[_MAX_PATH], filename[_MAX_FNAME], ext[_MAX_EXT];
if(avi.DoModal() == IDOK)
{
currPos = avi.GetStartPosition();
while(currPos != NULL)
{
m_SongName = avi.GetNextPathName(currPos);
_splitpath (m_SongName, drive, middle, filename, ext);
m_list7.AddString(m_SongName);
here
m_list7 is memeber vaiable for ListBox
|
|
|
|
|
So what you want to do is set a specific directory for CFileDialog?
Check out this article[^]
|
|
|
|
|
no my problem is for example we have songs in one folder.and if go to menu and add songs then if we select the folder then it should automatically selece the all songs in the folder.but it's not getting.if i click that folder all the songs are coming to select only one.
please solve this,
sree
|
|
|
|
|
OK.
Then I would use SHBrowseForFolder.
When I got the folder name, I would use FindFirstFile/FindNextFile to find all the mp3's in that folder.
What about that apporach?
|
|
|
|
|
to do this in my project where should i change the code
|
|
|
|
|