473,399 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

ULONG*

how do i initialize an atl ULONG* variable?


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Jul 22 '05 #1
5 6602

"alex" <al*************@verizon.net> wrote in message
news:40**********@127.0.0.1...
how do i initialize an atl ULONG* variable?


Same way as any other variable.

ULONG* x = something;

If you are having some trouble with code, it is best to post the actual
code.

john
Jul 22 '05 #2

"John Harrison" <jo*************@hotmail.com> wrote in message
news:2j*************@uni-berlin.de...

"alex" <al*************@verizon.net> wrote in message
news:40**********@127.0.0.1...
how do i initialize an atl ULONG* variable?


Same way as any other variable.

ULONG* x = something;

If you are having some trouble with code, it is best to post the actual
code.

john


ULONG* pnChars = 50; does not compile (int)

ULONG* pnChars = 50.0; does not compile (double)

ULONG* pnChars = 0; compiles but causes assertion failure when used in:

if ( MyCRegKey.QueryStringValue(valName.c_str(), pszValue, pnChars) ==
ERROR_SUCCESS )

MyCRegKey is an object instantiated from CRegKey -- a microsoft class that
wraps the registry functions.

for this QueryStringValue issue I think I'll just call one or more of the
registry functions directly, that should take care

of things, it would be good to know how to handle this though.

here's the method description:

http://msdn.microsoft.com/library/de...tringvalue.asp

but i'm just gonna use RegQueryValueEx from:

http://msdn.microsoft.com/library/de..._functions.asp

that should do it.


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Jul 22 '05 #3
alex wrote:
[snip] ULONG* pnChars = 50; does not compile (int)

ULONG* pnChars = 50.0; does not compile (double)

Man. The * in ULONG* means something!
It denotes a pointer! Neither 50 nor 50.0 are pointers.
ULONG* pnChars = 0; compiles but causes assertion failure when used in:

if ( MyCRegKey.QueryStringValue(valName.c_str(), pszValue, pnChars) ==
ERROR_SUCCESS )


Chances are high, that this function just wants to know the address of a variable
where it should place the result:

ULONG nChars;

if ( MyCRegKey.QueryStringValue(valName.c_str(), pszValue, &nChars) ==
ERROR_SUCCESS )

Not in every case when there is a pointer variable in an argument list it means
that you pass a pointer variable. In fact most of the time you simply pass
the address of a variable. Reading the documentation closely usually clearifies
things.
--
Karl Heinz Buchegger
kb******@gascad.at
Jul 22 '05 #4
>
ULONG* pnChars = 50; does not compile (int)

ULONG* pnChars = 50.0; does not compile (double)

ULONG* pnChars = 0; compiles but causes assertion failure when used in:

if ( MyCRegKey.QueryStringValue(valName.c_str(), pszValue, pnChars) ==
ERROR_SUCCESS )

MyCRegKey is an object instantiated from CRegKey -- a microsoft class that wraps the registry functions.

for this QueryStringValue issue I think I'll just call one or more of the
registry functions directly, that should take care

of things, it would be good to know how to handle this though.


Common newbie mistake. Just because a function takes a pointer argument it
doesn't mean that you have to declare a pointer variable. Just declare a
ULONG (no pointer) and use the address of operator.

ULONG nChars;
if ( MyCRegKey.QueryStringValue(valName.c_str(), pszValue, &nChars) ==
ERROR_SUCCESS )

john
Jul 22 '05 #5

"John Harrison" <jo*************@hotmail.com> wrote in message
news:2j*************@uni-berlin.de...

ULONG* pnChars = 50; does not compile (int)

ULONG* pnChars = 50.0; does not compile (double)

ULONG* pnChars = 0; compiles but causes assertion failure when used in:

if ( MyCRegKey.QueryStringValue(valName.c_str(), pszValue, pnChars) ==
ERROR_SUCCESS )

MyCRegKey is an object instantiated from CRegKey -- a microsoft class

that
wraps the registry functions.

for this QueryStringValue issue I think I'll just call one or more of the registry functions directly, that should take care

of things, it would be good to know how to handle this though.


Common newbie mistake. Just because a function takes a pointer argument it
doesn't mean that you have to declare a pointer variable. Just declare a
ULONG (no pointer) and use the address of operator.

ULONG nChars;
if ( MyCRegKey.QueryStringValue(valName.c_str(), pszValue, &nChars) ==
ERROR_SUCCESS )

john


yeah, that worked, thanks!


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Jul 22 '05 #6

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

Similar topics

3
by: Francois St-Arnaud | last post by:
Hello All, I have the following property in a C# class in a .NET 2003 project: public const ulong MASK_1 = 0x8000000000000000; I find the following observations unsettling (from my Command...
2
by: Nadav | last post by:
How can a UInt64 be converted to a byte ????
3
by: Curt Krueger | last post by:
I'll spare you the details of why we need this, but what I'm needing to do is convert -9999 to a positive ulong value. Any code examples or ideas on how to do this, where to look? thanks, Curt
9
by: Sanjib Biswas | last post by:
Could anyone point out to me the difference between ulong (C#) and UInt64/ULong (VB.Net)? I was under the impression that both are same. Below C# code works fine for a particular value of 'data'...
12
by: AK_TIREDOFSPAM | last post by:
I need to store a uint in an array of bytes. Doing it old fashioned style works: byte b=new byte; ulong ul = 1; for(int j=0; j<8; j++) { --- obviously I could (and did) optimize the code...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.