Click here to Skip to main content
15,887,434 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: atoi conversion query. Pin
Code-o-mat6-Oct-10 1:38
Code-o-mat6-Oct-10 1:38 
QuestionResource conflict on ON_UPDATE_COMMAND_UI Pin
yccheok5-Oct-10 22:52
yccheok5-Oct-10 22:52 
AnswerRe: Resource conflict on ON_UPDATE_COMMAND_UI Pin
«_Superman_»5-Oct-10 23:05
professional«_Superman_»5-Oct-10 23:05 
GeneralRe: Resource conflict on ON_UPDATE_COMMAND_UI Pin
yccheok5-Oct-10 23:13
yccheok5-Oct-10 23:13 
GeneralRe: Resource conflict on ON_UPDATE_COMMAND_UI Pin
«_Superman_»5-Oct-10 23:15
professional«_Superman_»5-Oct-10 23:15 
GeneralRe: Resource conflict on ON_UPDATE_COMMAND_UI Pin
yccheok5-Oct-10 23:36
yccheok5-Oct-10 23:36 
GeneralRe: Resource conflict on ON_UPDATE_COMMAND_UI Pin
Sauro Viti7-Oct-10 23:07
professionalSauro Viti7-Oct-10 23:07 
QuestionNeed to know how to make a custom control scroll nicely with a CView... Pin
Ben Aldhouse5-Oct-10 21:42
Ben Aldhouse5-Oct-10 21:42 
Hi gang,

I've got a custom control (m_HScrollBar1Ex) which I have made appear over a CTreeView derived interface (CLeftView) which moves up and down with the CTreeView object's scrollbar moderately well with a call to my control-positioning function PlaceScrollBar in the OnVScroll function. However, the custom control only 'snaps' in to its final position when the left mouse button is released. Ideally I'd like the control to move in absolute synch with the graphics underneath it (ie. the tree control).

Is there another message I could respond to which will allow the custom control to draw itself in the right place before the mouse button is released?

I'm guessing that the answer is a bit more involved than this - in which case any clues that you can give me will be very much appreciated.

Very much looking forward to your replies,

Ben.


void CLeftView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
	// TODO: Add your message handler code here and/or call default

	if (m_HScrollBar1Ex.m_hWnd != NULL){
		m_HScrollBar1Ex.ShowWindow(SW_HIDE);
	}
	PlaceScrollBar();

	CTreeView::OnVScroll(nSBCode, nPos, pScrollBar);
}

<pre>


and


<pre>

void CLeftView::PlaceScrollBar(void)
{

	if (m_bBlockScrollDraw==FALSE){
		CRect parentRect;
		CTreeCtrl &ctlFolders = this->GetTreeCtrl();
		ctlFolders.GetWindowRect(&parentRect);
		ScreenToClient(&parentRect);
		CRect contRect;

		//20100902
		HTREEITEM hRoot;
		HTREEITEM hFolder;
		hRoot = ctlFolders.GetSelectedItem();
		CRect heightRect;
		
		//20100902
		int count=0;
		int yPos=0;
		CRect itemRect;
		if (ctlFolders.ItemHasChildren(hRoot))
		{
		   HTREEITEM hNextItem;
		   HTREEITEM hChildItem = ctlFolders.GetChildItem(hRoot);

			CWnd * pChild = (CWnd *) &hChildItem;
			count = 1;

			if (ctlFolders.IsTopParentActive()){
				DWORD dwData = ctlFolders.GetItemData(hRoot);
				m_dw08bCurNodeVisItems = (dwData & 0x000000FF);
				m_dw24bCurNodeScrollPos = (dwData & 0xFFFFFF00) >> 8;
			}
			else m_dw24bCurNodeScrollPos = 99;	


			//20100917 temporary allocation
			//m_dw08bCurNodeVisItems=12000;

			ctlFolders.GetItemRect(hChildItem, itemRect, FALSE);

		   while (hChildItem != NULL)
		   {
			  hNextItem = ctlFolders.GetNextItem(hChildItem, TVGN_NEXT);
			  if (hNextItem != NULL){
					count++;
			  }
			  hChildItem = hNextItem;
		   }
		}

		if (m_HScrollBar1Ex.m_hWnd != NULL  && m_intChildCount > m_dw08bCurNodeVisItems){
			m_HScrollBar1Ex.SetScrollRange(1, m_intChildCount-m_dw08bCurNodeVisItems+1);

			if (m_dw24bCurNodeScrollPos == 0)
				m_HScrollBar1Ex.SetScrollPos(1) ;
			else
				m_HScrollBar1Ex.SetScrollPos(m_dw24bCurNodeScrollPos);

			m_HScrollBar1Ex.GetWindowRect(&contRect);
			ScreenToClient(&contRect);
			contRect.MoveToX(parentRect.right-contRect.Width()-16);

			m_HScrollBar1Ex.SetWindowPos(&wndTop,contRect.left,itemRect.top,
				contRect.Width(),count*ctlFolders.GetItemHeight(),SWP_SHOWWINDOW);		
			
		}
	}
	//OpenFolder(m_strCurFolder);
}





Questionsocket program is able to connect to the port which is still in TIME_WAIT [modified] Pin
Jayapal Chandran5-Oct-10 20:45
Jayapal Chandran5-Oct-10 20:45 
AnswerRe: socket program is able to connect to the port which is still in TIME_WAIT Pin
Moak5-Oct-10 23:25
Moak5-Oct-10 23:25 
GeneralRe: socket program is able to connect to the port which is still in TIME_WAIT Pin
Jayapal Chandran6-Oct-10 4:53
Jayapal Chandran6-Oct-10 4:53 
GeneralRe: socket program is able to connect to the port which is still in TIME_WAIT Pin
Moak6-Oct-10 6:39
Moak6-Oct-10 6:39 
GeneralRe: socket program is able to connect to the port which is still in TIME_WAIT Pin
Jayapal Chandran7-Oct-10 0:44
Jayapal Chandran7-Oct-10 0:44 
QuestionHooking TerminateProcess or ExitProcess Pin
NehaMishra286845-Oct-10 20:20
NehaMishra286845-Oct-10 20:20 
AnswerRe: Hooking TerminateProcess or ExitProcess Pin
«_Superman_»5-Oct-10 20:45
professional«_Superman_»5-Oct-10 20:45 
QuestionBasicExcel.Load --- crash!!! Pin
ssm19841195-Oct-10 20:11
ssm19841195-Oct-10 20:11 
AnswerRe: BasicExcel.Load --- crash!!! Pin
Richard MacCutchan5-Oct-10 21:26
mveRichard MacCutchan5-Oct-10 21:26 
AnswerRe: BasicExcel.Load --- crash!!! Pin
Sameerkumar Namdeo5-Oct-10 23:25
Sameerkumar Namdeo5-Oct-10 23:25 
Questiondate comparison Pin
ggoutam75-Oct-10 19:03
ggoutam75-Oct-10 19:03 
AnswerRe: date comparison Pin
Sameerkumar Namdeo5-Oct-10 19:17
Sameerkumar Namdeo5-Oct-10 19:17 
AnswerRe: date comparison Pin
«_Superman_»5-Oct-10 19:28
professional«_Superman_»5-Oct-10 19:28 
GeneralRe: date comparison [modified] Pin
ggoutam75-Oct-10 20:54
ggoutam75-Oct-10 20:54 
GeneralRe: date comparison Pin
David Crow6-Oct-10 3:24
David Crow6-Oct-10 3:24 
GeneralRe: date comparison Pin
ggoutam711-Oct-10 23:11
ggoutam711-Oct-10 23:11 
QuestionCDateTimeCtrl Pin
ganesh_IT5-Oct-10 19:01
ganesh_IT5-Oct-10 19:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.