@@ -15,7 +15,7 @@ public class Win32
1515 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
1616 /// </summary>
1717 [ DllImport ( "user32" ) ]
18- public static extern IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , NppMenuCmd lParam ) ;
18+ public static extern IntPtr SendMessage ( IntPtr hWnd , UInt32 Msg , IntPtr wParam , [ MarshalAs ( UnmanagedType . LPWStr ) ] string lParam ) ;
1919
2020 /// <summary>
2121 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
@@ -24,7 +24,7 @@ public class Win32
2424 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
2525 /// </summary>
2626 [ DllImport ( "user32" ) ]
27- public static extern IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , IntPtr lParam ) ;
27+ public static extern IntPtr SendMessage ( IntPtr hWnd , UInt32 Msg , IntPtr wParam , [ MarshalAs ( UnmanagedType . LPWStr ) ] StringBuilder lParam ) ;
2828
2929 /// <summary>
3030 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
@@ -33,7 +33,7 @@ public class Win32
3333 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
3434 /// </summary>
3535 [ DllImport ( "user32" ) ]
36- public static extern IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , int lParam ) ;
36+ public static extern IntPtr SendMessage ( IntPtr hWnd , UInt32 Msg , IntPtr wParam , IntPtr lParam ) ;
3737
3838 /// <summary>
3939 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
@@ -42,123 +42,167 @@ public class Win32
4242 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
4343 /// </summary>
4444 [ DllImport ( "user32" ) ]
45- public static extern IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , out int lParam ) ;
45+ public static extern IntPtr SendMessage ( IntPtr hWnd , UInt32 Msg , IntPtr wParam , out IntPtr lParam ) ;
4646
4747 /// <summary>
4848 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
4949 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
5050 /// If gateways are missing or incomplete, please help extend them and send your code to the project
5151 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
5252 /// </summary>
53- [ DllImport ( "user32" ) ]
54- public static extern IntPtr SendMessage ( IntPtr hWnd , uint Msg , IntPtr wParam , int lParam ) ;
53+ public static IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , NppMenuCmd lParam )
54+ {
55+ return SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , new IntPtr ( ( uint ) lParam ) ) ;
56+ }
57+
5558 /// <summary>
5659 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
5760 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
5861 /// If gateways are missing or incomplete, please help extend them and send your code to the project
5962 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
6063 /// </summary>
64+ public static IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , IntPtr lParam )
65+ {
66+ return SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , lParam ) ;
67+ }
6168
6269 /// <summary>
6370 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
6471 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
6572 /// If gateways are missing or incomplete, please help extend them and send your code to the project
6673 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
6774 /// </summary>
68- [ DllImport ( "user32" ) ]
69- public static extern IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , ref LangType lParam ) ;
75+ public static IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , int lParam )
76+ {
77+ return SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , new IntPtr ( lParam ) ) ;
78+ }
7079
7180 /// <summary>
7281 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
7382 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
7483 /// If gateways are missing or incomplete, please help extend them and send your code to the project
7584 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
7685 /// </summary>
77- [ DllImport ( "user32" ) ]
78- public static extern IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , [ MarshalAs ( UnmanagedType . LPWStr ) ] StringBuilder lParam ) ;
86+ public static IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , out int lParam )
87+ {
88+ IntPtr outVal ;
89+ IntPtr retval = SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , out outVal ) ;
90+ lParam = outVal . ToInt32 ( ) ;
91+ return retval ;
92+ }
7993
8094 /// <summary>
8195 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
8296 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
8397 /// If gateways are missing or incomplete, please help extend them and send your code to the project
8498 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
8599 /// </summary>
86- [ DllImport ( "user32" ) ]
87- public static extern IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , [ MarshalAs ( UnmanagedType . LPWStr ) ] string lParam ) ;
100+ public static IntPtr SendMessage ( IntPtr hWnd , uint Msg , IntPtr wParam , int lParam )
101+ {
102+ return SendMessage ( hWnd , ( UInt32 ) Msg , wParam , new IntPtr ( lParam ) ) ;
103+ }
88104
89105 /// <summary>
90106 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
91107 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
92108 /// If gateways are missing or incomplete, please help extend them and send your code to the project
93109 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
94110 /// </summary>
95- [ DllImport ( "user32" ) ]
96- public static extern IntPtr SendMessage ( IntPtr hWnd , uint Msg , IntPtr wParam , [ MarshalAs ( UnmanagedType . LPWStr ) ] string lParam ) ;
111+ public static IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , [ MarshalAs ( UnmanagedType . LPWStr ) ] StringBuilder lParam )
112+ {
113+ return SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , lParam ) ;
114+ }
97115
98116 /// <summary>
99117 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
100118 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
101119 /// If gateways are missing or incomplete, please help extend them and send your code to the project
102120 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
103121 /// </summary>
104- [ DllImport ( "user32" ) ]
105- public static extern IntPtr SendMessage ( IntPtr hWnd , uint Msg , IntPtr wParam , [ MarshalAs ( UnmanagedType . LPWStr ) ] StringBuilder lParam ) ;
106-
122+ public static IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , [ MarshalAs ( UnmanagedType . LPWStr ) ] string lParam )
123+ {
124+ return SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , lParam ) ;
125+ }
107126
108- // TODO KBG Experimental
109127 /// <summary>
110128 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
111129 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
112130 /// If gateways are missing or incomplete, please help extend them and send your code to the project
113131 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
114132 /// </summary>
115- [ DllImport ( "user32" ) ]
116- public static extern IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , IntPtr wParam , IntPtr lParam ) ;
133+ public static IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , IntPtr wParam , int lParam )
134+ {
135+ return SendMessage ( hWnd , ( UInt32 ) Msg , wParam , new IntPtr ( lParam ) ) ;
136+ }
137+
117138 /// <summary>
118139 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
119140 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
120141 /// If gateways are missing or incomplete, please help extend them and send your code to the project
121142 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
122143 /// </summary>
123- [ DllImport ( "user32" ) ]
124- public static extern IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , IntPtr wParam , int lParam ) ;
125-
144+ public static IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , int wParam , IntPtr lParam )
145+ {
146+ return SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , lParam ) ;
147+ }
126148
127149 /// <summary>
128150 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
129151 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
130152 /// If gateways are missing or incomplete, please help extend them and send your code to the project
131153 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
132154 /// </summary>
133- [ DllImport ( "user32" ) ]
134- public static extern IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , int wParam , IntPtr lParam ) ;
155+ public static IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , int wParam , string lParam )
156+ {
157+ return SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , lParam ) ;
158+ }
135159
136160 /// <summary>
137161 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
138162 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
139163 /// If gateways are missing or incomplete, please help extend them and send your code to the project
140164 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
141165 /// </summary>
142- [ DllImport ( "user32" ) ]
143- public static extern IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , int wParam , string lParam ) ;
166+ public static IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , int wParam , [ MarshalAs ( UnmanagedType . LPStr ) ] StringBuilder lParam )
167+ {
168+ return SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , lParam ) ;
169+ }
144170
145171 /// <summary>
146172 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
147173 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
148174 /// If gateways are missing or incomplete, please help extend them and send your code to the project
149175 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
150176 /// </summary>
151- [ DllImport ( "user32" ) ]
152- public static extern IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , int wParam , [ MarshalAs ( UnmanagedType . LPStr ) ] StringBuilder lParam ) ;
177+ public static IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , int wParam , int lParam )
178+ {
179+ return SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , new IntPtr ( lParam ) ) ;
180+ }
153181
154182 /// <summary>
155183 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
156184 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
157185 /// If gateways are missing or incomplete, please help extend them and send your code to the project
158186 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
159187 /// </summary>
160- [ DllImport ( "user32" ) ]
161- public static extern IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , int wParam , int lParam ) ;
188+ public static IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , IntPtr wParam , IntPtr lParam )
189+ {
190+ return SendMessage ( hWnd , ( UInt32 ) Msg , wParam , lParam ) ;
191+ }
192+
193+ /// <summary>
194+ /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
195+ /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
196+ /// If gateways are missing or incomplete, please help extend them and send your code to the project
197+ /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
198+ /// </summary>
199+ public static IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , ref LangType lParam )
200+ {
201+ IntPtr outVal ;
202+ IntPtr retval = SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , out outVal ) ;
203+ lParam = ( LangType ) outVal ;
204+ return retval ;
205+ }
162206
163207 public const int MAX_PATH = 260 ;
164208
@@ -186,4 +230,4 @@ public class Win32
186230 [ DllImport ( "kernel32" ) ]
187231 public static extern void OutputDebugString ( string lpOutputString ) ;
188232 }
189- }
233+ }
0 commit comments