Click here to Skip to main content
15,898,134 members
Home / Discussions / C#
   

C#

 
GeneralRe: Display Mode - SOLUTION :) Pin
leppie2-Sep-02 5:02
leppie2-Sep-02 5:02 
GeneralRe: Display Mode - SOLUTION :) Pin
Paul Riley2-Sep-02 5:57
Paul Riley2-Sep-02 5:57 
GeneralRe: Display Mode - SOLUTION :) Pin
leppie2-Sep-02 6:12
leppie2-Sep-02 6:12 
GeneralRe: Display Mode - SOLUTION :) Pin
Paul Riley2-Sep-02 8:00
Paul Riley2-Sep-02 8:00 
GeneralRe: Display Mode - SOLUTION :) Pin
Paul Ingles2-Sep-02 7:52
Paul Ingles2-Sep-02 7:52 
GeneralRe: Display Mode - SOLUTION :) Pin
James T. Johnson2-Sep-02 9:38
James T. Johnson2-Sep-02 9:38 
GeneralRe: Display Mode - SOLUTION :) Pin
Paul Riley2-Sep-02 9:52
Paul Riley2-Sep-02 9:52 
QuestionArray of strings to old DLL? Pin
EdgarBM1-Sep-02 23:25
EdgarBM1-Sep-02 23:25 
Hi,
I have an old DLL developped on VC++ 6.0. It was designed to work with VB and VC code. The problem always has been two special parameters which where an array of vaules. One was an array of doubles and the other an array of strings.
It was hard, but I solved it using the SAFEARRAY structure, this way:
Method (..., SAFEARRAY FAR *doubleArray, SAFEARRAY FAR *stringArray, ...)

-> To call the library from VB code I only should do:
Dim dbArray() as double<br />
Dim stArray() as string<br />
Redim dbArray(5)<br />
dbArray(0) = 3.4<br />
...<br />
'and so to strings

->To call it from VC it was more difficult:
char sMatriz[1][256/*128x2, chars doubled!*/];<br />
strcpy (sMatriz[0], "H E L L O "); //the space represents the NULL between the string characters due to compatibility with COM ; not for doubles array<br />
LPSAFEARRAY sS = new struct tagSAFEARRAY;<br />
sS->pvData=sMatriz;<br />
sS->rgsabound->cElements = 1;<br />
//...and I passed the reference of the LPSAFEARRAY: <br />
Method (..., &sD, &sS, ...)


THE PROBLEM:
---------------------

Now I want this library to be used on C# or VB.NET, but I don't know the way to instantiate and pass those parameters. Any chance I get an exception like this:
System.NullReferenceException<br />
Exception Details: Object reference not set to an instance of an object.

I pass those parameters like:
string[] sA = new string[5]; double[] dA = new double[5];<br />
Method (..., dA, sA,...)

...and if I modify the library taking out those params (ignoring them), everything works fine.

Does anyone knew how can I solve this problem? Is there any special way to pass those parameters?, anything before changing the library? I really need those params in the library!

Thank you in advance, (thanks if you read all the text!)
Edgar

Edgar Berengena Moreno
Software Engineer
Appeyron Research
AnswerRe: Array of strings to old DLL? Pin
Stephane Rodriguez.1-Sep-02 23:38
Stephane Rodriguez.1-Sep-02 23:38 
GeneralRe: Array of strings to old DLL? Pin
EdgarBM2-Sep-02 1:14
EdgarBM2-Sep-02 1:14 
GeneralRe: Array of strings to old DLL? Pin
Stephane Rodriguez.2-Sep-02 1:33
Stephane Rodriguez.2-Sep-02 1:33 
GeneralRe: Array of strings to old DLL? Pin
EdgarBM2-Sep-02 1:52
EdgarBM2-Sep-02 1:52 
AnswerRe: Array of strings to old DLL? Pin
leppie2-Sep-02 1:50
leppie2-Sep-02 1:50 
GeneralRe: Array of strings to old DLL? Pin
EdgarBM2-Sep-02 2:10
EdgarBM2-Sep-02 2:10 
GeneralRe: Array of strings to old DLL? Pin
leppie2-Sep-02 2:33
leppie2-Sep-02 2:33 
GeneralRe: Array of strings to old DLL? Pin
EdgarBM2-Sep-02 21:44
EdgarBM2-Sep-02 21:44 
GeneralRe: Array of strings to old DLL? Pin
leppie3-Sep-02 2:19
leppie3-Sep-02 2:19 
QuestionHow to do a virtual keyboard in c# ? Pin
AlbertoFujimori1-Sep-02 21:34
AlbertoFujimori1-Sep-02 21:34 
AnswerRe: How to do a virtual keyboard in c# ? Pin
Stephane Rodriguez.2-Sep-02 0:01
Stephane Rodriguez.2-Sep-02 0:01 
GeneralBringToFront changes index Pin
James McCutcheon1-Sep-02 20:32
James McCutcheon1-Sep-02 20:32 
QuestionGraphic engine for .NET anyone? Pin
Alastair Stell1-Sep-02 16:01
Alastair Stell1-Sep-02 16:01 
AnswerRe: Graphic engine for .NET anyone? Pin
David Stone1-Sep-02 17:58
sitebuilderDavid Stone1-Sep-02 17:58 
AnswerRe: Graphic engine for .NET anyone? Pin
Rickard Andersson201-Sep-02 20:47
Rickard Andersson201-Sep-02 20:47 
AnswerRe: Graphic engine for .NET anyone? Pin
Stephane Rodriguez.1-Sep-02 21:20
Stephane Rodriguez.1-Sep-02 21:20 
AnswerRe: Graphic engine for .NET anyone? Pin
leppie2-Sep-02 5:24
leppie2-Sep-02 5:24 

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.