Click here to Skip to main content
15,114,611 members

Comments by Member 11380615 (Top 22 by date)

Member 11380615 26-Apr-18 9:53am View
   
Each individual view the scroll sizes have been set.
Member 11380615 26-Apr-18 9:53am View
   
I tried adding the OnVScroll to the ScrollView class. SetScrollSizes were also called in the view class. There was only one scroll bar and that was in the main frame window. Despite me being able to scroll up and down through the mdi client area the call back function OnVScroll never got called.
Member 11380615 25-Apr-18 22:10pm View
   
Thanks Jochen. I do find that the MDI frame window automatically creates a vertical and horizontal scroll bar when the child windows go beyond the extent of the mdi client area. The MDI frame window scroll bar works fine when it is there. Scrolling works fine.
My objectve is to trap the scrolling event when ever the user tries to scroll. Would it be possible to trap the MDI frame window scrolling in the active view class using WM_HSCROLL, WM_VSCROLL. If so how would we differentiate between the scrolling of the view window and the MDI main frame window.
Member 11380615 25-Apr-18 22:02pm View
   
Thanks Richard, Yes a scroll bar appears on the main frame window. Whenever the number of child windows and their end to end extent go beyond the MDI client area and vertical and horizontal scroll bar automatically appears.
I was not able to call SetScrollSizes since the function is not available in the main frame class.
Member 11380615 1-May-17 23:57pm View
   
ID_FILE_NEW is mapped to OnFileNew1 . Which is what the system calls when creating the first mdi child window. When user creates new mdi child windows OnFileNew is used. Both OnFileNew and OnFIleNew1 are functions in theApp.

void CMarkBullNewVApp::OnFileNew1()
{
tagPlot ltempPlot;
theApp.Is_Graph_Data_3D = ANIMATION_WIN;
ltempPlot.WinCount = 0;
ltempPlot.Is_Graph_Data_3D = ANIMATION_WIN;
ltempPlot.Graph_Type = 0;// ii++;
ltempPlot.WinViewMap = 1;// lnumPlotCount[ii];
ltempPlot.RowCol[0] = 0;// DataColumnInt[jj];
strncpy(ltempPlot.PlotLegend[0], "0", 200);
ltempPlot.m_szXCaption[0] = "0";// m_szXCaption[0];
ltempPlot.m_szYCaption[0] = "0";// m_szYCaption[0];
ltempPlot.DirectionPlus[0] = "0";// DirectionPlus[0];
ltempPlot.DirectionMinus[0] = "0";// DirectionMinus[0];
theApp.plotList.clear();
theApp.plotList.push_back(ltempPlot);
CWinAppEx::OnFileNew(); // call base class method and / or...
// ...add other tasks here.
}


void CMarkBullNewVApp::OnFileNew()
{
CWinAppEx::OnFileNew(); // call base class method and / or...
}
Member 11380615 3-Jul-16 3:02am View
   
Initially I want to paint a rectangular strip above the client area. Its not working.
This is what I have in ncpaint().

void CChildFrame::OnNcPaint()
{
// still want the menu to be drawn, so trigger default handler first
//Default();
CFrameWnd::OnNcPaint();
CRect rc, rcGrabberOnly;
this->GetWindowRect(&rc);
rcGrabberOnly.right = (rc.right);
rcGrabberOnly.top = (rc.top-20);
rcGrabberOnly.bottom = (rc.top);
rcGrabberOnly.left = (rc.left);
CWindowDC * pDC = new CWindowDC(this);
CBrush* pBrush = new CBrush(RGB(255, 0, 0));
pDC->SelectObject(pBrush);
pDC->Rectangle(&rcGrabberOnly); //rcGrabberOnly);

cr_frm = RGB(255, 0, 0);
pDC->FillSolidRect(&rcGrabberOnly, cr_frm);

delete pDC;
delete pBrush;
return;
}

The rectangle is not getting painted.

BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs
if( !CMDIChildWnd::PreCreateWindow(cs) )
return FALSE;

//cs.style &= ~((LONG)FWS_ADDTOTITLE | WS_THICKFRAME | WS_MINIMIZE | WS_MAXIMIZE | WS_SYSMENU);
cs.style &= ~((LONG)FWS_ADDTOTITLE | WS_THICKFRAME | WS_CAPTION | WS_MINIMIZE | WS_MAXIMIZE);

cs.x = 100;
cs.y = 100;
cs.cx = 600;
cs.cy = 200;
return TRUE;
}
Member 11380615 3-Jul-16 1:59am View
   
Thanks enhzflep,
I am handling it in the child window.
void CChildFrame::OnNcPaint()

class CChildFrame : public CMDIChildWnd

What I am not clear about is what exactly to do in WM_NCPAINT
Should I just paint a rectangle above the client area

this->GetWindowRect(&rc); //returns the full window including the frame
GetWindowRect(&windowBounds); //returns only the client area

Should I be handling ON_WM_PAINT as well? I am already handling the ON_WM_PAINT in the CView class.
Regards,
Rakesh

Member 11380615 29-May-16 3:02am View
   
While the slider control is not visible it is actually there and fully functional.
If I try to approximate its position (which is slightly below the player window) and try to scrub the video. The scrubbing happens fine.
Member 11380615 29-May-16 2:43am View
   
////////////////////////////////////////////////////////////////////////////
void CAnalyseDialog::PlayStateChangeOcx3(long NewState)
{
//return;
// TODO: Add your message handler code here
LeftPlayerState = NewState;

LOGSAMP.LOGRP(FS, "Player State = ", (int)NewState);
LOGSAMP.LOGRP(FS, "scrLeftMaxOnce = ", (int)scrLeftMaxOnce);
LOGSAMP.LOGRP(FS, "totLeftVideoFrames = ", (int)totLeftVideoFrames);


if (NewState == 3)
{
if (mVideoTimer == NULL)
{
mVideoTimer = SetTimer(TimerId, TimerDuration, NULL);
}

if (scrLeftMaxOnce == 0)
{
sliderLeft.SetRange(0, totLeftVideoFrames, true);
//sliderLeft.MoveWindow(6, 49 + 30 + (cScreenXWidth / 2 - 12)*leftVideoHeightInFile / leftVideoWidthInFile +50, cScreenXWidth / 2 - 12, 40, true);
//m_pWMPPlayer1->put_uiMode(L"none");

//LOGSAMP.LOGRP(FS, "playerTop = ", playerTop);
//LOGSAMP.LOGRP(FS, "ActualVideoSizeLeft.left = ", ActualVideoSizeLeft.left);
//LOGSAMP.LOGRP(FS, "ActualVideoSizeLeft.left = ", ActualVideoSizeLeft.bottom);
//LOGSAMP.LOGRP(FS, "ActualVideoSizeLeft.left = ", ActualVideoSizeLeft.top);
//LOGSAMP.LOGRP(FS, "ActualVideoSizeLeft.left = ", ActualVideoSizeLeft.right);


vidCtrl1.MoveWindow(ActualVideoSizeLeft.left, playerTop + ActualVideoSizeLeft.top, ActualVideoSizeLeft.right, ActualVideoSizeLeft.bottom, true);
sliderLeft.MoveWindow(ActualVideoSizeLeft.left + 1, playerTop + ActualVideoSizeLeft.bottom + spacingBetPlayerScrub/2 + ActualVideoSizeLeft.top, ActualVideoSizeLeft.right - 1, 40, true);
//sliderLeft.ShowScrollBar(SB_HORZ, TRUE);
//sliderLeft.ShowCaret();
//vidCtrl1.UpdateWindow();
//LOGSAMP.LOGRP(FS,"Slider Visibility 0 = ",sliderLeft.IsWindowVisible());
HRESULT hrPause1 = m_spControls1->pause();
//HRESULT hrPause1 = m_spControls1->pause();
scrLeftMaxOnce = 1;
//LOGSAMP.LOGRP(FS, "Slider Visibility 1 = ", sliderLeft.IsWindowVisible());

Invalidate();
//LOGSAMP.LOGRP(FS, "Slider Visibility 2 = ", sliderLeft.IsWindowVisible());

RedrawWindow();
//LOGSAMP.LOGRP(FS, "Slider Visibility 3 = ", sliderLeft.IsWindowVisible());

}


//VARIANT_BOOL bSc = VARIANT_TRUE;
//HRESULT hrFull;
if (m_spControls1PauseCount == 1)
{
//HRESULT hrPause1 = m_spControls1->pause();
//m_spControls1->pause();
//m_spControls1PauseCount = 0;
//LOGD.LOGRP(FL, "In state changed 1 and m_spControls1PauseCount == 1");
}
//hrFull = m_pWMPPlayer1->put_fullScreen(bSc);
}

}
Member 11380615 29-May-16 2:42am View
   
//==============================================
void CAnalyseDialog::SwitchVideoPlay()
{
if (DlgPtr->m_VideoDialog.newVideoCHosenInTabVideo == 2)
{
LOGSAMP.LOGRP(FS, "newVideoCHosenInTabVideo = ", newVideoCHosenInTabVideo);
if (scrLeftMaxOnce != 0)
{
//LOGSAMP.LOGRP(FS, "scrLeftMaxOnce = ", scrLeftMaxOnce);

//sliderLeft.MoveWindow(ActualVideoSizeLeft.left + 1, playerTop + ActualVideoSizeLeft.bottom + spacingBetPlayerScrub / 2 + ActualVideoSizeLeft.top, ActualVideoSizeLeft.right - 1, 40, true);
//sliderLeft.Invalidate();
//sliderLeft.RedrawWindow();
//Sleep(50);
//LOGSAMP.LOGRP(FS, "Slider Visibility 4 = ", sliderLeft.IsWindowVisible());

//HRESULT hrPause1 = m_spControls1->play();

//sliderLeft.SetWindowPos(NULL, ActualVideoSizeLeft.left + 1, playerTop + ActualVideoSizeLeft.top - 50, ActualVideoSizeLeft.right - 1, 40, SWP_SHOWWINDOW);
//sliderLeft.UpdateWindow();
// m_pMainWnd = pMainFrame;

//DlgPtr->m_AnalyseDialog.RedrawWindow(NULL, NULL, RDW_ERASE | RDW_INVALIDATE);
//sliderLeft.MoveWindow(ActualVideoSizeLeft.left + 1+1, playerTop + ActualVideoSizeLeft.bottom + spacingBetPlayerScrub / 2 + ActualVideoSizeLeft.top, ActualVideoSizeLeft.right - 1, 40, true);
//sliderLeft.ShowWindow(SW_SHOW);
//LOGSAMP.LOGRP(FS, "Slider Visibility 5 = ", sliderLeft.IsWindowVisible());

//sliderLeft.ShowWindow(SW_HIDE);
//sliderLeft.ShowWindow(SW_SHOW);

//Invalidate();
//LOGSAMP.LOGRP(FS, "Slider Visibility 6 = ", sliderLeft.IsWindowVisible());

}

DlgPtr->m_VideoDialog.newVideoCHosenInTabVideo = 0;
return;
}

if (DlgPtr->m_VideoDialog.newVideoCHosenInTabVideo == 3)
{
LOGSAMP.LOGRP(FS, "newVideoCHosenInTabVideo = ", newVideoCHosenInTabVideo);
if (scrLeftMaxOnce != 0)
{

HRESULT hrPause1 = m_spControls1->play();
}

DlgPtr->m_VideoDialog.newVideoCHosenInTabVideo = 0;
return;
}


if (IsWindowVisible())
{
if (DlgPtr->m_VideoDialog.newVideoCHosenInTabVideo == 1)
{
LOGSAMP.LOGRP(FS, "In Analyse Timer newVideoCHosenInTabVideo ==1");
if (currentAnalPLayingURL != DlgPtr->m_VideoDialog.VideoFilePlay1)
{
LOGSAMP.LOGRP(FS, "In Analyse Timer the two play strings dont match");
leftVideoFps = DlgPtr->m_VideoDialog.leftVideoFps;
onlysecsLeft = DlgPtr->m_VideoDialog.onlysecsLeft;
leftVideoWidthInFile = DlgPtr->m_VideoDialog.leftVideoWidthInFile;
leftVideoHeightInFile = DlgPtr->m_VideoDialog.leftVideoHeightInFile;
totLeftVideoFrames = leftVideoFps*onlysecsLeft;
LOGSAMP.LOGRP(FS, "left video fps = ", leftVideoFps);
LOGSAMP.LOGRP(FS, "tot left frames = ", totLeftVideoFrames);

VideoSizeInFile.top = 0;
VideoSizeInFile.left = 0;
VideoSizeInFile.right = leftVideoWidthInFile;
VideoSizeInFile.bottom = leftVideoHeightInFile;
CalculateNewVideoSize();
ActualVideoSizeLeft.top = 0;
ActualVideoSizeLeft.left = 0;
ActualVideoSizeLeft.right = ActualVideoSize.right;
ActualVideoSizeLeft.bottom = ActualVideoSize.bottom;

ActualPlayerLeft = PlayerWindow;

LONG VidLeftCentX;
LONG VidLeftCentY;
LONG PlayerWinCentX;
LONG PlayerWinCentY;

VidLeftCentX = ActualVideoSizeLeft.right / 2;
VidLeftCentY = ActualVideoSizeLeft.bottom / 2;

PlayerWinCentX = PlayerWindow.right / 2;
PlayerWinCentY = PlayerWindow.bottom / 2;

LOGSAMP.LOGRP(FS, "onlysecsLeft = ", onlysecsLeft);
LOGSAMP.LOGRP(FS, "left width = ", leftVideoWidthInFile);
LOGSAMP.LOGRP(FS, "left height = ", leftVideoHeightInFile);

scrLeftMaxOnce = 0;
firstFileLeftChosen = 1;

sliderLeft.SetPos(0);
sliderLeft.Invalidate();

//vidCtrl1.MoveWindow(ActualVideoSizeLeft.left, playerTop + ActualVideoSizeLeft.top, ActualVideoSizeLeft.right, ActualVideoSizeLeft.bottom, true);
//sliderLeft.MoveWindow(ActualVideoSizeLeft.left + 1, playerTop + ActualVideoSizeLeft.bottom + spacingBetPlayerScrub / 2 + ActualVideoSizeLeft.top, ActualVideoSizeLeft.right - 1, 40, true);

m_spControls1->stop();
//Slee
Member 11380615 29-May-16 2:40am View
   
Given below is the ontimer function.

void CAnalyseDialog::OnTimer(UINT_PTR nIDEvent)
{
if (!IsWindowVisible())
{
//LOGSAMP.LOGRP(FS,"Window not visible");
//UpdateSliderOnPause();
if (AnalysisVideoPausedInOnTimer == 0)
{
m_spControls1->pause();
AnalysisVideoPausedInOnTimer = 1;
}
return;
}
else
{
AnalysisVideoPausedInOnTimer = 0;
}

SwitchVideoPlay();
//return;
if (nIDEvent == TimerId)
{
if (LeftPlayerState == 2)
{
if (mVideoTimer != NULL)
{
//LOGD.LOGRP(FL, "Killing Video Timer");
//KillTimer(nIDEvent);
}
}
else
{
int lminRange, lmaxRange;
double lnewPosTimer;
int newPosSlider;

if ((LeftPlayerState == 3) && (m_spControls1PauseCount == 0))
{
//sliderLeft.
//LOGD.LOGRP(FL, "Repositioning left slider");

m_spControls1->get_currentPosition(&getCurrentLeftPos);
LOGSAMP.LOGRP(FS, "Current left player pos = ", (int) getCurrentLeftPos);
sliderLeft.GetRange(lminRange, lmaxRange);
LOGSAMP.LOGRP(FS, "Slider min Range = ", lminRange);
LOGSAMP.LOGRP(FS, "Slider max Range = ", lmaxRange);

lnewPosTimer = (lmaxRange - lminRange)*getCurrentLeftPos / onlysecsLeft;
newPosSlider = lnewPosTimer + lminRange;
LOGSAMP.LOGRP(FS, "newPosSlider = ", newPosSlider);
repositioningLeftSliderTimer = 1;
if (newPosSlider > lmaxRange)
newPosSlider = lmaxRange;
if (newPosSlider < lminRange)
newPosSlider = lminRange;

if (DlgPtr->m_VideoDialog.newVideoCHosenInTabVideo==0)
sliderLeft.SetPos(newPosSlider);
//sliderLeft.EnableWindow(false);

//sliderLeft.EnableWindow(true);
}
}
//LOGD.LOGRP(FL, "In Video Timer");
}
}
//==============================================




///////////////////////////////////////////////////////////////////////////////////
Given below is the SwitchVideoPlay funciton
void CAnalyseDialog::SwitchVideoPlay()
{
if (DlgPtr->m_VideoDialog.newVideoCHosenInTabVideo == 2)
{
LOGSAMP.LOGRP(FS, "newVideoCHosenInTabVideo = ", newVideoCHosenInTabVideo);
if (scrLeftMaxOnce != 0)
{
//LOGSAMP.LOGRP(FS, "scrLeftMaxOnce = ", scrLeftMaxOnce);

//sliderLeft.MoveWindow(ActualVideoSizeLeft.left + 1, playerTop + ActualVideoSizeLeft.bottom + spacingBetPlayerScrub / 2 + ActualVideoSizeLeft.top, ActualVideoSizeLeft.right - 1, 40, true);
//sliderLeft.Invalidate();
//sliderLeft.RedrawWindow();
//Sleep(50);
//LOGSAMP.LOGRP(FS, "Slider Visibility 4 = ", sliderLeft.IsWindowVisible());

//HRESULT hrPause1 = m_spControls1->play();

//sliderLeft.SetWindowPos(NULL, ActualVideoSizeLeft.left + 1, playerTop + ActualVideoSizeLeft.top - 50, ActualVideoSizeLeft.right - 1, 40, SWP_SHOWWINDOW);
//sliderLeft.UpdateWindow();
// m_pMainWnd = pMainFrame;

//DlgPtr->m_AnalyseDialog.RedrawWindow(NULL, NULL, RDW_ERASE | RDW_INVALIDATE);
//sliderLeft.MoveWindow(ActualVideoSizeLeft.left + 1+1, playerTop + ActualVideoSizeLeft.bottom + spacingBetPlayerScrub / 2 + ActualVideoSizeLeft.top, ActualVideoSizeLeft.right - 1, 40, true);
//sliderLeft.ShowWindow(SW_SHOW);
//LOGSAMP.LOGRP(FS, "Slider Visibility 5 = ", sliderLeft.IsWindowVisible());

//sliderLeft.ShowWindow(SW_HIDE);
//sliderLeft.ShowWindow(SW_SHOW);

//Invalidate();
//LOGSAMP.LOGRP(FS, "Slider Visibility 6 = ", sliderLeft.IsWindowVisible());

}

DlgPtr->m_VideoDialog.newVideoCHosenInTabVideo = 0;
return;
}

if (DlgPtr->m_VideoDialog.newVideoCHosenInTabVideo == 3)
{
LOGSAMP.LOGRP(FS, "newVideoCHosenInTabVideo = ", newVideoCHosenInTabVideo);
if (scrLeftMaxOnce != 0)
{

HRESULT hrPause1 = m_spControls1->play();
}

DlgPtr->m_VideoDialog.newVideoCHosenInTabVideo = 0;
return;
}


if (IsWindowVisible())
{
if (DlgPtr->m_VideoDialog.newVideoCHosenInTabVideo == 1)
{
LOGSAMP.LOGRP(FS, "In Analyse Timer newVideoCHosenInTabVideo ==1");
if (currentAnalPLayingURL != DlgPtr->m_VideoDialog.VideoFilePlay1)
{
LOGSAMP.LOGRP(FS, "In Analyse Timer the two play strings dont match");
left
Member 11380615 19-Feb-16 0:11am View
   
The problem was the ScrollSizes were not set. My view class was derived from CSrollView.
I tried setting the scrollsizes in UpdateInit and it worked fine.
Thanks Jochen, you are very good. The swiftness with which you found the problem is inspiring.
Member 11380615 17-Feb-16 7:20am View
   
Thanks Richard for your thought. I did debug it but am still looking for some hint. The problem text is right in the top and I have tried to provide relevant stack details and pieces of function executed by the stack. I will try to optimize it further to make it more readable.
Regards,
Rakesh
Member 11380615 17-Feb-16 7:17am View
   
Thanks Jochen for your thoughts. I dont know how to address this since this isworking fine release mode. Could you throw some more light on what I should do.
Regards,
Rakesh
Member 11380615 20-Jan-16 2:29am View
   
Hello Serkan Onat,
I did put this question in codeproject. It was suggested that I should try to put it in full screen only when it is playing. Wait for the play event and then put full screen. I did that and it worked.
Thanks for the suggestion.
Will try with IWMPPlayer2
Will try LibVLC as well.
Regards,
Rakesh
Member 11380615 19-Jan-16 11:50am View
   
Thanks You so much.
Full screen mode worked.
Regards,
Rakesh
Member 11380615 19-Jan-16 3:13am View
   
Hello Serkan Onat,
I have been trying to get the media player to play in full screen. I get a runtime exception for hrFull )below in code) which says E_UNEXPECTED catastrophic failure. I see this when I put a break point other wise the code runs fine though it doesnt go to full screen. By right clicking on the running media player and selecting zoom full screen I am able to play in full screen.
My objective is to have a button clicking which should play full screen.

The code below is what I am using. This code is in InitDialog.

LPUNKNOWN pUnknown = m_MediaPlayer.GetControlUnknown();
//LPUNKNOWN pUnknown1 = m_MediaPlayer1.GetControlUnknown();


HRESULT hr = pUnknown->QueryInterface(__uuidof(IWMPPlayer), (void**)&m_pWMPPlayer);
//HRESULT hr1 = pUnknown1->QueryInterface(__uuidof(IWMPPlayer), (void**)&m_pWMPPlayer1);


if (SUCCEEDED(hr))
{
CComBSTR strMovie = _T("C:\\movie\\Hero 2004.mp4");
m_pWMPPlayer->put_URL(strMovie);


VARIANT_BOOL bSc = VARIANT_TRUE;
HRESULT hrFull;

hrFull = m_pWMPPlayer->put_fullScreen(bSc);

}

Look forward to your direction on what may be done for full screen.
Regards,
Rakesh
Member 11380615 18-Jan-16 7:05am View
   
Thanks,
I got the event.
Regards,
Rakesh
Member 11380615 18-Jan-16 6:35am View
   
Hello Serkan Onat,
I think I got the even handler list. When I right click on the media player control it gives me the option of adding the even handler. I will add from here and try and test it. It appears different from what you meant.
Regards,
Rakesg
Member 11380615 18-Jan-16 6:30am View
   
I do not see the events listed. Probably I am on a wrong understanding of what the dialog designer is. When you say dialog designer I do the following.
Resource View -> ProjectName.rc -> Dialog -> IDD_VIDEO_PLAYER(xxxxxxx)
I double click on it and I am presented with the dialog designer. It contains the windows media player active X control. I select it but I dont see any properties pane with event listed. What I see is the properties window in the bottom right which has items like "open state" "play state" "url" "windowless Video".
I have wrongly understood on what you mean by dialog designer.
Regards,
Rakesh
Member 11380615 17-Jan-16 23:13pm View
   
Hello Serkan Onat,
I could implement what you said and got the player a play a clip.
I need to handle event from the media player and be able to play and stop from with in the code.
I have been trying to add a handler and be able to get handles to play and stop and other functionalities. I didnt work.
HRESULT hr1 = pUnknown->QueryInterface(&spConnectionContainer);
if (SUCCEEDED(hr))
{
hr = spConnectionContainer->FindConnectionPoint(__uuidof(IWMPEvents), &m_spConnectionPoint);
if (FAILED(hr))
{
// If not, try the _WMPOCXEvents interface, which uses IDispatch.
hr = spConnectionContainer->FindConnectionPoint(__uuidof(_WMPOCXEvents), &m_spConnectionPoint);
}
}

if (SUCCEEDED(hr))
{
hr = m_spConnectionPoint->Advise(this, &m_dwAdviseCookie);
}

The this in Advise doesnt compile.

Could you give some direction as to how to play, pause and stop from within the code Also create a handler where I could get the play, pause, stop and other media player control events.
Regards,
Rakesh
Member 11380615 10-Jan-16 1:25am View
   
Hello Serkan Onat,
Thank You so much for the solution posted by you. I should be able to test it in the next few days and will update you on the results.
Regards,
Rakesh