Skip to content

Commit

Permalink
Cast to WPARAM for window messages
Browse files Browse the repository at this point in the history
  • Loading branch information
clsid2 committed Nov 14, 2023
1 parent b07b52b commit 91f7952
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/mpc-hc/BaseGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void CBaseGraph::NotifyEvent(long lEventCode, LONG_PTR lParam1, LONG_PTR lParam2
msg.m_lParam2 = lParam2;
m_msgqueue.AddTail(msg);

PostMessage((HWND)m_hNotifyWnd, m_lNotifyMsg, 0, m_lNotifyInstData);
PostMessage((HWND)m_hNotifyWnd, m_lNotifyMsg, (WPARAM)0, m_lNotifyInstData);
}

// IDispatch
Expand Down
2 changes: 1 addition & 1 deletion src/mpc-hc/CMPCThemePlayerListCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ BOOL CMPCThemePlayerListCtrl::OnLvnItemchanged(NMHDR* pNMHDR, LRESULT* pResult)
{
//LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
if (AppNeedsThemedControls()) {
::PostMessage(m_hWnd, PLAYER_PLAYLIST_LVN_ITEMCHANGED, 0, 0);
::PostMessage(m_hWnd, PLAYER_PLAYLIST_LVN_ITEMCHANGED, (WPARAM)0, (LPARAM)0);
}
*pResult = 0;
return FALSE;
Expand Down
6 changes: 1 addition & 5 deletions src/mpc-hc/GraphThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,7 @@ void CGraphThread::OnOpen(WPARAM wParam, LPARAM lParam)
void CGraphThread::OnReset(WPARAM wParam, LPARAM lParam)
{
if (m_pMainFrame) {
BOOL* b = (BOOL*)wParam;
BOOL bResult = m_pMainFrame->ResetDevice();
if (b) {
*b = bResult;
}
m_pMainFrame->ResetDevice();
}
if (CAMEvent* e = (CAMEvent*)lParam) {
e->Set();
Expand Down
12 changes: 6 additions & 6 deletions src/mpc-hc/MainFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ void CMainFrame::OnDestroy()

if (m_pGraphThread) {
CAMMsgEvent e;
m_pGraphThread->PostThreadMessage(CGraphThread::TM_EXIT, 0, (LPARAM)&e);
m_pGraphThread->PostThreadMessage(CGraphThread::TM_EXIT, (WPARAM)0, (LPARAM)&e);
if (!e.Wait(5000)) {
TRACE(_T("ERROR: Must call TerminateThread() on CMainFrame::m_pGraphThread->m_hThread\n"));
TerminateThread(m_pGraphThread->m_hThread, DWORD_ERROR);
Expand Down Expand Up @@ -1739,7 +1739,7 @@ void CMainFrame::OnDisplayChange() // untested, not sure if it's working...
if (GetLoadState() == MLS::LOADED) {
if (m_pGraphThread) {
CAMMsgEvent e;
m_pGraphThread->PostThreadMessage(CGraphThread::TM_DISPLAY_CHANGE, 0, (LPARAM)&e);
m_pGraphThread->PostThreadMessage(CGraphThread::TM_DISPLAY_CHANGE, (WPARAM)0, (LPARAM)&e);
e.WaitMsg();
} else {
DisplayChange();
Expand Down Expand Up @@ -3122,7 +3122,7 @@ LRESULT CMainFrame::OnResetDevice(WPARAM wParam, LPARAM lParam)

if (m_bOpenedThroughThread) {
CAMMsgEvent e;
m_pGraphThread->PostThreadMessage(CGraphThread::TM_RESET, 0, (LPARAM)&e);
m_pGraphThread->PostThreadMessage(CGraphThread::TM_RESET, (WPARAM)0, (LPARAM)&e);
e.WaitMsg();
} else {
ResetDevice();
Expand Down Expand Up @@ -17915,7 +17915,7 @@ void CMainFrame::OpenMedia(CAutoPtr<OpenMediaData> pOMD)
// initiate graph creation, OpenMediaPrivate() will call OnFilePostOpenmedia()
if (bUseThread) {
VERIFY(m_evOpenPrivateFinished.Reset());
VERIFY(m_pGraphThread->PostThreadMessage(CGraphThread::TM_OPEN, 0, (LPARAM)pOMD.Detach()));
VERIFY(m_pGraphThread->PostThreadMessage(CGraphThread::TM_OPEN, (WPARAM)0, (LPARAM)pOMD.Detach()));
m_bOpenedThroughThread = true;
} else {
OpenMediaPrivate(pOMD);
Expand Down Expand Up @@ -18109,7 +18109,7 @@ void CMainFrame::CloseMedia(bool bNextIsQueued/* = false*/)
if (m_pGraphThread && m_bOpenedThroughThread && !bGraphTerminated) {
// either opening or closing has to be blocked to prevent reentering them, closing is the better choice
VERIFY(m_evClosePrivateFinished.Reset());
VERIFY(m_pGraphThread->PostThreadMessage(CGraphThread::TM_CLOSE, 0, 0));
VERIFY(m_pGraphThread->PostThreadMessage(CGraphThread::TM_CLOSE, (WPARAM)0, (LPARAM)0));

HANDLE handle = m_evClosePrivateFinished;
DWORD dwWait;
Expand Down Expand Up @@ -18146,7 +18146,7 @@ void CMainFrame::StartTunerScan(CAutoPtr<TunerScanData> pTSD)
SendNowPlayingToSkype();

if (m_pGraphThread) {
m_pGraphThread->PostThreadMessage(CGraphThread::TM_TUNER_SCAN, 0, (LPARAM)pTSD.Detach());
m_pGraphThread->PostThreadMessage(CGraphThread::TM_TUNER_SCAN, (WPARAM)0, (LPARAM)pTSD.Detach());
} else {
DoTunerScan(pTSD);
}
Expand Down
2 changes: 1 addition & 1 deletion src/mpc-hc/PlayerSeekBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void CPlayerSeekBar::MoveThumb(const CPoint& point)

void CPlayerSeekBar::SyncVideoToThumb()
{
GetParent()->PostMessage(WM_HSCROLL, NULL, reinterpret_cast<LPARAM>(m_hWnd));
GetParent()->PostMessage(WM_HSCROLL, (WPARAM)0, reinterpret_cast<LPARAM>(m_hWnd));
}

void CPlayerSeekBar::CheckScrollDistance(CPoint point, REFERENCE_TIME minimum_duration_change, ULONGLONG minimum_elapsed_tickcount)
Expand Down
2 changes: 1 addition & 1 deletion src/mpc-hc/VMROSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ void CVMROSD::UpdateSeekBarPos(CPoint point)
}

if (m_pWnd) {
AfxGetApp()->GetMainWnd()->PostMessage(WM_HSCROLL, NULL, reinterpret_cast<LPARAM>(m_pWnd->m_hWnd));
AfxGetApp()->GetMainWnd()->PostMessage(WM_HSCROLL, (WPARAM)0, reinterpret_cast<LPARAM>(m_pWnd->m_hWnd));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/mpc-hc/WebServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ CWebServer::CWebServer(CMainFrame* pMainFrame, int nPort)
CWebServer::~CWebServer()
{
if (m_hThread != nullptr) {
PostThreadMessage(m_ThreadId, WM_QUIT, 0, 0);
PostThreadMessage(m_ThreadId, WM_QUIT, (WPARAM)0, (LPARAM)0);
if (WaitForSingleObject(m_hThread, 10000) == WAIT_TIMEOUT) {
TerminateThread(m_hThread, 0xDEAD);
}
Expand Down

0 comments on commit 91f7952

Please sign in to comment.