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 17705 times
    Source:
    {6} DrawImage.7z (9.26 KiB)
    Downloaded 550 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 17638 times
    Source:
    {7} SetPixel.7z (814 Bytes)
    Downloaded 532 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 17243 times
    Source:
    Downloaded 498 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 17165 times
    Source:
    {9} GetPixel.7z (865 Bytes)
    Downloaded 489 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 17128 times
    Source:
    {10} ReadFolder.7z (959 Bytes)
    Downloaded 509 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 17072 times
    Source:
    Downloaded 511 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 17021 times
    Source:
    Downloaded 493 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 16947 times
    Source:
    Downloaded 430 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 16901 times
    Source:
    Downloaded 454 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 16680 times
    Source:
    Downloaded 445 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 16615 times
    Source:
    Downloaded 444 times