[Help] Get rdPtr from WindowProc function
Hello all developers. ;)
For one of my extension I would like to get the rdPtr from the "WindowProc" function...
I imagine to store the rdPtr in global data thanks to "mvSetExtUserData" and then get it with "mvGetExtUserData" but I don't know how to use this function and how to get :
- CRunApp* pApp application
- HINSTANCE hInst HINSTANCE of my extension object
Is somebody can help me by put a part of code where mvGetExtUserData(...) is used from "WindowProc" function ?
Or maybe another solution to get the rdPtr from "WindowProc" ?
Thanks :)
Re: [Help] Get rdPtr from WindowProc function
There is a GetRdPtr function right above windowproc...
You can use it like this:
if ( (rdPtr = GetRdPtr((HWND)lParam, rhPtr)) != NULL && rdPtr->rHo.hoIdentifier == IDENTIFIER )
Re: [Help] Get rdPtr from WindowProc function
Yes, just declare a RUNDATA pointer like so:
and then use the code which can be found in the SDK documentation:
Quote:
if ( (rdPtr = GetRdPtr((HWND)lParam, rhPtr)) != NULL && rdPtr->rHo.hoIdentifier == IDENTIFIER )
Re: [Help] Get rdPtr from WindowProc function
My object don't have any window so, I must get the rdPtr without GetRdPtr function...
Thanks for the help
Re: [Help] Get rdPtr from WindowProc function
Throwing a idea, you could always have a invisible window.. :)
Hard to help when one doesn't know what you are trying to make :P
Re: [Help] Get rdPtr from WindowProc function
I only want to get some windows messages.
I don't want an invisible window...
So my question is how can I use mvGetUserData from WindowProc function ?
Re: [Help] Get rdPtr from WindowProc function
I think for EasyCom I did something like this in the CreateRunObject:
Code:
SetProp(rdPtr->rHo.hoAdRunHeader->rhHEditWin,"rdata",(HANDLE)rdPtr);
In DestroyRunObject I do something like:
Code:
RemoveProp(rdPtr->rHo.hoAdRunHeader->rhHEditWin,"rdata");
And then in my WinProc I do:
Code:
rdPtr = GetRdPtr(hWnd, "rdata"))
but I use a custom GetRdPtr function which you might want to name something else:
Code:
LPRDATA GetRdPtr(HWND hWnd, char*mPropName)
{
return (LPRDATA)GetProp(hWnd,(LPCSTR)mPropName);
}
Re: [Help] Get rdPtr from WindowProc function
Thanks a lot Vortex2, I'll try this asap ! :)
Re: [Help] Get rdPtr from WindowProc function
vortex2, after the :
Code:
LPRDATA rdPtr = GetRdPtr(hWnd, "rdata");
I try to access a value of my rdPtr but at this moment MMF2 crash :
Code:
LRESULT CALLBACK DLLExport WindowProc(LPRH rhPtr, HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
LPRDATA rdPtr = GetRdPtr(hWnd, "rdata");
rdPtr->myValue = 1;
return 0;
}
rdPtr->myValue is an int...
Re: [Help] Get rdPtr from WindowProc function
WindowProc is called for both hMainWin and hEditWin, you should do a GetRdPtr(rhPtr->rhHEditWin, "rdata"); instead of GetRdPtr(hWnd, "rdata");.
Re: [Help] Get rdPtr from WindowProc function
Thanks Yves for this so quick answer ! It works pretty well now ! :)
Re: [Help] Get rdPtr from WindowProc function
Ah, I will fix that in my extension as well.
My extension doesn't crash because I check the rdPtr for NULL and I use it inside of a message that is only dispatched to the window that I set the property for.
IE:
Code:
case WM_COMM_CTS_DETECTED:
if ((rdPtr = GetRdPtr(hWnd, "rdata")) != NULL && (IDENTIFIER == rdPtr->rHo.hoIdentifier))
{
rdPtr->mCurPort=lParam;
callRunTimeFunction(rdPtr, RFUNCTION_GENERATEEVENT, CND_CONONCTS, 0);
// Intercept the message
return REFLAG_MSGHANDLED;
}
break;