Click here to Skip to main content
15,917,793 members
Home / Discussions / C#
   

C#

 
Question.dll issue! VBA to C#?! Pin
andredani25-Aug-08 22:25
andredani25-Aug-08 22:25 
AnswerRe: .dll issue! VBA to C#?! Pin
selcuks25-Aug-08 22:37
selcuks25-Aug-08 22:37 
AnswerRe: .dll issue! VBA to C#?! Pin
Guffa26-Aug-08 2:03
Guffa26-Aug-08 2:03 
AnswerRe: .dll issue! VBA to C#?! Pin
Alan N26-Aug-08 7:43
Alan N26-Aug-08 7:43 
Your problem may be resolved by using a StringBuilder for the result buffer and I'll point you to a reference showing the win32 api function GetWindowText which returns a string.

http://msdn.microsoft.com/en-us/magazine/cc301501.aspx[^]

[DllImport("sn25.dll", EntryPoint = "****")] 
static extern int snod(string host, string port, 
                       string user, string passwd, 
                       string cert, string CAert, 
                       string Nodtjänst, string arg, 
                       string extra, 
                       StringBuilder result, int buf);


You'd then call your function like this
// create a 1K buffer
StringBuilder sb = new StringBuilder(1024);
int res = snod(............, sb, sb.Capacity);
string resultStr = sb.ToString();


Also make sure that you know what type of encoding the result string uses, i.e. Ansi or Unicode and set CharSet appropriately in your DllImport attribute.

I'm not an expert at this so can't guarantee that these suggestions will work, but hopefully...

Alan.
QuestionWIndows Service in Windows Form Pin
idreesbadshah25-Aug-08 22:14
idreesbadshah25-Aug-08 22:14 
AnswerRe: WIndows Service in Windows Form Pin
PIEBALDconsult26-Aug-08 3:34
mvePIEBALDconsult26-Aug-08 3:34 
GeneralRe: WIndows Service in Windows Form Pin
idreesbadshah26-Aug-08 18:12
idreesbadshah26-Aug-08 18:12 
GeneralRe: WIndows Service in Windows Form Pin
PIEBALDconsult27-Aug-08 4:52
mvePIEBALDconsult27-Aug-08 4:52 
QuestionRegular expression Pin
hadad25-Aug-08 21:30
hadad25-Aug-08 21:30 
AnswerRe: Regular expression Pin
J4amieC25-Aug-08 21:59
J4amieC25-Aug-08 21:59 
GeneralRe: Regular expression Pin
hadad25-Aug-08 23:03
hadad25-Aug-08 23:03 
GeneralRe: Regular expression Pin
J4amieC25-Aug-08 23:20
J4amieC25-Aug-08 23:20 
GeneralRe: Regular expression Pin
J4amieC25-Aug-08 23:24
J4amieC25-Aug-08 23:24 
GeneralRe: Regular expression Pin
hadad26-Aug-08 0:15
hadad26-Aug-08 0:15 
QuestionCreate Shortcut key in C# Pin
Laji5925-Aug-08 21:15
Laji5925-Aug-08 21:15 
AnswerRe: Create Shortcut key in C# Pin
Christian Graus25-Aug-08 21:53
protectorChristian Graus25-Aug-08 21:53 
AnswerRe: Create Shortcut key in C# Pin
Shpendh25-Aug-08 22:44
Shpendh25-Aug-08 22:44 
QuestionDatagridview Error! Pin
zeeShan anSari25-Aug-08 20:43
zeeShan anSari25-Aug-08 20:43 
QuestionPrint Preview problem in c#.net Pin
Punit Birla25-Aug-08 20:16
Punit Birla25-Aug-08 20:16 
AnswerRe: Print Preview problem in c#.net Pin
blackjack215025-Aug-08 22:13
blackjack215025-Aug-08 22:13 
GeneralRe: Print Preview problem in c#.net Pin
Punit Birla25-Aug-08 23:54
Punit Birla25-Aug-08 23:54 
GeneralRe: Print Preview problem in c#.net Pin
mutpan14-Sep-09 2:16
mutpan14-Sep-09 2:16 
QuestionAbsolute to Relative Path Pin
Mushtaque Nizamani25-Aug-08 19:34
Mushtaque Nizamani25-Aug-08 19:34 
AnswerRe: Absolute to Relative Path Pin
Christian Graus25-Aug-08 21:54
protectorChristian Graus25-Aug-08 21:54 
AnswerRe: Absolute to Relative Path Pin
Frank Horn25-Aug-08 23:19
Frank Horn25-Aug-08 23:19 

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.