File tree Expand file tree Collapse file tree 3 files changed +21
-24
lines changed
cpp/VS_Snippets_CLR/Interop InOutParameters/CPP
csharp/VS_Snippets_CLR/Interop InOutParameters/CS
visualbasic/VS_Snippets_CLR/Interop InOutParameters/VB Expand file tree Collapse file tree 3 files changed +21
-24
lines changed Original file line number Diff line number Diff line change 3
3
using namespace System ;
4
4
using namespace System ::Runtime::InteropServices;
5
5
6
-
7
6
// Declare a class member for each structure element.
8
7
9
- [StructLayout(LayoutKind::Sequential,CharSet= CharSet::Unicode)]
8
+ [StructLayout(LayoutKind::Sequential, CharSet = CharSet::Unicode)]
10
9
public ref class OpenFileName
11
10
{
12
11
public:
13
- int structSize;
14
- String^ filter;
15
- String^ file;
16
- // ...
12
+ int structSize;
13
+ String^ filter;
14
+ String^ file;
15
+ // ...
17
16
};
18
17
19
- public ref class LibWrap
18
+ private ref class NativeMethods
20
19
{
21
20
public:
22
21
23
- // Declare a managed prototype for the unmanaged function.
22
+ // Declare a managed prototype for the unmanaged function.
24
23
25
- [DllImport(" Comdlg32.dll" ,CharSet= CharSet::Unicode)]
26
- static bool GetOpenFileName ( [In,Out]OpenFileName^ ofn );
24
+ [DllImport(" Comdlg32.dll" , CharSet = CharSet::Unicode)]
25
+ static bool GetOpenFileName ([In, Out]OpenFileName^ ofn);
27
26
};
28
27
29
28
void main () {}
Original file line number Diff line number Diff line change @@ -13,17 +13,16 @@ public class OpenFileName
13
13
// ...
14
14
}
15
15
16
- public class LibWrap
16
+ internal static class NativeMethods
17
17
{
18
18
// Declare a managed prototype for the unmanaged function.
19
19
[ DllImport ( "Comdlg32.dll" , CharSet = CharSet . Unicode ) ]
20
- public static extern bool GetOpenFileName ( [ In , Out ] OpenFileName ofn ) ;
20
+ internal static extern bool GetOpenFileName ( [ In , Out ] OpenFileName ofn ) ;
21
21
}
22
22
23
23
public class MainMethod
24
24
{
25
25
static void Main ( )
26
26
{ }
27
-
28
27
}
29
28
// </Snippet1>
Original file line number Diff line number Diff line change 1
1
' <Snippet1>
2
2
Imports System.Runtime.InteropServices
3
3
4
-
5
4
' Declare a class member for each structure element.
6
- <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)> _
5
+ <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
7
6
Public Class OpenFileName
8
7
9
- Public structSize As Integer = 0
10
- Public filter As String = Nothing
11
- Public file As String = Nothing
12
- ' ...
8
+ Public structSize As Integer = 0
9
+ Public filter As String = Nothing
10
+ Public file As String = Nothing
11
+ ' ...
13
12
14
13
End Class
15
14
16
- Public Class LibWrap
17
- ' Declare managed prototype for the unmanaged function.
18
- Declare Unicode Function GetOpenFileName Lib "Comdlg32.dll" ( _
19
- <[In](), Out ()> ByVal ofn As OpenFileName) As Boolean
15
+ Friend Class NativeMethods
16
+ ' Declare managed prototype for the unmanaged function.
17
+ Friend Declare Unicode Function GetOpenFileName Lib "Comdlg32.dll" (
18
+ <[In](), Out ()> ByVal ofn As OpenFileName) As Boolean
20
19
End Class
21
20
22
21
Public Class App
@@ -25,4 +24,4 @@ Public Class App
25
24
End Sub
26
25
End Class
27
26
28
- ' </Snippet1>
27
+ ' </Snippet1>
You can’t perform that action at this time.
0 commit comments