×¢Òâµã£ºLPTSTR ¶ÔÓ¦µÄÊÇPAnsiChar »òÕßPWideChar ÄãÎÊÎÊËûµÄ±àÒëÑ¡Ïî,ÒªÊǶ¨ÒåÁËunicode¾ÍÊÇPWideChar ·ñÔòÊÇPAnsiChar
ÕâÀïÎÒÊÇÓÃUNICODE±à³ÌµÄ£¬ËùÒÔÓõ½µÄÊÇPWideChar
ÔÚVCдµÄA.dllÀïÌí¼ÓÒ»¸öº¯ÊýΪ
extern "C" __declspec(dllexport) LPTSTR WINAPI Do(LPTSTR i)
{
return i;
}
ÔÚDELPHIµ÷ÓÃΪ
type
TDoFunc=function(str:PWideChar) :PWideChar;stdcall;
var
Th:Thandle;
TDo:TDoFunc;
Tp:TFarProc;
str:PWideChar;
strA,strB:PWideChar;
begin
Th:=LoadLibrary('A.dll'); {×°ÔØDLL}
if Th>0 then
try
Tp:=GetProcAddress(Th,PChar('_Do@4'));
if Tp<>nil
then begin
TDo:=TDoFunc(Tp);
strA:='bread';
str:=TDo(strA);
ShowMessage(str);
end
else
ShowMessage('ûÓÐÕÒµ½º¯Êý');
finally
FreeLibrary(Th); {ÊÍ·ÅDLL}
end
else
ShowMessage('dllÎļþûÕÒµ½');
end;
ÕâÑù¾ÍOKÁË£¬(*^__^*) ÎûÎû
ºÃ¿ªÐÄŶ£¬ÓÖ½â¾öÁËÒ»¸öÎÊÌâ ......
1¡¢ÇëÁоÙVCLÀà¿âÖÐÒÔTObjectΪ¸ùµÄ¶ÔÏóÌåϵ£¨¿ÉÒÔÖ»ÀàÖ÷¸É£©
2¡¢ÇëÁоÙVCLÊý¾Ý¿â·½ÃæµÄºËÐÄÀà
3¡¢DelphiÖÐoverrideºÍoverloadµÄ×÷Ó÷ֱðÊÇʲô£¿
4¡¢DelphiÖÐRTTIÊÇʲô£¿ÓÐʲô×÷Óã¿
5¡¢Èç¹ûÒ»¸ö¸Õ²¿ÊðµÄWeb·þÎñÆ÷²»ÄÜ·ÃÎÊ£¬Áоٳö¿ÉÄÜ´æÔÚµÄÔÒò£¿
6¡¢ÔÚSQLÖÐ×óÁ¬½Óʱʲô?ËüÄÜʵÏÖµÄÊý¾Ý½á¹û¼¯µÄÌصãÊÇʲô£¿
7¡¢ÇëÎÊÔÚOracleºÍMssqlÖÐÈçºÎֻȡselectÓï¾ä½á¹û¼¯ÖеÄÇ°100Ìõ£¿
Oracle£ºselect top 100 * from tablename
Mssql£ºselect * from tablename where rownum < 101
8¡¢¶þ²æÊ÷
type
TBTreeNode = class
Data: string;
Left: TBTreeNode;
Right: TBTreeNode;
end;
function NewNode(const Data: string; Left, Right: TBTreeNode): TBTreeNode;
begin
Result := TBTreeNode.Create;
Result.Data := Data;
Result.Left := Left;
Result.Right := Right;
end;
var Root: TBTreeNode;
procedure Init;
begin
{ ½¨Ê÷£º
=
&n ......
×÷Õß¡¡: handsome1234
delphi µ÷Óà Excel ºê
ÎÒµÄÀí½âºê¾ÍÊǺ¯Êý,Ö»ÒªÎÒÄܵ÷ÓÃVBAµÄº¯Êý¾ÍËãÊǵ÷ÓÃExcelºê.
×î½üºÜ³¤Ê±¼äÑо¿ÈçºÎÓÃdelphiµ÷ÓÃExcelºê,ÕÒÁ˺ܶà×ÊÁÏ£¬´ó¶àÊǽ²ÈçºÎµ÷ÓÃExcel£¬Óкü¸ÖÖ·½Ê½£¬µ«ÕæÕý½²ºêµÄºÜÉÙ£¬ÎÒÏÖÔÚ°ÑÎÒµÄ×ÊÁϹ²Ïíһϣ¬Ê¡µÃ½ñºóÓÐÏëÁ˽âÕâ·½ÃæÄÚÈݵÄÐֵܽãÃÃÃÇÉÙ×ßÍä·¡££º
1¡¢¼ÓÔØactivexºÍvbide97µ¥Ôª£¬ÆäÖÐvbide97¾ßÌå·¾¶ÔÚC:\Program Files\Borland\Delphi5\Ocx\ServersÏÂ
{¶¯Ì¬¼ÓÔغê³ýÁ˵ļ¸ÖÖ·½·¨:V.CodeModule.AddfromString
V.CodeModule.AddfromFile
V.CodeModule.InsertLines
»¹ÓÐһЩ·½·¨ÔÚvbide97.pasÀïÃ涼¿ÉÒÔÕÒµ½
}
ÆäÖÐV:_VBComponent;ÀàÐÍ
ÎÒÔÚ UseExcelµ¥ÔªÖмÓÁËAddExcelMaroÕâ¸öº¯Êý£¬¿ÉÒÔÖ±½Óµ÷Óá£
ÏÂÃæÊÇUseExcel.pas ÆäÖÐÊÇmsgboxVBAµÄÒ»¸öº¯Êý¡£
unit UseExcel; //½«Êý¾Ýµ¼ÈëExcelµÄµ¥Ôª
{XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ......
×î½ü½ðɽÔÆ°²È«ÖÐÐĽػñÁËÒ»¸öºÜÅ£XµÄ²¡¶¾£¬½ðɽµÄ·´²¡¶¾¹¤³Ìʦ²»ÓÉ̾µÀYYºÜ¾ÃµÄ¶«Î÷ÖÕÓÚÓÐÈËʵÏÖÁË¡£
ÕâÊÇÒ»¶ÎÕë¶ÔITÃñ¹¤¡¢ÓÈÆäÊÇDelphi³ÌÐòÔ±µÄ²¡¶¾£¬¼òµ¥µÄÃèÊö¸Ã¶¾ÐÐΪ£¬¾ÍÊÇ£ºËüרßÐȾ³ÌÐòÔ±µÄµçÄÔ£¬Ò»µ©³É¹¦£¬³ÌÐòÔ±½ñºóд³öµÄÈκγÌÐò£¬¶¼ÊÇ´ø¶¾µÄ¡£
Ëüͨ¹ýijÖÖ·½Ê½È¥²éÕÒdephiµÄ°²×°Ä¿Â¼£¬Èç¹ûÕÒµ½dephiÕâ¸öÔ©´óÍ·£¬¾Í½«Ð°¶ñµÄ¶ñÒâ´úÂëÇ°ÅŲåÈëSysConst.pasÎļþ£¬Õâ¸öÎļþ±àÒëµÄʱºò£¬»áÉú³ÉSysConst.dcu£¬¶øÕâ¸öÎļþ»á±»Ìí¼Óµ½Ã¿¸öеÄdephi¹¤³ÌÖУ¬all right£¡ÏÖÔÚ£¬Ãñ¹¤ÃÇËù±àдµÄ³ÌÐò¾ÍÈ«²¿¶¼´ø¶¾¿©£¡¡£
¶ø¸ü¿ÉŵÄÊÇ£¬¸ù¾Ý¶ÔȾ¶¾ÏµÍ³µÄ·ÖÎö£¬ÎÒÃÇ·¢Ïָö¾ÔÚÈ«ÇòÍøÂçÖÐÒѾ´«²¥Á˶àÔ¡£ÒѲ»ÖªµÀÓжàÉÙÃñ¹¤µÄÉú²ú¹¤¾ßÖÐÁËÕÐ……
Delphi³ÌÐòÔ±µÄ±¯²Ò¾Àú——²¡¶¾ÔËÐйý³ÌÃèÊö
ijÄêijÔÂijÈÕ£¬dephiجÃÎÖпªÊ¼ÎÞÉùÎÞÏ¢µÄÖ´ÐС£²¡¶¾µÄÔËÐÐÒÔºó,Ê×ÏÈÖ´Ðкó´Ó×¢²á±í"HKEY_LOCAL_MACHINE\Software\Borland\Delphi\"µÄRootDirֵ϶ÁÈ¡Delphi·¾¶.È»ºóÔÙ¶ÁÈ¡delphi·¾¶ÏµÄ\source\rtl\sys\SysConst.pas Îļþ,Ñ»·¶ÁÈ¡Ö±µ½implementationÐÐ.È»ºóÌø³öÑ»·,ÏÂÃ濪ʼǰÅŲåÈë¶ñÒâ´úÂë.±£´æÎļþºó,×îºóʹÓÃMoveFileº¯Êý½«ÔÀ´µÄ SysConst.dcuÃüÃûÎ ......
Ê×ÏÈ´´½¨Ò»¸öеÄÏîÄ¿£¬È»ºóÏò´°ÌåÉÏÌí¼ÓÒ»¸öTQuery×é¼þºÍÒ»¸öTListView×é¼þ.
¡¡ÉèÖÃTQuery×é¼þµÄDatabaseNameÊôÐÔÉèÖÃΪDBDEMOS£¬SQLÊôÐÔÉèÖÃΪselect * from country¡£È»ºóÌí¼Ó³ÌÐò³õʼ»¯´úÂëÈçÏ£º
with adoquery1 do
begin
close;
ADOConnection1:=TADOConnection.Create(nil);
Adoconnection1.LoginPrompt:=false;
ADOConnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db1.mdb;Persist Security Info=False';
adoquery1.Connection := ADOConnection1;
SQL.Clear;
SQL.add('select * from BOSS');
Open;
end;
for i:=0 to adoquery1.FieldCount-1 do
begin
TempColumn:=self.ListView1.Columns.Add;
TempColumn.Caption:=adoquery1.Fields[i].FieldName;
end;
adoquery1.First;
while not adoquery1.Eof do
begin
TempItem:=self.ListView1.Items.Add;
TempItem.Caption:=adoquery1.Fields[0].AsString;
for i:=1 to adoquery1.FieldCount-1 do
begin
TempItem.SubItems.Add(adoquery1.Fields[i].AsString);
end;
adoquer ......
ÖÆ×÷Ô²½Ç¾ØÐεĴ°Ì壺
01.procedure TPortForm.FormCreate(Sender: Tobject);
02.var hr :thandle;
03.begin
04.hr:=createroundrectrgn(0,0,width,height,20,20);
05.setwindowrgn(handle,hr,true);
06.end;
Èç¹û²»Òª´°ÌåÍâ¿ò£¬ÔòʹÓãº
01.procedure TPortForm.FormCreate(Sender: Tobject);
02.var hr :thandle;
03.begin
04.hr:=createroundrectrgn(1,1,width-2,height-2,20,20);
05.setwindowrgn(handle,hr,true);
06.end;
ÓÉÓÚµÚÒ»¶Î´úÂë×ö³öÀ´µÄ´°¿Ú£¬Ô²½Ç²¿·Ý»áûÓб߿ò£¬Ê¹ÓÃÏÂÃæµÄ´úÂë×ö³ö±ß¿ò£º
01.procedure TForm1.FormPaint(Sender: TObject);
02.var
03.DC: HDC;
04.Pen: HPen;
05.OldPen: HPen;
06.OldBrush: HBrush;
07.begin
08.DC := GetWindowDC(Handle);
09.Pen := CreatePen(PS_SOLID, 1, clGray);
10.OldPen := SelectObject(DC, Pen); //ÔØÈë×Ô¶¨ÒåµÄ»±Ê,±£´æÔ»±Ê
11.OldBrush := SelectObject(DC, GetStockObject(NULL_BRUSH));//ÔØÈë¿Õ»Ë¢,±£´æԻˢ
12.RoundRect(DC, 0, 0, Width-1, Height-1,21,21); //»±ß¿ò
13.SelectObject(DC,OldBrush);//ÔØÈëԻˢ
14.SelectObject(DC,OldPen); // ÔØÈëÔ»±Ê
15.Del ......