我正在开发一个使用delphi和postgres 9.0的软件,原始开发人员选择了数据库编码为' SQL_ASCII '...所以我们将数据库的编码更改为UTF-8 ..我们之后开始收到此错误
单击其中一个复选框(表单从数据库填充)查询错误所在的查询
'select*from diary where in survey in(''2005407')';
但是这个错误只出现在几个复选框而不是ALL
这个改变是直截了当的,但是我们有大量的历史数据需要重新存储到新创建的UTF-8数据库中.所以我按照我在网上找到的步骤和stackoverflow也
SQL_Ascii_backup.backup使用iconv将SQL_ASCII转换为UTF-8
"C:\Program Files\GnuWin32\bin\iconv.exe" -f ISO8859-1 -t UTF-8 C:\SQL_Ascii_backup.backup>UTF_Backup.backup
Run Code Online (Sandbox Code Playgroud)
3.创建一个编码为UTF-8的新数据库,然后重新存储备份 UTF_Backup.backup
但是,当我尝试恢复它时,我得到了他的错误

然后我尝试将原始SQL_ASCII数据库转储为普通SQL_Ascii_.sql文件,然后再次使用iconv更改编码..然后恢复
>"C:\Program Files\PostgreSQL\9.0\bin\psql.exe"-h localhost -p 5434 -d myDB -U myDB_admin -f C:\converted_utf8.sql
Run Code Online (Sandbox Code Playgroud)
这是正确恢复,但我仍然在纠正错误.
编码"UTF-8"的字符0xc286在"WIN1252"中没有等价物;
我正在使用delphi 7工作项目,该项目是一个维护项目,我不是项目的原始编码器,我有一种情况,我需要在某些情况下通过代码创建后关闭可用的表单,表格是模特
这是示例代码
var
frmStratum : TfrmStratum;
begin
if not assigned(frmStratum) then myMainForm.OnExecute(PropAction);
end;
Run Code Online (Sandbox Code Playgroud)
在myMainForm.OnExecute(PropAction)中; 我有
frmStratum := TfrmStratum.Create(Self, Self as IStratum,inttostr(m_surveyno),Module,m_stations,false);
Run Code Online (Sandbox Code Playgroud)
现在程序TfrmStratum.FormActivate的TfrmStratum 我做很多calucaltion和写入数据库
var
if (bMassStratumExport) AND (bDoneOne) then
begin
//write to database..
end;
Run Code Online (Sandbox Code Playgroud)
现在我不得不这样做ATLEAST 20倍 即
1. Create the form
2. onactivate do database writing
3. close TfrmStratum
Run Code Online (Sandbox Code Playgroud)
因为它是一种模态形式,所以我无法关闭,如果在我创建它的地方下面,所以我想在第2步完成时关闭它onactivate
现在我试过这个
if (bMassStratumExport) AND (bDoneOne) AND NOT (bReadyToclose) then
begin
//do database writing
if bNowClo then frmStratum.close;
end …Run Code Online (Sandbox Code Playgroud) 我正在研究一个软件,所以我刚开始在我的项目中使用FastMM4(真实的).
我在网上找到了关于如何获取line numberFastMM4,我得到了行号,但我可以弄清楚日志中的其他信息是什么意思?
我在日志文件中有这个
This block was allocated by thread 0x15F8, and the stack trace (return addresses) at the time was:
402E86 [system.pas][System][System.@GetMem][2648]
403A3B [system.pas][System][System.TObject.NewInstance][8824]
403DAA [system.pas][System][System.@ClassCreate][9489]
403A70 [system.pas][System][System.TObject.Create][8839]
46A257 [u_home.pas][u_home][u_home.TForm1.SpeedButton1Click][80] {<-memory leak is here, but what are the Other detections?}
443AAC [Controls.pas][Controls][Controls.TControl.Click][5226]
46958B [Buttons.pas][Buttons][Buttons.TSpeedButton.Click][1211]
46956B [Buttons.pas][Buttons][Buttons.TSpeedButton.MouseUp][1204]
443FB2 [Controls.pas][Controls][Controls.TControl.DoMouseUp][5352]
441BA0 [Controls.pas][Controls][Controls.TControl.SetMouseCapture][4379]
444042 [Controls.pas][Controls][Controls.TControl.WMLButtonUp][5364]
The block is currently used for an object of class: TStringList
The allocation number is: 440
Run Code Online (Sandbox Code Playgroud)
在这leak是
46A257 [u_home.pas][u_home][u_home.TForm1.SpeedButton1Click][80] {<-memory leak is here, …Run Code Online (Sandbox Code Playgroud) 我正在为一个组件进行delphi 7快速安装而不必触摸IDE我正在制作一个简单的安装程序,根据Marjan Venema的这个SO答案 .
procedure TForm1.Button1Click(Sender: TObject);
var
sDelphi7PackageName : string;
sDelphi7Path,fileSource,fileDest : string;
sDelphi7packBPL,sDelphi7PathMenuBPL : string;
begin
sDelphi7Path:=ReadRegistryValues('\Software\Borland\Delphi\7.0',FALSE,'RootDir',1,TRUE);{<-- returns the 'C:\Program Files\Borland\Delphi7' }
{#1. Install .bpl}
sDelphi7BPL:=sDelphi7Path+'\Projects\Bpl\Pack.bpl';
WriteValueToRegisTry('\Software\Borland\Delphi\7.0\Known Packages',FALSE,sDelphi7BPL,'Delphi 7 compo Bpl File'); {<-- writes to the registry}
fileSource:=ExtractFilePath(Application.ExeName)+'\Packages\comPack.bpl';
fileDest:=sDelphi7BPL;
CopyFile(PChar(fileSource), PChar(fileDest), False);
end;
Run Code Online (Sandbox Code Playgroud)
这工作正常![在此处输入图像描述] [2]
C:\Program Files\Borland\Delphi7\Projects\Bpl\Pack.bpl.但组件安装了idhidden
谁能告诉我如何unhide在component上安装吗?
编辑
可能有用:
1)我已经拥有bpl组件的文件,所以我直接复制到delphi 7目录C:\Program Files\Borland\Delphi7\Projects\Bpl并修改注册表HKEY_CURRENT_USER\Software\Borland\Delphi\7.0\Known Packages.
2)register组件的程序
implementation …Run Code Online (Sandbox Code Playgroud) 我正在使用delphi 7,我有一个应用程序,其中我使用动作管理器来创建动作,然后为它们分配快捷方式,快捷方式属性中已经定义了动作管理器中的快捷方式.但是我希望有一个类似的快捷方式
1. ADD ,that is the + on the numpad
2. Subtract key ,that is the - on the numpad
3. divide key , that is the / on the numpad.
4. enter key
Run Code Online (Sandbox Code Playgroud)
我尝试将自己的快捷方式指定为减法和ADD,但它给了我这个错误消息

我也尝试过 - 但没有发生任何事情
我的代码跟踪动作
var
Action : TBasicAction;
begin
Action := Sender as TBasicAction;
if (Action is TAction) and not TAction(Action).Enabled then exit;
case Action.tag of
1 : ShowMessage('ADD + pressed');
2 …Run Code Online (Sandbox Code Playgroud) 我正在使用delphi 6处理应用程序,我试图将相机集成到现有应用程序中,相机代码将捕获的帧显示到Tpanel上,在我的应用程序中我需要在Tpaintbox上显示捕获的帧(我不是原始编码器)
这是来自的代码示例
procedure TFrameThreadX.DrawFrame;
var
hdc:THandle;
begin
//do processing
.
.
hdc := GetDC( ViewForm.ViewPanel.Handle );
SetStretchBltMode(hdc,COLORONCOLOR);
StretchDIBits(hdc,0,0,nW,nH,0,0,ScW,ScH,DibPixels,TBitMapInfo((@FDib)^),DIB_RGB_COLORS,SRCCOPY);
ReleaseDC( ViewForm.ViewPanel.Handle, hdc );
//do processing
end;
Run Code Online (Sandbox Code Playgroud)
这里是得到Tpanel手柄为87248682的这
hdc := GetDC( ViewForm.ViewPanel.Handle );
Run Code Online (Sandbox Code Playgroud)
所以当我尝试在这样的代码中使用Tpaintbox时
hdc := GetDC( ViewForm.PaintBox1.Canvas.Handle);
Run Code Online (Sandbox Code Playgroud)
结果是0,
所以相机框架不显示..
所以我试过这个
使用GetDC和GetWindowDC,但在这两种情况下,句柄的函数结果为0,

我的代码
var
hdc : THandle;
begin
hdc := GetDC(Panel1.Handle);
Label1.Caption:=inttostr(hdc);
hdc := GetDC(Image1.Canvas.Handle);
Label2.Caption:=inttostr(hdc);
hdc := GetDC(PaintBox1.Canvas.Handle);
Label3.Caption:=inttostr(hdc);
end;
Run Code Online (Sandbox Code Playgroud)
对于GetWindowDC
var
hdc : THandle;
begin
hdc …Run Code Online (Sandbox Code Playgroud) 我工作的组件,用于delphi 7和delphi 2006,组件使用SynTaskDialog.pas从synopse,我已经成功地使用了SynTaskDialog.pas的delphi 7成分,但是当我试图在使用它delphi 2006来创建组件包.我收到一个错误

我在synopse.info/forum上找到了相同的解决方案
引用:
我找到了两个解决方法:要么
Run Code Online (Sandbox Code Playgroud)TD_ICONS_IDENT: array[TTaskDialogIcon] of string =( '', SMsgDlgWarning, SMsgDlgConfirm, SMsgDlgError, SMsgDlgInformation, '', SMsgDlgInformation);
并删除一些LoadResString调用或
2.使用类似函数替换指针数组
Run Code Online (Sandbox Code Playgroud)GetIconIdent(TTaskDialogIcon): Pointer
但即便如此,我无法编译组件的包.而这些错误来了
[Pascal Error] E2201 Need imported data reference ($G) to access 'SMsgDlgOK' from unit 'SynTaskDialog'
[Pascal Error] E2201 Need imported data reference ($G) to access 'SMsgDlgYes' from unit 'SynTaskDialog'
[Pascal Error] E2201 Need imported data reference ($G) to access …Run Code Online (Sandbox Code Playgroud) 尝试使用按钮名称weapon1,weapon2和cancel来使用自定义对话框.但是,当我尝试编译它时,使用此代码将结果显示为未定义错误消息是
[DCC错误] ssClientHost.pas(760):E2003未声明的标识符:'结果'
代码是:
with CreateMessageDialog('Pick What Weapon', mtConfirmation,mbYesNoCancel) do
try
TButton(FindComponent('Yes')).Caption := Weapon1;
TButton(FindComponent('No')).Caption := Weapon2;
Position := poScreenCenter;
Result := ShowModal;
finally
Free;
end;
if buttonSelected = mrYes then ShowMessage('Weapon 1 pressed');
if buttonSelected = mrAll then ShowMessage('Weapon 2 pressed');
if buttonSelected = mrCancel then ShowMessage('Cancel pressed');
Run Code Online (Sandbox Code Playgroud) 我正在使用动作管理器处理具有大量动作(超过50个)的delph 7应用程序.并跟踪我有的每一个动作..现在我还有其他如下代码..
procedure TMainForm.OnActionExecute(Sender: TObject);
var
Action : TBasicAction;
begin
Action := Sender as TBasicAction;
if (Action is TAction) and not TAction(Action).Enabled then exit;
if Action = SQLQueryAction then
begin
//do somthing
end
else if (Action = NewSurveyAction) then
begin
//do somthing
end
else if ...
..
..
//lots of actions with if else latr..
end;// of OnActionExecute....
Run Code Online (Sandbox Code Playgroud)
任何人都可以告诉我
如何使用'案例'之类的
case actions of
SQLQueryAction : //do somthing;
newsurveyaction : //do somthing;
//lots …Run Code Online (Sandbox Code Playgroud)我正在使用FastMM4来自sourceforge.net的应用程序.所以我FastMM4.pas在开头就添加了使用条款.在应用程序中,我需要运行一个batch文件后,FinalizeMemoryManager;在finalization中unit FastMM4;像这样的
initialization
RunInitializationCode;
finalization
{$ifndef PatchBCBTerminate}
FinalizeMemoryManager;
RunTheBatFileAtTheEnd; //my code here..calling a procedure
{$endif}
end.
Run Code Online (Sandbox Code Playgroud)
然后我的RunTheBatFileAtTheEnd代码是:
procedure RunTheBatFileAtTheEnd;
begin
//some code here....
sFilePaTh:=SysUtils.ExtractFilePath(applicaTname)+sFileNameNoextension+'_log.nam';
ShellExecute(applcatiOnHAndle,'open', pchar(sExeName),pchar(sFilePaTh), nil, SW_SHOWNORMAL) ;
end;
Run Code Online (Sandbox Code Playgroud)
为此,我需要SysUtils,shellapi在fastmm4单元的uses子句中使用.但使用它们就会出现这个消息

但如果我SysUtils,shellapi从使用中删除它的工作原理.我仍然需要安装fastmm4的所有功能,但是SysUtils,shellapi没有安装fastmm4
我有自己的单位,但最终确定是在fastmm4完成之前执行的.
任何人都可以告诉我如何解决这个问题?
编辑 - 1
unit FastMM4;
//...
...
implementation
uses
{$ifndef Linux}Windows,{$ifdef FullDebugMode}{$ifdef Delphi4or5}ShlObj,{$else}
SHFolder,{$endif}{$endif}{$else}Libc,{$endif}FastMM4Messages,SysUtils,shellapi;
Run Code Online (Sandbox Code Playgroud)
我的应用程序
program memCheckTest;
uses
FastMM4,
Run Code Online (Sandbox Code Playgroud)
编辑-2:
(在@SertacAkyuz回答之后),我删除SysUtils …
delphi ×10
delphi-7 ×6
delphi-2006 ×2
fastmm ×2
case ×1
components ×1
forms ×1
handle ×1
if-statement ×1
logging ×1
memory-leaks ×1
postgresql ×1
winapi ×1