|
So if they are providing a facility whereby you can register a callback function, why don't you use that?
Signature space for rent. Apply by email to....
|
|
|
|
|
Yes, they notify my app only in some types of variables, the ones that are linked to the sensors and actuators of the machine, but the other ones, the ones that interest me are not included in this group.
this is my problem...
and I needed only to know which is the best way to do some checks without consumption of a lot of system resources...
what I've been doing till now is to create a timer in the main dialog, and re-send the WM_TIMER message to each dialog, window... that need to check some variables, in order to use only one timer and not to use a lot of processor...
NOTE:
I need all the processor that I can get because I need to control the machine granting that it will be well controlled...
|
|
|
|
|
this is how I access the callback function...
<br />
lError = AdsSyncAddDeviceNotificationReq(m_pAddr, this->m_iGrupADSTCAT, (iComptador * this->m_iBytesElementADSTCAT) + this->m_iOffsetInicialADSTCAT, &this->m_ArrDadesADSCallback[iComptador].m_adsNotificationAttrib, this->CallbackFX1, this->m_ArrDadesADSCallback[iComptador].m_hUser, &this->m_ArrDadesADSCallback[iComptador].m_hNotification);<br />
and this is the callback function...
<br />
void CMonitor::CallbackFX1(AmsAddr *pAddr, AdsNotificationHeader *pNotification, ULONG hUser)<br />
{<br />
printf("hUser: %.2u >> Contingut: %.10u\n",hUser, *(ULONG *)pNotification->data);<br />
}<br />
|
|
|
|
|
Hi,
Question:
How to Post Message with parameters?
How to use wParam and lParam??
Examples are welcome!!!
Thanks
Extreme programming. Do the No.1
|
|
|
|
|
Depends of the type of the message to post:
u should use PostMessage or SendMessage
an exemple :
MFC:
void CMXAutoDlg::SendStringToWnd ( CWnd * pWnd , CString sString )
{
pWnd->SetForegroundWindow() ;
pWnd->SetFocus();
pWnd->CenterWindow ( ) ;
for ( int iCounter = 0 ; iCounter < sString.GetLength ( ) ; iCounter ++)
{
pWnd->PostMessage ( WM_CHAR, sString [ iCounter ] , 0 );
Sleep ( 100 );
}
}
Non MFC:
PostMessage(hWnd , ...) same params
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
In this case, I use PostThreadMessage, then how to use wParam and lParam?
Extreme programming. Do the No.1
|
|
|
|
|
MSDN:
You can use the PostThreadMessage function to post a message to a specific thread message queue. PostThreadMessage is similar to PostMessage, except the first parameter is a thread identifier rather than a window handle. You can retrieve the thread identifier by calling theGetCurrentThreadId function.
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
After I use wParam & lParam in PostThreadMessage, then I use GetMessage() to accept them, then where can I get the wParam & lParam sent from PostThreadMessage. Appreciation.
Extreme programming. Do the No.1
|
|
|
|
|
BOOL GetMessage(
LPMSG lpMsg,
HWND hWnd,
UINT wMsgFilterMin,
UINT wMsgFilterMax
);
Pass a pointer to a MSG variable to GetMessage()
The MSG Struct has LPARAM and WPARAM members.
Signature space for rent. Apply by email to....
|
|
|
|
|
Still can't work, because of datatype casting.
suppose, I want to send two parameters, one is BYTE* m_pByte, the other, int m_nLen. Then, I use PostThreadMessage Like this,
::PostThreadMessage(m_threadID,WM_DATA_ARRIVAL,(WPARAM)m_pByte,(LPARAM)m_nLen);
Now I use GetMessage() to get the message (here is WM_DATA_ARRIVAL) as well as m_pByte and m_nLen,
<br />
...<br />
MSG msg;<br />
while(::GetMessage(&msg, NULL, 0,0))<br />
{<br />
switch(msg.message)<br />
{<br />
case WM_RXD_ARRIVAL:<br />
AfxMessageBox(msg.lParam);<br />
break;<br />
default:<br />
break;<br />
<br />
};<br />
};<br />
...<br />
and I got the Error MessageBox.
Extreme programming. Do the No.1
|
|
|
|
|
I you cast your datatypes to WPARAM and LPARAM, just cast them back again:-
MSG msg;
while(::GetMessage(&msg, NULL, 0,0))
{
switch(msg.message)
{
case WM_RXD_ARRIVAL:
BYTE* m_pByte = (BYTE *) msg.wParam;
int m_nLen = (int) msg.lParam;
break;
default:
break;
}
}
Thanks
JOn
PS. Have you considered using VB?
Signature space for rent. Apply by email to....
|
|
|
|
|
hi
I want to access a windowsregistry-value. The problem is the value has no name, except for "standard" or "default".
So without a name i can't read the value.
In example :
HKEY_CLASSES_ROOT\http\shell\open\command - the key for the standard-browser.
thanx
|
|
|
|
|
dont send a name for the value u want to read in that case
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
How can I send a e-mail in my mfc application under WinCE?
The ShellExecute function does not exist under WinCE!
I think it works with ShellExecuteEx ?!?
But how to init. the SHELLEXECUTEINFO members ?
Any sample????
|
|
|
|
|
hi,
how to wrap a CALLBACK function into a class?
Thanks in advance.
Extreme programming. Do the No.1
|
|
|
|
|
|
I remember it used #pragmas. I've searched with the above Search box. I've tried Google. I looked in "What's New" all the way back to August. Does anyone know where it is?
Cathy
Life's uncertain, have dessert first!
|
|
|
|
|
#pragma message("this is just how to do it")
You could also take a look at my article about compiler messages[^]
...if you're under 8 or younger. Chris Maunder, the Lounge
|
|
|
|
|
Thanks! That was the article I was looking for.
Cathy
Life's uncertain, have dessert first!
|
|
|
|
|
I want to rename files using wildcards. Any good resource tell me please.
|
|
|
|
|
when I am using waitcommevent() with EV_RXCHAR,It will get twice response.why? I am so...............????*&^*%&%
|
|
|
|
|
Hi Friends,
Can anyone help me in solving this problem. I am able to run my application in Debug mode but not able to run in Release mode.
In my application(MDI application) when I try to open a file it gives "Unreferenced memory 0x000005 - Access Violation" assertion. But, the same is working fine in debug mode.
|
|
|
|
|
Try to build your realease build with debug info.
Gero
|
|
|
|
|
Try adding debugging options to your release configuration so you can track the problem in a debug session:
Compiler: /Zi (if it is an optimizing problem additional try /Od)
Linker: /debug
It is not well known that you can also debug an VC++ app in the "Release Mode" configuration, if you use the above project settings and recompile.
Because MFC and CRT in debug version has many protections against failures sometimes the release version crashes. It is almost a sign for a serious problem in your code even when it dont occur in the debug version. It is a good idea to inspect the debug output (in the debug version) for some warning/diagnostic messages (from MFC/CRT) for getting hints to the problem.
|
|
|
|
|
I have brought a Qtronix Fingerprint mouse and I would like to captrue image from the mouse. But I dont know how to do. Could any one tell me hwo to capture fingerprint image from the mouse?
Million thanks if you could help me!!!!!!!!!!!!
writeln
|
|
|
|