PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 2024 → [WD75] Structures, dynamic arrays ...
[WD75] Structures, dynamic arrays ...
Started by Peter van Vuuren, Aug., 21 2003 8:04 PM - No answer
Posted on August, 21 2003 - 8:04 PM
Hi,
I'm working on a small class to integrate some Terminal Services functions
in our main configuration program via the wtsapi32 API.
I have a question about retrieving the values of an array of structures,
because for the moment i'm out of ideas.
Example code :
--

//Class declaration
WTS_SESSION_INFO is structure
SessionId is int
pWinStationName is int
//state As WTS_CONNECTSTATE_CLASS
State is int
END
clTSE is class
structSessionInfo is WTS_SESSION_INFO
END

--

PROCEDURE TSE_EnumerateSessions()
dynarrSessionInfo is array of 1 WTS_SESSION_INFO
res is int
//pCount receives the number of WTS_SESSION_INFO structures
pCount is int
//ppSessionInfo receives a pointer to array of structures
ppSessionInfo is int
res=API(:sDLL,"WTSEnumerateSessionsA",:hServer,0,1,&ppSessionInfo,&pCount)
IF res THEN
Dimension(dynarrSessionInfo,pCount) //redim array
Transfer(&dynarrSessionInfo,ppSessionInfo,pCount*Dimension(:structSessionInfo))
END

--
Now I've got a an array of structures (dynarrSessionInfo)
This structure is easy because it consists of 3 same VarTypes (3 ints)
so totally pCount*3 integers but how about an array of structures
with different kinds of varTypes ?
*
*
When writing down the problem i see also the solution
--

j=ppSessionInfo
FOR i = 1 TO pCount
Transfer(&:structSessionInfo,j,Dimension(:structSessionInfo))
DoTheThing() //Whatever
j+=Dimension(:structSessionInfo)
END
--

Sorry for the disturbance but i post it anyway ...
--
Peter