Skip to content

Instantly share code, notes, and snippets.

@MarkGoldberg
MarkGoldberg / API_CommonDialog.inc
Created November 3, 2016 12:04
GetSaveFileName API wrapped for Clarion for Windows
compile('***',_WIDTH32_)
ANSI EQUATE('A')
***
omit ('***',_WIDTH32_)
ANSI EQUATE('')
***
!-Rely On Once due to IDE Navigation Bugs-! omit('*** ifdef API_CommonDialog ***',ifDef_API_CommonDialog)
@MarkGoldberg
MarkGoldberg / ConfigureForMultipleWriters.bat
Created September 21, 2016 15:24
Claron - Set OpLocks (For TopSpeed files)
:: this batch file, created: by mark@tradesmens.com on Jan/19/2011
::
:: see http://support.microsoft.com/kb/296264
:: see http://www.dataaccess.com/whitepapers/opportunlockingreadcaching.html#Making_Windows_Registry_Changes
::
@echo You are about to configure your machine for Multi-user simulataneous sharing of files:
@echo\
@echo\
::
:: 0123456789 123
@MarkGoldberg
MarkGoldberg / FrameWndProc.clw
Last active August 22, 2016 13:21
Clarion Frame WndProc to detect frame gain/loss of focus
FRAME_WndProc Procedure(HWND arghwnd, UINT argmessage, WPARAM argwParam, LPARAM arglParam) !LRESULT,PASCAL
_WM_ACTIVATEAPP EQUATE(28)
RetVal LRESULT
CODE
CASE argMessage
OF _WM_ACTIVATEAPP ; IF argWParam
oGlo.OnGainFocus()
ELSE oGlo.OnLoseFocus()
END
@MarkGoldberg
MarkGoldberg / SpellNumber.clw
Created May 26, 2016 02:53
Convert a number to English, much like you'd see on a check
!===========================================================================================
SpellNum PROCEDURE(REAL pInputNum)!,STRING
!Region Documentation
! ============================================================
! Purpose : Spell out a number
! Assume Dollars and Cents
! ex: 63.46 -> Sixty Three Dollars and 46 Cents
! Assume American System of Numbers
! I`ve read that 10^9 is Milliard not Billion in the British System of Numbers
! I`ve read that trillion in the British System is 10^18 not 10^12
@MarkGoldberg
MarkGoldberg / CompareTimeSpan.clw
Last active October 28, 2016 21:42
Compare Time Spans
!NOTE should be worked into https://github.com/MarkGoldberg/CwUnit/blob/master/Libsrc/ctDateTimeLong.inc
gtDateTime GROUP,TYPE
_Date DATE
_Time TIME
END
@MarkGoldberg
MarkGoldberg / TestDragAndDrop.clw
Created May 20, 2016 10:50
Clarion Drag and Drop Example
TestDragAndDrop PROGRAM
MAP
Frame
DragFrom
DragTo
END
! Note: if you don't have debuger.inc then just rem all lines using DBG -- it's just for sending event info to OutputDebugString
! which you can view with DebugView++ or DbgView
@MarkGoldberg
MarkGoldberg / ControlMinMaxButtons.clw
Last active May 11, 2016 12:26
Clarion - Control Min/Max Buttons
PROGRAM
MAP
Child
Child2
Child3
END
AppFrame APPLICATION('Application'),AT(,,505,318),CENTER,MASK,SYSTEM,MAX,ICON('WAFRAME.ICO'),STATUS(-1,80,120,45),FONT('Microsoft Sans Serif',8,,FONT:regular),RESIZE
MENUBAR,USE(?Menubar)
ITEM('Child'),USE(?child)
@MarkGoldberg
MarkGoldberg / ctAPIColor.clw
Last active January 19, 2016 19:52
Clarion Frame Background Color
MEMBER
! http://www.odata.de/Clarion/colored_background_for_appframe
! the above from Wolfgang Orth says this code was from Jim Gambon on the newsgroups
! that sounds right, but somehow I forgot to give credit in the class. (blush)
MAP
MODULE('Win32API')
GetClassLong (LONG _hWnd,LONG _Index ),LONG, PASCAL,NAME('GetClassLongA')
SetClassLong (LONG _hWnd,LONG _Index,LONG NewValue),LONG,PROC,PASCAL,NAME('SetClassLongA')
@MarkGoldberg
MarkGoldberg / CorrectControls.clw
Last active August 29, 2015 14:24
CorrectControls
!Below is a simplified version of code that I call after opening every window
MOD:LineHeight LONG(9)
CorrectControls PROCEDURE(*Window xWin)
CurrFEQ SIGNED !No Auto
IsFrame BOOL,AUTO
CODE
IsFrame = CHOOSE( xWin{PROP:Type} = CREATE:application )
@MarkGoldberg
MarkGoldberg / TestDataPath
Created May 12, 2015 16:18
Clarion - Test Prop:DataPath
END
END
CODE
TextFile{PROP:Name} = 'Yada.txt'
DO CreateFile
SYSTEM{PROP:DataPath} = 'C:\TMP'
DO CreateFile