Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

To rwilson....again

Posted on 1999-07-06
9
Medium Priority
?
315 Views
Last Modified: 2010-04-06
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;
      }
}
***************************************************************
0
Comment
Question by:jintajak
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 12

Accepted Solution

by:
rwilson032697 earned 240 total points
ID: 1386582
Try this: Note I haven;t compiled it, but it should be close... I don't have Delphi to hand right this second so I'm not sure if PRect exists as a type - if not I'll fix it tomorrow. At least go get to play with it for now even if it isn't 100%.

If you do have problems with it, we can resolve them before grading...


buffsize : integer;
x : Cardinal;
buff : PRGNDATA ;
TopLeft TPoint;
URect : PRect; // or use ^TRect

// Get the size of buffer required
buffsize := GetRegionData(region, 0, 0);
if buffsize <> 0 then
begin
GetMem(buff, BuffSize);
// Now get the region data
if GetRegionData(region, buffsize, buff) <> 0 then
begin
for x := 0 to  buff^.rdh.nCount - 1 do
begin
// Obtain the rectangles from the list
urect := PRect (integer(pointer(buff)) + sizeof(RGNDATAHEADER) + (x * sizeof(TRECT)));
end;
free(buff);
end;
end;

Cheers,

Raymond.
0
 

Author Comment

by:jintajak
ID: 1386583
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.
0
 

Author Comment

by:jintajak
ID: 1386584
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)
{
     ........
}

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 12

Expert Comment

by:rwilson032697
ID: 1386585
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.
0
 

Author Comment

by:jintajak
ID: 1386586
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.
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1386587
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.

0
 

Author Comment

by:jintajak
ID: 1386588
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);
}
*************************************************
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1386589
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.

0
 

Author Comment

by:jintajak
ID: 1386590
Thak you so much. rwilson see you next time
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question