我需要加密使用Lazarus/Freepascal开发的程序中的一些文本,但我应该能够将它们作为文本加载并解密它们,而不是二进制文件,因为我需要将它们保存在TStrings类型属性中.
哪种算法适合于此?
我做了一点(或者至少我希望它很少)对一个朋友的青睐,但是在10年左右的时间里没有使用Delphi ......我的搜索没什么用处
我要做的是获取一个URL,然后解析HTML以找到他需要的一些信息.我希望有这样的东西(在python中)fileHandle = urllib2.urlopen(urlStr),fileHandle会收到我请求的页面的HTML.我找到的所有示例都打开了默认浏览器,但是
我正在使用Linux,使用Lazarus和Free Pascal,他正在使用Delphi 7(如果我没记错的话),如果这很重要的话.
谢谢.
我有一个TEdit字段,我需要在关注它时按下ENTER/RETURN按钮从动作列表中调用一个动作(就像在大多数搜索引擎中一样).使用Lazarus 0.9.28.2-12和Ubuntu 11.04
你能告诉我怎么办?是否有任何Freepascal单位可以为我做这个?我需要这样,所以我的程序可以将二进制数据存储在基于XML的文件格式中.
我正在尝试在PascalScript函数中使用TStrings.ValueFromIndex(在FreePascal和Delphi中工作),但它不起作用,编译器返回:
未知标识符'GETVALUEFROMINDEX'
我用得好吗?
PascalScript中是否提供此功能?
如果没有,有没有简单的方法呢?
代码:
Function dummy(R: TStringList):String;
var
i: Integer;
RESULTv: string;
begin
for i := 0 to ReqList.Count-1 do
RESULTv := RESULTv + R.Names[i]+' -> '+ R.ValueFromIndex[i];
dummy := RESULTv;
end;
Run Code Online (Sandbox Code Playgroud) 当我写入Pascal中的外部文件时,即使编码完美无缺,外部文件也不会完全写入.
procedure save;
{Menyimpan data penerbangan ke dalam file eksternal}
begin
write('> ');
write('nama file: ');
readln(namafisik);
assign(d,namafisik);
{$I-};
rewrite(d);
{$I+};
if (IOresult=0) then
begin
for i:=1 to Neff do
writejadwal(i);
end;
end;
procedure writejadwal(i:integer);
{Menuliskan jadwal ke file eksternal pada indeks ke-i}
begin
write(d,T.KodePenerbangan[i]);
write(d,' | ');
write(d,T.KotaKeberangkatan[i]);
write(d,' | ');
write(d,T.KotaKedatangan[i]);
write(d,' | ');
if ((T.TKeberangkatan[i].Day) < 10 ) then
begin
x:=T.TKeberangkatan[i].Day;
str(x,y);
s:=y;
write(d,'0'+s);
end
else
begin
write(d,T.TKeberangkatan[i].Day);
end;
write(d,':');
if ((T.TKeberangkatan[i].Month) < 10 ) then
begin …Run Code Online (Sandbox Code Playgroud) pascal procedural-programming freepascal lazarus turbo-pascal
如果TForm有一个TListBox上面,下面的工作:
procedure TForm1.FormCreate(Sender: TObject);
procedure _WorkOnListBox;
begin
ListBox.Items.Append('Test');
end;
begin
_WorkOnListBox;
end;
Run Code Online (Sandbox Code Playgroud)
如下所示:
procedure TForm1.DoWithoutListBoxEvents(AProc: TProc);
begin
ListBox.Items.BeginUpdate;
try
AProc;
finally
ListBox.Items.EndUpdate;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
DoWithoutListBoxEvents(procedure
begin
LayersListBox.Items.Append('Test');
end);
end;
Run Code Online (Sandbox Code Playgroud)
但以下不是:
procedure TForm1.FormCreate(Sender: TObject);
procedure _WorkOnListBox;
begin
ListBox.Items.Append('Test');
end;
begin
DoWithoutListBoxEvents(_WorkOnListBox);
end;
Run Code Online (Sandbox Code Playgroud)
我得到了E2555 Cannot capture symbol '_WorkOnListBox'.为什么?有没有办法在DoWithoutListBoxEvents不使用匿名程序的情况下开始工作?虽然我认为它看起来很优雅,但我试图保持FPC兼容.
首先,我使用Mingw 4.8作为代码中的C++ DLL的编译器:块13.12和Lazarus 1.4.2用于处理pascal代码.(windows 7)
我需要在c ++或c中生成一个可以从pascal程序调用的dll.
问题是我的关于pascal的知识是空的,制作一个简单的程序看起来并不复杂,但我找不到关于如何导入和使用C/C++ DLL的好信息.
唯一没有用的是:http://www.drbob42.com/delphi/headconv.htm 我的真实代码:
帕斯卡尔:
funtion hello():Integer; external 'function' index 1;
...
Label1.Caption:=IntToStr(hello());
Run Code Online (Sandbox Code Playgroud)
C++ DLL头:
#ifndef function_H
#define function_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef BUILDING_DLL
#define FUNCTION_DLL __declspec(dllexport)
#else
#define FUNCTION_DLL __declspec(dllimport)
#endif
int __stdcall FUNCTION_DLL hello( );
#ifdef __cplusplus
}
#endif
#endif
Run Code Online (Sandbox Code Playgroud)
C++文件:
#include <stdio.h>
#include "function.h"
__stdcall int hello( )
{
return 8;
}
Run Code Online (Sandbox Code Playgroud)
但是当试图传递任何参数或做一些复杂的函数时,开始给出randoms数字.
这是新代码:Pascal:
function function1(t1:Integer):Integer; external 'function' index 1;
...
entero:=8;
Label1.Caption:=IntToStr(function1(entero2));
Run Code Online (Sandbox Code Playgroud)
我还将c …
我正在使用PASCAL进行我正在做的课程而且我在编程时遇到问题,在我的程序中我使用2个数组,它使用来自用户输入的变量但是当我去运行程序时它出现了with,错误:无法计算常量表达式.该数组的代码是:
Var
x : integer;
s : array[1..x] of real;
n : array[1..x] of string[30];
Run Code Online (Sandbox Code Playgroud)
这里x是用户的输入,有没有一种方法可以让数组从1变为x?
我试图显示附加到Resourcestring的常量数组的内容; 但它无法正常工作(Showmessage应显示'Primavera'),但是当您完成应用程序时,您会收到一条空白消息和异常.例如,示例代码在Lazurus中运行良好.我错过了什么....
unit U_Translate;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
end;
Resourcestring
RS1 = 'Primavera'; RS2 = 'Verano'; RS3 = 'Otoño'; RS4 = 'Invierno';
Const
CEstacion: Array [1..4] of ^String = (@RS1,@RS2,@RS3,@RS4);
var Form1: TForm1;
implementation
$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
ShowMessage (CEstacion[1]^);
end;
end.
Run Code Online (Sandbox Code Playgroud) freepascal ×10
delphi ×8
lazarus ×5
pascal ×3
base64 ×1
c++ ×1
delphi-2010 ×1
dll ×1
encryption ×1
linux ×1
pascalscript ×1
text ×1
turbo-pascal ×1