Click here to Skip to main content
15,920,633 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to clear the drawings? Pin
yogendra kaushik15-Jun-06 3:57
yogendra kaushik15-Jun-06 3:57 
GeneralRe: How to clear the drawings? Pin
llp00na15-Jun-06 23:24
llp00na15-Jun-06 23:24 
Questionsocket arrays in Accept Pin
shuchigo_jane15-Jun-06 0:40
shuchigo_jane15-Jun-06 0:40 
QuestionHow to write zip/unzip folder program Pin
huutribk200115-Jun-06 0:39
huutribk200115-Jun-06 0:39 
AnswerRe: How to write zip/unzip folder program Pin
Hamid_RT15-Jun-06 0:47
Hamid_RT15-Jun-06 0:47 
AnswerRe: How to write zip/unzip folder program Pin
kakan15-Jun-06 1:20
professionalkakan15-Jun-06 1:20 
AnswerRe: How to write zip/unzip folder program Pin
Ștefan-Mihai MOGA15-Jun-06 2:48
professionalȘtefan-Mihai MOGA15-Jun-06 2:48 
QuestionSome OCX related problem Pin
budihartanto15-Jun-06 0:33
budihartanto15-Jun-06 0:33 
Hi all,

I like to create a kind of digital clock as an ocx. therefore other programmer can use my ocx inside their program. problem is:

1. How can i set up the timer for an ocx?
Note: I have create a WM_CREATE message handler and put the SetTimer command in it. Then I Create a WM_TIMER message handler and put the increment of the "second" in it, and display the number inside the OnDraw. But, it seems that the WM_TIMER message handler is never been called (that make my "Second" number never changed)

2. Is it possible to use a dialog box for an ocx, or do I have to always use OnDraw to draw something inside the ocx?

Below is the code that mimic the functionality of my digital clock. I use a data member called m_number that has been set to 0 inside the CxxxCtrl constructor. I expect to have this number increased each second elapsed. But it just didn't work. Any help please. Thanks.

// CTimerOcxCtrl::OnDraw - Drawing function
void CTimerOcxCtrl::OnDraw(
CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
// TODO: Replace the following code with your own drawing code.
CRect rectOcx = rcBounds;
CString strNumber;
strNumber.Format("%ld", m_number);
pdc->DrawText(strNumber, rectOcx, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
}

/////////////////////////////////////////////////////////////////////////////
// CTimerOcxCtrl message handlers

void CTimerOcxCtrl::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
m_number ++;
if (m_number > 100)
m_number = 0;

COleControl::OnTimer(nIDEvent);
}


int CTimerOcxCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (COleControl::OnCreate(lpCreateStruct) == -1)
return -1;

// TODO: Add your specialized creation code here
/*
CWnd *pMainWnd = AfxGetMainWnd();
HWND hWnd = pMainWnd->GetSafeHwnd();
*/

//SetTimer(hWnd, ID_TIMER1, 100, NULL);
SetTimer(ID_TIMER1, 100,NULL);

return 0;
}


AnswerRe: Some OCX related problem [modified] Pin
Naveen15-Jun-06 1:05
Naveen15-Jun-06 1:05 
AnswerRe: Some OCX related problem Pin
Viorel.15-Jun-06 1:42
Viorel.15-Jun-06 1:42 
QuestionMovePrev problem Pin
mikobi15-Jun-06 0:27
mikobi15-Jun-06 0:27 
AnswerRe: MovePrev problem Pin
Milton Karimbekallil15-Jun-06 1:31
Milton Karimbekallil15-Jun-06 1:31 
GeneralRe: MovePrev problem Pin
mikobi15-Jun-06 1:57
mikobi15-Jun-06 1:57 
QuestionRe: MovePrev problem Pin
David Crow15-Jun-06 3:27
David Crow15-Jun-06 3:27 
AnswerRe: MovePrev problem Pin
mikobi15-Jun-06 3:58
mikobi15-Jun-06 3:58 
QuestionRe: MovePrev problem Pin
David Crow15-Jun-06 4:16
David Crow15-Jun-06 4:16 
AnswerRe: MovePrev problem Pin
mikobi15-Jun-06 6:09
mikobi15-Jun-06 6:09 
GeneralRe: MovePrev problem Pin
David Crow15-Jun-06 6:20
David Crow15-Jun-06 6:20 
Questionwindows 2000 / VC++ 2005 web service access problem in ws2_32.dll Pin
Imre Koszo15-Jun-06 0:18
Imre Koszo15-Jun-06 0:18 
QuestionMessageBox french Pin
dungpapai15-Jun-06 0:13
dungpapai15-Jun-06 0:13 
AnswerRe: MessageBox french Pin
Milton Karimbekallil15-Jun-06 1:45
Milton Karimbekallil15-Jun-06 1:45 
AnswerRe: MessageBox french Pin
FarPointer15-Jun-06 2:02
FarPointer15-Jun-06 2:02 
AnswerRe: MessageBox french Pin
James R. Twine15-Jun-06 2:08
James R. Twine15-Jun-06 2:08 
GeneralRe: MessageBox french Pin
dungpapai16-Jun-06 0:29
dungpapai16-Jun-06 0:29 
QuestionAdd/Remove files on remote computer Pin
RanjanShrestha14-Jun-06 23:47
RanjanShrestha14-Jun-06 23:47 

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.