我想在两个应用程序之间共享数组数据.在我看来,第一个程序创建数组,第二个程序可以从已分配的内存区读取数组.该数组不是动态数组.
我发现了一种使用OpenFileMapping和分享指针的方法MapViewOfFile.我没有运气实现数组共享,我想我还不想使用IPC方法.
有可能计划这样的方案(共享数组)吗?我的目的是最大限度地减少内存使用和读取数据.
我曾经使用Pythia来混淆我的D6程序.但似乎Pythia不再适用于我的D2007.这是Pythia的链接(自2007年初以来没有更新):http://www.the-interweb.com/serendipity/index.php?/ archives/86-Pythia-1.1.html
从上面的链接,这是我想要实现的

我尝试使用Delphi XE编译时没有响应.它是否适用于您的计算机或功能有问题?
function Test(const FileName: string;
const Force: boolean = false): boolean;
var
IsAllowed: boolean;
begin
result := false;
if FileExists(FileName) then
begin
try
if (Force) then
begin
result := false;
exit;
end;
finally
if IsAllowed then
DeleteFile(FileName);
end;
try
result := true;
except
result := false;
end;
end;
end;
Run Code Online (Sandbox Code Playgroud) 我曾经使用HYPERSTR库进行字符串处理例程.现在我使用更新的Delphi.我需要在字符串中搜索模式,例如旧函数function IsMatchEx(const Source, Search:AnsiString; var Start:integer) : Integer;.实际上我不需要结果值,我只想知道模式是否与字符串匹配.
我的旧代码(返回TRUE):
var
StartPos: integer;
FoundPos: integer;
begin
StartPos := 1;
FoundPos := IsMatchEx('abcdef', 'abcd?f', StartPos);
if FoundPos > 0 then
showmessage('match');
end;
Run Code Online (Sandbox Code Playgroud)
我看到Delphi XE有TRegEx但我仍然不明白使用它.
这些代码不返回TRUE:
if TRegEx.IsMatch('abcdef', 'abcd?f') then
showmessage('match');
Run Code Online (Sandbox Code Playgroud)
使用时我也得到了相同的结果MatchesMask.
谢谢.
var
FileBuff: TBytes;
Pattern: TBytes;
begin
FileBuff := filetobytes(filename);
Result := CompareMem(@Pattern[0], @FileBuff[0], Length(Pattern));
end;
Run Code Online (Sandbox Code Playgroud)
有没有任何功能,如
Result := Pos(@Pattern[0], @FileBuff[0]);
Run Code Online (Sandbox Code Playgroud) 我如何在Delphi中使用TTouchKeyboard,因此它可以向其他程序发送击键.例如,我想使用TTouchKeyboard组件在浏览器中键入密码.我不知道在点击我的键盘时如何让浏览器保持专注.
我曾经使用这个函数将十六进制字符串转换为Delphi 6中的字符串:
const
testSign = '207F8060287F585054505357FFD55861';
function Hex2Dec(const data: string): byte;
var
nH1, nH2: byte;
begin
if data[1] in ['0' .. '9'] then
nH1 := strtoint(data[1])
else
nH1 := 9 + ord(data[1]) - 64;
if data[2] in ['0' .. '9'] then
nH2 := strtoint(data[2])
else
nH2 := 9 + ord(data[2]) - 64;
Result := nH1 * 16 + nH2;
end;
function HexStrToStr(const HexStr: string): string;
var
BufStr: string;
LenHex: Integer;
x, y: Integer;
begin
LenHex := Length(HexStr) div 2;
x …Run Code Online (Sandbox Code Playgroud) 我需要在一个单独的线程中执行一个函数,并等待线程完成.
例如,这是原始函数:
Procedure Search;
begin
CallA;
CallB;
end;
Run Code Online (Sandbox Code Playgroud)
这是修改后的功能:
Procedure Search;
var
testMyThread: TMyThread;
Done: Boolean;
begin
// create a new thread to execute CallA
testMyThread:=TMyThread.Create(False,Done);
WaitForSingleObject(testMyThread.Handle, INFINITE );
if not Done then
begin
TerminateThread(testMyThread.Handle, 0);
end
else;
CallB;
end
unit uMyThread;
interface
uses classes;
type
TMyThread = class(TThread)
private
{ Private declarations }
FDone: ^boolean;
protected
procedure Execute; override;
public
constructor Create(const aSuspended: boolean; var Done: boolean);
procedure CallA;
end;
implementation
uses uMain;
constructor TMyThread.Create(const aSuspended: boolean;
var Done: …Run Code Online (Sandbox Code Playgroud) 我需要将数据存储到内存中.我的数据类型数据是字符串.我想最小化内存使用量.我想我必须将字符串更改为字节.我对吗?如果我将字符串转换为字节,这意味着我必须将字符串转换为TMemoryStream?
我的程序在分离的线程上执行"繁重"任务(搜索文件并查找签名).每个任务都使用PostMessage来调用将记录添加到ListView的过程.
问题是当ListView(经常)显示许多记录时,我的窗口将冻结.似乎我的程序正在尖叫以请求Application.ProcessMessages.只有Progressbar仍在继续.操作完成后,一切恢复正常.
如果我删除添加记录的操作,我的程序的操作将顺利运行.
你有什么主意吗?
假设我有一个包含我的数据的文本文件.
data :
ab
bc
de
Run Code Online (Sandbox Code Playgroud)
-
encrypted data on text file :
ba
cb
ed
Run Code Online (Sandbox Code Playgroud)
我想bc从文本文件中找到,所以我必须使用以下代码解密文本文件:
SL:=TStringList.create;
SL.LoadFromFile(textfile)
SLtemp:=TStringList.create;
for I := 0 to SL.Count - 1 do
SLtemp.Add(ReverseString(SL[i])); //decrypt
SL.Free;
for I := 0 to SLtemp.Count - 1 do
if SLtemp[i] = 'bc' then
begin
showmessage('found');
break;
end;
SLtemp.Free;
Run Code Online (Sandbox Code Playgroud)
我认为我的方式是浪费资源.我必须将整个文件加载到内存并解密它们.我需要一些建议来快速找到加密文本中的特定行.
谢谢.
delphi ×11
delphi-xe ×3
arrays ×1
byte ×1
bytearray ×1
compilation ×1
encryption ×1
hex ×1
listview ×1
obfuscation ×1
unicode ×1