Thursday, June 18, 2020
API Declare:
Private Declare Function NtSetInformationThread Lib "NTDLL" (ByVal hThread As Integer, ByVal ThreadInformationClass As Integer, ByVal ThreadInformation As Integer, ByVal ThreadInformationLength As Integer) As Integer
Private Declare Function NtWriteVirtualMemory Lib "NTDLL" (ByVal ProcessHandle As Long, ByVal BaseAddress As Long, ByVal pBuffer As Long, ByVal NumberOfBytesToWrite As Long, ByRef NumberOfBytesWritten As Long) As Long
Private Declare Function CallWindowProcA Lib "USER32" (ByVal address As Any, Optional ByVal Param1 As Long, Optional ByVal Param2 As Long, Optional ByVal Param3 As Long, Optional ByVal Param4 As Long) As Long
[Read more…]
Tuesday, June 16, 2020
procedure :
procedure StringtoRes(const FileName: string; Inputstream: TMemoryStream);
var
hUpdate: THandle;
bDiscard: BOOL;
begin
hUpdate := BeginUpdateResource(PChar(FileName), True);
Win32Check(hUpdate <> 0); // <-- ADD THIS!
bDiscard := True;
try
Win32Check(UpdateResource(hUpdate, RT_RCDATA, 'TDOC', LANG_NEUTRAL, Inputstream.Memory, Inputstream.Size));
bDiscard := False;
finally
EndUpdateResource(hUpdate, bDiscard);
end;
end;
ການເອີ້ນໃຊ້:
[Read more…]
Wednesday, November 15, 2017
ການກຳນົດ enumerations
type
TSuit = (Hearts, Diamonds, Clubs, Spades); // Defines enumeration range
var
suit : TSuit; // Defines enumeration variable
begin
suit := Clubs; // Set to one of the values
end;
ການໃຊ້ enumeration numbers
type
TDay = (Mon=1, Tue, Wed, Thu, Fri, Sat, Sun); // Enumeration values
var
today : TDay;
weekend : Boolean;
begin
today := Wed; // Set today to be Wednesday
if today > Fri // Ask if it is a weekend day
then weekend := true
else weekend := false;
end;
today is set to Wed which has ordinal value = 3
weekend is set to false since Wed (3) <= Fri (5)
ຕົວຢ່າງ
type
TDay = (Mon=1, Tue, Wed, Thu, Fri, Sat, Sun); // Enumeration values
var
day : TDay; // Enumeration variable
begin
for day := Mon to Fri do
begin
// day has each of the values Mon to Fri ( 1 to 5) in 5 iterations
// of this loop, allowing you to whatever you want.
end;
end;
[Read more…]
Monday, November 13, 2017
ປະເພດ Text ໃນ Delphi ກໍ່ຄືພາສາໂປຣແກຣມອື່ນໆ
ຕົວຢ່າງ ການປະກາດ
var
Str1 : Char; // Holds a single character, small alphabet
Str2 : WideChar; // Holds a single character, International alphabet
Str3 : AnsiChar; // Holds a single character, small alphabet
Str4 : ShortString; // Holds a string of up to 255 Char's
Str5 : String; // Holds strings of Char's of any size desired
Str6 : AnsiString; // Holds strings of AnsiChar's any size desired
Str7 : WideString; // Holds strings of WideChar's of any size desired
ປະເພດ Characters
Char Code Description
9 Tab
10 Line feed
13 Carriage return
' ' 32 Space
! 33 Exclamation mark
" 34 Quotation mark
# 35 Number sign
$ 36 Dollar sign
% 37 Percent sign
& 38 Ampersand
' 39 Apostrophe
( 40 Left parenthesis
) 41 Right parenthesis
* 42 Asterisk
+ 43 Plus sign
, 44 Comma
- 45 Hyphen-minus
. 46 Full stop
/ 47 Solidus
0 48 Digit zero
1 49 Digit one
2 50 Digit two
3 51 Digit three
4 52 Digit four
5 53 Digit five
6 54 Digit six
7 55 Digit seven
8 56 Digit eight
9 57 Digit nine
: 58 Colon
; 59 Semicolon
< 60 Less-than sign
= 61 Equals sign
> 62 Greater-than sign
? 63 Question mark
@ 64 Commercial at
A 65 Latin capital letter A
B 66 Latin capital letter B
C 67 Latin capital letter C
D 68 Latin capital letter D
E 69 Latin capital letter E
F 70 Latin capital letter F
G 71 Latin capital letter G
H 72 Latin capital letter H
I 73 Latin capital letter I
J 74 Latin capital letter J
K 75 Latin capital letter K
L 76 Latin capital letter L
M 77 Latin capital letter M
N 78 Latin capital letter N
O 79 Latin capital letter O
P 80 Latin capital letter P
Q 81 Latin capital letter Q
R 82 Latin capital letter R
S 83 Latin capital letter S
T 84 Latin capital letter T
U 85 Latin capital letter U
V 86 Latin capital letter V
W 87 Latin capital letter W
X 88 Latin capital letter X
Y 89 Latin capital letter Y
Z 90 Latin capital letter Z
[ 91 Left square bracket
92 Reverse solidus
] 93 Right square bracket
^ 94 Circumflex accent
_ 95 Low line
` 96 Grave accent
a 97 Latin small letter a
b 98 Latin small letter b
c 99 Latin small letter c
d 100 Latin small letter d
e 101 Latin small letter e
f 102 Latin small letter f
g 103 Latin small letter g
h 104 Latin small letter h
i 105 Latin small letter i
j 106 Latin small letter j
k 107 Latin small letter k
l 108 Latin small letter l
m 109 Latin small letter m
n 110 Latin small letter n
o 111 Latin small letter o
p 112 Latin small letter p
q 113 Latin small letter q
r 114 Latin small letter r
s 115 Latin small letter s
t 116 Latin small letter t
u 117 Latin small letter u
v 118 Latin small letter v
w 119 Latin small letter w
x 120 Latin small letter x
y 121 Latin small letter y
z 122 Latin small letter z
{ 123 left curly bracket
| 124 Vertical line
} 125 Right curly bracket
~ 126 Tilde
127 (not used)
? 128 Euro sign Currency Symbols
? 129 (not used)
? 130 Single low-9 quotation mark General Punctuation
? 131 Latin small letter f with hook Latin Extended-B
? 132 Double low-9 quotation mark General Punctuation
? 133 Horizontal ellipsis General Punctuation
? 134 Dagger General Punctuation
? 135 Double dagger General Punctuation
? 136 Modifier letter circumflex accent Spacing Modifier Letters
? 137 Per mille sign General Punctuation
? 138 Latin capital letter S with caron Latin Extended-A
? 139 Single left-pointing angle quotation mark General Punctuation
? 140 Latin capital ligature OE Latin Extended-A
? 141 (not used)
? 142 Latin capital letter Z with caron Latin Extended-A
? 143 (not used)
? 144 (not used)
? 145 Left single quotation mark General Punctuation
? 146 Right single quotation mark General Punctuation
? 147 Left double quotation mark General Punctuation
? 148 Right double quotation mark General Punctuation
? 149 Bullet General Punctuation
? 150 En dash General Punctuation
? 151 Em dash General Punctuation
? 152 Small tilde Spacing Modifier Letters
? 153 Trade mark sign Letterlike Symbols
? 154 Latin small letter s with caron Latin Extended-A
? 155 Single right-pointing angle quotation mark General Punctuation
? 156 Latin small ligature oe Latin Extended-A
? 157 (not used)
? 158 Latin small letter z with caron Latin Extended-A
? 159 Latin capital letter Y with diaeresis Latin Extended-A
160 No-break space
? 161 Inverted exclamation mark
? 162 Cent sign
? 163 Pound sign
? 164 Currency sign
? 165 Yen sign
? 166 Broken bar
? 167 Section sign
? 168 Diaeresis
? 169 Copyright sign
? 170 Feminine ordinal indicator
? 171 Left-pointing double angle quotation mark
? 172 Not sign
? 173 Soft hyphen
? 174 Registered sign
? 175 Macron
? 176 Degree sign
? 177 Plus-minus sign
? 178 Superscript two
? 179 Superscript three
? 180 Acute accent
? 181 Micro sign
? 182 Pilcrow sign
? 183 Middle dot
? 184 Cedilla
? 185 Superscript one
? 186 Masculine ordinal indicator
? 187 Right-pointing double angle quotation mark
? 188 Vulgar fraction one quarter
? 189 Vulgar fraction one half
? 190 Vulgar fraction three quarters
? 191 Inverted question mark
? 192 Latin capital letter A with grave
? 193 Latin capital letter A with acute
? 194 Latin capital letter A with circumflex
? 195 Latin capital letter A with tilde
? 196 Latin capital letter A with diaeresis
? 197 Latin capital letter A with ring above
? 198 Latin capital letter AE
? 199 Latin capital letter C with cedilla
? 200 Latin capital letter E with grave
? 201 Latin capital letter E with acute
? 202 Latin capital letter E with circumflex
? 203 Latin capital letter E with diaeresis
? 204 Latin capital letter I with grave
? 205 Latin capital letter I with acute
? 206 Latin capital letter I with circumflex
? 207 Latin capital letter I with diaeresis
? 208 Latin capital letter Eth
? 209 Latin capital letter N with tilde
? 210 Latin capital letter O with grave
? 211 Latin capital letter O with acute
? 212 Latin capital letter O with circumflex
? 213 Latin capital letter O with tilde
? 214 Latin capital letter O with diaeresis
? 215 Multiplication sign
? 216 Latin capital letter O with stroke
? 217 Latin capital letter U with grave
? 218 Latin capital letter U with acute
? 219 Latin capital letter U with circumflex
? 220 Latin capital letter U with diaeresis
? 221 Latin capital letter Y with acute
? 222 Latin capital letter Thorn
? 223 Latin small letter sharp s
? 224 Latin small letter a with grave
? 225 Latin small letter a with acute
? 226 Latin small letter a with circumflex
? 227 Latin small letter a with tilde
? 228 Latin small letter a with diaeresis
? 229 Latin small letter a with ring above
? 230 Latin small letter ae
? 231 Latin small letter c with cedilla
? 232 Latin small letter e with grave
? 233 Latin small letter e with acute
? 234 Latin small letter e with circumflex
? 235 Latin small letter e with diaeresis
? 236 Latin small letter i with grave
? 237 Latin small letter i with acute
? 238 Latin small letter i with circumflex
? 239 Latin small letter i with diaeresis
? 240 Latin small letter eth
? 241 Latin small letter n with tilde
? 242 Latin small letter o with grave
? 243 Latin small letter o with acute
? 244 Latin small letter o with circumflex
? 245 Latin small letter o with tilde
? 246 Latin small letter o with diaeresis
? 247 Division sign
? 248 Latin small letter o with stroke
? 249 Latin small letter u with grave
? 250 Latin small letter u with acute
? 251 Latin small letter with circumflex
? 252 Latin small letter u with diaeresis
? 253 Latin small letter y with acute
? 254 Latin small letter thorn
? 255 Latin small letter y with diaeresis
[Read more…]
Wednesday, October 25, 2017
ໃນ delphi ມີຫລາຍປະເພດ Number ຂື້ນຢູ່ກັບທ່ານເລືອກໃຊ້ໃນຊອບແວຂອງທ່ານ ດັ່ງລຸ່ມນີ້
Type Storage size Range
Byte 1 0 to 255
ShortInt 1 -127 to 127
Word 2 0 to 65,535
SmallInt 2 -32,768 to 32,767
LongWord 4 0 to 4,294,967,295
Cardinal 4* 0 to 4,294,967,295
LongInt 4 -2,147,483,648 to 2,147,483,647
Integer 4* -2,147,483,648 to 2,147,483,647
Int64 8 -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
Single 4 7 significant digits, exponent -38 to +38
Currency 8 50+ significant digits, fixed 4 decimal places
Double 8 15 significant digits, exponent -308 to +308
Extended 10 19 significant digits, exponent -4932 to +4932
* Note : the Integer and Cardinal types are both 4 bytes in size at present (Delphi release 7), but are not guaranteed to be this size in the future. All other type sizes are guaranteed.
ການກຳໜົດໃຫ້ ຕົວປ່ຽນ Number
const
YOUNG_AGE = 23; // Small integer constant
MANY = 300; // Bigger integer constant
RICH = 100000.00; // Decimal number : note no thousand commas
var
Age : Byte; // Smallest positive integer type
Books : SmallInt; // Bigger signed integer
Salary : Currency; // Decimal used to hold financial amounts
Expenses : Currency;
TakeHome : Currency;
begin
Age := YOUNG_AGE; // Assign from a predefined constant
Books := MANY + 45; // Assign from a mix of constants (expression)
Salary := RICH; // Assign from a predefined constant
Expenses := 12345.67; // Assign from a literal constant
TakeHome := Salary; // Assign from another variable
TakeHome := TakeHome - Expenses; // Assign from an expression
end;
ຜົນໄດ້ແມ່ນ
Age is set to 23
Books is set to 345
Salary is set to 100000.00
Expenses is set to 12345.67
TakeHome is set to 87654.33
Numerical operators
ສຳລັບການປະມວນ ໃຊ້ສັນຍາລັກຄື
+ : Add one number to another
- : Subtract one number from another
* : Multiply two numbers
/ : Divide one decimal number by another
div : Divide one integer number by another
mod : Remainder from dividing one integer by another
[Read more…]
Tuesday, October 3, 2017
ໃນພາສາ Delphi ມີ ປະເພດຂໍ້ມູນຫລາກຫລາຍຄືກັບພາສາໂປຣແກຣມອື່ນໆ
ຕົວຢ່າງ ການປະກາດຕົວປ່ຽນ
var // This starts a section of variables
LineTotal : Integer; // This defines an Integer variable called LineTotal
First,Second : String; // This defines two variables to hold strings of text
ຈາກໂຄດຂ້າງເທິງ ເຫັນວ່າ ການເລີ່ມຕົ້ນດ້ວຍຊື່ຕົວປ່ຽນ ແລ້ວຕາມດ້ວຍ ປະເພດຂໍ້ມູນຕົວປ່ຽນ ສຶ່ງສຳຄັນ ຊື່ຂອງຕົວປ່ຽນຕ້ອງແມ່ນບໍ່ຊ້ຳກັນ ແລະ ການປະກາດຕົວປ່ຽນ ຈະບໍ່ຈຳແນກ ຕົວອັກສອນ ໃຫຍ່ ຫລື ນ້ອຍ
ຂໍ້ມູນປະເພດຕົວເລກ
Var
// Integer data types :
Int1 : Byte; // 0 to 255
Int2 : ShortInt; // -127 to 127
Int3 : Word; // 0 to 65,535
Int4 : SmallInt; // -32,768 to 32,767
Int5 : LongWord; // 0 to 4,294,967,295
Int6 : Cardinal; // 0 to 4,294,967,295
Int7 : LongInt; // -2,147,483,648 to 2,147,483,647
Int8 : Integer; // -2,147,483,648 to 2,147,483,647
Int9 : Int64; // -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
// Decimal data types :
Dec1 : Single; // 7 significant digits, exponent -38 to +38
Dec2 : Currency; // 50+ significant digits, fixed 4 decimal places
Dec3 : Double; // 15 significant digits, exponent -308 to +308
Dec4 : Extended; // 19 significant digits, exponent -4932 to +4932
[Read more…]
Wednesday, September 27, 2017
ຄວາມແຕກຕາງຂອງໂປຣແກຣມ
ໃນ Delphi ໃຫ້ທ່ານສາມາດສ້າງໂປຣແກຣມ ແບບ GUI (Graphical User Interface) ຫລື Console (text-only) ແລະ ປະເພດອື່ນໆ
ໃນບົດນີ້ ເຮົາຈະຮຽນການຂຽນໂປຣແກຣມ ແບບ GUI
ຕົວຢ່າງ ສ້າງ ‘Hello World’ ໂປຣແກຣມ
ເມື່ອເຮົາເປີດໂປຣແກຣມ Delphi ມາທຳອິດ ຈະມີຫນ້າຕາງ ສຳລັບ ອອກແບບ ຫລື ຟອມນັ້ນເອງ ໃນນັ້ນຈະມີ ເມນູ, Code Editor ແລະ ອື່ນໆ
ຟອມ:
Image does not exist: https://image.ibb.co/n8hYdk/Blank_Form.gif
ເມນູ control ຕ່າງໆ:
Image does not exist: https://image.ibb.co/dozDdk/Standard_A.gif
ເມື່ອເຮົາເລືອກໃຊ້ Control Label ໃສ່ຟອມຈະເປັນແບບນີ້
Image does not exist: https://image.ibb.co/cPO0PQ/Form_Label.gif
ນອກນັ້ນເຮົາຍັງສາມາດກຳນົດ Property ຂອງ label ໃນ ຟອມໄດ້ທີ່ Object Inspector
Image does not exist: https://image.ibb.co/i8bbyk/Label_Caption.gif
ໃນຂັ້ນຕອນນີ້ ແມ່ນໃຫ້ທ່ານເພີ່ມ Button control ໃສ່ຟອມ
Image does not exist: https://image.ibb.co/dQffPQ/Form_Button.gif
ໃຫ້ Double Click ທີ່ Button control
Image does not exist: https://image.ibb.co/cRd0PQ/Button_Action.gif
[Read more…]