如何将控件(按钮,面板,页面控件,标签)放在窗体的玻璃区域?

谢谢!
我尝试发送电子邮件,但是我有一个问题,但是,我在网上找到了这个代码:
Uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdMessage, IdTCPConnection, IdTCPClient,
IdMessageClient, IdSMTP, IdBaseComponent, IdComponent, IdIOHandler,
IdExplicitTLSClientServerBase, IdSMTPBase
procedure SendSimpleMail;
var
Msg: TIdMessage;
DestAddr: TIdEmailAddressItem;
begin
Msg := TIdMessage.Create(Self); //error here
Msg.From.Text := 'name';
Msg.From.Address := 'username@gmail.com';
Msg.Subject := 'Test';
DestAddr := Msg.Recipients.Add;
DestAddr.Text := 'name';
DestAddr.Address := 'username@yahoo.com';
Msg.Body.Add('simple test mail.');
tIdSMTP.Host := 'smtp.gmail.com';
tIdSMTP.Port := 25;
tIdSMTP.AuthenticationType := atLogin; //error here (2 error)
tIdSMTP.Username := 'username@gmail.com';
tIdSMTP.Password := 'password';
tIdSMTP.Connect;
tIdSMTP.Authenticate;
tIdSMTP.Send(Msg);
tIdSMTP.Disconnect;
end; …Run Code Online (Sandbox Code Playgroud) 我必须在system32文件夹中移动一个文件,我使用了这段代码:
//-----------FUNCTION----------------
function GetWindowsSystemDir(): String;
var
vlBuff: Array[0..MAX_PATH-1] of Char;
begin
getSystemDirectory(vlBuff, MAX_PATH);
Result := vlBuff;
end;
//-----------------------------------
const
SMyFile = GetWindowsSystemDir+'\intructions.txt'; //error here, line 87
var
S: TStringList;
begin
S := TStringList.Create;
try
S.Add('intructions');
S.SaveToFile(SMyFile);
finally
S.Free;
end;
end;
Run Code Online (Sandbox Code Playgroud)
编译时给我错误:
[DCC Error] Unit1.pas(87): E2026 Constant expression expected
Run Code Online (Sandbox Code Playgroud)
谢谢.
我如何自动删除我的Delphi程序?我试过这段代码:
procedure DeleteSelf;
var
module : HMODULE;
buf : array [ 0 .. MAX_PATH - 1 ] of char;
p : ULONG;
hKrnl32 : HMODULE;
pExitProcess, pDeleteFile, pFreeLibrary : pointer;
begin
module := GetModuleHandle ( nil );
GetModuleFileName ( module, buf, sizeof ( buf ) );
CloseHandle ( THandle ( 4 ) );
p := ULONG ( module ) + 1;
hKrnl32 := GetModuleHandle ( 'kernel32' );
pExitProcess := GetProcAddress ( hKrnl32, 'ExitProcess' );
pDeleteFile := GetProcAddress ( hKrnl32, 'DeleteFileA' …Run Code Online (Sandbox Code Playgroud) 我创建了一个文件.Lrs和我导入到程序中,它可以工作,但是如何从程序中获取资源并将其解压缩到我的PC上的某个位置?这是代码:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, LResources, Controls, Graphics, Dialogs, ExtCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
end;
initialization
{$I resource.lrs}
end.
Run Code Online (Sandbox Code Playgroud)
谢谢!
如何在不添加XP主题的情况下为UAC添加清单?
我试过这个清单:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Run Code Online (Sandbox Code Playgroud)
但XP主题仍然存在.
我尝试了很多其他清单,但是我收到了这个错误:
"无效的win32应用程序"
谢谢您的帮助
我试图通过使用WMI获取CPU缓存信息并且它工作得很好,但仅适用于2级和3级缓存,所以我的问题是,如何获取CPU 1级缓存信息?
如何将一个位图放在一个样式框设置为简单的组合框中?例如,Google Chrome右侧有一颗星,Firefox右侧有箭头.我试过这段代码:
procedure TForm2.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var
ComboBox: TComboBox;
bitmap: TBitmap;
begin
ComboBox := (Control as TComboBox);
Bitmap := TBitmap.Create;
try
ImageList1.GetBitmap(0, Bitmap);
with ComboBox.Canvas do
begin
FillRect(Rect);
if Bitmap.Handle <> 0 then Draw(Rect.Left + 2, Rect.Top, Bitmap);
Rect := Bounds(Rect.Left + ComboBox.ItemHeight + 2, Rect.Top, Rect.Right - Rect.Left, Rect.Bottom - Rect.Top);
DrawText(handle, PChar(ComboBox.Items[0]), length(ComboBox.Items[0]), Rect, DT_VCENTER+DT_SINGLELINE);
end;
finally
Bitmap.Free;
end;
end;
Run Code Online (Sandbox Code Playgroud)
但只能使用样式:csOwnerDrawFixed和csOwnerDrawVariable,位图也只能在项目上显示.
谢谢.
哪里可以找到适用于Delphi的Chromium Embedded Framework 3的最新版本?我用TortoiseSVN从这个页面下载了它:
http://code.google.com/p/dcef3/
因为CEF1提出了太多问题,但它是一个非常旧的版本,有一个下载的版本24,但最新版本是823.你能告诉我在哪里可以找到Delphi-XE2的最新版本吗?
非常感谢你.