Author Topic: Win64 ScreenRecorder (Example code, UPDATED)  (Read 24031 times)

Offline encryptor256

  • Full Member
  • **
  • Posts: 250
  • Country: lv
  • Win64 .
    • On Youtube: encryptor256
Win64 ScreenRecorder (Example code, UPDATED)
« on: October 21, 2013, 04:58:09 PM »
Hello!

This is Win64 ScreenRecorder.

Reasonable quality at reasonable size.

I was looking on the net for a simple srceen recorder,
didn't found, so,
then i decided to make my own.

I was inspired by Evan's AVICapt. http://www.evanolds.com/sc_main.html
He also provides source code for his screen recorder.
He made it in C++ builder.

But,
all programming i did,
i did on my own, collecting,
learning information from web's, so, nothing here is just a clean copy paste.

.Win64_ScreenRecorder:

Default frame rate is 30, assigned automatically.
Default file name, created automatically.
And it works too! :D

First i created, it, in Pelles C, because i wanted to be sure, that recorder, on Win64, actually works, and it did.
Then i translated, it, into NASM.

.Formal_description:

Code: [Select]
; ---------------------------------------------------------------------------
; This is: Win64 ScreenRecorder (Win64 API, NASM, MINGW64)
; Author: J.K. Encryptor256
; Date: October 21, 2013
; ---------------------------------------------------------------------------
; Using:
; NASM, The Netwide Assembler (http://nasm.us/)
; MINGW64 (http://mingw-w64.sourceforge.net/)
; ---------------------------------------------------------------------------
; Compile:
; NASM:
; cmd: "nasm.exe screenrecorder.asm -f win64 -o screenrecorder.o"
; MINGW64:
; cmd: "gcc.exe -m64 screenrecorder.o -lvfw32 -lgdi32 -o screenrecorder.exe"
; ---------------------------------------------------------------------------
; Description:
; Recorder records AVI files.
; 1. Run Program.
; 2. Press Button "Init recorder", to initialize.
; 3. Press Button "Choose recorder", to choose recorder.
; 4. Press Button "Start recording", to start recording.
; 5. Press "Esc" key to stop recording.
; -. Output file name is generated like this: "%d.avi" (from GetTickCount)
; ---------------------------------------------------------------------------

Project is organized into six files,
one is main compile file,
and others, just an include files.

  • screenrecorder.asm (Main compile file)
  • funcdefs.inc
  • constants.inc
  • macros.inc
  • structures.inc
  • avifunctions.inc

.Using_functions: (If it matters)

Code: [Select]
; ---------------------------------------------------------------------------
; Functions
; ---------------------------------------------------------------------------

global main
extern printf
extern malloc
extern memset
extern free
extern fopen
extern fclose
extern MessageBoxA
extern sprintf
extern ExitProcess
extern GetModuleHandleA
extern LoadIconA
extern LoadCursorA
extern RegisterClassExA
extern CreateWindowExA
extern GetMessageA
extern TranslateMessage
extern DispatchMessageA
extern DefWindowProcA
extern GetLastError
extern PostQuitMessage
extern GetCursor
extern EnableWindow
extern DestroyWindow

; ---------------------------------------------------------------------------
; More functions
; ---------------------------------------------------------------------------

extern GetDC
extern CreateCompatibleDC
extern GetDeviceCaps
extern SetRect
extern AVIFileInit
extern AVIFileExit
extern SetRect
extern CreateDIBSection
extern GetDIBits
extern SelectObject
extern CreateCompatibleBitmap
extern DeleteObject
extern DeleteDC
extern ReleaseDC
extern AVIFileOpenA
extern memcpy
extern AVIFileCreateStream
extern ICCompressorChoose
extern ICOpen
extern ICSendMessage
extern ICClose
extern ICSeqCompressFrameStart
extern AVIStreamSetFormat
extern BitBlt
extern ICSeqCompressFrame
extern AVIStreamWrite
extern ICSeqCompressFrameEnd
extern ICCompressorFree
extern AVIStreamRelease
extern AVIFileRelease
extern GetCursorPos
extern PtInRect
extern DrawIcon
extern GetAsyncKeyState
extern SetBkMode
extern TextOutA
extern GetTickCount
extern Sleep

.Attachment:

Added attachment, named: "win64_screen_recorder.zip"


And that's it,
Encryptor256!


Edit:
Find better version at the post below.

jmp post_below :D


Edit:
I used this Win64 ScreenRecorder, to record demo video, for
topic, named: "Win64 Basic Hello World NASM MINGW64 GoLink",
link to topic, http://forum.nasm.us/index.php?topic=1751.0.
Demo video find at tag "Video".

« Last Edit: October 22, 2013, 03:06:52 PM by encryptor256 »
Encryptor256's Investigation \ Research Department.

Offline encryptor256

  • Full Member
  • **
  • Posts: 250
  • Country: lv
  • Win64 .
    • On Youtube: encryptor256
Re: Win64 ScreenRecorder (Example code)
« Reply #1 on: October 22, 2013, 06:38:13 AM »
post_below:

Hello!

This is Win64 ScreenRecorder, using NASM and GoLink.

I get rid of gcc garbage, which produces large size application, so i went for new linker GoLink.

This new version uses GoLink, which produces exe size only: 9.50 KB (9,728 bytes) :D

.Formal_description:

Code: [Select]
; ---------------------------------------------------------------------------
; This is: Win64 ScreenRecorder (Win64 API, NASM, GoLink)
; Author: J.K. Encryptor256
; Date: October 22, 2013
; ---------------------------------------------------------------------------
; Using:
; NASM, The Netwide Assembler (http://nasm.us/)
; GoLink, (http://www.godevtool.com/)
; ---------------------------------------------------------------------------
; Compile:
; NASM:
; cmd: "nasm.exe screenrecorder.asm -f win64 -o screenrecorder.o"
; GoLink:
; cmd: "golink.exe /entry main screenrecorder.obj kernel32.dll gdi32.dll user32.dll msvfw32.dll Avifil32.dll MSVCRT.dll"
; ---------------------------------------------------------------------------
; Description:
; Recorder records AVI files.
; 1. Run Program.
; 2. Press Button "Init recorder", to initialize.
; 3. Press Button "Choose recorder", to choose recorder.
; 4. Press Button "Start recording", to start recording.
; 5. Press "Esc" key to stop recording.
; -. Output file name is generated like this: "%d.avi" (from GetTickCount)
; ---------------------------------------------------------------------------

How to compile, you find in the formal description above.

.Attachment:

Added attachment, named: "win64_screen_recorder_GoLink.zip"

And that's it,
Encryptor256!
« Last Edit: October 22, 2013, 06:41:00 AM by encryptor256 »
Encryptor256's Investigation \ Research Department.

Offline avcaballero

  • Full Member
  • **
  • Posts: 133
  • Country: es
    • Abre los Ojos al Ensamblador
Re: Win64 ScreenRecorder (Example code, UPDATED)
« Reply #2 on: October 22, 2013, 07:49:58 AM »
I will check it this evening  :) What about the win32 version?  ;D

Offline encryptor256

  • Full Member
  • **
  • Posts: 250
  • Country: lv
  • Win64 .
    • On Youtube: encryptor256
Re: Win64 ScreenRecorder (Example code, UPDATED)
« Reply #3 on: October 22, 2013, 08:33:28 AM »
I will check it this evening  :) What about the win32 version?  ;D

Win32's?
It might be easier to translate back to win32's.
But, you can do it, on your own. :D

Encryptor256's Investigation \ Research Department.

Offline HD1920.1

  • Jr. Member
  • *
  • Posts: 40
Re: Win64 ScreenRecorder (Example code, UPDATED)
« Reply #4 on: February 02, 2014, 12:31:32 PM »
Your cmd to assemble the updated version is incorrect. It must be:
Code: [Select]
nasm screenrecorder.asm -f win64 -o screenrecorder.obj

Offline encryptor256

  • Full Member
  • **
  • Posts: 250
  • Country: lv
  • Win64 .
    • On Youtube: encryptor256
Re: Win64 ScreenRecorder (Example code, UPDATED)
« Reply #5 on: February 02, 2014, 02:50:12 PM »
Your cmd to assemble the updated version is incorrect. It must be:
Code: [Select]
nasm screenrecorder.asm -f win64 -o screenrecorder.obj

Yes, i agree, well done eagle eye, HD1920.1!  ;)

EXP = EXP + 500... you reached a new level.  ;D

Encryptor256's Investigation \ Research Department.