Skip to content

Instantly share code, notes, and snippets.

@jarroddavis68
jarroddavis68 / DelphiChatGPT.pas
Last active April 28, 2023 05:48
Use ChatGPT from Delphi
(****************************************************************************
___ _ _ _ ___ _ _ ___ ___ _____
| \ ___ | | _ __ | |_ (_) / __|| |_ __ _ | |_ / __|| _ \|_ _|
| |) |/ -_)| || '_ \| ' \ | || (__ | ' \ / _` || _|| (_ || _/ | |
|___/ \___||_|| .__/|_||_||_| \___||_||_|\__,_| \__| \___||_| |_|
|_|
Copyright © 2022-present tinyBigGAMES™ LLC
All Rights Reserved.
@jarroddavis68
jarroddavis68 / SetGlobalEnvronment.pas
Created November 23, 2022 13:17
SetGlobalEnvironment
function SetGlobalEnvironment(const aName: string; const aValue: string; const aUser: Boolean = True): Boolean;
const
REG_MACHINE_LOCATION = 'System\CurrentControlSet\Control\Session Manager\Environment';
REG_USER_LOCATION = 'Environment';
var
lParam, wParam: NativeInt;
Buf: Array[0..11] of Char;
dwReturnValue: DWORD_PTR;
begin
Buf := 'Environment'+#0;
@jarroddavis68
jarroddavis68 / CmdLine.pas
Last active November 8, 2022 07:44
TCmdLine - Enhanced Command line Processing for Delphi
{==============================================================================
TCmdLine - Enhanced Command line Processing for Delphi
Copyright © 2022 tinyBigGAMES™ LLC
All Rights Reserved.
Website: https://tinybiggames.com
Email : support@tinybiggames.com
Redistribution and use in source and binary forms, with or without
modifications are permitted provided that the following conditions are met:
@jarroddavis68
jarroddavis68 / EncryptedZipFile.pas
Last active October 17, 2022 18:40
TZipFile with Password Encryption
{==============================================================================
.
.--: :
---- :---:
.----- .-.
.------ .
-------.
.-------- :
.--------- .:.
----------: .
@jarroddavis68
jarroddavis68 / uSingleUnit.pas
Last active July 13, 2023 13:28
Combine multiple Delphi into a single unit
{==============================================================================
____ _
/ ___| _ __ __ _ _ __| | __
\___ \| '_ \ / _` | '__| |/ /
___) | |_) | (_| | | | <
|____/| .__/ \__,_|_| |_|\_\
|_| Game Toolkit™
Copyright © 2022 tinyBigGAMES™ LLC
All Rights Reserved.
unit uCaptureConsoleEvent;
interface
type
{ TCaptureConsoleEvent }
TCaptureConsoleEvent = procedure(aSender: Pointer; aLine: string);
procedure CaptureConsoleOutput(const aTitle: string; const aCommand: PChar; const aParameters: PChar; aSender: Pointer; aEvent: TCaptureConsoleEvent);
@jarroddavis68
jarroddavis68 / uSpStringList.pas
Last active April 7, 2022 00:12
TSpStringList - Enhanced Delphi String List
unit uSpStringList;
interface
uses
System.SysUtils,
System.Classes;
type
{ TSpStringList }
@jarroddavis68
jarroddavis68 / uSpSingleton.pas
Last active April 4, 2022 21:12
Singleton Class Implementation
unit uSpSingleton;
interface
uses
System.SysUtils;
type
// 1. Add this unit to your project, then save-as a new unit file
@jarroddavis68
jarroddavis68 / StartupShutdownConsole.pas
Created February 6, 2022 00:30
Startup/Shutdown Console
procedure PostKey(aKey: word; const aShift: TShiftState; aSpeciaKey: Boolean);
{ ************************************************************
* Procedure PostKey
*
* Parameters:
* key : virtual keycode of the key to send. For printable
* keys this is simply the ANSI code (Ord(character)).
* shift : state of the modifier keys. This is a set, so you
* can set several of these keys (shift, control, alt,
* mouse buttons) in tandem. The TShiftState type is
@jarroddavis68
jarroddavis68 / DeferDelFile.pas
Created January 9, 2022 21:36
Defer Delete File
procedure DeferDelFile(const aFilename: string);
var
LCode: TStringList;
LFilename: string;
procedure C(const aMsg: string; const aArgs: array of const);
var
LLine: string;
begin
LLine := Format(aMsg, aArgs);