Link to home
Start Free TrialLog in
Avatar of abondar
abondar

asked on

Send message to the external application control

I have tried to send message to the TreeView control to the some external application control. It works fine for messages like TVM_GETNEXTITEM, TVM_SELECTITEM, but it failed for TVM_GETITEM call! The difference is, as I can see it, the TVM_GETITEM need to fill some structure which address I pass as LPARAM SendMessage() call. I get the FALSE as SendMessage(hTV, TVM_GETITEM, 0, &TVItem). Any suggesions? Thanks.
ASKER CERTIFIED SOLUTION
Avatar of NickRepin
NickRepin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Madshi
Madshi

Good answer, Nick...  :-)

abondar, if you choose (3), then you might be interested in the following (undocumented) functions which allocate memory in another process under all win9x systems (well, the functions in reality allocate memory in shared memory, but that doesn't matter):

function SharedMem9x_Alloc   (              size: cardinal) : pointer;  stdcall; external 'comCtl32.dll' index 71;
function SharedMem9x_ReAlloc (ptr: pointer; size: cardinal) : pointer;  stdcall; external 'comCtl32.dll' index 72;
function SharedMem9x_Free    (ptr: pointer                ) : bool;     stdcall; external 'comCtl32.dll' index 73;
function SharedMem9x_GetSize (ptr: pointer                ) : cardinal; stdcall; external 'comCtl32.dll' index 74;

These functions are also exported from the winNT comCtl32.dll, but there they just point to LocalAlloc or something like that. So under winNT you have to use VirtualAllocEx, like Nick suggested.

Regards, Madshi.
Useful info, Madshi.
Will save it to use in future answers :)
Avatar of abondar

ASKER

Hi Madshi!
I have not found these undocumented functions in comctl32.dll... Where they are??

Thanks,
 Anton.
It seems that they are exported by ordinal number.

For example, for SharedMem9x_Alloc:
GetProcAddress(hLib,LPCTSTR(71));
Avatar of abondar

ASKER

Hi Madshi!
I have not found these undocumented functions in comctl32.dll... Where they are??

Thanks,
 Anton.
Avatar of abondar

ASKER

Ahh... Ok, thanks!

Anton
Avatar of abondar

ASKER

Ahh... Ok, thanks!

Anton