Type: Posts; User:
December 9th, 2002
I have a rich edit control and I want to add some kind of a selection bar on the left side of it. I need to paint this bar on my own (gray background, images etc.).
The problem is that the rich...
Maybe you could put a value in the registry that works as a counter of the instances of your app and then divide the time equally between all instances?
Add OnCtlColor() to your dialog window, check the control's ID and use pDC->SetTextColor() with your color.
I don't have the full MSDN installed (just the docs about MFC, C++ libraries and so on). But I have the Platform SDK update which contains very good documentation with clear function descriptions and...
Wait a minute. A toolbar button is not a control (like a dialog button) so you can't attach it to a CButton. Use CToolbarCtrl member function to manipulate buttons.
Well... when they say something is unsupported under Win95, it means that it will fail if you try to do it. That's why you should always check the result and use some default value.
The ClipCursor() function confines the cursor to a rectangular area on the screen.
Just use the default value (in this case 3) if the function fails.
Update commands are by default sent to the active view only. Try adding the following to CMainFrame to change this routing:
BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra,...
I use an owner-drawn button and the following code:
void CAboutDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
The MSDN says that the edit control sends WM_CTLCOLOREDIT to its parent (which is the combo box in this case). This message is handled by
CWnd::OnCtlColor( CDC* pDC, CWnd* pWnd, UINT nCtlColor );...
The easier way to create a font is CFont::CreatePointFont() where you only need to pass the size (multiplied by 10) and name. LOGFONT is useful if you have to specify all these bold, italic,...
Your can do it this way:
ShellExecute(::GetDesktopWindow(), "open", "YourApp.exe", NULL, "C:\", SW_SHOWNORMAL);
Remove "->m_pMainWnd" and it should work. You were trying to get the main window and cast it ta an application object. That's why it chrashes.
You have to read the variable from the CMainDialog object that opens the subdialog. When you create a temporary (local)CMainDialog object, it contains nothing. It's a different instance.
The window that previously had focus is passed to CWnd::OnSetFocus(). You can store its handle (not the pointer itself!) for later use.
You have to do something like this:
int sec = timespan.GetTotalSeconds();
sec = (int)(sec * 10.5);
timespan = CTimeSpan((time_t)sec);
Since CPoint is a really simple object, I don't see any reasons not to return it from a function, as well as pass it as a argument etc. Returning a reference allows anyone to modify this object and...
Why don't you just use a simple array of structs containing int id nad char* string pairs?
It's easier to check if the HWND of toolbar is not null in OnSize(), this way you don't need an extra variable. In fact WM_SIZE is often sent to a window before its children have been created.
You have to use the report list style having one column as wide
as the list. You can use GetClientRect() to find the width and decrease it by some number for the scrollbar to fit.
Try calling SeekToEnd() before writing, to append data to the end of the file.
When you press ENTER in a dialog, it activates the default button, so if you have an OK button the dialog will be closed. KillFocus is sent when the user deactivates the control (by pressing TAB or...
If this is a single line edit box, it cannot have a '\n' at the end.
Click Here to Expand Forum to Full Width