forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


DELPHI Translation please???

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced Help for VDS 5 & Up
View previous topic :: View next topic  
Author Message
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Sun Dec 04, 2005 3:57 am    Post subject: DELPHI Translation please??? Reply with quote

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
View user's profile Send private message Send e-mail
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Sun Dec 04, 2005 8:26 pm    Post subject: Reply with quote

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. Smile

_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Tue Dec 06, 2005 2:03 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
ShinobiSoft
Professional Member
Professional Member


Joined: 06 Nov 2002
Posts: 790
Location: Knoxville, Tn

PostPosted: Tue Dec 06, 2005 4:57 am    Post subject: Reply with quote

Oops Embarassed . I stand corrected Wink
_________________
Bill Weckel
ShinobiSoft Software

"The way is known to all, but not all know it."
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Aslan
Valued Contributor
Valued Contributor


Joined: 31 May 2001
Posts: 589
Location: Memphis, TN USA

PostPosted: Tue Dec 06, 2005 11:06 pm    Post subject: Reply with quote

Hey thanks guys Wave

Now back to tinkering with it Smile
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced Help for VDS 5 & Up All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum




Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group