Problem building Platinum.lib with VS2010 error MSB8009: .NET Framework 2.0/3.0/3.5 you need v90-Plattformtoolset
merano
Posts
-
Play Media File -
How to Move an MFC Button. [modified]You already have the very good hint from Niklas Lindquist 14Jul'10. SetWindowPos()[^] or MoveWindow()[^] to move the buttons Every Button is based on a Window and SetWindowPos() can do everything with the button (even hide it) if you are able to get the CWnd-handle. See Example:
void CWinApp::HideApplication()
On the MSDN Online-Page (linked also by Niklas Lindquist) you really should start to read MFC doku (See advice of Cedric Moonen). You can get hints from the Forum, but nobody will do the complete work for you. What is the complete Funktion of your Application ? -If you want networkfunktions you will probably get Timing an Sync Problems. You can send every Button a message to get the same result as if you pressed it, but over Network you will not see the monitor. You have to find a way to send the results back to every client and display it. -
How to Move an MFC Button. [modified]Yes that will do the job. Found an easy TODO for the Timer-Part here ("Using Timers in MFC Applications") In our Sample it would look like this: First update your class in MoveTheButtonDlg.h (Some work is already done by VisualStudio when clicking the Button)
enum {DIR_STOP, DIR_LEFT, DIR_RIGHT};
// CMoveTheButtonDlg dialog
class CMoveTheButtonDlg : public CDialog
{...
DECLARE\_MESSAGE\_MAP()
public:
afx_msg void OnBnClickedMoveright();
afx_msg void OnBnClickedStop();
afx_msg void OnBnClickedMoveleft();
afx_msg void OnTimer(UINT TimerVal); // TI: Add timer handler to messagemapprivate:
BOOL StartTimer (UINT TimerDuration);
BOOL StopTimer(void);UINT\_PTR m\_nTimer; UINT m\_Direction; DWORD m\_winpos;
};
After that you have to declare Message-Map:
BEGIN_MESSAGE_MAP(CMoveTheButtonDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDC_MoveRight, &CMoveTheButtonDlg::OnBnClickedMoveright)
ON_BN_CLICKED(IDC_Stop, &CMoveTheButtonDlg::OnBnClickedStop)
ON_BN_CLICKED(IDC_MoveLeft, &CMoveTheButtonDlg::OnBnClickedMoveleft)
ON_WM_TIMER ( ) // TI: timer implementation
END_MESSAGE_MAP()At last the new members have do be defined:
void CMoveTheButtonDlg::OnBnClickedStop()
{
m_Direction = DIR_STOP;
StopTimer();
}void CMoveTheButtonDlg::OnBnClickedMoveright()
{
m_Direction = DIR_RIGHT;
StartTimer(1000);
}void CMoveTheButtonDlg::OnBnClickedMoveleft()
{
m_Direction = DIR_LEFT;
StartTimer(1000);
}BOOL CMoveTheButtonDlg::StartTimer (UINT TimerDuration)
{
m_nTimer = SetTimer (IDT_TIMER_0, TimerDuration, NULL);if ( m_nTimer == 0) {
MessageBox (_T("Unable to obtain timer"), _T("IDT_TIMER_0"), MB_OK|MB_SYSTEMMODAL);
return FALSE;
}return TRUE;
}// end StartTimerBOOL CMoveTheButtonDlg::StopTimer(void)
{
if(m_nTimer) {
// Stop the timer
if (!KillTimer (m_nTimer)) {
return FALSE;
m_nTimer = 0;
}
}return TRUE;
} // end StopTimer
void CMoveTheButtonDlg::OnTimer (UINT TimerVal)
{
if(TimerVal != m_nTimer) // TI: check what timer
return;switch(m\_Direction) { case DIR\_LEFT: // TI: move to left here m\_winpos-=5; break; case DIR\_RIGHT: // TI: move to right here m\_winpos+=5; break; }
}
I
-
How to Move an MFC Button. [modified]The link does not work. Do you have a Solution ?