Questions tagged [pascal]
Pascal is an imperative language from the Wirthian family created in 1969. It was widely used in engineering and teaching in the 1970s and 1980s. It lives on in compilers as Free Pascal and Delphi.
2,597
questions
-7
votes
0
answers
78
views
converting a pointer to class object in C# (Low level memory operation) [closed]
I am New to pointers concept
My question is how to convert pointer to class type in C# ?
i have provided for background of issue in my code in below info
I have a DLL code return for my project i cant ...
-1
votes
0
answers
46
views
The color of my label is not changing even though I changed it in my code
I was trying to change the color of my label. The code does not show any error, but it does not seem to work either.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, ...
0
votes
2
answers
143
views
Given a word or set of characters how to only take one part and dispose the rest
I use Free Pascal where I have to do a task for college course (introduction course to programming).
We are not allowed to use certain words from Free Pascal like string, break, and some other ones ...
1
vote
1
answer
181
views
How can I create a TBitSet32 record in Delphi for efficient 32-bit operations?
I am working on a project where I need to manipulate a set of 32 bits very efficiently. Memory efficiency is crucial, so using an array of boolean (which would occupy 32 bytes) is not an option (if I ...
0
votes
2
answers
87
views
I have used so many "if" and I would like to know if I can substitute some by "case"
I have this code:
program Coordenadas;
var
x,z : integer;
begin
writeln('Ingresa la coordenada en X.');
readln(x);
writeln('Ingresa la coordenada en Z.');
readln(z);
if (x=0) and (z=0) ...
0
votes
1
answer
109
views
Is there a Delphi equivalent for GCC's __builtin_popcountl, __builtin_clz, and __builtin_ctz?
I'm currently translating some C++ code into Delphi and came across the following GCC built-in functions:
__builtin_popcountl(x): Counts the number of set bits (1s) in the integer x.
__builtin_clz(x):...
0
votes
0
answers
50
views
Delphi + nsoftware sshclient how to send command to device?
I'm trying to send command via SSH to Router using nsoftware SSHClient:
procedure TForm1.Button2Click(Sender: TObject);
begin
iphSSHClient1.Connected:=true;
iphSSHClient1.OpenChannel('session');//...
0
votes
0
answers
64
views
I cannot use the Format function in Apophysis 7x
I am playing with a drawing software called Apophysis 7x 15D 32dit and I am having trouble writing code from Script and it throws an error. The error text pointed me to the wrong type of Format ...
0
votes
0
answers
39
views
LoadFromFile() function returns garbage string [duplicate]
How to read unicode strings from text file in innosetup.
We tried LoadFromFile(), however it returns garbage string.
0
votes
1
answer
109
views
FireDac FDQuery Access Violation when called multiple times
I have a strange error whereby FDQuery throws access violations when called multiple times in my function. Basically, I have a function which loops through a date range to produce a 2d array of data ...
0
votes
1
answer
68
views
Inno Setup : How to setup advance settings for IIS application pool?
In Inno setup script how to set advance settings for IIS application pool? I'm specifically looking for setting Idle Time-out property?
I was not able to find and helpful information related to ...
0
votes
1
answer
86
views
How to use relative file paths in Lazarus
I'm creating a simple CRM in Lazarus with an SQLite backend but I can't figure out how to give Lazarus the file path to the database file relativly. This is needed for when I publish the app as I won'...
0
votes
0
answers
60
views
Why "BlockRead" can use a buffer whose size is smaller than the size of the data being read
I have a program:
program OverflowTest;
var
src: file;
dest: file;
res: longint;
buf: byte;
begin
assign(src, '48_bytes_file.txt');
assign(dest, 'copy_of_48_bytes_file.txt');
...
0
votes
0
answers
63
views
Why my exe is looking for version.dll locally?
I have an issue with the executable I generate in Lazarus ( I have the same problem with any project in the example folder found in Lazarus installation folder) and the windows dll version.dll. I know ...
0
votes
0
answers
190
views
Delphi VCL code found a strange problem in Win11, set the pixel format to 8bit (index format), there was a display problem
Delphi VCL code found a strange problem in Win11, set the pixel format to 8bit (index format), there was a display problem, the code is:
Image1.Picture.Bitmap.PixelFormat:=pf8bit;
The displayed effect ...
1
vote
1
answer
59
views
Why does my For loop only print the last result?
I am trying to program a for loop that will multiply a given number n with every number in a certain range (e.g. 1-10), printing every step. My code for this looks like this:
begin
writeln('FOR');...
0
votes
0
answers
197
views
Invalid column name when inserting a new record
I have a problem when I try to add new record to the database table from an Adoquery it shows me an error that says invalid column name the Adoquery is connected to adoconnection which is connected to ...
0
votes
0
answers
82
views
Use Delphi TMsRdpClient9NotSafeForScripting minimizing remoteapp after more than 10 seconds, the session will automatically disconnect
Use Delphi TMsRdpClient9NotSafeForScripting minimizing remoteapp after more than 10 seconds, the session will automatically disconnect
Environment: Client: Windows 10
Server: winserver 2008 R2
var
rdp:...
0
votes
1
answer
127
views
Pascal Scripting in Altium Designer Professional: Getting an "undeclared identifier" error for a built-in method?
Trying to draw a circular board shape in Altium Professional.
enter image description here
I am getting this error message for all methods in this script, including BoardOutline, RemoveAllVertices and ...
-1
votes
1
answer
60
views
What does this Pascal code set the VGA card in?
I have this Pascal code. It seems to enter mode X, but seems to be wider or different.
What is this video mode called, or is it standard Mode X?
{INIT: Configure VGA to mode ???}
{INIT: Configure VGA ...
1
vote
2
answers
88
views
External access violation in Pascal - From where does it come from?
when i try to run this code:
program Version_als_Kompilett;
uses SysUtils;
type
tRefBinBaum = ^tBinBaum;
tBinBaum = record
wert: integer;
li: tRefBinBaum;
re: tRefBinBaum
end;
...
0
votes
0
answers
116
views
2D Discrete Fourier Transform and Inverse DFT
I am currently implementing 2D DFT and IDFT for images, and the response of my IDFT is not the same from the original image. It is intriguing because the generated image looks inverted. I don't know ...
-1
votes
1
answer
74
views
How do I resolve syntax error, ";" expected but "IF" found?
The following is my code displayed below, however, I seem to be having trouble getting my second if statement running. How do I resolve this?
Program HelloUser(input,output);
var
UserName:string;
...
0
votes
0
answers
41
views
Is it possible to find out the amount of RAM in turbo pascal, and if so, how?
I need a program for dos
Thanks in advance
I searched on the Internet but did not find anything for turbo pascal, only for pascal ABC
0
votes
2
answers
206
views
Multithreading using loop in Delphi
I want to do multithreading where the threads are allocated automatically using loop (e.g for loop) in delphi. When I do so, I'm getting a Range check error or the threads are getting crashed. Below ...
0
votes
2
answers
154
views
E2029 '(' expected but 'THEN' found
So I'm trying to write a function in Delphi 10.4 that takes a JSON file out of a SQL table and shows all the items within on a grid.
One of those is in a date format which causes the app to crash, so ...
1
vote
1
answer
145
views
How to fix syntax error of ";" expected but "identifier USER" found for Pascal?
I'm quite new to Pascal, although it's outdated, my teacher is currently having us learn it since it is the building block of Pseudocode. However, we've only made one attempt in practicing the program ...
-1
votes
1
answer
109
views
Detect Dragging File event before Dropped on Form
I'm trying to create an application for Windows.
In my application, when dragging items File from Windows Explorer to FormOne and then FormOne will call FormSecond show and Drop Items on FormSecond.
...
-1
votes
2
answers
69
views
writeln() messes with Pascal output
On a computer science lesson, I was tasked to write a simple piece of code. Program receives a sequence of integers, and it should output the length of the longest same-integer sequence. It also stops ...
0
votes
1
answer
54
views
Getting an error because I'm using TSetupForm in Inno Setup Compiler Code
I setup the variable TSetupform but I'm getting an error using CenterInsideControl telling me it's unknown. Isn't CenterInsideControl a command TSetupform? Also is there something not setup correctly?
...
1
vote
1
answer
66
views
Access Violation when using SetLength()
I'm writing a connect4 game using Pascal for an assignment. It would by default create a board with the size of 6x7 and win length equal 4, however it can also be passed parameters such as ./connect4 ...
0
votes
1
answer
38
views
How do I correctly use Visual Form Inheritance in Delphi 10.3/7?
I have a base form that I am trying to use for multiple forms on screen at once. I thought I set up inheritance correctly but when I create 2 forms, only the last one created shows up on the screen. I ...
0
votes
1
answer
102
views
MetaTrader (MQL4) > .DLL (Delphi/Pascal) > .jar (Java) | Java-Thread seems to close immediately when opened via .dll (ShellExecute) via mql-call
(I use Windows 11 Home) To establish a communication between MetaTrader4 and my own Java Application I want to use stdin and stdout pipes. At this moment, I try to open my .jar from a .dll called by ...
0
votes
0
answers
69
views
Delphi 2010 How to add break point in Classes.pas
I want to add a break point in TThread class ,function ThreadProc which in Classes.pas.
but i click and run the break point has a cross on it, it doesnt work.
i have a class has a TThread member , it ...
1
vote
1
answer
54
views
Deleting whole directory before new SW installation
I created a simple code using Inno Setup and I just want to delete original files inside "SPMPET" directory before installing fresh files and program, automatically. But the code I wrote did ...
1
vote
1
answer
43
views
Using the identifier of a variable as input in Pascal [duplicate]
So let's say I have some variables for example x:=1, y:=2 and z:=3
Is there a way to input just x , y or z
and get the value of the variable as output?
ex:
User's input: y
output : 2
I tried using if ...
0
votes
1
answer
48
views
Pascal ERROR Range check error help me find my mistakes
I was trying to make a cashier program right, and I think I did everything right but I faced an error that I dont know how to fix.
uses
crt;
var
harga, jumlah, total, final: integer;
nama, kode:...
0
votes
0
answers
141
views
How to create interstitial ads using delphi 11.0
How can I create interstitial ads using Delphi 11.0? The following code does not work in Delphi 11.0, but it was working in older version.
TMyAdViewListener = class(TJavaLocal, JIAdListener)
private
...
0
votes
0
answers
91
views
How to debug Windows dll from Delphi
CodeGear™ Delphi® 2007 for Win32® R2 Version 11.0.2902.10471
Working on an application written in Delphi Pascal that calls a DLL (also Delphi) that changes a panel in the GUI. Occasionally during the ...
2
votes
1
answer
67
views
Wrong output of bubble sort algorithm in Pascal
Recently I have been trying to create a bubble sort algorithm in Pascal language, however after the program is run, the output turned out to be only 0s and 1s. I wonder what have I done wrong.
program ...
0
votes
1
answer
204
views
Problem with SQLite database locking when multiple users try to save data simultaneously in Lazarus
I have a problem with saving data to a SQLite database in Lazarus. When several users try to save data to the database at the same time, a collision occurs because the database is locked.
Has anyone ...
1
vote
0
answers
67
views
My Pascal Program wont read the data from stocks.txt. How do I have it read the data from data.txt
I am currently learning Pascal. Using Pascal XE for IDE. This program I wrote runs but wouldn't read the data from stocks.txt
The Current output when the program is reading a .txt file with no data
...
0
votes
2
answers
102
views
Having trouble adding TStringLists with chunks
I am trying to separate data coming from a dataset (Q) into chunks of 10 and place them into a TStringList.
I've create a TStringList called LIST, where every time a record is found it adds a value (...
0
votes
1
answer
192
views
Problem with Pascal - Fatal: Syntax error, "identifier" expected but "in" found
procedure LoesungBestimmen (
in a,b,c : real;
out Loesung1, Loesung2 : real;
out gibtLoesung : boolean);
{ bestimmt die Loesungen der Gleichung
a*x*x + b*x + c = 0....
1
vote
0
answers
121
views
Why WTSRegisterSessionNotification may fail with Access Denied error?
I receiving a few bug reports from users which contains a strange error. On some machines (Windows 10 and 8.1) calling WTSRegisterSessionNotification returns Error code 5 (Access Denied):
type
...
0
votes
1
answer
124
views
Illegal counter variable in FOR loop - Pascal
Mayby problem is inside the enviroment [I use replit]; but someone can help me understand step by step why I can't use counter in that way? In another/second compiler [dev-pascal] result is correct, ...
0
votes
0
answers
36
views
Most efficient conversion between USCD Pascal style Strings and Swift Strings
A data file contains (among other data) USCD Pascal style Strings which are an contiguous array of bytes prefixed by a length byte but with no trailing zero, and may have a length of zero to 255 only.
...
-3
votes
2
answers
176
views
Is it possible to have a key "Start" and then "Stop" a function?
I want to achieve the following:
I press and release the C key, and the letter C is typed, as normal.
But instead, I want to press and release the C key, and have ...
0
votes
1
answer
80
views
Pascal - Initializing class variable array
I have a trouble initializing dynamic array in a class. Class looks like this:
MyClass = class
private
var
myVar: array of array of real;
public
constructor Create();
...