<p>I'm using managed c++ to implement a method that returns a string. I declare the method in my header file using the following signature:</p>

<pre><code>String^ GetWindowText()
</code></pre>

<p>However, when I'm using this method from C#, the signature is:</p>

<pre><code>string GetWindowTextW();
</code></pre>

<p>How do I get rid of the extra "W" at the end of the method's name?</p>

To get around the preprocessor hackery of the Windows header files, declare it like this:
```
```
#undef GetWindowText
String^ GetWindowText()
```
```
Note that, if you actually use the Win32 or MFC
```
GetWindowText()
```
routines in your code, you'll need to either redefine the macro or call them as
```
GetWindowTextW()
```
.