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

فيجوال 2010، ودوال API

بدأه Adban في 16 سبتمبر 2010 · 11 رد · 2,722 مشاهدة · في C++.Net
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم... استبشر خيرا لأول مشاركة لي في هذا المنتدى ...

الحقيقة أني بدأت أقرأ بشكل بسيط في دوال API الخاصة بويندوز...

حاولت أن أكتب بعض الدوال بلغة السي على شكل برنامج من نوع console وتم ذلك بنجاح ولله الحمد...

بعدها حاولت الانتقال إلى البرمجة باستخدام مشروع windows form application كما هو واضح في الصورة

post-233812-086823100 1284633129_thumb.j

وادرجت زرا على الشكل التالي..

post-233812-022586300 1284633160_thumb.g

ضغط نقرتين عليه كي أضيف الكود، حاولت كتابة دالة ال MessageBox بطريقتين كما هو واضح ولم أفلح بتنفيذ البرنامج ..!

post-233812-012695800 1284633172_thumb.g

فلم أجد إلا أن أسألكم عن الخطأ اللذي ارتكبته!!

ولي سؤال أخر ... كيف أكتب دالة كاملة بالسي وأين!! وأستدعيها بضغطت زر !! أرجو أن يتسع صدركم لأسألتي

المرفقات
project.jpgForm.gifCode.gif

تم تعديل هذه المشاركة بواسطة Adban في 16 سبتمبر 2010 في 13:33

#2

وعليكم السلام ورحمة الله وبركاته .

هذا القسم يخص ما يتعلق بـNative API فقط ولا يتطرق للـCLR .

ينقل للقسم المناسب .

mov eax, dword ptr ds:[0xffdf0308]

jmp dword ptr [eax+0xfc]

#3

لاستخدام native api داخل clr project عليك ضبط بعض الخيارات أولا :

1- قم بوضع خيار المترجم clr/ ، من Project->Properties->General->Common Language Runtime Support اختر clr/ .

2- داخل ملف الـheader قم بوضع الكود التالي في البداية :

#pragma managed(push, off)
#include <windows.h>
#pragma comment(lib, "user32.lib")
#pragma managed(pop)

طبعا المكتبة المستخدمة user32 لأن الدالة MessageBox موجودة بها، يمكن ان تضيف ما تريد حسب احتياجاتك .

بعد ذلك يمكنك استخدام الكود :

::MessageBox((HWND)this->Handle.ToPointer(), TEXT("MessageBox Text"), TEXT("MessageBox Caption"), MB_OK);

أو يمكنك استخدام النوع الخاص بالـCLR :

MessageBox::Show("CLR::MessageBox Text", "CLR::MessageBox Caption");

تم تعديل هذه المشاركة بواسطة GamingMasteR في 16 سبتمبر 2010 في 15:32

1

mov eax, dword ptr ds:[0xffdf0308]

jmp dword ptr [eax+0xfc]

#4

GamingMasteR بارك الله فيك..

ومعذرة على المكان الخاطيء..

تم التنفيذ بنجاح ... لكن بقي هذا الشق من السؤال

اقتباس
ولي سؤال أخر ... كيف أكتب دالة كاملة بالسي وأين!! وأستدعيها بضغطت زر !! أرجو أن يتسع صدركم لأسألتي

ثم أود سؤالك عن مصادر تعينني في هذا الموضوع... مثلا أنت أضفت البارمتر الأول هكذا..

(HWND)this->Handle.ToPointer()

ما تفسيره،، عن هذه المصادر التي أجد فيها مثل هذه الدوال كنت أسأل..

تم تعديل هذه المشاركة بواسطة Adban في 16 سبتمبر 2010 في 16:03

#5

سؤال قبل ان اجاوبك ، هل لديك خلفية عن لغة ++C ؟

ما هي اللغات التي تعرفها ؟

كي تصل اجابتي اليك بشكل اسهل فقط ...

mov eax, dword ptr ds:[0xffdf0308]

jmp dword ptr [eax+0xfc]

#6

نعم لدي خلفية عن C\C++ القياسية، ولكن خلفيتي مقتصرة في برامج من نوع console فقط.. لي معرفة في OOP و Struct.. والاشكال والاستخدامات الأولية للمؤشرات pointers

..

#7

جميل :)

اقتباس
ولي سؤال أخر ... كيف أكتب دالة كاملة بالسي وأين!! وأستدعيها بضغطت زر !! أرجو أن يتسع صدركم لأسألتي

بشكل عادي جدا كما نفعل في ++C

void PrintSquare(int number)
{
	TCHAR Buffer[128];

	wsprintf(Buffer, TEXT("%d x %d = %d"), number, number, number * number);
	::MessageBox(0, Buffer, TEXT("PrintSquare"), MB_OK | MB_ICONINFORMATION);
}


System::Void Form1::button1_Click(System::Object^  sender, System::EventArgs^  e) 
{
	int number;

	try
	{
    	number = int::Parse(textBox1->Text);
	}
	catch(...) 
	{
    	number = 0;
	}

	PrintSquare(number);
}

اقتباس
ثم أود سؤالك عن مصادر تعينني في هذا الموضوع... مثلا أنت أضفت البارمتر الأول هكذا..

الباراميتر الاول يأخذ مقبض نافذة ، this تعود على الكائن الخاص بالـنافذة الام و this->Handle عبارة عن Property يعبر عن المقبض الخاص بالنافذة .

قمنا بتحويله الى مؤشر ثم عملنا typecasting كي تقبل الدالة MessageBox قيمته .

المصادر هي MSDN ستجد قسم خاص بالـ DotNET Framework Class Library

تم تعديل هذه المشاركة بواسطة GamingMasteR في 16 سبتمبر 2010 في 19:54

mov eax, dword ptr ds:[0xffdf0308]

jmp dword ptr [eax+0xfc]

#8

والله لقد أفدتني كثيرا أخي GamingMasteR ... فشكرا لك وشكرا شكرا

لكن هل لي أن أستزيد منك أكثررر......... :blush:

أذا أردت أن أكتب تطبيقا لويندوز ... هل تنصحيني باستخدام MFC أو أي نوع من المشاريع التي احترت فيها مما يقدمه Visiual Studio !! الله يرحم أيام البساطة!!

#9

موضوع الاختيار هذا صعب ويعتمد على احتياجات البرنامج .

يعني احيانا احتاج لكتابة برامج سريعة التنفيذ فأكتبها بـWindows API و ++C/C .

أحياناً يكون الـPerformance ليس ذو أهمية كبيرة لكن أحتاج الى بيئة تطوير سريعة فأذهب الى Interpreted Language مثل #C .

ابتعد عن C++ .Net فلن تجد دعم لها مثل ما تجد لـ#C او ++C .

2

mov eax, dword ptr ds:[0xffdf0308]

jmp dword ptr [eax+0xfc]

#10

أحسن الله إليك أخي ووفقك وبارك بك وبأهلك... نعم الخطاب معك...

أعرف أني أتعبتك معي إلا أنني لا زلت أواجه مشكلة! كتبت كود بسيط ومفذته بنجاح ... ولكن عندما اتيت لترجمته على أنه Release اصطدمت بأخطاء كثيرة!!! لا تكون موجودة في حالة Debug!!!

هذه هي الاخطاء

1>------ Build started: Project: test2, Configuration: Release Win32 ------
1>  stdafx.cpp
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\basetsd.h(357): error C3862: 'PtrToPtr64': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\basetsd.h(357): error C3862: 'PtrToPtr64': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\basetsd.h(357): error C3645: 'PtrToPtr64' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\basetsd.h(366): error C3862: 'Ptr64ToPtr': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\basetsd.h(366): error C3862: 'Ptr64ToPtr': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\basetsd.h(366): error C3645: 'Ptr64ToPtr' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\basetsd.h(375): error C3862: 'HandleToHandle64': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\basetsd.h(375): error C3862: 'HandleToHandle64': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\basetsd.h(375): error C3645: 'HandleToHandle64' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\basetsd.h(384): error C3862: 'Handle64ToHandle': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\basetsd.h(384): error C3862: 'Handle64ToHandle': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\basetsd.h(384): error C3645: 'Handle64ToHandle' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(115): error C3862: 'strnlen_s': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(115): error C3862: 'strnlen_s': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(115): error C3645: 'strnlen_s' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(214): error C3862: 'strchr': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(214): error C3862: 'strchr': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(214): error C3645: 'strchr' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(216): error C3862: 'strpbrk': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(216): error C3862: 'strpbrk': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(216): error C3645: 'strpbrk' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(218): error C3862: 'strrchr': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(218): error C3862: 'strrchr': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(218): error C3645: 'strrchr' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(220): error C3862: 'strstr': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(220): error C3862: 'strstr': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(220): error C3645: 'strstr' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(225): error C3862: 'memchr': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(225): error C3862: 'memchr': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(225): error C3645: 'memchr' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(288): error C3862: 'wcsnlen_s': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(288): error C3862: 'wcsnlen_s': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(288): error C3645: 'wcsnlen_s' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(361): error C3862: 'wcschr': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(361): error C3862: 'wcschr': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(361): error C3645: 'wcschr' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(363): error C3862: 'wcspbrk': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(363): error C3862: 'wcspbrk': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(363): error C3645: 'wcspbrk' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(365): error C3862: 'wcsrchr': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(365): error C3862: 'wcsrchr': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(365): error C3645: 'wcsrchr' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(367): error C3862: 'wcsstr': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(367): error C3862: 'wcsstr': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\string.h(367): error C3645: 'wcsstr' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\guiddef.h(150): error C3862: 'InlineIsEqualGUID': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\guiddef.h(150): error C3862: 'InlineIsEqualGUID': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\guiddef.h(150): error C3645: 'InlineIsEqualGUID' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\guiddef.h(159): error C3862: 'IsEqualGUID': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\guiddef.h(159): error C3862: 'IsEqualGUID': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\guiddef.h(159): error C3645: 'IsEqualGUID' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\guiddef.h(192): error C3862: 'operator ==': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\guiddef.h(192): error C3862: 'operator ==': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\guiddef.h(194): error C3821: 'IsEqualGUID': managed type or function cannot be used in an unmanaged function
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\guiddef.h(194): error C3642: 'int IsEqualGUID(const GUID &,const GUID &)' : cannot call a function with __clrcall calling convention from native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\guiddef.h(192): error C3645: 'operator ==' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\guiddef.h(197): error C3862: 'operator !=': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\guiddef.h(197): error C3862: 'operator !=': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\guiddef.h(199): error C3642: 'int operator ==(const GUID &,const GUID &)' : cannot call a function with __clrcall calling convention from native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\guiddef.h(197): error C3645: 'operator !=' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(4044): error C3862: 'DbgRaiseAssertionFailure': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(4044): error C3862: 'DbgRaiseAssertionFailure': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(4049): error C3821: '__int2c': managed type or function cannot be used in an unmanaged function
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(4049): error C3642: 'void __int2c(void)' : cannot call a function with __clrcall calling convention from native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(4044): error C3645: 'DbgRaiseAssertionFailure' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(4077): error C3862: 'GetFiberData': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(4077): error C3862: 'GetFiberData': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(4077): error C3821: '__readfsdword': managed type or function cannot be used in an unmanaged function
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(4077): error C3642: 'DWORD __readfsdword(DWORD)' : cannot call a function with __clrcall calling convention from native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(4077): error C3645: 'GetFiberData' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(4078): error C3862: 'GetCurrentFiber': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(4078): error C3862: 'GetCurrentFiber': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(4078): error C3821: '__readfsdword': managed type or function cannot be used in an unmanaged function
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(4078): error C3642: 'DWORD __readfsdword(DWORD)' : cannot call a function with __clrcall calling convention from native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(4078): error C3645: 'GetCurrentFiber' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(12955): error C3862: 'HEAP_MAKE_TAG_FLAGS': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(12955): error C3862: 'HEAP_MAKE_TAG_FLAGS': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(12955): error C3645: 'HEAP_MAKE_TAG_FLAGS' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(13065): error C3862: 'RtlSecureZeroMemory': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(13065): error C3862: 'RtlSecureZeroMemory': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(13065): error C3645: 'RtlSecureZeroMemory' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14766): error C3862: 'TpInitializeCallbackEnviron': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14766): error C3862: 'TpInitializeCallbackEnviron': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14766): error C3645: 'TpInitializeCallbackEnviron' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14800): error C3862: 'TpSetCallbackThreadpool': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14800): error C3862: 'TpSetCallbackThreadpool': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14800): error C3645: 'TpSetCallbackThreadpool' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14810): error C3862: 'TpSetCallbackCleanupGroup': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14810): error C3862: 'TpSetCallbackCleanupGroup': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14810): error C3645: 'TpSetCallbackCleanupGroup' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14822): error C3862: 'TpSetCallbackActivationContext': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14822): error C3862: 'TpSetCallbackActivationContext': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14822): error C3645: 'TpSetCallbackActivationContext' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14832): error C3862: 'TpSetCallbackNoActivationContext': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14832): error C3862: 'TpSetCallbackNoActivationContext': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14832): error C3645: 'TpSetCallbackNoActivationContext' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14841): error C3862: 'TpSetCallbackLongFunction': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14841): error C3862: 'TpSetCallbackLongFunction': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14841): error C3645: 'TpSetCallbackLongFunction' : __clrcall cannot be used on functions compiled to native code
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14850): error C3862: 'TpSetCallbackRaceWithDll': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>          #pragma unmanaged is in effect
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14850): error C3862: 'TpSetCallbackRaceWithDll': cannot compile an unmanaged function with /clr:pure or /clr:safe
1>C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\winnt.h(14850): fatal error C1003: error count exceeds 100; stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
#11

نعم ، لكل Configuration مثل Debug/Release خيارات منفصلة للـCompiler/Linker ... إلخ .

عد الى تطبيق الخيار رقم 1 كي تضبط خيارات الـCompiler على الـConfiguration الجديد :

اقتباس
1- قم بوضع خيار المترجم clr/ ، من Project->Properties->General->Common Language Runtime Support اختر clr/ .

mov eax, dword ptr ds:[0xffdf0308]

jmp dword ptr [eax+0xfc]

#12

100 % :)

أدعو لك بالتوفيق ..بوركت

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