|
yes, target_process_id do be defined in a shared segment:
#pragma data_seg (".SHARED")
HHOOK g_hPreviousMouseHook = 0;
HHOOK g_hPreviousWinProcHook = 0;
HINSTANCE g_hInstance = 0;
HWND g_hMinimizedWindowList[ARRAY_SIZE] = {0};
int g_iMinimizedWindowCount = 0;
DWORD target_process_id = 0;
#pragma data_seg()
#pragma comment(linker, "/SECTION:.SHARED,RWS")
Malli_S, this code slice is copied from your tutor article http://www.codeproject.com/KB/system/TrayMe.aspx. Im trying your demo project today.
|
|
|
|
|
You through with your issue ?
[Delegates] [Virtual Desktop] [Tray Me !]
-Malli...!
|
|
|
|
|
yes. I wanna make the target program do nothing when the user click its right mouse key on the tray icon.
|
|
|
|
|
A mousehook seems like an overkill solution for getting all the mouse events for a window.
Why not just get the messages in the window's windowproc (possibly by subclassing if it's not your window)?
Or is the window in another app?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
oh, Code-o-mat told me that the tray icon not use WM_RBUTTONUP message any more. yes, i used spy++ and found its message should be TB_GETBUTTONINFO message. Im trying to find a way to hook this message or another method to hook the real procedure of such message.
|
|
|
|
|
Hi,
I have changed my input locale to 'Japanese' through Regional Settings and Language options in control panel. (and Restarted my PC as well)
2. I have written a simple MFC dialog application.
3. In resource view, Inserted a copy of dialog in Japanese (Copied the title as japanese string)
4. I am able to see japanese character in Visual C++ 6.0 environment.
5. But When i execute the application. Firstly,it is the english dialog which is launched not my japanese dialog. Second even i change the english strings to japanese string in english dialog, junk characters are shown in place of japanese string.
Please provide me a answer.
Thanks
Prashant
|
|
|
|
|
Please check whether the unicode is enabled in your dialog project? You have to define - UNICODE and _UNICODE to preprocessor definitions.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
|
I am working on this little VC++ 6.0 simple dialog-based application.
No matter whatever I change about the styles etc I only get a combobox
that at launch being clicked shows a drop down cell (one cell) that shows one item with a spin
control on the right corner instead of a full list of items. Of course I can use
the spin control to go through all the items, but it's kind of annoying when
I can simply pick easily from a drop list that shows everything at one time.
how can I solve that problem
Trioum
|
|
|
|
|
Open the resource editor and click on the arrow of the control. You'll be able to modify the size of the drop region instead of the size of the control.
|
|
|
|
|
|
What's the difference between what you are expecting to see and what you are actually seeing?
|
|
|
|
|
why did you delete your question without answering the reply you got ?!
|
|
|
|
|
Thanks for delete your question.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hamid. wrote: Thanks for delete your question
what was it about ?!
|
|
|
|
|
I could said where's your question or why did you delete your question
but I said thanks,it was equivocal(thanks doesnt have real mean here ).
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
oh, that was rethorical... I thought you knew much than me
|
|
|
|
|
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
The OP was setting WS_EX_LAYOUT_RTL on a (to be created) window in PreCreateWindow , but he had some (unstated) issue with it - which is why I asked him to describe what he was expecting vs what he saw.
|
|
|
|
|
Thanks for your reply.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hello guys!
Im new in C++ programing, and I want to
get and put same data in my COM.
I dont have problems with basic data types.
My IDL:
[propget, id(FW_DISPID_OFFSET), helpstring("property Offset")] HRESULT Offset([out, retval] short *pVal);
[propput, id(FW_DISPID_OFFSET), helpstring("property Offset")] HRESULT Offset([in] short newVal);
My Cpp:
STDMETHODIMP CYslider::get_Offset(short *pVal)
{
*pVal = m_Offset;
return S_OK;
}
STDMETHODIMP CYslider::put_Offset(short newVal)
{
m_Offset = newVal;
SetDirty(TRUE);
FireViewChange();
return S_OK;
}
So far so good , but now I dont know how to deal with arrays,
I googled a lot and I have found that solution is with VARIANT and safearray
but I dont know how to fill STDMETHODIMP for array.
My IDL:
[propget, id(FW_DISPID_ARRAYTEST), helpstring("property ArrayTest")] HRESULT ArrayTest([out, retval] VARIANT *pVal);
[propput, id(FW_DISPID_ARRAYTEST), helpstring("property ArrayTest")] HRESULT ArrayTest([in] VARIANT newVal);
My Cpp:
STDMETHODIMP CYslider::get_ArrayTest(VARIANT *pVal)
{
????????????????????????????????
return S_OK;
}
STDMETHODIMP CYslider::put_ArrayTest(VARIANT newVal)
{
????????????????????????????????
return S_OK;
}
I will be very happy if somebody could help me, with example, advice...
Bye,
Komofilms
|
|
|
|
|
I haven't worked with COM in quite a few months. The sample code below demonstrates everything you need to know based on your inquiry/statements.
STDMETHODIMP CYslider::get_ArrayTest(VARIANT v)
{
SAFEARRAY *pArrayVal = v.parray;
char HUGEP *pArray = NULL;
HRESULT hr = SafeArrayAccessData(pArrayVal,(void HUGEP * FAR *)&pArray );
SafeArrayUnaccessData(pArrayVal);
return S_OK;
}
HRESULT CYslider::put_ArrayTest(BYTE* data, LONG iLen)
{
VARIANT v;
SAFEARRAY *pArrayVal = NULL;
SAFEARRAYBOUND arrayBound;
CHAR HUGEP *pArray = NULL;
arrayBound.lLbound = 0;
arrayBound.cElements = iLen;
pArrayVal = SafeArrayCreate(VT_UI1, 1, &arrayBound);
if (NULL != pArrayVal)
{
HRESULT hr = SafeArrayAccessData(pArrayVal,(void HUGEP * FAR *)&pArray);
if (SUCCEEDED(hr))
{
memcpy(pArray, data, arrayBound.cElements);
V_VT(&v) = VT_ARRAY | VT_UI1;
V_ARRAY(&v) = pArrayVal;
}
else
{
if (NULL != pArrayVal)
{
SafeArrayDestroy(pArrayVal);
return S_FALSE;
}
}
hr = SUCCEEDED(get_ArrayTest(&v));
SafeArrayUnaccessData(pArrayVal);
}
VariantClear(&v);
return S_OK;
}
Hopefully its enough to get you started. You can tweak it so it works with your application. If you have any questions feel free to ask.
Best Wishes,
-David Delaune
|
|
|
|
|
Here's an example of creating a SAFEARRAY of doubles and returning it through an output parameter (as you have in your get_ArrayTest method):
SAFEARRAYBOUND saBound[2] = { {10, 0}, {5, 0} };
pSA = ::SafeArrayCreate(VT_R8, 2, saBound);
for(int i=0;i<10;++i)
{
for(int j=0;j<5;++j)
{
static long indices[2];
indices[0] = i;
indices[1] = j;
double value = i *5 + j;
::SafeArrayPutElement(pSA, indices, (void*)&value);
}
}
pVal->vt = VT_ARRAY|VT_R8;
V_ARRAY(pVal) = pSA;
Accessing a SAFEARRAY is similar - you use SafeArrayGetElement rather than SafeArrayPutElement and don't need to create or destroy the array.
The vt member of the VARIANT holding the array should define the type of the array as shown, with a VT_type defining the element type, ORed with VT_ARRAY . SafeArrayGetVartype interrogates the SAFEARRAY to get the element type directly.
HTH!!!
|
|
|
|
|
I made it this way....
STDMETHODIMP CYslider::put_VrednostArray(VARIANT newVal)
{
if (!(newVal.vt & VT_ARRAY)) return S_OK;
if (newVal.parray == NULL) return S_OK;
VARTYPE vt = newVal.vt & VT_TYPEMASK;
SAFEARRAY* psaSafeArray = newVal.parray;
SafeArrayLock(psaSafeArray);
long j;
long LBound, HBound;
unsigned long elementsToWrite;
int writeBufferCn;
LBound = psaSafeArray->rgsabound[0].lLbound;
//write minimum of: TotElements, array size
elementsToWrite = m_TotElements;
if (elementsToWrite > 10) { //psaSafeArray->rgsabound[0].cElements) {
elementsToWrite = psaSafeArray->rgsabound[0].cElements;
}
HBound = LBound + elementsToWrite;
VARIANT varValToWriteTableElement;
V_VT(&varValToWriteTableElement) = vt;
writeBufferCn =0;
for(j = LBound; j < HBound; j++)
{
switch( vt )
{
case VT_R4:
SafeArrayGetElement(psaSafeArray, &j, &V_R4(&varValToWriteTableElement));
m_VrednostArray[writeBufferCn++] =(varValToWriteTableElement.fltVal);
break;
default:
break;
}
}
SafeArrayUnlock(psaSafeArray);
FireViewChange();
return S_OK;
}
It Works
Thanks all for help!
|
|
|
|
|
Suppose I've got a variable of type BYTE. It looks something like 10001011 in the memory. Now I want to inverse it so that I get 11010001.
Thank you masters!
|
|
|
|