View previous topic :: View next topic |
Author |
Message |
Aslan Valued Contributor
Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Sun Dec 04, 2005 3:57 am Post subject: DELPHI Translation please??? |
|
|
I'm trying to play around with the ListView group api's that can be used in XP.
I've got most of it but need to know how to set the 'cbSize' member for the LVGROUP structure.
Below is a snippet of Delphi code to create a basic LVGROUP structure
I need the VDS translation of:
"FillChar(Group, SizeOf(Group), 0);
Group.cbSize := SizeOf(Group);"
Code: | var
Group: TLVGROUP;
begin
FillChar(Group, SizeOf(Group), 0);
Group.cbSize := SizeOf(Group);
Group.mask := LVGF_GROUPID or LVGF_HEADER;
Group.pszHeader := 'Group 1';
Group.iGroupId := 101;
ListView_InsertGroup(ListView1.Handle, -1, Group);
end;
|
Thanks in advance,
Aslan |
|
Back to top |
|
|
ShinobiSoft Professional Member
Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Sun Dec 04, 2005 8:26 pm Post subject: |
|
|
Hi Aslan,
You will need to manually add the sizes of each member of the LVCOLUMN
structure together to obtain this size.
Code: |
UINT = 2 bytes
INT = 2 bytes
WORD = 2 bytes
DWORD = 4 bytes
LONGLONG = 8 bytes
|
I'm not 100% sure about LPTSTR, but I think that they are 4 bytes as well.
All handle types are 4 bytes long. IE( HMENU, HWND, HICON, etc.)
Once you determine the appropriate size of the structure, if you are trying
to obtain information about a listview column, you will need to declare a variable and initialize it at least to the SizeOf(LVCOLUMN).
Code: |
%%size = ???
%A = @fill(%%size,0)
|
Hope this helps. _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Tue Dec 06, 2005 2:03 am Post subject: |
|
|
ShinobiSoft wrote: | Code: |
UINT = 2 bytes
INT = 2 bytes
WORD = 2 bytes
DWORD = 4 bytes
LONGLONG = 8 bytes
|
|
Hi All,
I don't know if this is true under Delphi but C/C++ says this
unsigned int = UINT = DWORD = 4 bytes
int = 4 bytes
short = 2 bytes
unsigned short = WORD = 2 bytes
_int64 = LONGLONG = 8 bytes
So the LVGROUP would be
Code: |
typedef struct tagLVGROUP {
UINT cbSize; // 4 bytes
UINT mask; // 4 bytes
LPWSTR pszHeader; // 4 byte pointer to array of unsiged shorts
int cchHeader; // 4 bytes
LPWSTR pszFooter; // 4 byte pointer to array of unsiged shorts
int cchFooter; // 4 bytes
int iGroupId; // 4 bytes
UINT stateMask; // 4 bytes
UINT state; // 4 bytes
UINT uAlign; // 4 bytes
} LVGROUP, *PLVGROUP;
|
Code: |
%%Size = 40
%A = @Fill(%%Size,,Z)
|
BTW the LPWSTR = LPTSTR = 4 bytes is a pointer to a Wide character string. Wide characters take 2 bytes so they are the same size as a WORD. Take a look at this article from John Cook http://www.hal-pc.org/~abeld/cppsighal/vcppstrings.htm
To make a Wide character string with ASCII characters you would do this...
Code: |
%A = @chr(0)H@chr(0)E@chr(0)L@chr(0)L@chr(0)O@chr(0)@chr(0)
|
Here are a couple other links about UNICODE (ie... Wide character strings).
http://www.unicode.org
link below is a Javascript that shows the character codes for different spoken language script.
http://www.macchiato.com/unicode/chart/
Anyway the LVCOLUMN structure is only 40 bytes total in size each member of the structure is 4 bytes. _________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
ShinobiSoft Professional Member
Joined: 06 Nov 2002 Posts: 790 Location: Knoxville, Tn
|
Posted: Tue Dec 06, 2005 4:57 am Post subject: |
|
|
Oops . I stand corrected _________________ Bill Weckel
ShinobiSoft Software
"The way is known to all, but not all know it." |
|
Back to top |
|
|
Aslan Valued Contributor
Joined: 31 May 2001 Posts: 589 Location: Memphis, TN USA
|
Posted: Tue Dec 06, 2005 11:06 pm Post subject: |
|
|
Hey thanks guys
Now back to tinkering with it |
|
Back to top |
|
|
|