EDN Admin
Well-known member
<p align=left><font face=Arial size=2>Hello, I was writing a card game for fun on my Windows XP box using Visual Studio 2005 in C#. I was using the cards.dll thats shipped with the system and everything was working fine. Now I have a Vista box and wanted to get it running there. Vista replaced the cards.dll file with another dll (CardGames.dll) so I copied my cards.dll file from XP and put it in the same directory as the application file. But now I get the PInvokeStackImbalance error.</font>
<p align=left>
<p align=left>Its breaking at this point...
<p align=left> <font color="#2b91af" size=2>
Card</font><font size=2>.cdtDrawExt(hdc, rect.X, rect.Y, rect.Width, rect.Height, card, type, color); </font>
<p align=left>
<p align=left>Which is initialized here...
<p align=left> <font size=2>
[</font><font color="#2b91af" size=2>DllImport</font><font size=2>(</font><font color="#a31515" size=2>"cards.dll"</font><font size=2>)]
</font><font color="#0000ff" size=2>public</font><font size=2> </font><font color="#0000ff" size=2>static</font><font size=2> </font><font color="#0000ff" size=2>extern</font><font size=2> </font><font color="#0000ff" size=2>bool</font><font size=2> cdtDrawExt (</font><font color="#2b91af" size=2>IntPtr</font><font size=2> hdc, </font><font color="#0000ff" size=2>int</font><font size=2> x, </font><font color="#0000ff" size=2>int</font><font size=2> y, </font><font color="#0000ff" size=2>int</font><font size=2> dx, </font><font color="#0000ff" size=2>int</font><font size=2> dy, </font><font color="#0000ff" size=2>int</font><font size=2> card, </font><font color="#0000ff" size=2>int</font><font size=2> suit, </font><font color="#0000ff" size=2>long</font><font size=2> color); </font>
<p align=left>
<p align=left>
<p align=left>PInvokeStackImbalance was detected
Message: A call to PInvoke function ChatClient!Card.Card::cdtDrawExt has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
<p align=left>Any help would be appreciated. Thank you
View the full article
<p align=left>
<p align=left>Its breaking at this point...
<p align=left> <font color="#2b91af" size=2>
Card</font><font size=2>.cdtDrawExt(hdc, rect.X, rect.Y, rect.Width, rect.Height, card, type, color); </font>
<p align=left>
<p align=left>Which is initialized here...
<p align=left> <font size=2>
[</font><font color="#2b91af" size=2>DllImport</font><font size=2>(</font><font color="#a31515" size=2>"cards.dll"</font><font size=2>)]
</font><font color="#0000ff" size=2>public</font><font size=2> </font><font color="#0000ff" size=2>static</font><font size=2> </font><font color="#0000ff" size=2>extern</font><font size=2> </font><font color="#0000ff" size=2>bool</font><font size=2> cdtDrawExt (</font><font color="#2b91af" size=2>IntPtr</font><font size=2> hdc, </font><font color="#0000ff" size=2>int</font><font size=2> x, </font><font color="#0000ff" size=2>int</font><font size=2> y, </font><font color="#0000ff" size=2>int</font><font size=2> dx, </font><font color="#0000ff" size=2>int</font><font size=2> dy, </font><font color="#0000ff" size=2>int</font><font size=2> card, </font><font color="#0000ff" size=2>int</font><font size=2> suit, </font><font color="#0000ff" size=2>long</font><font size=2> color); </font>
<p align=left>
<p align=left>
<p align=left>PInvokeStackImbalance was detected
Message: A call to PInvoke function ChatClient!Card.Card::cdtDrawExt has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
<p align=left>Any help would be appreciated. Thank you
View the full article