2022年5月31日 星期二

delphi DataSource TDataSetProvider local data

 MyBaseを試してみる。(フィールド作成編): Delphi-fan

http://hiderin.air-nifty.com/delphi/2011/09/mybase-dcff.html 

http://delphi.ktop.com.tw/board.php?cid=30&fid=66&tid=51084

 


https://blog.karatos.in/a?ID=00200-12c89300-5e82-48ad-ada0-aab6e1319adf

https://stackoverflow.com/questions/67149100/how-to-detect-user-either-in-dbgrid-or-clientdataset-has-deleted-data-in-a-cell

https://www.delphipower.xyz/guide_6/working_with_data_using_a_client_dataset.html


delphi DataSource TDataSetProvider  Advanced Data TableGram ADTG

https://docwiki.embarcadero.com/Libraries/Sydney/en/Data.Win.ADODB.TPersistFormat

https://torry.net/quicksearchd.php?String=dataset&page=6

https://github.com/osmanatam/delphi-foundations

 https://github.com/osmanatam/delphi-foundations

 https://github.com/zhugecaomao/DelphiSourceCodeCollection

FMX Utilities
Tweaks to TClipboard code to compile with newer FMX versions
 
Misc/Generics.Defaults if done with metaclasses
 
XE2 book 
01. Language basics
02. Enums, numbers, dates and times
04. Classes and records
05. String handling
06. Arrays, collections and enumerators
07. Basic IO
08. Streams
Cleaned up source for fuller visual control demo
09. ZIP, XML, Registry and INI files
10. Packages
11. Dynamic typing and expressions
12. RTTI
13. Native APIs
Make comment more precise
14. Dynamic libraries
15. Multithreading
Another little FileSearchThread.pas thing

delphi image TResourceStream standard Microsoft SDK resource compiler

  standard Microsoft SDK resource compiler

 https://github.com/graphics32/GR32PNG

 RC.EXE, the Microsoft SDK Resource Compiler

https://forum.lazarus.freepascal.org/index.php?topic=12312.0
https://www.wireshark.org/docs/wsdg_html_chunked/ChToolsMSChain.html

https://support.microsoft.com/en-us/topic/an-updated-resource-compiler-for-the-windows-sdk-for-windows-server-2008-and-for-the-net-framework-3-5-is-now-available-a716ac6a-19a7-5b45-b5df-55980cd4cdb4
https://archicadapi.graphisoft.com/documentation/graphisoft-resource-compiler-4
https://docs.microsoft.com/zh-tw/windows/win32/menurc/resource-compiler
https://en.wikibooks.org/wiki/Windows_Programming/Resource_Scripts

Var

   jpg: TJPEGImage;
 resStream: TResourceStream;

begin
  jpg := TJPEGImage.Create;
  resStream := TResourceStream.Create(HInstance, 'testJpg', 'jpgtype');
  jpg.LoadFromStream(resStream);
  Image1.Picture.Assign(jpg);
  jpg.Free;
  resStream.Free;
end;

//RC: testBmp bitmap res\test.bmp
Image1.Picture.Bitmap.LoadFromResourceName(HInstance, 'res\test.bmp');
//RC: testBmp bmptype res\test.bmp
var
  resStream: TResourceStream;
begin
  resStream := TResourceStream.Create(HInstance, 'testBmp', 'bmptype');
  Image1.Picture.Bitmap.LoadFromStream(resStream);
  resStream.Free;
end;

http://melander.dk/reseditor/

https://wiki.freepascal.org/Lazarus_Resources

https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src/menurc/resource-compiler.md
 Microsoft platform SDK Resource Compiler
https://docwiki.embarcadero.com/RADStudio/Sydney/en/RC.EXE,_the_Microsoft_SDK_Resource_Compiler

 https://delphi.cjcsoft.net/viewthread.php?tid=43646
Title: Extracting Resource Data from an Exe
Question: Article 832 mentions how one can put Files into an Exe. This shows you how you can get it out
Answer:
I've written a simple function that does this for you, just cut and paste (some detail is below)

procedure ExtractToFile(Instance:THandle; ResID:Integer; ResType, FileName:String);
var
  ResStream: TResourceStream;
  FileStream: TFileStream;
begin
  try
    ResStream := TResourceStream.CreateFromID(Instance, ResID, pChar(ResType));
    try
      //if FileExists(FileName) then
        //DeleteFile(pChar(FileName));
      FileStream := TFileStream.Create(FileName, fmCreate);
      try
        FileStream.CopyFrom(ResStream, 0);
      finally
        FileStream.Free;
      end;
    finally
      ResStream.Free;
    end;
  except
    on E:Exception do
    begin
      DeleteFile(FileName);
      raise;
    end;
  end;
end;

https://docwiki.embarcadero.com/Libraries/Sydney/en/System.Classes.TResourceStream

https://github.com/osmanatam/delphi-foundations/tree/ea2c878f01107146674bd92ea518908d8f3e185d/XE2%20book/08.%20Streams/TResourceStream

2022年5月29日 星期日

Spiral transform image algorithm rotatey region around

 [ GDI+ サンプル ] [ G080_RotateTransform による画像とオブジェクトの回転 ] - Mr.XRAY

https://stackoverflow.com/questions/65163260/image-transformation-python

 https://medium.com/analytics-vidhya/opencv-perspective-transformation-9edffefb2143

 https://en.wikipedia.org/wiki/Archimedean_spiral#General_Archimedean_spiral

 https://docs.opencv.org/3.4/da/d54/group__imgproc__transform.html#gab75ef31ce5cdfb5c44b6da5f3b908ea4

 The Rick Sammon Swirl Effect

https://www.geeks3d.com/20110428/shader-library-swirl-post-processing-filter-in-glsl/

delphi form Transparent blur Msimg32.dll AlphaBlend

 https://stackoverflow.com/questions/5964701/how-to-draw-a-translucent-image-on-a-form

transparent background http://delphiexamples.com/forms/transpform.html

 https://sourceforge.net/projects/widget32/

https://parnassus.co/transparent-graphics-with-pure-gdi-part-2-and-introducing-the-ttransparentcanvas-class/

 Form com área transparente no Lazarus/Windows 

http://fanzinepas.blogspot.com/2012/06/form-com-area-transparente-no.html

THandle CreateRectRgn CreateRectRgn SetWindowRgn Winuser.h

https://www.codeguru.com/cplusplus/transparent-listbox/

https://stackoverflow.com/questions/48511634/partially-transparent-window-opengl-win32

 

winapi Transparent form layer GetMonitorInfo

https://www.experts-exchange.com/articles/1783/Win32-Semi-Transparent-Window.html

Layered Windows

https://docs.microsoft.com/en-us/previous-versions/ms997507(v=msdn.10)?redirectedfrom=MSDN

https://www.codeproject.com/Articles/1822/Per-Pixel-Alpha-Blend-in-C

 http://suyamasoft.blue.coocan.jp/ExcelVBA/Sample/SetLayeredWindowAttributes/index.html

http://suyamasoft.blue.coocan.jp/ExcelVBA/Sample/SetLayeredWindowAttributes/index.html

https://docs.microsoft.com/en-us/windows/win32/winauto/magapi/magapi-intro

Žarko Gajić gZoom – Delphi Implementation of the Missing Mode in Windows Magnifier

https://zarko-gajic.iz.hr/gzoom-delphi-implementation-of-the-missing-mode-in-windows-magnifier/


https://www.codeproject.com/Articles/5051/Various-methods-for-capturing-the-screen

https://www.codeproject.com/Articles/607288/Screenshot-using-the-Magnification-library

2022年5月28日 星期六

swig parsing llvm parsing Delphi2Cpp conversion C++ translating Pascal Delphi

https://github.com/FMXExpress/swig-delphi
https://blog.mbedded.ninja/programming/languages/python/python-swig-bindings-from-cplusplus/
https://code.google.com/archive/p/swig-gsoc/wikis/ProjectIdeas.wiki
https://en.delphipraxis.net/topic/940-delphi-compiler-need-to-be-opensourced/?page=4
https://swig-devel.narkive.com/qhi42Zwz/delphi-module
https://www.swig.org/
https://www.swig.org/Doc1.3/Extending.html
https://stackoverflow.com/questions/38884979/parsing-a-header-file-using-swig
https://stackoverflow.com/questions/10373935/pascal-to-c-converter
https://sites.google.com/a/chromium.org/dev/blink/webidl

https://en.wikipedia.org/wiki/Comparison_of_parser_generators
https://en.wikipedia.org/wiki/Source-to-source_compiler
https://en.wikipedia.org/wiki/Language_binding
https://wiki.freepascal.org/C_to_Pascal
https://wiki.lazarus.freepascal.org/User:Roozbeh
https://discourse.panda3d.org/t/help-with-swig/570

    Developer Tools Code Code Convertors
https://torry.net/pages.php?id=1518

llvm parsing  pascal

https://intel.github.io/llvm-docs/clang_doxygen/ParseExprCXX_8cpp_source.html
https://forum.lazarus.freepascal.org/index.php?topic=43007.15
https://github.com/mladedav/mila-compiler
https://github.com/FrozenGene/LLVMPascalCompiler

https://aclanthology.org/people/p/pascal-denis/
http://www.eteks.com/jeks/en/doc/com/eteks/parser/PascalSyntax.html
https://www.freepascal.org/docs-html/user/userse62.html
https://en.wikipedia.org/wiki/Comparison_of_Pascal_and_C

https://www.codeproject.com/Articles/371453/Visual-AST-for-ANTLR-Generated-Parser-Output
https://github.com/RomanYankovsky/DelphiAST

https://www.texttransformer.com/Delphi2Cpp_en.html
http://ivan.vecerina.com/code/delphi2cpp/

https://www.codeproject.com/Articles/10115/Crafting-an-interpreter-Part-1-Parsing-and-Grammar
https://www.codeproject.com/Articles/10142/Crafting-an-interpreter-Part-2-The-Calc0-Toy-Langu
https://www.codeproject.com/Articles/10421/Crafting-an-interpreter-Part-3-Parse-Trees-and-Syn

2022年5月27日 星期五

How can I change the background color of a button WinAPI C++

 Rectangles, Regions, and Clipping rectangular region CreateRoundRectRgn

 

https://miffyzzang.tistory.com/378
CreateWindow("button","",WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | BS_BITMAP | BS_OWNERDRAW,   100,100,70,30,hWnd,(HMENU)IDC_BUTTON, hInst,NULL);

Creating Owner-Drawn Controls - Windows Programming

BS_OWNERDRAW   SetButtonStyle SetWindowRgn

https://stackoverflow.com/questions/18745447/how-can-i-change-the-background-color-of-a-button-winapi-c

https://www.pablosoftwaresolutions.com/html/cimagebutton.html

#pragma comment( \
    linker, \
    "/manifestdependency:\"type='win32' \
    name='Microsoft.Windows.Common-Controls' \
    version='6.0.0.0' \
    processorArchitecture='*' \
    publicKeyToken='6595b64144ccf1df' \
    language='*'\"")
https://www.pablosoftwaresolutions.com/html/ccolorbutton.html

https://stackoverflow.com/questions/17678261/how-to-change-color-of-a-button-while-keeping-buttons-functions-in-win32
https://stackoverflow.com/questions/8695185/why-my-edit-control-looks-odd-in-my-win32-c-application-using-no-mfc

https://stackoverflow.com/questions/18745447/how-can-i-change-the-background-color-of-a-button-winapi-c




PraButtonStyle Button with very attractive layout, standard bootstrap to Delphi VCL

 https://github.com/pauloalvis/Delphi-PraButtonStyle

RkSmartButton rkGlassButton

 https://rmklever.com/?tag=rkglassbutton


Klever on Delphi
My take at Delphi, tips and tricks and how tos
Skip to content

    HomeAbout Contact Downloads

Tag Archives: rkGlassButton    
Glassbutton updated to v2.4
3 Comments    

This is a long forgotten update to my rkGlassButton component. Some bugs have been corrected and it now work more as expected.

The first ting first. The autosize property is working like it should.
Secondly the down property also work when duostyle is active.
Last but not forgotten OnClick now work as expected.

Please report any bugs you find to me.

Hope this helps a little

Download rkGlassButton v2.4
This entry was posted in Component, GUI and tagged Component, GUI, rkGlassButton on August 19, 2014.







Klever on Delphi
My take at Delphi, tips and tricks and how tos
Skip to content

    HomeAbout Contact Downloads

A smarter button
8 Comments    

There is a lot of buttons out there I know but I have yet to find a button like this where you can have more than one button in “one button” (see screen shot). Especially at no cost.
RkSmartButton on display.

RkSmartButton on display.

I belive this is all you need to get started using rkSmartButton. I have tried to make it easy to use but there are a few things worth noticing… to show a popupmenu on any of the buttons you must set a flag in ButtonsPopup property which will look, something like this: 0010 “0” means do not show “1” means show. In this case only third button will get the popup. I also use this technic for enabling buttons and keeping hold of which one is down. No popup will be shown if CheckButtons is set. Popupmenu is shown after the button is pressed and hold down for the time given in PopupDelay property (like in Chrome). To get images on button add an imagelist and set the indexes in the ImageIndexes property. Use format like this: 0,1,2,7,4. To know which button was pressed use SelectedIndex property. Button number one gets the index of 0.

Thats it, hope you like it.

Next up is an update of SmartPathBar.

Download: Project with source

TColorButton - button with Color properties unit ColorButton;

 

unit ColorButton;
 
{
Article:
 
TColorButton - button with Color properties
 
http://delphi.about.com/library/weekly/aa061104a.htm
 
Full source code of the TColorButton Delphi component,
an extension to the standard TButton control,
with font color, background color and mouse over color properties.
 
}
 
interface
 
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, StdCtrls, Buttons, ExtCtrls;
 
type
  TColorButton = class(TButton)
  private
    FBackBeforeHoverColor: TColor;
  private
    FCanvas: TCanvas;
    IsFocused: Boolean;
    FBackColor: TColor;
    FForeColor: TColor;
    FHoverColor: TColor;
    procedure SetBackColor(const Value: TColor);
    procedure SetForeColor(const Value: TColor);
    procedure SetHoverColor(const Value: TColor);
 
    property BackBeforeHoverColor : TColor read FBackBeforeHoverColor write FBackBeforeHoverColor;
  protected
    procedure CreateParams(var Params: TCreateParams); override;
    procedure WndProc(var Message : TMessage); override;
 
    procedure SetButtonStyle(Value: Boolean); override;
    procedure DrawButton(Rect: TRect; State: UINT);
 
    procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED;
    procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
    procedure CNMeasureItem(var Message: TWMMeasureItem); message CN_MEASUREITEM;
    procedure CNDrawItem(var Message: TWMDrawItem); message CN_DRAWITEM;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
 
  published
    property BackColor: TColor read FBackColor write SetBackColor default clBtnFace;
    property ForeColor: TColor read FForeColor write SetForeColor default clBtnText;
    property HoverColor: TColor read FHoverColor write SetHoverColor default clBtnFace;
  end;
 
procedure Register;
 
implementation
 
 
constructor TColorButton.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FCanvas := TCanvas.Create;
  BackColor := clBtnFace;
  ForeColor := clBtnText;
  HoverColor := clBtnFace;
end; (*Create*)
 
destructor TColorButton.Destroy;
begin
  FCanvas.Free;
  inherited Destroy;
end; (*Destroy*)
 
procedure TColorButton.WndProc(var Message : TMessage);
begin
  if (Message.Msg = CM_MOUSELEAVE) then
  begin
    BackColor := BackBeforeHoverColor;
    invalidate;
  end;
  if (Message.Msg = CM_MOUSEENTER) then
  begin
    BackBeforeHoverColor := BackColor;
    BackColor := HoverColor;
    invalidate;
  end;
 
  inherited;
end; (*WndProc*)
 
procedure TColorButton.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  with Params do Style := Style or BS_OWNERDRAW;
end; (*CreateParams*)
 
 
 
procedure TColorButton.SetButtonStyle(Value: Boolean);
begin
  if Value <> IsFocused then
  begin
    IsFocused := Value;
    Invalidate;
  end;
end; (*SetButtonStyle*)
 
procedure TColorButton.CNMeasureItem(var Message: TWMMeasureItem);
begin
  with Message.MeasureItemStruct^ do
  begin
    itemWidth  := Width;
    itemHeight := Height; 
  end; 
end; (*CNMeasureItem*)
 
procedure TColorButton.CNDrawItem(var Message: TWMDrawItem);
var 
  SaveIndex: Integer;
begin
  with Message.DrawItemStruct^ do 
  begin 
    SaveIndex := SaveDC(hDC); 
    FCanvas.Lock;
    try 
      FCanvas.Handle := hDC; 
      FCanvas.Font := Font; 
      FCanvas.Brush := Brush;
      DrawButton(rcItem, itemState);
    finally
      FCanvas.Handle := 0;
      FCanvas.Unlock;
      RestoreDC(hDC, SaveIndex); 
    end;
  end; 
  Message.Result := 1;
end; (*CNDrawItem*)
 
procedure TColorButton.CMEnabledChanged(var Message: TMessage);
begin
  inherited; 
  Invalidate;
end; (*CMEnabledChanged*)
 
procedure TColorButton.CMFontChanged(var Message: TMessage);
begin
  inherited;
  Invalidate;
end; (*CMFontChanged*)
 
 
procedure TColorButton.SetBackColor(const Value: TColor);
begin
  if FBackColor <> Value then begin
    FBackColor:= Value;
    Invalidate;
  end;
end; (*SetButtonColor*)
 
procedure TColorButton.SetForeColor(const Value: TColor);
begin
  if FForeColor <> Value then begin
    FForeColor:= Value;
    Invalidate;
  end;
end; (*SetForeColor*)
 
procedure TColorButton.SetHoverColor(const Value: TColor);
begin
  if FHoverColor <> Value then begin
    FHoverColor:= Value;
    Invalidate;
  end;
end; (*SetHoverColor*)
 
procedure TColorButton.DrawButton(Rect: TRect; State: UINT);
var
  Flags, OldMode: Longint;
  IsDown, IsDefault, IsDisabled: Boolean;
  OldColor: TColor;
  OrgRect: TRect;
begin
  OrgRect := Rect;
  Flags := DFCS_BUTTONPUSH or DFCS_ADJUSTRECT;
  IsDown := State and ODS_SELECTED <> 0;
  IsDefault := State and ODS_FOCUS <> 0;
  IsDisabled := State and ODS_DISABLED <> 0;
 
  if IsDown then Flags := Flags or DFCS_PUSHED;
  if IsDisabled then Flags := Flags or DFCS_INACTIVE;
 
  if IsFocused or IsDefault then 
  begin 
    FCanvas.Pen.Color := clWindowFrame;
    FCanvas.Pen.Width := 1; 
    FCanvas.Brush.Style := bsClear; 
    FCanvas.Rectangle(Rect.Left, Rect.Top, Rect.Right, Rect.Bottom); 
    InflateRect(Rect, - 1, - 1); 
  end;
 
  if IsDown then 
  begin
    FCanvas.Pen.Color := clBtnShadow;
    FCanvas.Pen.Width := 1;
    FCanvas.Brush.Color := clBtnFace; 
    FCanvas.Rectangle(Rect.Left, Rect.Top, Rect.Right, Rect.Bottom); 
    InflateRect(Rect, - 1, - 1); 
  end 
  else
    DrawFrameControl(FCanvas.Handle, Rect, DFC_BUTTON, Flags); 
 
  if IsDown then OffsetRect(Rect, 1, 1); 
 
  OldColor := FCanvas.Brush.Color;
  FCanvas.Brush.Color := BackColor;
  FCanvas.FillRect(Rect); 
  FCanvas.Brush.Color := OldColor;
  OldMode := SetBkMode(FCanvas.Handle, TRANSPARENT); 
  FCanvas.Font.Color := ForeColor;
  if IsDisabled then
    DrawState(FCanvas.Handle, FCanvas.Brush.Handle, nil, Integer(Caption), 0,
    ((Rect.Right - Rect.Left) - FCanvas.TextWidth(Caption)) div 2,
    ((Rect.Bottom - Rect.Top) - FCanvas.TextHeight(Caption)) div 2,
      0, 0, DST_TEXT or DSS_DISABLED)
  else
    DrawText(FCanvas.Handle, PChar(Caption), - 1, Rect,
      DT_SINGLELINE or DT_CENTER or DT_VCENTER); 
  SetBkMode(FCanvas.Handle, OldMode);
 
  if IsFocused and IsDefault then
  begin
    Rect := OrgRect;
    InflateRect(Rect, - 4, - 4);
    FCanvas.Pen.Color := clWindowFrame;
    FCanvas.Brush.Color := clBtnFace;
    DrawFocusRect(FCanvas.Handle, Rect);
  end;
end; (*DrawButton*)
 
procedure Register;
begin
  RegisterComponents('delphi.about.com', [TColorButton]);
end;
 
end.

unit ColorButton;

 https://delphisources.ru/pages/faq/base/change_button_color.html

Изменить цвет TButton


{
  You cannot change the color of a standard TButton,
  since the windows button control always paints itself with the
  button color defined in the control panel.
  But you can derive derive a new component from TButton and handle
  the and drawing behaviour there.
}


unit ColorButton;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons, ExtCtrls;

type
  TDrawButtonEvent = procedure(Control: TWinControl;
    Rect: TRect; State: TOwnerDrawState) of object;

  TColorButton = class(TButton)
  private
    FCanvas: TCanvas;
    IsFocused: Boolean;
    FOnDrawButton: TDrawButtonEvent;
  protected
    procedure CreateParams(var Params: TCreateParams); override;
    procedure SetButtonStyle(ADefault: Boolean); override;
    procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED;
    procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
    procedure CNMeasureItem(var Message: TWMMeasureItem); message CN_MEASUREITEM;
    procedure CNDrawItem(var Message: TWMDrawItem); message CN_DRAWITEM;
    procedure WMLButtonDblClk(var Message: TWMLButtonDblClk); message WM_LBUTTONDBLCLK;
    procedure DrawButton(Rect: TRect; State: UINT);
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    property Canvas: TCanvas read FCanvas;
  published
    property OnDrawButton: TDrawButtonEvent read FOnDrawButton write FOnDrawButton;
    property Color;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Samples', [TColorButton]);
end;

constructor TColorButton.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FCanvas := TCanvas.Create;
end;

destructor TColorButton.Destroy;
begin
  inherited Destroy;
  FCanvas.Free;
end;

procedure TColorButton.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  with Params do Style := Style or BS_OWNERDRAW;
end;

procedure TColorButton.SetButtonStyle(ADefault: Boolean);
begin
  if ADefault <> IsFocused then
  begin
    IsFocused := ADefault;
    Refresh;
  end;
end;

procedure TColorButton.CNMeasureItem(var Message: TWMMeasureItem);
begin
  with Message.MeasureItemStruct^ do
  begin
    itemWidth  := Width;
    itemHeight := Height;
  end;
end;

procedure TColorButton.CNDrawItem(var Message: TWMDrawItem);
var
  SaveIndex: Integer;
begin
  with Message.DrawItemStruct^ do
  begin
    SaveIndex := SaveDC(hDC);
    FCanvas.Lock;
    try
      FCanvas.Handle := hDC;
      FCanvas.Font := Font;
      FCanvas.Brush := Brush;
      DrawButton(rcItem, itemState);
    finally
      FCanvas.Handle := 0;
      FCanvas.Unlock;
      RestoreDC(hDC, SaveIndex);
    end;
  end;
  Message.Result := 1;
end;

procedure TColorButton.CMEnabledChanged(var Message: TMessage);
begin
  inherited;
  Invalidate;
end;

procedure TColorButton.CMFontChanged(var Message: TMessage);
begin
  inherited;
  Invalidate;
end;

procedure TColorButton.WMLButtonDblClk(var Message: TWMLButtonDblClk);
begin
  Perform(WM_LBUTTONDOWN, Message.Keys, Longint(Message.Pos));
end;

procedure TColorButton.DrawButton(Rect: TRect; State: UINT);
var
  Flags, OldMode: Longint;
  IsDown, IsDefault, IsDisabled: Boolean;
  OldColor: TColor;
  OrgRect: TRect;
begin
  OrgRect := Rect;
  Flags := DFCS_BUTTONPUSH or DFCS_ADJUSTRECT;
  IsDown := State and ODS_SELECTED <> 0;
  IsDefault := State and ODS_FOCUS <> 0;
  IsDisabled := State and ODS_DISABLED <> 0;

  if IsDown then Flags := Flags or DFCS_PUSHED;
  if IsDisabled then Flags := Flags or DFCS_INACTIVE;

  if IsFocused or IsDefault then
  begin
    FCanvas.Pen.Color := clWindowFrame;
    FCanvas.Pen.Width := 1;
    FCanvas.Brush.Style := bsClear;
    FCanvas.Rectangle(Rect.Left, Rect.Top, Rect.Right, Rect.Bottom);
    InflateRect(Rect, - 1, - 1);
  end;

  if IsDown then
  begin
    FCanvas.Pen.Color := clBtnShadow;
    FCanvas.Pen.Width := 1;
    FCanvas.Brush.Color := clBtnFace;
    FCanvas.Rectangle(Rect.Left, Rect.Top, Rect.Right, Rect.Bottom);
    InflateRect(Rect, - 1, - 1);
  end
  else
    DrawFrameControl(FCanvas.Handle, Rect, DFC_BUTTON, Flags);

  if IsDown then OffsetRect(Rect, 1, 1);

  OldColor := FCanvas.Brush.Color;
  FCanvas.Brush.Color := Color;
  FCanvas.FillRect(Rect);
  FCanvas.Brush.Color := OldColor;
  OldMode := SetBkMode(FCanvas.Handle, TRANSPARENT);
  FCanvas.Font.Color := clBtnText;
  if IsDisabled then
    DrawState(FCanvas.Handle, FCanvas.Brush.Handle, nil, Integer(Caption), 0,
    ((Rect.Right - Rect.Left) - FCanvas.TextWidth(Caption)) div 2,
    ((Rect.Bottom - Rect.Top) - FCanvas.TextHeight(Caption)) div 2,
      0, 0, DST_TEXT or DSS_DISABLED)
  else
    DrawText(FCanvas.Handle, PChar(Caption), - 1, Rect,
      DT_SINGLELINE or DT_CENTER or DT_VCENTER);
  SetBkMode(FCanvas.Handle, OldMode);

  if Assigned(FOnDrawButton) then
    FOnDrawButton(Self, Rect, TOwnerDrawState(LongRec(State).Lo));

  if IsFocused and IsDefault then
  begin
    Rect := OrgRect;
    InflateRect(Rect, - 4, - 4);
    FCanvas.Pen.Color := clWindowFrame;
    FCanvas.Brush.Color := clBtnFace;
    DrawFocusRect(FCanvas.Handle, Rect);
  end;
end;
end.

how-to-change-the-color-of-tbutton BS_OWNERDRAW SetWindowLong WM_DRAWITEM BS_OWNERDRAW color properties TColorButton

 
Buttons and Similar Controls
https://docwiki.embarcadero.com/RADStudio/Sydney/en/Buttons_and_Similar_Controls
https://blogs.embarcadero.com/creating-a-custom-button-style-with-rad-studio-10-seattle/

https://docs.microsoft.com/en-us/windows/win32/controls/button-styles
https://stackoverflow.com/questions/23082687/how-to-change-the-color-of-tbutton
BS_OWNERDRAW SetWindowLong WM_DRAWITEM
BS_OWNERDRAW to expose working color properties: TColorButton
TColorButton = class(TButton) private ...
procedure DrawItem(const DrawItemStruct: TDrawItemStruct); ...
with Params do Style := Style or BS_OWNERDRAW;
https://stackoverflow.com/questions/55731281/delphi-button-transitions-using-vcl
https://stackoverflow.com/questions/9758016/how-do-i-custom-draw-of-tedit-control-text

https://lazarus-ccr.sourceforge.io/docs/lcl/dialogs/tcolorbutton.html

https://community.embarcadero.com/es/blogs/entry/creating-a-custom-button-style-with-rad-studio-10-seattle
https://torry.net/quicksearchd.php?String=button+color&Title=Yes

http://www.lohninger.com/onoffbut.html SDL Component Suite - OnOffBut

http://www.festra.com/cb/mtut24.htm
A button doesn't have a Color property.
But we can simulate a colored button by using a TPanel component.

https://www.swissdelphicenter.ch/en/showcode.php?id=1100

unit ColorButton;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons, ExtCtrls;

type
  TDrawButtonEvent = procedure(Control: TWinControl;
    Rect: TRect; State: TOwnerDrawState) of object;

  TColorButton = class(TButton)
  private
    FCanvas: TCanvas;
    IsFocused: Boolean;
    FOnDrawButton: TDrawButtonEvent;
  protected
    procedure CreateParams(var Params: TCreateParams); override;
    procedure SetButtonStyle(ADefault: Boolean); override;
    procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED;
    procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
    procedure CNMeasureItem(var Message: TWMMeasureItem); message CN_MEASUREITEM;
    procedure CNDrawItem(var Message: TWMDrawItem); message CN_DRAWITEM;
    procedure WMLButtonDblClk(var Message: TWMLButtonDblClk); message WM_LBUTTONDBLCLK;
    procedure DrawButton(Rect: TRect; State: UINT);
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    property Canvas: TCanvas read FCanvas;
  published
    property OnDrawButton: TDrawButtonEvent read FOnDrawButton write FOnDrawButton;
    property Color;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Samples', [TColorButton]);
end;

constructor TColorButton.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FCanvas := TCanvas.Create;
end;

destructor TColorButton.Destroy;
begin
  inherited Destroy;
  FCanvas.Free;
end;

procedure TColorButton.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  with Params do Style := Style or BS_OWNERDRAW;
end;

procedure TColorButton.SetButtonStyle(ADefault: Boolean);
begin
  if ADefault <> IsFocused then
  begin
    IsFocused := ADefault;
    Refresh;
  end;
end;

procedure TColorButton.CNMeasureItem(var Message: TWMMeasureItem);
begin
  with Message.MeasureItemStruct^ do
  begin
    itemWidth  := Width;
    itemHeight := Height;
  end;
end;

procedure TColorButton.CNDrawItem(var Message: TWMDrawItem);
var
  SaveIndex: Integer;
begin
  with Message.DrawItemStruct^ do
  begin
    SaveIndex := SaveDC(hDC);
    FCanvas.Lock;
    try
      FCanvas.Handle := hDC;
      FCanvas.Font := Font;
      FCanvas.Brush := Brush;
      DrawButton(rcItem, itemState);
    finally
      FCanvas.Handle := 0;
      FCanvas.Unlock;
      RestoreDC(hDC, SaveIndex);
    end;
  end;
  Message.Result := 1;
end;

procedure TColorButton.CMEnabledChanged(var Message: TMessage);
begin
  inherited;
  Invalidate;
end;

procedure TColorButton.CMFontChanged(var Message: TMessage);
begin
  inherited;
  Invalidate;
end;

procedure TColorButton.WMLButtonDblClk(var Message: TWMLButtonDblClk);
begin
  Perform(WM_LBUTTONDOWN, Message.Keys, Longint(Message.Pos));
end;

procedure TColorButton.DrawButton(Rect: TRect; State: UINT);
var
  Flags, OldMode: Longint;
  IsDown, IsDefault, IsDisabled: Boolean;
  OldColor: TColor;
  OrgRect: TRect;
begin
  OrgRect := Rect;
  Flags := DFCS_BUTTONPUSH or DFCS_ADJUSTRECT;
  IsDown := State and ODS_SELECTED <> 0;
  IsDefault := State and ODS_FOCUS <> 0;
  IsDisabled := State and ODS_DISABLED <> 0;

  if IsDown then Flags := Flags or DFCS_PUSHED;
  if IsDisabled then Flags := Flags or DFCS_INACTIVE;

  if IsFocused or IsDefault then
  begin
    FCanvas.Pen.Color := clWindowFrame;
    FCanvas.Pen.Width := 1;
    FCanvas.Brush.Style := bsClear;
    FCanvas.Rectangle(Rect.Left, Rect.Top, Rect.Right, Rect.Bottom);
    InflateRect(Rect, - 1, - 1);
  end;

  if IsDown then
  begin
    FCanvas.Pen.Color := clBtnShadow;
    FCanvas.Pen.Width := 1;
    FCanvas.Brush.Color := clBtnFace;
    FCanvas.Rectangle(Rect.Left, Rect.Top, Rect.Right, Rect.Bottom);
    InflateRect(Rect, - 1, - 1);
  end
  else
    DrawFrameControl(FCanvas.Handle, Rect, DFC_BUTTON, Flags);

  if IsDown then OffsetRect(Rect, 1, 1);

  OldColor := FCanvas.Brush.Color;
  FCanvas.Brush.Color := Color;
  FCanvas.FillRect(Rect);
  FCanvas.Brush.Color := OldColor;
  OldMode := SetBkMode(FCanvas.Handle, TRANSPARENT);
  FCanvas.Font.Color := clBtnText;
  if IsDisabled then
    DrawState(FCanvas.Handle, FCanvas.Brush.Handle, nil, Integer(Caption), 0,
    ((Rect.Right - Rect.Left) - FCanvas.TextWidth(Caption)) div 2,
    ((Rect.Bottom - Rect.Top) - FCanvas.TextHeight(Caption)) div 2,
      0, 0, DST_TEXT or DSS_DISABLED)
  else
    DrawText(FCanvas.Handle, PChar(Caption), - 1, Rect,
      DT_SINGLELINE or DT_CENTER or DT_VCENTER);
  SetBkMode(FCanvas.Handle, OldMode);

  if Assigned(FOnDrawButton) then
    FOnDrawButton(Self, Rect, TOwnerDrawState(LongRec(State).Lo));

  if IsFocused and IsDefault then
  begin
    Rect := OrgRect;
    InflateRect(Rect, - 4, - 4);
    FCanvas.Pen.Color := clWindowFrame;
    FCanvas.Brush.Color := clBtnFace;
    DrawFocusRect(FCanvas.Handle, Rect);
  end;
end;

end.


Adding a component to the Titlebar using CustomTitleBar
https://forum.lazarus.freepascal.org/index.php?topic=49456.0
https://wiki.freepascal.org/BGRAControls
https://lazarus-ccr.sourceforge.io/docs/lcl/dialogs/tcolorbutton.html
https://docwiki.embarcadero.com/Libraries/Alexandria/en/FMX.Colors.TColorButton
CustomTitleBar.Control = TitleBarPanel1
https://stackoverflow.com/questions/70437417/adding-a-component-to-the-titlebar-using-customtitlebar
https://stackoverflow.com/questions/5634743/non-client-painting-on-aero-glass-window
 
How can I put a custom button on the title bar? [duplicate]
JVCL Help:.pas - Project JEDI Wiki
https://wiki.delphi-jedi.org/wiki/JEDI_Visual_Component_Library
https://docs.microsoft.com/zh-tw/windows/win32/dwm/customframe?redirectedfrom=MSDN














2022年5月26日 星期四

...show controls with rounded corners?

 https://www.swissdelphicenter.ch/en/showcode.php?id=921

 www.teamb.com

 Autor: P. Below
Homepage: http://www.teamb.com
[ Print tip ]         

Tip Rating (38):     
     




procedure MakeRounded(Control: TWinControl);
var
  R: TRect;
  Rgn: HRGN;
begin
  with Control do
  begin
    R := ClientRect;
    rgn := CreateRoundRectRgn(R.Left, R.Top, R.Right, R.Bottom, 20, 20);
    Perform(EM_GETRECT, 0, lParam(@r));
    InflateRect(r, - 5, - 5);
    Perform(EM_SETRECTNP, 0, lParam(@r));
    SetWindowRgn(Handle, rgn, True);
    Invalidate;
  end;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
  // TMemo:
  Memo1.BorderStyle := bsNone;
  MakeRounded(Memo1);
  // TEdit:
  Edit2.BorderStyle := bsNone;
  MakeRounded(Edit2);
  // TPanel:
  MakeRounded(Panel1);
  // TStaticText:
  MakeRounded(StaticText1);
  // TForm
  Form1.BorderStyle := bsNone;
  MakeRounded(Form1);
end;


Vcl.ExtCtrls.TShape corner size of RoundRect


FMX.StdCtrls.TCornerButton


https://stackoverflow.com/questions/11675374/how-to-make-tframe-with-rounded-corners

  TCustomRoundShape = class(TGraphicControl)



procedure TForm1.FormPaint(Sender: TObject);
const
  n = 50;
var
  Rgn: HRGN;
  x1,y1,x2,y2: Integer;
begin
  x1 := n;
  y1 := n div 2;
  x2 := ClientWidth - n;
  y2 := ClientHeight - n;
 
  Rgn := CreateRoundRectRgn(x1, y1, x2, y2, n, n);
 
  Canvas.Brush.Color := clSilver;
  Canvas.Brush.Style := bsCross;
  FillRgn(Canvas.Handle, Rgn, Canvas.Brush.Handle);
 
  Canvas.Brush.Color := clRed;
  Canvas.Brush.Style := bsSolid;
  FrameRgn(Canvas.Handle, Rgn, Canvas.Brush.Handle, 2, 2);

  DeleteObject(Rgn);
end;

 https://stackoverflow.com/questions/11675374/how-to-make-tframe-with-rounded-corners
https://stackoverflow.com/questions/5755719/rounded-and-titled-tpanel-in-delphi-7
https://stackoverflow.com/questions/32987649/how-to-create-a-user-control-with-rounded-corners

...create a form with rounded corners?
Autor: Horst Kniebusch
Homepage: http://members.tripod.de/Kniebusch
[ Print tip ]          

Tip Rating (38):      
     




{
  Die CreateRoundRectRgn lässt eine Form mit abgerundeten Ecken erscheinen.

  The CreateRoundRectRgn function creates a rectangular
  region with rounded corners
}

procedure TForm1.FormCreate(Sender: TObject);
var
  rgn: HRGN;
begin
  Form1.Borderstyle := bsNone;
  rgn := CreateRoundRectRgn(0,// x-coordinate of the region's upper-left corner
    0,            // y-coordinate of the region's upper-left corner
    ClientWidth,  // x-coordinate of the region's lower-right corner
    ClientHeight, // y-coordinate of the region's lower-right corner
    40,           // height of ellipse for rounded corners
    40);          // width of ellipse for rounded corners
  SetWindowRgn(Handle, rgn, True);
end


{ The CreatePolygonRgn function creates a polygonal region. }


procedure TForm1.FormCreate(Sender: TObject);
const
  C = 20;
var
  Points: array [0..7] of TPoint;
  h, w: Integer;
begin
  h := Form1.Height;
  w := Form1.Width;
  Points[0].X := C;     Points[0].Y := 0;
  Points[1].X := 0;     Points[1].Y := C;
  Points[2].X := 0;     Points[2].Y := h - c;
  Points[3].X := C;     Points[3].Y := h;

  Points[4].X := w - c; Points[4].Y := h;
  Points[5].X := w;     Points[5].Y := h - c;

  Points[6].X := w;     Points[6].Y := C;
  Points[7].X := w - C; Points[7].Y := 0;

  SetWindowRgn(Form1.Handle, CreatePolygonRgn(Points, 8, WINDING), True);
end;
 

Receive Windows Messages In Your Custom Delphi Class NonWindowed Control AllocateHWnd(WndMethod); TMsgReceiver RegisterWindowMessage TApplicationEvent

 https://zarko-gajic.iz.hr/receive-windows-messages-in-your-custom-delphi-class-nonwindowed-control-object/

Embed the Chromium web browser in your Delphi projects

 https://github.com/salvadordf/CEF4Delphi

https://github.com/salvadordf/WebView4Delphi 

https://landof.dev/awesome/pascal/

https://github.com/Fr0sT-Brutal/awesome-pascal

2022年5月25日 星期三

Using Delphi’s Expressions Engine EXPR math parser library parsing evaluating expressions

https://blogs.embarcadero.com/using-delphis-expressions-engine/

https://github.com/torvalds/linux/blob/master/scripts/kconfig/expr.c 

https://beltoforion.de/en/muparser/

C++ Mathematical Expression Library (ExprTk) - By Arash

C library for parsing and evaluating simple expressions.

 evaluating  expressions

 https://stackoverflow.com/questions/1326258/mathematical-expression-parser-in-delphi

 https://github.com/Crownie88/Delphi-mathematic-expression-parser/blob/master/MathExpParser.pas

2022年5月24日 星期二

一起結束

 https://codeoncode.blogspot.com/2016/12/create-job-object-and-terminate-child.html

Create a Job object And terminate Child Process

JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE flag
How to gracefully handle when main.exe terminated, child.exe terminated also?
You need to use jobs. Main executable should create a job object, then you'll need to set JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE flag to your job object.
 

unit JobsApi;
interface
uses
  Windows;
type
  TJobObjectInfoClass   =   Cardinal;

  PJobObjectAssociateCompletionPort   =   ^TJobObjectAssociateCompletionPort;
  TJobObjectAssociateCompletionPort   =   Record
      CompletionKey     :   Pointer;
      CompletionPort   :   THandle;
  End;
  {$EXTERNALSYM JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION}
  JOB_OBJECT_LIMIT_BREAKAWAY_OK = $00000800;
  {$EXTERNALSYM JOB_OBJECT_LIMIT_BREAKAWAY_OK}
  JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK = $00001000;
  {$EXTERNALSYM JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK}
  JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = $00002000;
  {$EXTERNALSYM JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE}

Function QueryInformationJobObject(hJob : THandle;
                        JobObjectInformationClass : TJobObjectInfoClass;
                        lpJobObjectInformation : Pointer;
                        cbJobObjectInformationLength : DWORD;
                        lpReturnLength : PDWORD) : Bool; StdCall;
                        External Kernel32 Name 'QueryInformationJobObject';

Function SetInformationJobObject(hJob : THandle;
                        JobObjectInformationClass : TJobObjectInfoClass;
                        lpJobObjectInformation : Pointer;
                        cbJobObjectInformationLength : DWORD): BOOL; StdCall;
                        External Kernel32 Name 'SetInformationJobObject';

 

 

 QueryInformationJobObject function (jobapi2.h)

https://docs.microsoft.com/en-us/windows/win32/api/jobapi2/nf-jobapi2-queryinformationjobobject 



https://www.google.com/search?q=github+Helper.System.JobObject.Header.pas

https://gist.github.com/JensMertelmeyer/5e23a5dccb59b2902f37c69e7f7fa4cd

 @JensMertelmeyer
JensMertelmeyer/Helper.System.JobObject.Header.pas

CreateJobObjectW. KERNEL32.CreateMutexW. KERNEL32.CreateProcessW. KERNEL32.CreateThread. KERNEL32.DelayLoadFailureHook.

提升權限

 OpenProcessToken GetCurrentProcessID   TOKEN_ADJUST_PRIVILEGES or TOKEN_QUERY

 CreateProcessAsUser

SystemHandleInformation = 16;
ProcessBasicInformation = 0;
STATUS_SUCCESS = cardinal($00000000);
SE_DEBUG_PRIVILEGE =20;
STATUS_ACCESS_DENIED = cardinal($C0000022);
STATUS_INFO_LENGTH_MISMATCH = cardinal($C0000004);
SEVERITY_ERROR = cardinal($C0000000);
TH32CS_SNAPPROCESS = $00000002;  
JOB_OBJECT_ALL_ACCESS = $1f001f;

printf("SeCreateSymbolicLinkPrivilege = %ld, %ld\n", seCreateSymbolicLinkPrivilege.HighPart, seCreateSymbolicLinkPrivilege.LowPart);

      if (!GetTokenInformation(hProcess, TokenPrivileges, NULL, 0, &length))
      {
        if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
        {
          TOKEN_PRIVILEGES* privileges = (TOKEN_PRIVILEGES*)malloc(length);
          if (GetTokenInformation(hProcess, TokenPrivileges, privileges, length, &length))
          {
            BOOL found = FALSE;
            DWORD count = privileges->PrivilegeCount;

            printf("User has %ld privileges\n", count);

            if (count > 0)
            {
              LUID_AND_ATTRIBUTES* privs = privileges->Privileges;
              while (count-- > 0 && !luid_eq(privs->Luid, seCreateSymbolicLinkPrivilege))
                privs++;
              found = (count > 0);

advapi32.dll advapi32.lib AbortSystemShutdown InitiateSystemShutdown 關機 重新 開機

 https://docs.microsoft.com/zh-tw/windows/win32/shutdown/displaying-the-shutdown-dialog-box

2022年5月23日 星期一

Interesting Homemade DLP Resin Printer Making PCB's using transparant LCD

 https://hackaday.io/project/21933-prism-laser-scanner
https://hackaday.com/2017/06/15/laser-pcbs-with-ldgraphy/
https://pcbwriter.github.io/
https://habr.com/en/post/438618/
https://github.com/hzeller/ldgraphy

https://hackaday.com/2016/09/18/vacuum-exposure-unit-gives-better-pcb-etching-results/

6thD RGB LD 13000, 0.9mrad – Low divergence RGB LASER
https://6thd.eu/produkt/scannermax-compact-506/
Sharp Laser Printer Motors Sharp Polygon Motor
https://www.copyparts.eu/ax060396-ricoh-polygon-motor/p4242
MP C2000 Color Laser Multifunction Printer | Ricoh USA
 Replacing the Laser Polygon Mirror Motor Assembly RICOH AFICIO 1060 1075 2060 2075 MP7500 MP8000
https://www.laserworld.com/en/newslist/106-laserworld-news-en/1864-pangolin-scannermax-available.html
 Repalcement DC Polygon Mirror Motor Assy RICOH AFICIO MP6001 MP7001 MP8001 MP9001
https://electronics.stackexchange.com/questions/195943/how-does-a-laser-printer-control-the-laser-to-produce-such-high-resolutions
https://ruediste.github.io/pcb/2021/01/01/spinning-polygon-mirror.html


Polygon mirror scanner motors  Brushless motors
cdrom Brushless motors

Interesting Homemade DLP Resin Printer
Making PCB's using transparant LCD
Casually Laser-Exposing 0.2 mm PCB features on a 3D printer


https://www.instructables.com/DIY-STEPDIR-LASER-GALVO-CONTROLLER/
The fastest way to make crisp PCBs at home!
DLP-enabled PCB lithography: low cost and high reliability
Make PCB with a LCD mask
Maskless Photolithography with DLP Projector - 10um Feature Sizes
Make pcb with laser

dmd chip projector series mini Genuine

 

https://hackaday.com/2014/02/03/laser-based-pcb-printer/
http://www.diyouware.com/
eagle-pcb-design-software
http://www.diyouware.com/download
Laser Marking - Printed Circuit Board (PCB) Fabrication

2022年5月21日 星期六

VIRT interpreter TSymbolTable ast TREE

Language - 演算法筆記
https://web.ntnu.edu.tw/~algo/
https://web.ntnu.edu.tw/~algo/Language.html

https://sourcemaking.com/design_patterns/interpreter/delphi

https://docs.python.org/zh-tw/3.7/library/language.html
https://docs.python.org/3.7/library/parser.html
Python 语言服务
Python 提供了许多模块来帮助使用 Python 语言。 这些模块支持标记化、解析、语法分析、字节码反汇编以及各种其他工具。

 JavaCC Interpreter (AST to Symbol Table) 

https://ruslanspivak.com/lsbasi-part1/

AST interpreter Backus–Naur Form syntax tree

Introduction to AST manipulation in ROSE
Abstract Syntax Trees
https://ix.cs.uoregon.edu/~norris/pat/index.cgi?n=Main.ROSEIntro

Presentation on theme: "Programming Languages 2nd edition Tucker and Noonan"— Presentation transcript:
https://slideplayer.com/slide/5039873/

https://staff.csie.ncu.edu.tw/chia/Course/Compiler/lexparse2.html
     Catalog of Compiler Construction Tools
Lexer and Parser Generators Compiler Construction Kits

https://www.sigmdel.ca/michel/program/delphi/parser/parser1_en.html
Part 1 of Parsing and Evaluating Mathematical Expressions
   building parsers  using Pascal or Delphi JEDI Code Library (JCL)’s unit JclExprEval.pas, Renate Schaaf’s TExpress TParser Renate Schaaf, Alin Flaider and Stefan Hoffmeister or symbolic.pas by Marco van de Voort.

parsing code scanner interpreter   sequence  terms separated

Behavioral.State.Pattern (Delphi Sample) Intent      Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.     An object-oriented state machine     wrapper + polymorphic wrappee + collaboration

character table parsing integer digit number  Integer  floating-point types  Data Types
https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node189.html

使用巴科斯範式(BNF/EBNF)定義語言 https://hackmd.io/@ShenTengTu/HJzCM3aDr

The Asf+Sdf Meta-Environment: A Component-Based Language Development Environment
https://www.sciencedirect.com/science/article/pii/S1571066104809174?via%3Dihub
https://eelcovisser.org/research/#ASF+SDF
https://www2.cs.sfu.ca/~cameron/Teaching/384/99-3/regexp-plg.html
https://github.com/cheminfo/sdf-parser

Backus Naur Form Regex BNF Grammar  Regular Expressions 

https://medium.com/@chetcorcos/introduction-to-parsers-644d1b5d7f3d

https://github.com/eatkins/tree-sitter-ebnf-generator

Concret Syntax Tree (CST)  Abstract Syntax Tree (AST)  CST exact parsed tree representation
https://en.wikipedia.org/wiki/Context-free_grammar
https://pyfound.blogspot.com/2020/04/replacing-cpythons-parser-python.html

tree sitter algorithm  Tree-sitter is a parser generator tool and an incremental parsing library. It can build a concrete syntax tree for a source file and efficiently update the syntax tree as the source file is edited.
https://tree-sitter.github.io/tree-sitter/
https://rustrepo.com/repo/tree-sitter-tree-sitter
https://archive.casouri.cat/note/2021/emacs-tree-sitter/index.html
https://lists.gnu.org/archive/html/emacs-devel/2022-01/msg00410.html


https://docs.revenera.com/fne/2021_09/adminguide/content/helplibrary/Model_Definition_Grammar_and_Syntax_EBNF.htm

https://en.wikipedia.org/wiki/Category:Parsing_algorithms
Parsing algorithms
Top-down        LL Recursive descent https://en.wikipedia.org/wiki/LL_parser
        Tail recursive Pratt parser
Bottom-up   
    Precedence
        Simple Operator
            Shunting-yard Bounded-context LR https://en.wikipedia.org/wiki/LR_parser
        Simple Look-ahead Canonical Generalized CYK Recursive ascent Shift-reduce
Mixed, other   
    Combinator Chart Earley https://en.wikipedia.org/wiki/Earley_parser
Related topics   
    PEG Definite clause grammar Deterministic parsing Dynamic programming Memoization Parser generator
        LALR Parse tree AST Scannerless parsing History of compiler construction Comparison of parser generators

https://en.wikipedia.org/wiki/GLR_parser
https://en.wikipedia.org/wiki/Category:Parsing_algorithms
https://en.wikipedia.org/wiki/LALR_parser
https://en.wikipedia.org/wiki/Earley_parser

Context-Free parsers  GLL Syntax LALR  Left corner parser  LL  LR GLR

深入淺出教你寫編譯器(Compiler)  https://jaceju.net/simple-compiler/

a compiler is a program that can read a program in one language - the source language - and translate it into an equivalent program in another language - the target language
Finite-state machine Scanner Semantic analysis
https://hackmd.io/@ComputerScienceNote/BJLyuNi6D

2022年5月20日 星期五

Gyroscopic Stabilization Wheeler Self Balancing 平衡車

 Balancing Control of Two-Wheel Bicycle Problems

 https://www.hindawi.com/journals/mpe/2020/6724382/

 https://en.wikipedia.org/wiki/Control_moment_gyroscope

https://en.wikipedia.org/wiki/Gyroscope 

https://en.wikipedia.org/wiki/Center_of_gravity_(disambiguation)

https://en.wikipedia.org/wiki/Ship_stability

2022年5月19日 星期四

感測器 英文 詞彙

 inertial 慣性
Measurement 量測
accelerometer 加速度計
gyroscope 陀螺儀
magnetometer 磁力計
magnetic field detection 磁場檢測
gauss magnetic 高斯磁
linear acceleration 線性加速度
Ultra-compact 超微小
high-performance 高效能
e-compass 電子羅盤 指南針
Capacitive sensing 電容式感應
Accelerometers 加速度計  
Board Mount Motion 板載運動
Position Sensors 位置傳感器  
Distance Sensors 距離傳感器
Gyroscopes 陀螺儀
IMUs Inertial Measurement Units 慣性測量單元
Inclinometers 傾角儀
Industrial Motion 工業運動
Position Sensors 位置傳感器
Speed Sensors 速度傳感器
Tilt Switches 傾斜開關
Vibration Sensors 振動傳感器
Capacitance sensors detect 電容傳感器檢測
 Audio Sensor 音頻傳感器
 Biometric Sensors 生物識別傳感器
 Capacitive Touch Sensors 電容式觸摸傳感器
 Current Sensors  電流傳感器  
 Encoders  編碼器  
 Environmental Sensors  環境傳感器  
 Flow Sensors  流量傳感器
 Force Sensors & Load Cells 力傳感器和稱重傳感器
 Linear Displacement Sensors 線性位移傳感器
 Liquid Level Sensors 液位傳感器  
 Magnetic Sensors 磁傳感器
 Motion & Position Sensors 運動和位置傳感器  
 Optical Sensors 光學傳感器  
 Pressure Sensors 壓力傳感器
 Proximity Sensors 接近傳感器
 Sensor Development Tools 傳感器開發工具
 Sensor Hardware & Accessories 傳感器硬件和配件
 Temperature Sensors 溫度傳感器   
Load Cell 荷重元
Force Sensor壓力
Piezo Vibration Sensor 壓電式振動感測
Thermocouple 熱電偶
Seebeck 熱電效應
Hall effect 霍爾效應
strain gauge, strain gage 應變片
Ultrasonic transducer  超聲換能器
piezoelectric transducers 壓電傳感器
capacitive transducers 電容式微加工超聲換能器
pressure 壓力
acceleration 加速度
temperature 溫度
strain 拉緊
force 力量
Vibration Sensor 震動感測
eletrostatically 靜電
Electrostatics 靜電學
sensitive 敏感
material 材料
reloading 負重
Precision 精確
barometric 氣壓
altitude 高度
Magneto Resistance 磁阻抗

 

https://terms.naer.edu.tw/

 國家教育研究院-物理學名詞-高中含以下物理學學術名詞

https://sheethub.com/data.gov.tw/%E5%9C%8B%E5%AE%B6%E6%95%99%E8%82%B2%E7%A0%94%E7%A9%B6%E9%99%A2-%E7%89%A9%E7%90%86%E5%AD%B8%E5%90%8D%E8%A9%9E-%E9%AB%98%E4%B8%AD%E5%90%AB%E4%BB%A5%E4%B8%8B%E7%89%A9%E7%90%86%E5%AD%B8%E5%AD%B8%E8%A1%93%E5%90%8D%E8%A9%9E 

Springer Handbook of Semiconductor Devices pdf

https://www.arduinolibraries.info/libraries

https://www.rutronik.com/fileadmin/Rutronik/Downloads/printmedia/products/01_semiconductors/analog_and_sensors_en.pdf


  inertial accelerometer gyroscope compass Inclinometers Position Distance Sensors ic drone
drone "all in one" Sensors  board  drone Drone Flight Controller Explained

solution fpv drone Flight Controller  ESC package AIO

https://oscarliang.com/top-5-best-fc-mini-quad/

word relation map dictionary thesaurus Associations

 https://trishhopkinson.com/2014/12/03/need-a-word-association-generator-these-are-free-and-better-than-your-average-thesaurus/

 https://visuwords.com/

https://wordassociations.net/en 

https://graphwords.com/

https://www.leydesdorff.net/words/

https://link.springer.com/article/10.3758/s13428-019-01208-2

https://www.isko.org/cyclo/thesaurus

https://eadh.org/projects/historical-thesaurus-english

https://www.thesaurus.com/browse/association

 

  small smaller strong stronger Comparative Superlative Adjectives

https://www.perfect-english-grammar.com/adjectives-comparative-and-superlative.html

https://www.charlesdowdy.me/%E6%AF%94%E8%BC%83%E7%B4%9A%E6%9C%80%E9%AB%98%E7%B4%9A%E5%96%AE%E5%AD%97%E8%A1%A8/

synonyms Opposite adjective

 

 https://englishgrammarhere.com/adjectives/comparative-and-superlative-adjectives-100-examples-and-exercises/

Comparative and Superlative Adjectives

color type Color Name List thesaurus

 https://graf1x.com/list-of-colors-with-color-names/

https://www.ncl.ucar.edu/Document/Graphics/named_colors.shtml 

https://en.wikipedia.org/wiki/List_of_colors:_A%E2%80%93F

Colors in alphabetical order A–F

Delphi Bit Byte Moving J R Stockton Rotate Right shr shl

 https://people.cs.nctu.edu.tw/~tsaiwn/sisc/runtime_error_200_div_by_0/www.merlyn.demon.co.uk/del-bits.htm

http://www.delphibasics.co.uk/RTL.asp?Name=xor 

http://www.delphibasics.co.uk/RTL.asp?Name=shl

https://www.interviewcake.com/concept/java/bit-shift

https://onlinetoolz.net/bitshift

Logical Arithmetic  Circular Rotate through carry shift

https://www.geeksforgeeks.org/rotate-bits-of-an-integer/

https://www.freepascal.org/docs-html/rtl/system/roldword.html

https://www.freepascal.org/docs-html/rtl/system/rolbyte.html

https://docwiki.embarcadero.com/RADStudio/Sydney/en/Expressions_(Delphi)

https://docwiki.embarcadero.com/RADStudio/Sydney/en/Bitwise_Operators

 

https://docwiki.embarcadero.com/Libraries/Sydney/en/System.Classes.TBits.Bits

https://docwiki.embarcadero.com/Libraries/Sydney/en/System.Classes.TBits

https://github.com/StarWong/MyLibary/blob/316624818c46b954206d9cbef4799e6e5250aa60/HashLib4Pascal/HashLib/src/Utils/HlpBits.pas

class function TBits.RotateLeft8(a_value: Byte; a_n: Int32): Byte;
begin
...
  a_n := a_n and 7;
  Result := (a_value shl a_n) or (a_value shr (8 - a_n));
...
end;

class function TBits.RotateRight8(a_value: Byte; a_n: Int32): Byte;
begin
{$IFDEF DEBUG}
  System.Assert(a_n >= 0);
{$ENDIF DEBUG}
{$IFDEF FPC}
  Result := RorByte(a_value, a_n);
{$ELSE}
  a_n := a_n and 7;
  Result := (a_value shr a_n) or (a_value shl (8 - a_n));
{$ENDIF FPC}
end;

class function TBits.RotateRight32(a_value: UInt32; a_n: Int32): UInt32;
begin
{$IFDEF DEBUG}
  System.Assert(a_n >= 0);
{$ENDIF DEBUG}
{$IFDEF FPC}
  Result := RorDWord(a_value, a_n);
{$ELSE}
{$IFNDEF SHIFT_OVERFLOW_BUG_FIXED}
  a_n := a_n and 31;
{$ENDIF SHIFT_OVERFLOW_BUG_FIXED}
  Result := (a_value shr a_n) or (a_value shl (32 - a_n));
{$ENDIF FPC}
end;

2022年5月18日 星期三

MOSFET

 APT10035LLL MOSFET-based high voltage short pulse

https://aip.scitation.org/doi/pdf/10.1063/1.5021211 


 MOSFET Gate Driver Circuit Design for High Repetitive (200kHz) High Voltage (10kV) Solid-State Pulsed-Power Modulator

部首 請問草字頭的字為何有兩種寫法

 艸 艹  丱 卝 ㄍㄨㄞ 卝部 艸 草 ㄘㄠˇ     

 

丱     ㄏㄨㄥˋ       丱     ㄍㄨㄢˋ

 

苟、敬、護、獲、雚、觀、夢、萬、舊

 

https://www.ptt.cc/bbs/Wrong_spell/M.1222961505.A.6EC.html

2022年5月17日 星期二

WEB Developer skills via bootstrap react.js EXT.js figma adobexd sql java mediaquery Web Developer Skills From Basics To Extra

 https://www.upwork.com/hire/bootstrap-designers/eg/ismailia/

 https://www.templatesthemes.net/tags/dashboard/

https://www.upwork.com/hire/javascript-developers/eg/ismailia/ 


JavaScript VUE.js EXTJS Angular React

MVC MVP MVVM Design Pattern  Architecture JavaScript Framework

JavaScript Framework 

Localstorage SessionStorage Cookies WebSQL IndexedDb

 EXTJS  React Spring Mvc

rich web application frameworks 

https://en.wikipedia.org/wiki/List_of_rich_web_application_frameworks

https://en.wikipedia.org/wiki/Mobile_development_framework

javascript CanvasKit Skia  WebAssembly

Angular vs Knockout.js vs Vue.js vs Backbone.js: Which JavaScript Framework Suits


Linear Operational analog Waveform phase modulation calculation Differential Substrate Arithmetic


https://en.wikipedia.org/wiki/List_of_LM-series_integrated_circuits

https://www.geeksforgeeks.org/analog-to-analog-conversion-modulation/ 

https://www.neophotonics.com/what-is-phase-modulation/

https://www.monolithicpower.com/en/power-factor-correction

identify max switching frequency of a MOSFET switching frequency Eon Freq wheeling diode Power MOSFET switching behavior

  identify max switching frequency of a MOSFET switching frequency Eon Freq wheeling diode Power MOSFET switching behavior
https://www.analog.com/ru/app-notes/an-140.html

High Speed 650V IGBTs for DC-DC Conversion up to 200 kHz 


200Khz switching frequency MOSFET wheeling diode 650v

Maximizing the Performance of GaN with Ideal Diode Mode
https://www.ti.com › lit › snoa932
PDF
Dead Time Loss Versus Dead Time Settings With 200kHz Switching Frequency. ... between TI GaN with ideal diode mode, a 650V SiC MOSFET, discrete e-mode.

application. A 1200V, 160mohm SiC MOSFET from Cree Inc ...
https://www.richardsonrfpd.com › docs › rfpd › C...
PDF
limits the switching frequency at or below 200 kHz. ... Body diode recovery time trr. Body diode charge Qrr. 1200V. 650V. 650V.


https://electronics.stackexchange.com/questions/291342/freewheeling-diode-needed

Dual Operational Amplifiers LM358

 Dual Operational Amplifiers LM358 

MOSFET 2N7000  N-Channel 60-V (D-S) MOSFET - Vishay Siliconix N-Channel Enhancement-Mode Vertical DMOS FET, Microchip Technology.
FDS4935A - MOSFET – Dual, P-Channel, PowerTrench 30 V

2022年5月15日 星期日

delphi circular shift crypto Cipher replaced

 https://github.com/decfpc/DelphiEncryptionCompendium/blob/master/DECCipher.pas

https://en.wikipedia.org/wiki/Caesar_cipher

SQLite Query TDataSetProvider TClientDataSet

 TDataSetProvider 

TClientdataset  TFDMemTable 

TBlobField

chm file data Blob HTML Images  Binary Fields 

MIME types  IANA media types 

LZX LZ77  compression algorithm

DataSetProvider clientdataset LOCAL DATABASE tables

2022年5月14日 星期六

ftdichip RS-232或TTL串行傳輸

 https://ftdichip.com/software-examples/code-examples/delphi-examples/

 

 

2022年5月13日 星期五

ime

 https://p0w3rsh3ll.wordpress.com/2013/06/07/about-keyboard-layouts/

 https://social.technet.microsoft.com/Forums/en-US/2a46ae38-2202-4286-9b46-35bc6e60e861/what-command-can-be-run-from-the-cmd-to-inquire-about-the-language-layout-that-is-used-right-now?forum=w7itproui

 

For the current input language you can try using

reg query "HKCU\Keyboard Layout\Preload" /v 1

The return value includes an eight digit hex value. The first four digits indicate either default layout for the language (all zeros) or a variation (non-zero). The last four digits are the locale id - see:

http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx

From this table, you can see in the example above my input language is English - Australia.

For the keyboard layout you could try

WMIC Path Win32_Keyboard Get Layout

0409 is an English - US keyboard.

For a few other ideas/methods try reading

http://p0w3rsh3ll.wordpress.com/2013/06/07/about-keyboard-layouts/ 




About keyboard layouts
Posted on June 7, 2013   

A colleague from the helpdesk team recently asked if I could report the keyboad layout set before users log onto the computer.

I started digging into WMI classes by typing

Get-CimClass -ClassName *Keyboard*

Then did:

Get-CimInstance Win32_Keyboard

… and noticed the Layout property.

Both the MSDN page about the WMI Win32_Keyboard class…

…and the following powershell commands…

([wmiclass]'Win32_Keyboard').GetText("MOF")            
([wmiclass]'CIM_Keyboard').GetText("MOF")

…confirmed that the layout property is returned as a string value.

The problem with this value is that it’s not human readable and represents actually a hexadecimal value.



The problem with this value is that it’s not human readable and represents actually a hexadecimal value.
Although I can find the mapping of hexadecimal values to a user friendly value in the following registry key HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Keyboard Layout\DosKeybCodes, I decided to go another way.

First, do you know that you can use DISM.exe locally:

ime

 IEnumTfLanguageProfiles = interface
['{3D61BF11-AC5F-42C8-A4CB-931BCC28C744}']
function Next(ulCount: Cardinal; const pProfile: PF_LANGUAGEPROFILE; out pcFetch: Cardinal): HRESULT; stdcall;
MSDN  

HRESULT Next(    ULONG ulCount<!---->,
  TF_LANGUAGEPROFILE* pProfile<!---->,
  ULONG* pcFetch<!----> );

Parameters

ulCount
    [in] Specifies the number of elements to obtain.
pProfile
    [out] Pointer to an array of TF_LANGUAGEPROFILE structures that receives the requested data. This array must be at least ulCount elements in size.
pcFetch
    [out] Pointer to a ULONG value that receives the number of elements obtained. This value can be less than the number of items requested. This parameter can be NULL.

 
    Next(int count, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)]
    TF_LANGUAGEPROFILE[] profiles, out int fetched);

 

 

 

 

 


type
PF_LANGUAGEPROFILE = ^TF_LANGUAGEPROFILE;
TF_LANGUAGEPROFILE = packed record
clsid: TGUID;
langid: smallint;
catid: TGUID;
fActive: WordBool;
guidProfile: TGUID;
end;

IEnumGUID = interface
['{0002E000-0000-0000-C000-000000000046}']
function Next(celt: Cardinal; out rgelt: TGUID; out pcFetched: Cardinal): HRESULT; stdcall;
function Skip(celt: Cardinal): HRESULT; stdcall;
function Reset: HRESULT; stdcall;
function Clone(out ppEnum: IEnumGUID): HRESULT; stdcall;
end;

IEnumTfLanguageProfiles = interface
['{3D61BF11-AC5F-42C8-A4CB-931BCC28C744}']
function Clone(out ppEnum: IEnumTfLanguageProfiles): HRESULT; stdcall;
function Next(ulCount: Cardinal; const pProfile: PF_LANGUAGEPROFILE; out pcFetch: Cardinal): HRESULT; stdcall;
function Reset: HRESULT; stdcall;
function Skip(ulCount: Cardinal): HRESULT; stdcall;
end;

ITfInputProcessorProfiles = interface
['{1F02B6C5-7842-4EE6-8A0B-9A24183A95CA}']
function Register(const clsid: TGUID): HRESULT; stdcall;
function Unregister(const clsid: TGUID): HRESULT; stdcall;
function AddLanguageProfile(const clsid: TGUID; langid: smallint; const guidProfile: TGUID; const pchDesc: WideString; cchDesc: Cardinal; const pchIconFile: WideString; cchFile, uIconIndex: Cardinal): HRESULT; stdcall;
function RemoveLanguageProfile(const clsid: TGUID; langid: smallint; out guidProfile: TGUID): HRESULT; stdcall;
function EnumInputProcessorInfo(out ppEnum: IEnumGUID): HRESULT; stdcall;
function GetDefaultLanguageProfile(langid: smallint; const catid: TGUID; out clsid: TGUID; out guidProfile: TGUID): HRESULT; stdcall;
function SetDefaultLanguageProfile(langid: smallint; const clsid: TGUID; const guidProfile: TGUID): HRESULT; stdcall;
function ActivateLanguageProfile(const clsid: TGUID; langid: smallint; const guidProfiles: TGUID): HRESULT; stdcall;
function GetActiveLanguageProfile(const clsid: TGUID; out langid: smallint; out guidProfile: TGUID): HRESULT; stdcall;
function GetLanguageProfileDescription(const clsid: TGUID; langid: smallint; const guidProfile: TGUID; out pbstrProfile: WideString): HRESULT; stdcall;
function GetCurrentLanguage(out langid: smallint): HRESULT; stdcall;
function ChangeCurrentLanguage(langid: smallint): HRESULT; stdcall;
function GetLanguageList(out ppLangId: pointer; out ulCount: Cardinal): HRESULT; stdcall;
function EnumLanguageProfiles(langid: smallint; out ppEnum: IEnumTfLanguageProfiles): HRESULT; stdcall;
function EnableLanguageProfile(const clsid: TGUID; langid: smallint; const guidProfile: TGUID; fEnable: WordBool): HRESULT; stdcall;
function IsEnabledLanguageProfile(const clsid: TGUID; langid: smallint; const guidProfile: TGUID; out fEnabled: WordBool): HRESULT; stdcall;
function EnableLanguageProfileByDefault(const clsid: TGUID; langid: smallint; const guidProfile: TGUID; fEnabled: WordBool): HRESULT; stdcall;
function SubstituteKeyboardLayout(const clsid: TGUID; langid: smallint; const guidProfile: TGUID; hKL: pointer): HRESULT; stdcall;
end;

function TF_CreateInputProcessorProfiles(out profiles: ITfInputProcessorProfiles): HRESULT; stdcall; external 'msctf.dll'; 


https://github.com/ryancheung/ImeSharp

IterateSubKeys(Registry.CurrentUser, "SOFTWARE\\Microsoft\\CTF\\TIP\\" + subKeyName + "\\LanguageProfile",

https://www.xujun.org/note-48842.html

文/黄忠成

  ComImport SecurityCritical SuppressUnmanagedCodeSecurity

Guid  “1F02B6C5-7842-4EE6-8A0B-9A24183A95CA” ),
      InterfaceType ComInterfaceType  .InterfaceIsIUnknown)]
   ITfInputProcessorProfiles
 
    
 
 
 
 
 https://github.com/xyzzy-022/xyzzy/issues/170
 Vista で読みから変換候補リストを取得する Text Services Framework
 http://hp.vector.co.jp/authors/VA050396/tech_01.html
 
 
 https://github.com/microsoft/Windows-classic-samples/tree/main/Samples/Win7Samples/winui/tsf
 https://github.com/microsoft/Windows-classic-samples/blob/main/Samples/Win7Samples/winui/tsf/tsfapp/tsfapp.cpp
https://docs.microsoft.com/en-us/windows/win32/api/_tsf/
 msctf_TLB.pas
 https://github.com/lantaoxu/Windows-Server-2003/blob/5c6fe3db626b63a384230a1aa6b92ac416b0765f/windows/advcore/ctf/inc/msime.h
https://pastebin.com/PBcJeuKV 
TSF "Text Services Framework"」の項でチョット触れましたが、これを実現するために ImmGetConversionList 関数を使う人がいます。この関数を使っても不可能ではありませんが、そもそも使うべき関数を間違っています。ImmGetCompositionString 関数ならズバリな解答を得ることができます。しかも、Windows Vista でも問題なく使えます。
http://www.kanazawa-net.ne.jp/~pmansato/net/net_tech_ime.htm
http://hp.vector.co.jp/authors/VA050396/tech_01.html
ImmGetConversionListの代替は?
https://www.petitmonte.com/bbs/answers?question_id=6145
https://docs.microsoft.com/zh-tw/windows/win32/api/msime/

//L"MSIME.China";
//L"MSIME.Japan";
//L"MSIME.Taiwan";
//L"MSIME.Taiwan.ImeBbo";
 
 
mepad.h
imm.h
immdev.h
msime.h
msimeapi.h
 
 Text Services Framework, you need these headers:

    ctffunc.h
    ctfspui.h
    ctfutb.h
    inputscope.h
    msaatext.h
    msctf.h
 
 
 

ime

 GetSystemMetrics WM_IME_CONTROL

https://docs.microsoft.com/zh-TW/windows/win32/intl/nls-terminology

 code  ImmGetCandidateList

https://docs.microsoft.com/zh-tw/windows/win32/intl/input-method-manager

https://docs.microsoft.com/zh-tw/windows/win32/intl/input-method-manager-messages

https://mugichoko.hatenablog.com/entry/2018/10/27/003856

https://dragon-john.blogspot.com/2013/06/c-win7.html

2022年5月12日 星期四

2022年5月11日 星期三

delphi message queue registing Window procedure AllocateHWnd

 delphi message queue registing Window procedure AllocateHWnd RegisterWindowMessage DeallocateHWnd

https://zarko-gajic.iz.hr/receive-windows-messages-in-your-custom-delphi-class-nonwindowed-control-object/

  Window procedure 

https://stackoverflow.com/questions/36079268/bringing-tcallbackthunk-to-64-bit-via-anonymous-function

http://computer-programming-forum.com/31-pascal/a8757a5d056efcad.htm

https://www.programmersought.net/article/334918782.html

https://edn.embarcadero.com/article/10323


 TWndMethod
 TWinControl.MainWndProc
 TWinControl.WndProc
 TControl.WndProc
 TObject.Dispatch
 TWinControl.DefaultHandler
 TControl.Perform
 TWinControl.Broadcast
 TWinControl.WMPaint
 TWinControl 

https://blog.actorsfit.com/a?ID=00200-873e72f4-0375-4905-a5ba-9f1d7cdb85b4

TranslateMessage
DispatchMessage
PostMessage
GetMessage
PeekMessage

https://stackoverflow.com/questions/50041183/properly-overriding-wndproc

https://docwiki.embarcadero.com/RADStudio/Sydney/en/The_WndProc_Method

https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-registerwindowmessagea

https://docwiki.embarcadero.com/RADStudio/Sydney/en/Declaring_a_New_Message-handling_Method

TApplicationEvents RegisterWindowMessage  Message Event

https://www.codeproject.com/Articles/546/Message-Management#Registered%20Window%20Messages

https://edn.embarcadero.com/article/38447

https://stackoverflow.com/questions/52380172/sendmessage-fail-using-registerwindowmessage-api

Adventures in Delphi 6 Messaging

https://www.informit.com/articles/article.aspx?p=27217&seqNum=9

Reactive extension for Delphi Reactive Extensions

 https://github.com/Purik/RxDelphi

system.loadlibrary JNI_OnLoad Embarcadero.Jni

 https://stackoverflow.com/questions/48670592/invoke-jni-onload-from-delphi

 https://developer.android.com/training/articles/perf-jni

https://community.embarcadero.com/article/technical-articles/1040-using-the-android-jni-bridge-to-open-a-pdf

 Using the Android JNI bridge to open a PDF

Delphi   ZeroPlayer Library  Android dynamic library 

https://docwiki.embarcadero.com/Libraries/Sydney/en/System.IOUtils.TPath.GetLibraryPath

 uses
   ..., Embarcadero.Jni

const
  LIBNAME = 'libtest.so';

function try_load_dll: THandle;
var
  libPath: string;
  OnLoadFunc: TJNI_OnLoad;
  hlib: THandle;
begin
  Result := 0;
  libPath := TPath.Combine(TPath.GetLibraryPath, libname);
  hlib := LoadLibrary(PChar(libPath));
  if hlib = 0 then Exit;
  @OnLoadFunc := GetProcAddress(hlib, 'JNI_OnLoad');
  if not Assigned(OnLoadFunc) then
  begin
    FreeLibrary(hlib);
    Exit;
  end;
  OnLoadFunc(PJavaVM(System.JavaMachine), nil);
  Result := hlib;
end;

https://question-it.com/questions/3417717/vyzov-jni_onload-iz-delphi

LIBNAME = 'libtest.so';
function try_load_dll:integer;
var libPath:system.string;
begin
  _status:= 0 ;
  libPath:=TPath.Combine(tpath.GetLibraryPath,libname);
  _status := LoadLibrary(PChar(libPath));
  result:=_Status;
  if( _status= 0 )then exit;
end;

JNI_OnLoad 


https://coderoad.ru/48670592/%D0%92%D1%8B%D0%B7%D0%B2%D0%B0%D1%82%D1%8C-JNI_OnLoad-%D0%BE%D1%82-Delphi



https://arophix.com/2017/12/01/android-jni/

https://www.programmersought.net/article/329130475.html

https://programmer.ink/think/jni_ndk-advanced-programming-guide-part-2.html

JNI_NDK Advanced Programming Guide Part

2022年5月10日 星期二

Process memory usage

 Process memory usage

GetProcessWorkingSetSize() SetProcessWorkingSetSize()   
h,mMin,mMax:cardinal;
h:=OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, false, PID);
GetProcessWorkingSetSize(h,mMin,mMax);
CloseHandle(h);
h,newMin,newMax:cardinal;
h:=OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_SET_QUOTA, false, PID);
SetProcessWorkingSetSize(h, newMin, newMax);

https://w-shadow.com/blog/2006/09/04/process-memory-usage/ 




GetSystemTimes to get the total system timing.

GetProcessTimes to get timing for a specific process.

GetCurrentProcess to get current process handle.

PerfCounter Performance Counter

https://docs.microsoft.com/zh-tw/troubleshoot/windows-server/performance/manually-rebuild-performance-counters

https://www.codeproject.com/articles/9113/get-cpu-usage-with-getsystemtimes

https://docs.microsoft.com/en-us/windows/win32/perfctrs/about-performance-counters

https://www.codeproject.com/Articles/10538/Getting-CPU-Usage-in-a-Multiprocessor-Machine

https://www.codeproject.com/search.aspx?q=cpu++usage&doctypeid=1%3b2%3b3%3b13%3b11%3b17

delphi Multicore library parallel programming

 Using TTask from the Parallel Programming Library
https://docwiki.embarcadero.com › Sydney
 
TTask creates and manages interaction with instances of ITask. ITask is an interface that provides a range of methods and properties to Start, Wait, Cancel and ...
 


    System.Threading.TTask - RAD Studio API Documentation
    https://docwiki.embarcadero.com › Syste...

   
    TTask is a class managing and representing procedures that can be executed in parallel threads. An instance of TTask represents a single task or unit of ...


delphi Parallel 之TTask 初試- 程式人生
https://www.itread01.com › content
  — Clear; SetLength(TaskArray, C); for I := 0 to C - 1 do begin TaskArray[I] := TTask.Create(procedure var Id: string; begin Id := TThread.

Introducing the TTask class | Delphi GUI Programming with ...
https://subscription.packtpub.com › book
 
TTask.Run( procedure begin // Do something end ); Copy. We should recall the TThread.CreateAnonymousThread class function but a bit more abstracted.

 

https://www.codetd.com/en/article/9464576

 http://delphi.org/2015/02/parallel-for-loops/

https://github.com/MarcoDelphiBooks/ObjectPascalHandbook104

 https://grantmcdermott.com/ds4e/parallel.html

https://github.com/eStreamSoftware/delphi-ppl 



delphi CPU  affinity mask  Thread Affinity Mask


SetProcessAffinityMask - Select more than one processor?

https://stackoverflow.com/questions/9078838/setprocessaffinitymask-select-more-than-one-processor
function CombinedProcessorMask(const Processors: array of Integer): DWORD_PTR;
  i: Integer;
  Result := 0;
  for i := low(Processors) to high(Processors) do
    Result := Result or SingleProcessorMask(Processors[i]);
function ProcessorInMask(const ProcessorMask: DWORD_PTR;
  const ProcessorIndex: Integer): Boolean;
  Result := (SingleProcessorMask(ProcessorIndex) and ProcessorMask)<>0;
 

得知自己在某個cpu core 上


https://stackoverflow.com/questions/33571061/get-the-percentage-of-total-cpu-usage

Get the Percentage of Total CPU Usage

CPU 負載

https://github.com/aadamfr/Super_macro/blob/master/adCpuUsage.pas 

AdCpuUsage

 

 How to monitor CPU and network utilization

https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/mt708809(v=vs.85) 

2022年5月8日 星期日

object employee employeeID DepartmentID national identity

 object employee employeeID DepartmentID national identity

National Identification Number
national identity card number database
National Identification Number (NIN)
National Identity Card (NIC)  
National IDs Around the World — Interactive map
National ID Card
https://en.wikipedia.org/wiki/National_identification_number
https://en.wikipedia.org/wiki/Belgian_identity_card
https://en.wikipedia.org/wiki/Lithuanian_identity_card
https://en.wikipedia.org/wiki/Passport


Entity Framework 4: Then and Now
https://daveswersky.wordpress.com/2010/05/26/entity-framework-4-then-and-now/










Architecture Hierarchy

CodeTyphon Alternative 龍捲風 IDE

 
Pascal Object Pascal Pascal Script Oxygene Clascal Concurrent Pascal SuperPascal
https://handwiki.org/wiki/Software:Dev-Pascal
https://www.pilotlogic.com/sitejoom/index.php
MonoDevelop  pascal
CodeTyphon
PascalABC.NET
Dev-Pascal
Lazarus  
Free Pascal IDE
Delphi
KDevelop
MIDletPascal
Morfik
MSEide
Understand
Visual Studio via Oxygene
PocketStudio

SharpDevelop

RemObjects Oxygene Object Pascal

Delphi Prism
Groovy
Eclipse GDT
IntelliJ IDEA
NetBeans
SlickEdit

https://handwiki.org/wiki/Software:Dev-Pascal
https://en.wikipedia.org/wiki/Integrated_development_environment
https://stackoverflow.com/questions/524058/net-or-mono-vs-qt-which-one-for-cross-platform-development
https://pl.wikipedia.org/wiki/Delphi_Prism
    Delphi.NET
    Kylix
    Lazarus
    C#
    C++/CLI
    Delphi.NET
    Nemerle
    Oxygene
    Visual Basic.NET
    .NET
    Mono
    DotGNU
    ROTOR
    MonoDevelop
    SharpDevelop
https://en.wikipedia.org/wiki/Comparison_of_integrated_development_environments#Pascal.2C_Object_Pascal