🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #4426

Re: PVOID and Borland data types

#4426
From: Remy Lebeau (TeamB)
Date: Mon, 06 Feb 2006 22:12
30 lines
2027 bytes
"Mike Collins" <its@thebottomofthe.post> wrote:

> Data
> Pointer to a caller-allocated buffer containing the
> data for the value entry.
> DataSize
> Specifies the size in bytes of the Data buffer. If
> Type is any of the REG_XXX_SZ, this value must
> include the terminating zero(s).

So, you are trying to call one of the Registry functions such as RegSetValueEx() or RegQueryValueEx()?

> Can someone explain to me how to achieve this using
> the WideString or AnsiString data types that are available

AnsiString has a c_str() method, and WideString has a c_bstr() method, for the getting a pointer to the memory used for the raw characters.  Pass that pointer as the parameter.

> I need to dynamically alocate the values as I'll 
> only know them at runtime.

For example:

    AnsiString Data;
    Data.SetLength(12345);
    DWORD dwSize = Data.Length()+1;
    TheFunction(..., Data.c_str(), &dwSize, ...);


Gambit
Technical Details
Message-ID: <43e7d7ce$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!news-lond.gip.net!news.gsl.net!gip.net!easynet-quince!easynet.net!grolier!194.74.65.66.MISMATCH!news-peer0-test!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <43e7b1a5$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,e5fa031ed46571ec
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau (TeamB)" <no.spam@no.spam.com>
Sender: "Remy Lebeau (TeamB)" <no.spam@no.spam.com>
Reply-To: "Remy Lebeau (TeamB)" <no.spam@no.spam.com>
Subject: Re: PVOID and Borland data types
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 69.175.11.30     
References:  <43e7b1a5$1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <43e7d7ce$1@newsgroups.borland.com>
Date: 6 Feb 2006 15:12:14 -0700
X-Trace: newsgroups.borland.com 1139267534 207.105.83.66 (6 Feb 2006 15:12:14 -0700)
Lines: 31
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!news-lond.gip.net!news.gsl.net!gip.net!easynet-quince!easynet.net!grolier!194.74.65.66.MISMATCH!news-peer0-test!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail