473,545 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DWORDS ? LONG? - I need to create constants for the following

Hi Everyone,

I am creating an application to interface with Terminal Services but as you
will learn I am a beginner. I have learned how to connect to the API to use
the functions available. One of the functions I would like to use is the
following:

BOOL WTSWaitSystemEv ent(
HANDLE hServer,
DWORD EventMask,
DWORD* pEventFlags
);

The following are my available choices for [DWORD EventMask]:

#define WTS_EVENT_NONE 0x00000000
#define WTS_EVENT_CREAT E 0x00000001
#define WTS_EVENT_DELET E 0x00000002
#define WTS_EVENT_RENAM E 0x00000004
#define WTS_EVENT_CONNE CT 0x00000008
#define WTS_EVENT_DISCO NNECT 0x00000010
#define WTS_EVENT_LOGON 0x00000020
#define WTS_EVENT_LOGOF F 0x00000040
#define WTS_EVENT_STATE CHANGE 0x00000080
#define WTS_EVENT_LICEN SE 0x00000100
#define WTS_EVENT_ALL 0x7fffffff <-- I am not sure how to convert
these and what they are?
#define WTS_EVENT_FLUSH 0x80000000

The constants will be Long in Visual Basic but how can I define what the
constant value will be? What will the long numerical value be? Hope I am
making sense..

Thanks
Jeremie Legault
jl******@system fix.ca
Apr 28 '06 #1
4 2576
Might have found my own answer, can someone confirm for me?

Is this right?
#define WTS_EVENT_NONE 0x00000000 = 0
#define WTS_EVENT_CREAT E 0x00000001 = 1
#define WTS_EVENT_DELET E 0x00000002 = 2
#define WTS_EVENT_RENAM E 0x00000004 = 4
#define WTS_EVENT_CONNE CT 0x00000008 = 8
#define WTS_EVENT_DISCO NNECT 0x00000010 = 16
#define WTS_EVENT_LOGON 0x00000020 = 32
#define WTS_EVENT_LOGOF F 0x00000040 = 64
#define WTS_EVENT_STATE CHANGE 0x00000080 = 128
#define WTS_EVENT_LICEN SE 0x00000100 = 256
#define WTS_EVENT_ALL 0x7fffffff = 2147483647
#define WTS_EVENT_FLUSH 0x80000000 = 2147483648

Thanks
Jeremie Legault
jl******@system fix.ca

"Jeremie Legault" wrote:
Hi Everyone,

I am creating an application to interface with Terminal Services but as you
will learn I am a beginner. I have learned how to connect to the API to use
the functions available. One of the functions I would like to use is the
following:

BOOL WTSWaitSystemEv ent(
HANDLE hServer,
DWORD EventMask,
DWORD* pEventFlags
);

The following are my available choices for [DWORD EventMask]:

#define WTS_EVENT_NONE 0x00000000
#define WTS_EVENT_CREAT E 0x00000001
#define WTS_EVENT_DELET E 0x00000002
#define WTS_EVENT_RENAM E 0x00000004
#define WTS_EVENT_CONNE CT 0x00000008
#define WTS_EVENT_DISCO NNECT 0x00000010
#define WTS_EVENT_LOGON 0x00000020
#define WTS_EVENT_LOGOF F 0x00000040
#define WTS_EVENT_STATE CHANGE 0x00000080
#define WTS_EVENT_LICEN SE 0x00000100
#define WTS_EVENT_ALL 0x7fffffff <-- I am not sure how to convert
these and what they are?
#define WTS_EVENT_FLUSH 0x80000000

The constants will be Long in Visual Basic but how can I define what the
constant value will be? What will the long numerical value be? Hope I am
making sense..

Thanks
Jeremie Legault
jl******@system fix.ca

Apr 28 '06 #2

Jeremie Legault wrote:
Hi Everyone,

I am creating an application to interface with Terminal Services but as you
will learn I am a beginner. I have learned how to connect to the API to use
the functions available. One of the functions I would like to use is the
following:

BOOL WTSWaitSystemEv ent(
HANDLE hServer,
DWORD EventMask,
DWORD* pEventFlags
);

The following are my available choices for [DWORD EventMask]:

#define WTS_EVENT_NONE 0x00000000
#define WTS_EVENT_CREAT E 0x00000001
#define WTS_EVENT_DELET E 0x00000002
#define WTS_EVENT_RENAM E 0x00000004
#define WTS_EVENT_CONNE CT 0x00000008
#define WTS_EVENT_DISCO NNECT 0x00000010
#define WTS_EVENT_LOGON 0x00000020
#define WTS_EVENT_LOGOF F 0x00000040
#define WTS_EVENT_STATE CHANGE 0x00000080
#define WTS_EVENT_LICEN SE 0x00000100
#define WTS_EVENT_ALL 0x7fffffff <-- I am not sure how to convert
these and what they are?
#define WTS_EVENT_FLUSH 0x80000000

The constants will be Long in Visual Basic but how can I define what the
constant value will be? What will the long numerical value be? Hope I am
making sense..


If you are using VB.CLASSIC - then yes, they would be Long... But,
since this is a VB.NET group, I'll assume your using VB.NET - and in
that case, they will be integers. Integer in VB.NET is a 32-bit
number, not 16-bit as in VB.CLASSIC. A Long in VB.NET is actually a
64-bit number.

Anyway - to declare these:

Private Const WTS_EVENT_ALL As Integer = &H7FFFFFFF

In other words, change the 0x to an &H :) These look like a bunch of
flags that are going to be or'd together, so in reality I would
probably make these an Enum...

<Flags()> _
Private Enum EventFlags
None = &H0
Create = &H1
Delete = &H2
Rename = &H4
Connect = &H8
Disconnect = &H10
Logon = &H20
Logoff = &H40
StateChange = &H80
License = &H100
All = &H7FFFFFFF
Flush = &H80000000
End Enum

And then I would delcare the parameter that I was passing these to as
EventFlags. This way you get a handy intellisense on what flags are
valid :)

HTH

--
Tom Shelton [MVP]

Apr 28 '06 #3
"Jeremie Legault" <Je************ @discussions.mi crosoft.com> schrieb:
Might have found my own answer, can someone confirm for me?
[...]
#define WTS_EVENT_FLUSH 0x80000000 = 2147483648


I don't see any reasons for transforming the hexadecimal literals into
decimal literals. Simply replace the '0x' with '&H' in VB.NET:

\\\
Private Const WTS_EVENT_FLUSH As Int32 = &H80000000
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Apr 28 '06 #4
"Jeremie Legault" <Je************ @discussions.mi crosoft.com> schrieb:
I am creating an application to interface with Terminal Services but as
you
will learn I am a beginner. I have learned how to connect to the API to
use
the functions available. One of the functions I would like to use is the
following:

BOOL WTSWaitSystemEv ent(
HANDLE hServer,
DWORD EventMask,
DWORD* pEventFlags
);


\\\
Private Declare Function WTSWaitSystemEv ent Lib "Wtsapi32.d ll" ( _
ByVal hServer As IntPtr, _
ByVal EventMask As WTS_EVENT_FLAGS , _
ByRef pEventFlags As Int32 _
) As Boolean

<Flags()> _
Private Enum WTS_EVENT_FLAGS
WTS_EVENT_NONE = &H0
WTS_EVENT_CREAT E = &H1
WTS_EVENT_DELET E = &H2
WTS_EVENT_RENAM E = &H4
WTS_EVENT_CONNE CT = &H8
WTS_EVENT_DISCO NNECT = &H10
WTS_EVENT_LOGON = &H20
WTS_EVENT_LOGOF F = &H40
WTS_EVENT_STATE CHANGE = &H80
WTS_EVENT_LICEN SE = &H100
WTS_EVENT_ALL = &H7FFFFFFF
WTS_EVENT_FLUSH = &H80000000
End Enum
///

The enumeration type is implicitly typed as 'Int32'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Apr 28 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4958
by: Peter Kwan | last post by:
Hi, I believe I have discovered a bug in Python 2.3. Could anyone suggest a get around? When I tested my existing Python code with the newly released Python 2.3, I get the following warning: FutureWarning: hex/oct constants > sys.maxint will return positive values in Python 2.4 and up It is because I used some constants such as...
2
3764
by: Bryan Olson | last post by:
The current Python standard library provides two cryptographic hash functions: MD5 and SHA-1 . The authors of MD5 originally stated: It is conjectured that it is computationally infeasible to produce two messages having the same message digest. That conjecture is false, as demonstrated by Wang, Feng, Lai and Yu in 2004 . Just recently,...
8
5214
by: J.Haan | last post by:
Hi all. I'm currently coping with a problem on which I hope you could shed some light. Imagine the following: I have table in DB2 8.1 (.5) which is defined as: table test { t1 smallint, t2 smallint, t3 smallint,
6
6126
by: Danny Lesandrini | last post by:
I'm using an Access database to drive a web site and the colors of various table backgrounds are stored in Access. I want users of the Access database to be able to select colors for the site, but my mappings between named colors, HEX values and the Long Integer values used in Access are not jibbing. Anyone have a nice list laying around? ...
26
2015
by: Christopher Benson-Manica | last post by:
I have, in a certain unnamed header file, the following: #define PIPE_WAIT 0x00000000 #define PIPE_NOWAIT 0x00000001 and a function that the compiler believes has the following prototype: __stdcall SetNamedPipeHandleState(void *,unsigned long *, unsigned long *,unsigned long *); /* nonstandard calling...
24
1849
by: Michael B Allen | last post by:
I use long longs occasionally. I know there are some limitations regarding the standards such as not using long long constants but what's the big deal? Why is long long not used so much? Mike
9
7114
by: rsine | last post by:
I have developed a program that sends a command through the serial port to our business system and then reads from the buffer looking for a number. Everything worked great on my WinXP system, but when I tried the program on the Win98 system it will be running on, I get the following error: Cast from string "2076719" to type 'Long' is not...
12
3331
by: Laurent Deniau | last post by:
If I understand well, an enumeration is only garantee to hold at most an int (6.7.2.2-2). So I would like to know: how to store a long in an enum? enum { p2_31 = 1L << 31 }; // boom how to define a synonym of a constant address?
52
5938
by: lcw1964 | last post by:
Greetings, all, I am trying to port a little bit of math code to gcc, that in the original version used the long double version of several functions (in particular, atanl, fabsl, and expl). I get a complie-time "unidentified reference" error to the expl() calls, but gcc seems to digest atanl and fabsl just fine. Changing expl to exp...
0
7459
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7393
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7653
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7803
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7749
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5322
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3444
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
695
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.