@@ -85,7 +85,7 @@ public enum ScrollInfoBar
8585 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
8686 /// </summary>
8787 [ DllImport ( "user32" ) ]
88- public static extern IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , NppMenuCmd lParam ) ;
88+ public static extern IntPtr SendMessage ( IntPtr hWnd , UInt32 Msg , IntPtr wParam , [ MarshalAs ( UnmanagedType . LPWStr ) ] string lParam ) ;
8989
9090 /// <summary>
9191 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
@@ -94,7 +94,7 @@ public enum ScrollInfoBar
9494 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
9595 /// </summary>
9696 [ DllImport ( "user32" ) ]
97- public static extern IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , IntPtr lParam ) ;
97+ public static extern IntPtr SendMessage ( IntPtr hWnd , UInt32 Msg , IntPtr wParam , [ MarshalAs ( UnmanagedType . LPWStr ) ] StringBuilder lParam ) ;
9898
9999 /// <summary>
100100 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
@@ -103,7 +103,7 @@ public enum ScrollInfoBar
103103 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
104104 /// </summary>
105105 [ DllImport ( "user32" ) ]
106- public static extern IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , int lParam ) ;
106+ public static extern IntPtr SendMessage ( IntPtr hWnd , UInt32 Msg , IntPtr wParam , IntPtr lParam ) ;
107107
108108 /// <summary>
109109 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
@@ -112,123 +112,167 @@ public enum ScrollInfoBar
112112 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
113113 /// </summary>
114114 [ DllImport ( "user32" ) ]
115- public static extern IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , out int lParam ) ;
115+ public static extern IntPtr SendMessage ( IntPtr hWnd , UInt32 Msg , IntPtr wParam , out IntPtr lParam ) ;
116116
117117 /// <summary>
118118 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
119119 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
120120 /// If gateways are missing or incomplete, please help extend them and send your code to the project
121121 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
122122 /// </summary>
123- [ DllImport ( "user32" ) ]
124- public static extern IntPtr SendMessage ( IntPtr hWnd , uint Msg , IntPtr wParam , int lParam ) ;
123+ public static IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , NppMenuCmd lParam )
124+ {
125+ return SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , new IntPtr ( ( uint ) lParam ) ) ;
126+ }
127+
125128 /// <summary>
126129 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
127130 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
128131 /// If gateways are missing or incomplete, please help extend them and send your code to the project
129132 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
130133 /// </summary>
134+ public static IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , IntPtr lParam )
135+ {
136+ return SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , lParam ) ;
137+ }
131138
132139 /// <summary>
133140 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
134141 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
135142 /// If gateways are missing or incomplete, please help extend them and send your code to the project
136143 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
137144 /// </summary>
138- [ DllImport ( "user32" ) ]
139- public static extern IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , ref LangType lParam ) ;
145+ public static IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , int lParam )
146+ {
147+ return SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , new IntPtr ( lParam ) ) ;
148+ }
140149
141150 /// <summary>
142151 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
143152 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
144153 /// If gateways are missing or incomplete, please help extend them and send your code to the project
145154 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
146155 /// </summary>
147- [ DllImport ( "user32" ) ]
148- public static extern IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , [ MarshalAs ( UnmanagedType . LPWStr ) ] StringBuilder lParam ) ;
156+ public static IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , out int lParam )
157+ {
158+ IntPtr outVal ;
159+ IntPtr retval = SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , out outVal ) ;
160+ lParam = outVal . ToInt32 ( ) ;
161+ return retval ;
162+ }
149163
150164 /// <summary>
151165 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
152166 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
153167 /// If gateways are missing or incomplete, please help extend them and send your code to the project
154168 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
155169 /// </summary>
156- [ DllImport ( "user32" ) ]
157- public static extern IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , [ MarshalAs ( UnmanagedType . LPWStr ) ] string lParam ) ;
170+ public static IntPtr SendMessage ( IntPtr hWnd , uint Msg , IntPtr wParam , int lParam )
171+ {
172+ return SendMessage ( hWnd , ( UInt32 ) Msg , wParam , new IntPtr ( lParam ) ) ;
173+ }
158174
159175 /// <summary>
160176 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
161177 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
162178 /// If gateways are missing or incomplete, please help extend them and send your code to the project
163179 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
164180 /// </summary>
165- [ DllImport ( "user32" ) ]
166- public static extern IntPtr SendMessage ( IntPtr hWnd , uint Msg , IntPtr wParam , [ MarshalAs ( UnmanagedType . LPWStr ) ] string lParam ) ;
181+ public static IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , [ MarshalAs ( UnmanagedType . LPWStr ) ] StringBuilder lParam )
182+ {
183+ return SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , lParam ) ;
184+ }
167185
168186 /// <summary>
169187 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
170188 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
171189 /// If gateways are missing or incomplete, please help extend them and send your code to the project
172190 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
173191 /// </summary>
174- [ DllImport ( "user32" ) ]
175- public static extern IntPtr SendMessage ( IntPtr hWnd , uint Msg , IntPtr wParam , [ MarshalAs ( UnmanagedType . LPWStr ) ] StringBuilder lParam ) ;
176-
192+ public static IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , [ MarshalAs ( UnmanagedType . LPWStr ) ] string lParam )
193+ {
194+ return SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , lParam ) ;
195+ }
177196
178- // TODO KBG Experimental
179197 /// <summary>
180198 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
181199 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
182200 /// If gateways are missing or incomplete, please help extend them and send your code to the project
183201 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
184202 /// </summary>
185- [ DllImport ( "user32" ) ]
186- public static extern IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , IntPtr wParam , IntPtr lParam ) ;
203+ public static IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , IntPtr wParam , int lParam )
204+ {
205+ return SendMessage ( hWnd , ( UInt32 ) Msg , wParam , new IntPtr ( lParam ) ) ;
206+ }
207+
187208 /// <summary>
188209 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
189210 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
190211 /// If gateways are missing or incomplete, please help extend them and send your code to the project
191212 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
192213 /// </summary>
193- [ DllImport ( "user32" ) ]
194- public static extern IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , IntPtr wParam , int lParam ) ;
195-
214+ public static IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , int wParam , IntPtr lParam )
215+ {
216+ return SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , lParam ) ;
217+ }
196218
197219 /// <summary>
198220 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
199221 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
200222 /// If gateways are missing or incomplete, please help extend them and send your code to the project
201223 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
202224 /// </summary>
203- [ DllImport ( "user32" ) ]
204- public static extern IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , int wParam , IntPtr lParam ) ;
225+ public static IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , int wParam , string lParam )
226+ {
227+ return SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , lParam ) ;
228+ }
205229
206230 /// <summary>
207231 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
208232 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
209233 /// If gateways are missing or incomplete, please help extend them and send your code to the project
210234 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
211235 /// </summary>
212- [ DllImport ( "user32" ) ]
213- public static extern IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , int wParam , string lParam ) ;
236+ public static IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , int wParam , [ MarshalAs ( UnmanagedType . LPStr ) ] StringBuilder lParam )
237+ {
238+ return SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , lParam ) ;
239+ }
214240
215241 /// <summary>
216242 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
217243 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
218244 /// If gateways are missing or incomplete, please help extend them and send your code to the project
219245 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
220246 /// </summary>
221- [ DllImport ( "user32" ) ]
222- public static extern IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , int wParam , [ MarshalAs ( UnmanagedType . LPStr ) ] StringBuilder lParam ) ;
247+ public static IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , int wParam , int lParam )
248+ {
249+ return SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , new IntPtr ( lParam ) ) ;
250+ }
223251
224252 /// <summary>
225253 /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
226254 /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
227255 /// If gateways are missing or incomplete, please help extend them and send your code to the project
228256 /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
229257 /// </summary>
230- [ DllImport ( "user32" ) ]
231- public static extern IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , int wParam , int lParam ) ;
258+ public static IntPtr SendMessage ( IntPtr hWnd , SciMsg Msg , IntPtr wParam , IntPtr lParam )
259+ {
260+ return SendMessage ( hWnd , ( UInt32 ) Msg , wParam , lParam ) ;
261+ }
262+
263+ /// <summary>
264+ /// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
265+ /// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
266+ /// If gateways are missing or incomplete, please help extend them and send your code to the project
267+ /// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
268+ /// </summary>
269+ public static IntPtr SendMessage ( IntPtr hWnd , uint Msg , int wParam , ref LangType lParam )
270+ {
271+ IntPtr outVal ;
272+ IntPtr retval = SendMessage ( hWnd , ( UInt32 ) Msg , new IntPtr ( wParam ) , out outVal ) ;
273+ lParam = ( LangType ) outVal ;
274+ return retval ;
275+ }
232276
233277 public const int MAX_PATH = 260 ;
234278
@@ -266,4 +310,4 @@ public enum ScrollInfoBar
266310 [ DllImport ( "user32" ) ]
267311 public static extern int GetScrollInfo ( IntPtr hwnd , int nBar , ref ScrollInfo scrollInfo ) ;
268312 }
269- }
313+ }
0 commit comments