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 17920 times
    Source:
    {6} DrawImage.7z (9.26 KiB)
    Downloaded 578 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 17853 times
    Source:
    {7} SetPixel.7z (814 Bytes)
    Downloaded 557 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 17458 times
    Source:
    Downloaded 523 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 17380 times
    Source:
    {9} GetPixel.7z (865 Bytes)
    Downloaded 516 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 17343 times
    Source:
    {10} ReadFolder.7z (959 Bytes)
    Downloaded 534 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 17287 times
    Source:
    Downloaded 538 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 17236 times
    Source:
    Downloaded 518 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 17162 times
    Source:
    Downloaded 464 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 17116 times
    Source:
    Downloaded 476 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 16895 times
    Source:
    Downloaded 477 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 16830 times
    Source:
    Downloaded 475 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 1 guest