Skip to content

Instantly share code, notes, and snippets.

View CarlTBarnes's full-sized avatar

Carl T. Barnes CarlTBarnes

View GitHub Profile
@CarlTBarnes
CarlTBarnes / Region_Drag_Window.clw
Last active March 17, 2021 17:14
Region dragging with mouse example, e.g. for Splash Window with no title bar
!Examle how to drag window by Region using Mouse. Might use for a Splash with no Caption.
!Best choice is probably the LAST one BrahnMove1Accept() ... so scroll to the bottom
PROGRAM
MAP
CarlMove PROCEDURE() !I have used this on many machines and know it works
CarlMoveSimpler PROCEDURE() !From https://gist.github.com/fushnisoft/4f9da267e165033e007a
BrahnMoveOriginal PROCEDURE() !Code from Brahn's GIST that
BrahnMoveGetPoz PROCEDURE() !Use GetPosition not Prop:Xpos Prop:Ypos
@CarlTBarnes
CarlTBarnes / 00_Index_GIST_.txt
Last active September 22, 2022 14:47
00 Index of my GIST because there does not seem to be options to list them by file name or description
Backup_CW_Project.BAT https://gist.github.com/CarlTBarnes/bbb936e418226d55ff8651bb1bfbf7e4 Backup Clarion Project BAT files
CBAltWin7Fix.tpl https://gist.github.com/CarlTBarnes/5e0e7d5a3e3f0b5c991e8f0601e69004 Fix Alt key lockup problem with the latest version of Windows 10 that I wrote and published in ClarionMag
CascadeMdiChildren.clw https://gist.github.com/CarlTBarnes/ed29557b7142ec4695f7d460cabef3fd Cascade open MDI Child windows like Clarion RTL STD:CascadeWindow using Windows API
Clarion_Hub_Interesting.txt https://gist.github.com/CarlTBarnes/aabb812d5a34fcfe69d2421702799aef Clarion Hub links of interest
CloseWindowHook.clw https://gist.github.com/CarlTBarnes/f86f6b695276b2b3327f5959e5c57682 Prop:CloseWindowHook Example Clarion
DateSplit.clw
@CarlTBarnes
CarlTBarnes / Clarion_Hub_Interesting.txt
Created August 8, 2020 21:20
Clarion Hub links of interest
Tips: https://clarionhub.com/c/ide/tips/19
IDE: https://clarionhub.com/c/ide/9
Msbuild example for Clarion
https://clarionhub.com/t/msbuild-example-for-clarion/274/10
FIXED statement in EXP for 4% smaller EXE without .reloc table
https://clarionhub.com/t/fixed-statement-in-exp-for-4-smaller-exe-without-reloc-table/3450/4
How to successfully start the debugger from the command line?
@CarlTBarnes
CarlTBarnes / UnsignCSharp.cs
Last active August 5, 2020 15:24
C++ remove Codesigning Certificates #1 - also OptionalHeader DataDirectory IMAGE_DIRECTORY_ENTRY_SECURITY
// from https://github.com/WhitakerDaniel/UnsignTool
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// For information on ImageRemoveCertificate, see: https://docs.microsoft.com/en-us/windows/desktop/api/imagehlp/nf-imagehlp-imageremovecertificate
@CarlTBarnes
CarlTBarnes / Scratch.clw
Last active September 14, 2022 23:04
Scratch source I use when I want to write a quick test of some code
PROGRAM !Scratch program by Carl Barnes - Version 8/1/2020 - Download https://git.io/JtPKE
INCLUDE('TplEqu.CLW')
INCLUDE('KeyCodes.CLW')
MAP
main PROCEDURE()
DB PROCEDURE(STRING DebugMessage)
DBClear PROCEDURE() !Clear DebugView Buffer
Hex8 PROCEDURE(LONG LongInt),STRING
@CarlTBarnes
CarlTBarnes / LenFastClip.clw
Created August 2, 2020 17:52
LenFastClip replaces LEN(CLIP()) in ClaRUN.DLL as NAME('Cla$FASTCLIP')
MODULE('RTL')
LenFastClip PROCEDURE(CONST *STRING Text2Measure),LONG,NAME('Cla$FASTCLIP'),DLL(dll_mode)
END
MODULE('RTL')
LenFastClip(CONST *STRING Text2Measure),LONG,NAME('Cla$FASTCLIP'),DLL(dll_mode)
END
!Use LenFastClip() or FastClip() instead of LEN(CLIP( string ))
!This has been around since at least C55. It runs much faster by passing *STRING.
@CarlTBarnes
CarlTBarnes / Error4Message.clw
Created July 18, 2020 16:14
Format ErrorCode() & Error() etc ... to show in a Message() Stop() Halt(), or format on 1 line for a Log file or debug/tracing
MAP
Err4Msg PROCEDURE(Byte NoCRLF=0),STRING !Fromat ErrorCode() & Error() & FileError... for Message() Stop() Halt() or Log file (NoCRLF)
END
!-----------------------------------------
Err4Msg PROCEDURE(Byte NoCRLF=0)!,STRING
!Example: IF ERRORCODE() THEN STOP('Failed ADD(xxx)' & Err4Msg()).
!Note: Return starts '<13,10><13,10>Error Code:' so no need to put in the Message()
CODE
IF ~ERRORCODE() THEN RETURN ''.
IF ~NoCRLF THEN
@CarlTBarnes
CarlTBarnes / SmashSpaces.clw
Created July 16, 2020 15:38
Smash (remove) spaces from a STRING
MAP
SmashSpaces PROCEDURE(*string InOutText, BYTE Leave1Space=0)
MODULE('RTL')
LenFastClip PROCEDURE(CONST *STRING Text2Measure),LONG,NAME('Cla$FASTCLIP'),DLL(dll_mode)
!RTL has had this since at least C55. It is much faster because it passes *STRING and is CLIP and LEN in one call
END
END
SmashSpaces PROCEDURE (*string Txt, BYTE Leave1Spc=0)
@CarlTBarnes
CarlTBarnes / ParseTokenStringIntoQueue.clw
Created July 5, 2020 22:39
Parse String with Delimited with Tokens into a Queue
MAP
ParseTokenStringIntoQueue(CONST *STRING pString,STRING pToken,*QUEUE OutQueue,BYTE pBlanksOk=0),LONG,PROC !Return Count
END
ParseTokenStringIntoQueue PROCEDURE(CONST *STRING pString,STRING pToken,*QUEUE OutQueue,BYTE pBlanksOk=0)!,LONG,PROC !Return Count
SLen LONG,AUTO !pString Length
Ndx LONG,AUTO
TokenVal BYTE,AUTO !When hunting for chars I like VAL compares
BegPos LONG(1) !BegPos = 1 required to work right
EndPos LONG,AUTO !EndPos = 0 required to work right
@CarlTBarnes
CarlTBarnes / CBAltWin7Fix.tpl
Created July 5, 2020 22:10
A fix for the Alt key lockup problem with the latest version of Windows 10 that I wrote and published in ClarionMag
#TEMPLATE (CBAltFix, 'Carl Barnes fix for Alt Key Lockup in Windows 7'),FAMILY('ABC','CW20')
#!===========================================================================
#! Warning! Version 2 of the template changes things.
#! The Global template AltWin7Fix_Global has been removed and is no longer needed.
#! The Frame template AltWin7Fix_Frame has been renamed because it has new questions
#! Only the Frame Extension template is required, it is where you specify all choices.
#! It has a new name AltWin7Fix_Frame2 so you must populate it again on the Frame.
#! If you used the first version of the template you will get errors when you open
#! an APP. Ignore the errors, you should open the Frame, go to Extenstions and add the new template.
#! *** Removed ===>#EXTENSION (AltWin7Fix_Global,'Fix Windows 7 Alt Key Lockup-Global-by Carl Barnes'), APPLICATION