Link to home
Start Free TrialLog in
Avatar of jintajak
jintajak

asked on

To rwilson....again

To rwilson In Question Q.10177440
in frist convert C++ to Delphi it not work.
Now I'm to past it agian. Can you help me again please??
***************************************************************
int buffsize;
UINT x;
RGNDATA *buff;
POINT TopLeft;
// Get the size of buffer required
buffsize = GetRegionData(region, 0, 0);
if (buffsize != 0)
{
      buff = (RGNDATA *) new BYTE [buffsize];
      // Now get the region data
      if(GetRegionData(region, buffsize, buff))
      {
            for (x=0; x<(buff->rdh.nCount); x++)
            {
            // Obtain the rectangles from the list
            RECT *urect = (RECT *) (((BYTE *) buff) + sizeof(RGNDATAHEADER) + (x * sizeof(RECT)));
            }
            delete [] buff;
      }
}
***************************************************************
ASKER CERTIFIED SOLUTION
Avatar of rwilson032697
rwilson032697

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 jintajak
jintajak

ASKER

urect: PRECT;
/ Obtain the rectangles from the list
urect := PRect (integer(pointer(buff)) + sizeof(RGNDATAHEADER) + (x * sizeof(TRECT)));

<<<is line [Warning] Comparing signed and unsigned types - widened both operands>>>
I think it not problem to use it. or you comment or suggest about it.
Um...,agian What is PRECT?? and Now I increase points +10= 50 to rwilson again. with ask last problem??

WPARAM wParam
HANDLE prop = GetProp(hWnd, (LPCTSTR) MAKELONG(MYATOM, 0));
if (prop != (HANDLE) wParam)
{
     ........
}

This line:

urect := PRect (integer(pointer(buff)) + sizeof(RGNDATAHEADER) + (x * sizeof(TRECT)));

is probably OK, but you could change it like this:

urect := PRect (cardinal(pointer(buff)) + sizeof(RGNDATAHEADER) + (x * sizeof(TRECT)));

2. PRect is a pointer to TRect (Type PRect = ^TRect). It's in windows.pas...

3. WPARAM wParam
HANDLE prop = GetProp(hWnd, (LPCTSTR) MAKELONG(MYATOM, 0));
if (prop != (HANDLE) wParam)
{
     ........
}

Should become:

wParam : WPARAM;
prop : THANDLE;

prop := GetProp(hWnd, MAKELONG(MYATOM, 0));
if (prop <> THandle(wParam)) then
begin
     ........
end;

(Assuming hWnd is aome var containing the window handle)

Cheers,

Raymond.
This Line:
--->prop := GetProp(hWnd, MAKELONG(MYATOM, 0))
it compile error, but use
--->prop := GetProp(hWnd, PCHAR(MYATOM));
it compile pass.......sorry I don't to tell you.
jintajak:

Sorry, I was thinking of Atom in terms of the TAtom type (a word) - which is hows it looks in your C++ code.

Does it work correctly with the PChar cast?

Cheers,

Raymond.

Sorry rwilson.......last again
Now!! in problem I forget some line of source code have problem. I want to you help me again with increase 10+ = 60. Old problem I to clear ready with Excellent and good Idea and some knowledge. C++ is easy I think but I don't know it something.
************************************************
WPARAM wParam
LPARAM lParam
MSG *msg = (MSG *) lParam;
if (wParam & PM_REMOVE)
{
    MyHandle(msg->message, msg->hwnd, msg->wParam, msg->lParam);
}
*************************************************
This should look something like this:

wParam :WPARAM ;
lParam :LPARAM ;
msg : PMSG; // Defined as ^TMSG in windows.pas

msg := PMSG(LParam);

if (wParam AND PM_REMOVE) <> 0 then
  MyHandle(msg^.message, msf^.hwnd, msg^.wParam, msg^.lParam);

Cheers,

Raymond.

Thak you so much. rwilson see you next time