Delphi7 examples

High-level languages programming questions
  • DrawImage example.

    Load 24 bits per pixel targa file and draw it into the window.
    This image file is uncompressed and was saved with top to bottom pixel order.
    Used functions: DrawImage, LoadFile, HeapCreate, SetCurrentDirectory, GetScreenSize, WaitEvent, BeginDraw, DrawWindow, EndDraw, GetKey, GetButton, ThreadTerminate.

    Screenshot:
    Spoiler:
    6.PNG
    6.PNG (12 KiB)
    Viewed 17803 times
    Source:
    {6} DrawImage.7z (9.26 KiB)
    Downloaded 557 times
  • Just a simple example. Drawing in the window with SetPixel function.
    Used functions: SetPixel, BeginDraw, DrawWindow, EndDraw, WaitEvent, GetKey, GetButton, GetScreenSize, ThreadTerminate.

    Screenshot:
    Spoiler:
    7.PNG
    7.PNG (2.66 KiB)
    Viewed 17736 times
    Source:
    {7} SetPixel.7z (814 Bytes)
    Downloaded 537 times
  • Show info about the thread with given slot in the console window.
    Used functions: LoadLibrary, GetProcAddress, GetThreadInfo, ThreadTerminate.

    Screenshot:
    Spoiler:
    8.PNG
    8.PNG (12.68 KiB)
    Viewed 17341 times
    Source:
    Downloaded 508 times
  • Draw the rectangle with a color of the pixel under the mouse.
    Used functions: GetPixel, GetMousePos, DrawRectangle, GetScreenSize, SetEventMask, WaitEvent, BeginDraw, DrawWindow, DrawLine, EndDraw, GetButton, ThreadTerminate.

    Screenshot:
    Spoiler:
    9.PNG
    9.PNG (2.79 KiB)
    Viewed 17263 times
    Source:
    {9} GetPixel.7z (865 Bytes)
    Downloaded 498 times
  • Reading the contents of a folder in the console window.
    Used functions: ReadFolder, LoadLibrary, GetProcAddress, ThreadTerminate.

    Screenshot:
    Spoiler:
    10.PNG
    10.PNG (16.22 KiB)
    Viewed 17226 times
    Source:
    {10} ReadFolder.7z (959 Bytes)
    Downloaded 519 times
  • Reading image files with different bits per pixel values(4, 1, 24) and draw images in window.
    Used functions: DrawImageEx, ReadFile, HeapCreate, HeapAllocate, SetCurrentDirectory, GetFileAttributes, GetScreenSize, WaitEvent, BeginDraw, DrawWindow, EndDraw, GetKey, GetButton, ThreadTerminate.

    Screenshot:
    Spoiler:
    11.PNG
    11.PNG (16.49 KiB)
    Viewed 17170 times
    Source:
    Downloaded 520 times
  • Launch application "TextEditor" with parameters for open "example.asm" in it. Also do minimize and restore "TextEditor" window.
    Used functions: RunFile, MinimizeWindowByID, RestoreWindowByID, DrawText, GetScreenSize, WaitEvent, BeginDraw, DrawWindow, DrawButton, EndDraw, GetKey, GetButton, ThreadTerminate.

    Screenshot:
    Spoiler:
    12.PNG
    12.PNG (2.7 KiB)
    Viewed 17119 times
    Source:
    Downloaded 505 times
  • Load 32 bit bitmaps(top to bottom pixel order) and use it as mouse cursors. Also draw these pictures on window. For this purpose Blit function is used.
    Used functions: LoadCursorIndirect, SetCursor, Blit, DrawText, DrawButton, LoadFile, HeapCreate, SetCurrentDirectory, GetScreenSize, WaitEvent, BeginDraw, DrawWindow, EndDraw, GetKey, GetButton, ThreadTerminate.

    Screenshot:
    Spoiler:
    13.PNG
    13.PNG (4.08 KiB)
    Viewed 17045 times
    Source:
    Downloaded 436 times
  • Get image of screen and draw it in the application window.
    Used functions: GetScreenImage, DrawImage, GetSkinHeight, HeapCreate, GetScreenSize, HeapAllocate, WaitEvent, BeginDraw, DrawWindow, EndDraw, GetKey, GetButton, ThreadTerminate.

    Screenshot:
    Spoiler:
    14.PNG
    14.PNG (72.08 KiB)
    Viewed 16999 times
    Source:
    Downloaded 456 times
  • This example writes the system date and system time to the console window and updates it periodically.
    Used functions: LoadLibrary, GetProcAddress, GetSystemDate, GetSystemTime, Sleep, ThreadTerminate.

    Screenshot:
    Spoiler:
    SystemDate_SystemTime.PNG
    SystemDate_SystemTime.PNG (7.6 KiB)
    Viewed 16778 times
    Source:
    Downloaded 453 times
  • In this example a folder 'test_folder' is created on '/rd/1'.
    Then in the folder you created a file is created 'test_file.txt'.
    In the created file data is written 'Test100500'.
    After that you can open 'test_file.txt' and find in it written data.
    Used functions: CreateFolder, CreateFile, WriteFile, SetEventMask, GetScreenSize, WaitEvent, BeginDraw, DrawWindow, DrawButton, DrawText, EndDraw, GetButton, ThreadTerminate.

    Screenshot:
    Spoiler:
    16.PNG
    16.PNG (4.58 KiB)
    Viewed 16713 times
    Source:
    Downloaded 450 times
  • Какого размера бинарники от Д7 получаются?
  • Siemargl, для примера приложение CoffDump http://board.kolibrios.org/viewtopic.php?f=9&t=3577
    Сжатый kpaсk-ом: 1,91 КБ (1964 байта)
    Несжатый: 3,72 КБ (3812 байтов)

    Или самый первый пример {1} DrawWindow
    Сжатый kpaсk-ом: 342 байта
    Несжатый: 496 байтов
    Last edited by 0CodErr on Wed Sep 27, 2017 9:41 pm, edited 2 times in total.
  • лучше по всем примерам прилагать. не было инфы - пришлось на хабре не упоминать (
  • Who is online

    Users browsing this forum: No registered users and 2 guests