بسم الله الرحمن الرحيم
إن الحمد لله نحمده و نستعينه و نستغفره و نعوذ بالله من شرور أنفسنا و
من سيئات أعمالنا ، من يهده الله فلا مضل له
ومن يضلل فلا هادي له و أشهد أن لا إله إلا الله و أشهد أن محمدا عبده و رسوله صلى الله عليه و على آله و صحبه و سلم .
أما بعد ، فأتقدم بخالص الحب و الوفاء إلى الأستاذ أحمد و الأخ مصطفى اللذين يسهران على إيقاظ المنتدى من سباته الطويل
وذلك من خلال تنشيط القسم فجزاهم الله خير الأجر و الثواب .
سنتطرق في موضوعنا اليوم إلى كيفية برمجة محرر نصوص بسيط في لغة السي بالاعتماد على الكونسول فقط . وعندما أقول بسيط
فأنا أعي تماما ما أقوله لأنني و في أيام خلت كنت أبحث عن فكرة أسترجع فيها فكري البرمجي الضائع :wacko: ، فلا تنتظروا مني محررا كمحرر
Notepad plus plus أو غيره :blush: ، ومع هذا فإني أعدكم تمام الوعد بأن الفكرة ستروق لكم فهيا نشرع في العمل :stop:
1 - ما الذي سنستعمله لتخزين المدخلات ؟؟؟
إن فهمت هذه النقطة بالذات فستسهل عليك برمجة المحرر ، لأنك إن اخترت استعمال الدالة scanf فستكون قد ضللت الطريق بنسبة 99% ،
أنا لا أقول لك أن هذه الدالة لا تصلح في برمجة مثل هذه الأشياء ، لأنه يمكن استخدام هذه الطريقة بإدراج تعليمة استقبال محرف من المستخدم
في حلقة تكرارية و من تم تخزين المحرف في مصفوفة و .... و .... و :hot: . لأ أعتقد أن الطريقة ستكون مجدية البثة لاسيما و أن
الحاسوب صنع لكي ننال من سرعته و خدماته ، لا أن ينال منا و من ضعفنا B) .
بكل بساطة ، نستطيع استخدام دالة من دوال API تستعمل عادة في برمجة KeyLoggers الجميلة :evil: هذه الدالة تسمى
GetAsyncKeyState و التي لها دور فعال في رصد و مراقبة أزرار لوحة المفاتيح ، حيث تعيد لنا قيمة الزر المضغوط :ohmy:
SHORT GetAsyncKeyState(
int vKey // virtual-key code
);
Parameters
vKey
Specifies one of 256 possible virtual-key codes.
Windows NT: You can use left- and right-distinguishing constants to specify certain keys. See the Remarks section for further information.
Windows 95: Windows 95 does not support the left- and right-distinguishing constants available on Windows NT.
Return Values
If the function succeeds, the return value specifies whether the key was pressed since the last call to GetAsyncKeyState, and whether the key is currently up or down. If the most significant bit is set, the key is down, and if the least significant bit is set, the key was pressed after the previous call to GetAsyncKeyState. The return value is zero if a window in another thread or process currently has the keyboard focus.
Windows 95: Windows 95 does not support the left- and right-distinguishing constants. If you call GetAsyncKeyState on the Windows 95 platform with these constants, the return value is zero.
Remarks
You can use the virtual-key code constants VK_SHIFT, VK_CONTROL, and VK_MENU as values for the vKey parameter. This gives the state of the SHIFT, CTRL, or ALT keys without distinguishing between left and right.
Windows NT: You can use the following virtual-key code constants as values for vKey to distinguish between the left and right instances of those keys:
VK_LSHIFT VK_RSHIFT
VK_LCONTROL VK_RCONTROL
VK_LMENU VK_RMENU
The GetAsyncKeyState function determines whether a key is up or down at the time the function is called, and whether the key was pressed after a previous call to GetAsyncKeyState.
2 - برمجة البرنامج : ;)
نلتقي في الرد القادم ...
