|
Thank you for your help.
I've found a timer tutorial an I'm trying to develop a Multimedia Timer.
Here the source in my user class.
void CALLBACK TimerFunction(UINT wTimerID, UINT msg, DWORD dwUser, DWORD dw1, DWORD dw2)
{
// This is used only to call MMTimerHandler
// Typically, this function is static member of CTimersDlg
CMyClass* obj = (CMyClass*) dwUser;
obj->MMTimerHandler(wTimerID);
}
//----------------------------------------------------------------------------------------
void CMyClass::StartTimer()
{
m_nTimeout = 2000;
TIMECAPS tc;
timeGetDevCaps(&tc, sizeof(TIMECAPS));
DWORD resolution = min(max(tc.wPeriodMin, 0), tc.wPeriodMax);
timeBeginPeriod(resolution);
// create the timer
m_idEvent = timeSetEvent(
m_nTimeout,
resolution,
::TimerFunction,
(DWORD)this,
TIME_PERIODIC);
}
//----------------------------------------------------------------------------------------
void CMyClass::StopTimer()
{
// destroy the timer
timeKillEvent(m_idEvent);
// reset the timer
timeEndPeriod (m_nTimeout);
}
//----------------------------------------------------------------------------------------
void CMyClass::MMTimerHandler(UINT nIDEvent) // called every elTime milliseconds
{
// do what you want to do, but quickly
static int a = 0;
CString str;
str.Format("Timer-Event %d", a++);
m_pTargetDlg->SetState(str);
}
//----------------------------------------------------------------------------------------
It's done in the way you expained, I think. But when the last line of code is done in the MMTimerHandler function (it calls the following Methode in a Dialog class)
void CTestDlg::SetState(CString strState)
{
m_strStatus = strState;
UpdateData(FALSE);
}
it crashes with a Debug Assertion Failed!- Error.
File wincore.cpp
Line 879
Any idea why?
Juergen
|
|
|
|
|
It is better to send a user defined message to your dialog class. And in the event handler of this message, update the data.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
If I do it in that way
m_pTargetDlg->SetWindowText(str);
it works.
But this is only for testing.
I am trying now to call a member function, which tries a cyclic reconnect to a telnet server after the connection has been closed by the server side.
The connect method works, but if I start it in the timer callback it crashes.
The timer only runs ones. After the first callback I stop the timer and call the connect method, but it crashes.
Hard work, I don't know why...
|
|
|
|
|
Did you read my previous post ? Did you implement it ?
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
I am trying to write an OPC server, opcfoundation.org is no help as one need to be a member of the orgaization. I tried some ActiveX, but with limited flexibility.
Can anyone help?
Sanjay
|
|
|
|
|
Hello
mouse_event(MOUSEEVENTF_RIGHTUP,x,y,0,GetMessageExtraInfo());
it works!
But with MOUSEEVENTF_LEFTUP and MOUSEEVENTF_ABSOLUTE nothing happens!
I think that the fanction has a problem . I write my program in Borland C++Builder version 6. can you help me?
thanks
|
|
|
|
|
Did you do MOUSEEVENTF_LEFTDOWN before MOUSEEVENTF_LEFTUP?
|
|
|
|
|
No , but I think that isn't important. because when I use MOUSEEVENTF_RIGHTUP I dont use MOUSEEVENTF_RIGHTDOWN before it but it works .
thanks
|
|
|
|
|
That would depend on whatever application that is the receipient of the mouse clicks, and I would imagine that a programmer won't think of a situation in which the mouse button can go up without going down first. Just because it "works" in certain cases doesn't mean it's correct. If you had tried simulating keyboard input with keys going up without coming down first you get fantastic results.
Have your taskbar be on the bottom of your primary monitor and visible and run this snippet. Does the start menu pop up? Works for me...
mouse_event(MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE, 0, 65535, 0, GetMessageExtraInfo());
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0 ,0,GetMessageExtraInfo());
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0 ,0,GetMessageExtraInfo());
|
|
|
|
|
|
I am a beginner, trying to make an application in Borland C++ builder that can monitor the chat communication(openned port as file using windows API) going on serial port, I read different funcitons but couldn't understand. it will be so kind of you to guide me how to create a hook to sniff the in and out traffic on serial port thanks
Akram Mahmood
|
|
|
|
|
See if this article helps.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi,
I am coding an application in vc++6, mfc. I have some sort of bar graph in which when I click on one of the bars a small dialog pops up giving information about that bar. I want the dialog to close automatically when I click anywhere outside it and not when an OK button is pressed. I tried with OnKillFocus and EndDialog but it is not working.
void CChartInfoDisplay::OnKillFocus(CWnd* pNewWnd)
{
EndDialog(0);
CDialog::OnKillFocus(pNewWnd);
}
Please can you tell me how to make a dialog box close when the user click anywhere outside it?
Thanks,
Tara
Fortitudine Vinsinues!
|
|
|
|
|
If you have a modeless dialog (activated with Create ), I think you should try WM_ACTIVATE notification, sent to your dialog when another window is activated.
Make a handler for this message and watch for WA_INACTIVE value of WPARAM .
Otherwise, if your dialog is modal (activated with DoModal ), then I think you should process WM_NCACTIVATE notification with FALSE value of WPARAM .
I hope it helps.
|
|
|
|
|
It worked! This is what I did.
BOOL CChartInfoDisplay::OnNcActivate(BOOL bActive )
{
if (bActive == FALSE)
CDialog::OnOK();
return TRUE;
}
I tried with
afx_msg void OnActivate( UINT nState, CWnd* pWndOther, BOOL bMinimized ); but I got some errors I could not understand.
Thank a lot.
Fortitudine Vinsinues!
|
|
|
|
|
Try with
afx_msg void OnActivate( UINT nState, CWnd* pWndOther, BOOL bMinimized );
nState must be WM_INACTIVE , then call OnOK();
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
Is there any registry path where all the installed components in the system are listed?
I found that components to be uninstalled are listed in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall. Just like that i want to know whether any place is there where all the installed components are listed.
|
|
|
|
|
If they did not use MSI, then there is almost no chance of locating everything.
If they were installed using MSI, then you can use the MSI API to get lists of installed 'packages'. A product does not necessarily have to be installed using MSI to end up in the 'add/remove programs' list.
I've seen better runs in my shorts! - Patches O'Houlihan
|
|
|
|
|
HI all,
I am trying to replace FreeImage Libraries with JPEG Package in my VC++ MFC Code.
Where i can refer JPEG Package ?
Is it a free Package ? If so, where can i download ?
Kindly suggest me.
Karthik M
|
|
|
|
|
Gooooooooooogle search.
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
im trying to overwrite the date in flex grid on runtime,(the data was initially written on complie time). please help me out
i am unable to do it....
also send me ur answers on following.....
mansoor_yahya@yahoo.com
{I c E}
|
|
|
|
|
Dear all,
I have .html file and i want to show the file contents on the dialogbox as error messages/ warning messages in formated way. How to implement this?
thanks in advance
Regards,
aj
|
|
|
|
|
I think you can use the WebBrowser ActiveX control. Go to dialog editor, right-click on dialog, select Insert ActiveX Control, and then select Microsoft Web Browser.
Then create a control variable for this new control.
Next call Navigate2 member function in this manner:
_bstr_t urll1(_T("file://path-to-your-html-file"));
_variant_t url2 = url1;
m_cMyControl.Navigate2(&url2, NULL, NULL, NULL, NULL);
Alternatively, you can format a nice message using some editor (like Write) and save as RTF file or resource. Then load this content to a rich-edit control (CRichEditCtrl ).
I hope this helps.
|
|
|
|
|
See ShowHTMLDialog or IHostDialogHelper .
Steve
|
|
|
|
|
i have a bitmap image on my hard drive.i want to display this imag eon my dialog button control.
how to do it?
thanx
|
|
|
|