Click here to Skip to main content
15,914,111 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
AnswerRe: VC#.Net class in VC++.Net ? Pin
Paul Conrad16-Jul-08 9:36
professionalPaul Conrad16-Jul-08 9:36 
QuestionBlowFish Pin
Xaria14-Jul-08 16:24
Xaria14-Jul-08 16:24 
AnswerRe: BlowFish Pin
led mike15-Jul-08 4:27
led mike15-Jul-08 4:27 
AnswerRe: BlowFish Pin
Mark Salsbery15-Jul-08 6:27
Mark Salsbery15-Jul-08 6:27 
AnswerRe: BlowFish Pin
Paul Conrad16-Jul-08 9:35
professionalPaul Conrad16-Jul-08 9:35 
GeneralRe: BlowFish Pin
Xaria16-Jul-08 20:46
Xaria16-Jul-08 20:46 
QuestionMarshalAs UnmanagedType::LPStrunc trouble Pin
Thees Ch. Winkler13-Jul-08 2:44
Thees Ch. Winkler13-Jul-08 2:44 
AnswerRe: MarshalAs UnmanagedType::LPStrunc trouble Pin
Mark Salsbery13-Jul-08 16:08
Mark Salsbery13-Jul-08 16:08 
As the exception message indicates, without structure layout, the Guid can't be marshaled.

Using the info in "How to: Convert Between System::Guid and _GUID[^]", you could marshal
the Guid as a byte array, something like:
[DllImport("shell32.dll", CallingConvention = CallingConvention::Cdecl)]
extern int SHGetKnownFolderPath([MarshalAs(UnmanagedType::LPArray)] array<Byte> ^ar, UInt32 dwFlags, IntPtr hToken, [Runtime::InteropServices::Out] IntPtr %ppszPath);

...

String^ str;
IntPtr path;

array<Byte> ^ar = KnownFolders::AddNewPrograms->ToByteArray();
if(SHGetKnownFolderPath(ar, 0, IntPtr::Zero, path) == 0)
{
	str = System::Runtime::InteropServices::Marshal::PtrToStringAuto(path);
	System::Runtime::InteropServices::Marshal::FreeCoTaskMem(path);
}

Note I also changed the Path paramter so it would marshal as an Out parameter.
The "[Runtime::InteropServices::Out]" is optional - the "%" is NOT optional Smile | :)

Mark

Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: MarshalAs UnmanagedType::LPStrunc trouble Pin
Thees Ch. Winkler14-Jul-08 9:59
Thees Ch. Winkler14-Jul-08 9:59 
GeneralRe: MarshalAs UnmanagedType::LPStrunc trouble Pin
Mark Salsbery14-Jul-08 10:04
Mark Salsbery14-Jul-08 10:04 
QuestionCalling .Net Interface from VC++ Pin
Debasis108-Jul-08 6:11
Debasis108-Jul-08 6:11 
AnswerRe: Calling .Net Interface from VC++ Pin
Mark Salsbery8-Jul-08 6:57
Mark Salsbery8-Jul-08 6:57 
QuestionHow to give message from thread to main application in VC++.net? Pin
AnayKulkarni7-Jul-08 21:27
AnayKulkarni7-Jul-08 21:27 
AnswerRe: How to give message from thread to main application in VC++.net? Pin
killabyte7-Jul-08 22:05
killabyte7-Jul-08 22:05 
AnswerRe: How to give message from thread to main application in VC++.net? Pin
LionAM8-Jul-08 0:22
LionAM8-Jul-08 0:22 
QuestionCan we reduce this function (x&lt;-3 || x &gt;3) further Pin
pallaka7-Jul-08 20:18
pallaka7-Jul-08 20:18 
AnswerRe: Can we reduce this function (x&lt;-3 || x &gt;3) further Pin
LionAM8-Jul-08 0:35
LionAM8-Jul-08 0:35 
GeneralRe: Can we reduce this function (x&lt;-3 || x &gt;3) further Pin
pallaka8-Jul-08 1:32
pallaka8-Jul-08 1:32 
GeneralRe: Can we reduce this function (x&lt;-3 || x &gt;3) further Pin
killabyte8-Jul-08 2:07
killabyte8-Jul-08 2:07 
QuestionWhat is the proper way to add a form to an existing class? Pin
BuckBrown7-Jul-08 5:55
BuckBrown7-Jul-08 5:55 
AnswerRe: What is the proper way to add a form to an existing class? Pin
led mike7-Jul-08 6:16
led mike7-Jul-08 6:16 
GeneralRe: What is the proper way to add a form to an existing class? Pin
BuckBrown7-Jul-08 7:45
BuckBrown7-Jul-08 7:45 
GeneralRe: What is the proper way to add a form to an existing class? Pin
led mike7-Jul-08 9:17
led mike7-Jul-08 9:17 
AnswerRe: What is the proper way to add a form to an existing class? Pin
killabyte7-Jul-08 23:37
killabyte7-Jul-08 23:37 
QuestionHow can i create multiple instances of form Pin
Xaria6-Jul-08 18:28
Xaria6-Jul-08 18:28 

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.