我有一个Windows Delphi应用程序,通过通知图标可以访问"开始"和"停止"菜单项.点击"开始"后,我需要执行以下操作(我看到实现):
ThreadMonitor:第一个线程正在等待指定文件夹中指定文件的出现.
ThreadParse:一旦文件出现,它应该被转移到另一个线程(用于解析内容)并继续监视下一个文件.
ThreadDB:解析完所有数据后,将它们保存到MySQL DB中.(具有活动数据库连接的另一个后台线程?)
ThreadLog:如果步骤1-3中有任何错误,请将它们写入日志文件(另一个后台线程?)而不中断步骤1-3.
也就是说,事实证明,像连续输送机这样的东西只能通过按下Stop来停止工作.我应该从OmniThreadLibrary的各种方法中使用什么?
如何在Delphi 7的过程中使用特定的字体名称及其大小,如下所示:
procedure TForm1.infoClick(Sender: TObject);
begin
ShowMessage(
'- Lorem ipsum dolor sit amet.'+chr(10)+
'- Lorem ipsum dolor sit amet.'+chr(10)+
'- Lorem ipsum dolor sit amet.'
);
end;
Run Code Online (Sandbox Code Playgroud) 我可以使用ShellExecute成功发送电子邮件.收件人地址是正确的,发件人地址是正确的,主题是正确的.电子邮件的正文是正确的,除了根本没有换行符,所有内容都显示为单个段落,没有换行符.我的默认电子邮件客户端是Windows 8.1邮件.
我的问题是,可以使用ShellExecute以保留换行符吗?我不打算直接发送电子邮件给Indy.我需要做的就是向默认的电子邮件客户端发送电子邮件并正确格式化.
procedure TForm1.Email1Click(Sender: TObject);
var
iGridTableItem: TcxCustomGridTableItem;
iName, iDate, iEmail, iSubject, iBody, iParam: string;
begin
iGridTableItem := cxGrid1DBTableView1.DataController.
GetItemByFieldName('EMail');
if iGridTableItem.EditValue <> null then
iEmail := iGridTableItem.EditValue;
iGridTableItem := cxGrid1DBTableView1.DataController.
GetItemByFieldName('Name');
if iGridTableItem.EditValue <> null then
iName := iGridTableItem.EditValue;
iGridTableItem := cxGrid1DBTableView1.DataController.
GetItemByFieldName('Date');
if iGridTableItem.EditValue <> null then
iDate := DateToStr(iGridTableItem.EditValue);
iSubject := 'ImageEn EBook';
iBody := 'Dear Mr. ' + iName + ',' + sLineBreak + sLineBreak +
'PayPal has advised me that you purchased …Run Code Online (Sandbox Code Playgroud) 我已经使用Java很长一段时间了,决定改用C++.我已经写了这样一个列表:
std::list <Player*> players;
Run Code Online (Sandbox Code Playgroud)
我想要做的就是从这个列表中获取一个特定的元素.我记得在Java中调用了一个".get(index)"方法,但我在C++中找不到类似的东西.谁能帮我?谢谢.
我目前正在学习一些不同的排序算法.由于对这些差异感到好奇,我试图找到他们的信息,但没有一个是足够好的.所以这里是我的问题,从性能和概念来看,冒泡排序,选择排序,插入排序,shell排序和快速排序之间的区别是什么.
好的,所以我知道我可以在Windows注册表中重新映射Caps Lock键,但有什么用处可以将它映射到Delphi 2009 IDE吗?我希望代码完成(Ctrl-Space),有没有办法将单个Caps Lock键映射到Ctrl键组合?
我使用以下代码捕获我的程序的最小化按钮何时被按下,以便我可以从任务栏隐藏表单,并因此最小化到系统托盘.
procedure TForm1.WMSysCommand;
begin
if (Msg.CmdType = SC_MINIMIZE) then
begin
form1.Hide;
show1.Checked :=false;
hide1.Checked :=true;
end;
if (Msg.CmdType = SC_CLOSE) then form1.Close;
end;
Run Code Online (Sandbox Code Playgroud)
我不得不将捕获放入关闭按钮,因为此代码阻止程序通过关闭按钮关闭.我需要帮助的是如何修复已经停止使用此代码的标题栏拖动程序窗口.
我一直在研究重新排列单词字母的算法,但是找到正确的单词需要很长时间.
var
Form1: TForm1;
DictionaryArray : array[0..2000] of string;
const Numbrs : string = '123456789';
implementation
{$R *.dfm}
function GenerateSequence(CPoint : String; L : Integer): String;
var
Increaser : array[1..8] of Integer;
i : Integer;
AnagramSequence : String;
begin
FillChar(Increaser, SizeOf(Increaser), 0);
for i := 1 to Length(CPoint) do
Increaser[9 - i] := StrToInt(CPoint[L + 1 - i]);
//==========================================//
if Increaser[8] <= L then
Increaser[8] := Increaser[8] + 1;
if Increaser[8] > L then
begin
Increaser[8] := 1;
Increaser[7] := …Run Code Online (Sandbox Code Playgroud) 我有一个类,我想创建一个数字实例的数组,特别是矩阵类:
class Matrix {
public:
Matrix(int sizeX, int sizeY);
Matrix();
~Matrix();
....//omiting the rest here
private:
int dx, dy;
float **p
void allocArrays() {
assert(dx>0);
assert(dy>0);
p = new float*[dx];
for (int i = 0; i < dx; i++){
p[i] = new float[dy];
}
}
};
Matrix::Matrix(int sizeX=1, int sizeY=1)
: dx(sizeX),dy(sizeY) {
allocArrays();
for (int i = 0; i < dx; i++) {
for (int j = 0; j < dy; j++) {
p[i][j] = 0;
}
}
} …Run Code Online (Sandbox Code Playgroud) 我试图通过BDE在运行时连接到Interbase DB.我试图在一个无形的项目(但不是一个控制台应用程序)中这样做.别名是已知的.我从注册表中检索别名.示例:MyAlias.
//create alias params list
AParams:= TStringList.Create;
//create a session to get alias parameters
ASession:= TSession.Create(nil);
ASession.SessionName := 'MainSession';
try
ASession.GetAliasParams(tmpAlias, AParams);
finally
ASession.Free;
end;
//connect to database
dbMain:= TDatabase.Create(nil);
with dbMain do
begin
//AliasName:= 'MyAlias';
DatabaseName:= 'test';
LoginPrompt:= False;
Params.Assign(AParams);
try
Connected:=True;
if Connected then ShowMessage('Connected!') else ShowMessage('Failed to Connect!');
finally
Free;
end; //try
end;//with
//free alias params list
AParams.Free;
Run Code Online (Sandbox Code Playgroud)
无论如何,它看起来不像Session.GetParams实际获得密码.我如何获得密码?如果我知道别名,有没有办法从BDE获取所有连接信息并建立连接?如果客户端将来更改用户名和密码,我宁愿不对其进行硬编码.