الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

خطأ عند استخدام win32 Dll

مغلق
بدأه oldman في 8 مايو 2007 · 5 رد · 971 مشاهدة · في Microsoft Visual C#.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

عند تنفيذ احد الدوال فانه يعطي الخطأ التالي

A call to PInvoke function 'Test!Test.cardsdll::cdtDraw' 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.

الملف في المرفقات

test.rar

#2

للرفع

#3

السلام عليكم

بإمكانك رسم البطاقات بالكيفية المعرفة في الملف المرفق.

ا لمصدر

والله أعلم

Cards.zip

post-91400-1178704241_thumb.jpg

#4

نفس المشكلة اعتقد ان هذه الطريقة تصلح مع Microsoft Visual Studio 2003

#5

up

#6

السلام عليكم

عليك بتغير النوع longالى Int32في ال APIs لأن النوع long في الدوت نت يعادل 64 بيت في حين في APIيعادل بيت 32فقط

لقد عدلت الكود وهو يعمل الآن

هذه التعديلات

[DllImport("cards.dll")]
private static extern bool cdtDraw( IntPtr hdc, int x, int y, int card, int mode, Int32 color );

[DllImport("cards.dll")]
private static extern bool cdtDrawExt(IntPtr hdc, int x, int y, int dx, int dy, int card, int mode, Int32 color);

public bool drawCard(IntPtr hdc, int x, int y, int card, int mode, Int32 color)
 { 
  return  cdtDraw(hdc, x, y, card, mode, color); 
 }
public bool drawEmptyCard(IntPtr hdc, int x, int y, Int32 color)
 {
  return cdtDraw(hdc, x, y, 1, mdGhost, color);
 }
public bool drawExtrudedCard(IntPtr hdc, int x, int y, int dx, int dy, int card, int mode, Int32 color)
 {
 return cdtDrawExt(hdc, x, y, dx, dy, card, mode, color);
 }

هذا الموضوع مغلق.

مواضيع مشابهة