Click here to Skip to main content
15,897,518 members
Home / Discussions / C#
   

C#

 
GeneralDataset, Dataview, XML, RadioButtonList Question. HELP!! Pin
bentai25-Mar-04 9:59
bentai25-Mar-04 9:59 
GeneralRe: Dataset, Dataview, XML, RadioButtonList Question. HELP!! Pin
Heath Stewart25-Mar-04 14:03
protectorHeath Stewart25-Mar-04 14:03 
GeneralRe: Dataset, Dataview, XML, RadioButtonList Question. HELP!! Pin
bentai29-Mar-04 4:29
bentai29-Mar-04 4:29 
GeneralRe: Dataset, Dataview, XML, RadioButtonList Question. HELP!! Pin
Heath Stewart29-Mar-04 5:14
protectorHeath Stewart29-Mar-04 5:14 
GeneralPassing BStr by refrence to unmanaged dll Pin
schnee2k325-Mar-04 9:45
schnee2k325-Mar-04 9:45 
GeneralRe: Passing BStr by refrence to unmanaged dll Pin
Dave Kreskowiak25-Mar-04 12:03
mveDave Kreskowiak25-Mar-04 12:03 
GeneralRe: Passing BStr by refrence to unmanaged dll Pin
schnee2k325-Mar-04 12:10
schnee2k325-Mar-04 12:10 
GeneralRe: Passing BStr by refrence to unmanaged dll Pin
Dave Kreskowiak25-Mar-04 12:49
mveDave Kreskowiak25-Mar-04 12:49 
schnee2k3 wrote:
They are actually of type PWSTR, which, I read somewhere, is of type BSTR,

Not quite. BSTR's begin with a 32-bit byte length preceding the array of Unicode characters. The length is in BYTES, not characters. You'd probably be better off Marshaling them as LPWSTR's. All PWSTR means is "Pointer to Wide (or Unicode) String". Kind of odd though, it's usually called LPWSTR (Long Pointer... Unless your actually using BSTR's in your app or .DLL, you'd be better off not using them.

Now, the reason why your string you passed by ref didn't change is because it had a zero length to start with. Managed strings are immutable, they can't change unless poked into directly. Unless your .DLL will deallocate and allocate you a new Managed string, you have to declare the string at a maximum size you can handle first. Something like either a character array of zero's to satisfy the termination character at the end of a string, or use Stringbuilder to do it. But even with StringBuilder, you have to tell it to allocate enough space to handle the maximum size string you expect to get back.



RageInTheMachine9532
GeneralRe: Passing BStr by refrence to unmanaged dll Pin
schnee2k325-Mar-04 13:05
schnee2k325-Mar-04 13:05 
GeneralRe: Passing BStr by refrence to unmanaged dll Pin
Heath Stewart25-Mar-04 13:46
protectorHeath Stewart25-Mar-04 13:46 
GeneralRe: Passing BStr by refrence to unmanaged dll Pin
schnee2k325-Mar-04 14:21
schnee2k325-Mar-04 14:21 
GeneralRe: Passing BStr by refrence to unmanaged dll Pin
Dave Kreskowiak25-Mar-04 14:56
mveDave Kreskowiak25-Mar-04 14:56 
GeneralRe: Passing BStr by refrence to unmanaged dll Pin
schnee2k325-Mar-04 15:06
schnee2k325-Mar-04 15:06 
GeneralRe: Passing BStr by refrence to unmanaged dll Pin
Heath Stewart26-Mar-04 3:06
protectorHeath Stewart26-Mar-04 3:06 
GeneralRe: Passing BStr by refrence to unmanaged dll Pin
Heath Stewart26-Mar-04 3:18
protectorHeath Stewart26-Mar-04 3:18 
GeneralRe: Passing BStr by refrence to unmanaged dll Pin
schnee2k326-Mar-04 4:27
schnee2k326-Mar-04 4:27 
GeneralRe: Passing BStr by refrence to unmanaged dll Pin
Heath Stewart26-Mar-04 4:31
protectorHeath Stewart26-Mar-04 4:31 
GeneralRe: Passing BStr by refrence to unmanaged dll Pin
schnee2k326-Mar-04 4:35
schnee2k326-Mar-04 4:35 
GeneralRe: Passing BStr by refrence to unmanaged dll Pin
Dave Kreskowiak26-Mar-04 7:44
mveDave Kreskowiak26-Mar-04 7:44 
Questiontranslation vb to c# ? Pin
el69os25-Mar-04 8:59
el69os25-Mar-04 8:59 
AnswerRe: translation vb to c# ? Pin
Daniel Turini25-Mar-04 9:09
Daniel Turini25-Mar-04 9:09 
AnswerRe: translation vb to c# ? Pin
Michael Flanakin25-Mar-04 11:14
Michael Flanakin25-Mar-04 11:14 
GeneralRe: translation vb to c# ? Pin
el69os26-Mar-04 1:55
el69os26-Mar-04 1:55 
GeneralRe: translation vb to c# ? Pin
Michael Flanakin26-Mar-04 2:06
Michael Flanakin26-Mar-04 2:06 
AnswerRe: translation vb to c# ? Pin
Jeremy Kimball25-Mar-04 14:04
Jeremy Kimball25-Mar-04 14:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.