TRect如何正确洗杨梅Create

What’s new about Diablo III compared to the previous Diablo games?Exciting new classes like the witch doctor bring new gameplay options to the table. Returning classes, like the barbarian, have been completely redone with new skills to give them a feel unique to Diablo III. New customization options will provide for an even greater level of character specialization than the previous Diablo games, allowing the player to create unique characters brimming with power.Diablo III is powered by a new graphics engine that can display characters and hordes of monsters in lush, fully 3D environments. Powerful special-effects systems and Havok-powered physics allow the player to lay waste to the Hells' minions in spectacular ways.Also, Diablo III builds on the random environments of the previous Diablo games by introducing a host of new ways to create random scripted events throughout the game. This creates a dense and exciting world alive with quests, NPCs, dynamic encounters, and viciously challenging new monsters and bosses. Diablo III's environments add a great deal of interactivity to the game, including destructible elements and environmental obstacles that can be turned against your enemies.In addition, Diablo III will benefit from Battle.net upgrades that will provide some exciting new features for players. Cooperative online play remains a primary focus, with multiple enhancements being planned to make connecting with your friends easier and cooperative gameplay even more fun. We'll have more details on all these aspects as well as other exciting new features at a later date.
at June 30, 2008. by 傻猫 . &&nbsp Views: 3216 &&nbsp
What is Diablo III?We’re developing Diablo III to be the definitive action role-playing game, and a true continuation of the Diablo series. Players will create a hero from one of five distinct classes, such as barbarian or witch doctor, each equipped with an array of spells and abilities. As these heroes adventure through rich and varied settings, unraveling an epic storyline and engaging in combat with hordes of monsters and challenging bosses, they’ll grow in experience and ability and acquire items of incredible power.The game takes place on Sanctuary, a world of dark fantasy. Unbeknownst to most of its inhabitants, Sanctuary was saved some twenty years ago from the demonic forces of the underworld by a few brave and powerful heroes. Most of those warriors who directly faced the armies of the Burning Hells -- and were fortunate enough to survive -- went mad from their experiences. And most of the others have buried their haunted memories and pushed the horrors from their thoughts. In Diablo III, players will return to Sanctuary to confront evil in its many forms once again.Diablo III will be a fitting sequel to Diablo II, with the easy interface, fast-paced action, and visceral gameplay that Diablo players have come to expect and enjoy. It will also include many new features that will take the Diablo action-RPG experience to the next level. We look forward to going into much more detail on our plans for Diablo III as development on the game progresses.
at June 30, 2008. by 傻猫 . &&nbsp Views: 3258 &&nbsp
//获取任务栏尺寸procedure TForm1.Button1Click(Sender: TObject);varTaskList: HWBordered: TRbeginTaskList := FindWindow(’Shell_TrayWnd’, nil);GetWindowRect(TaskList, Bordered);Label1.Caption := ’Left: ’ + IntToStr(Bordered.Left);Label2.Caption := ’Right: ’ + IntToStr(Bordered.Right);Label3.Caption := ’Top: ’ + IntToStr(Bordered.Top);Label4.Caption := ’Bottom: ’ + IntToStr(Bordered.Bottom);//修改指定路径下的文件只读属性function PathSetAttr(sFilePath: string): BvarSearchRec: TSearchRbeginResult := Fif Copy(sFilePath, Length(sFilePath) - 1, Length(sFilePath)) && ’\’ then&& sFilePath := sFilePath + ’\’;if DirectoryExists(sFilePath) thenbegin&& if FindFirst(sFilePath+’*.*’, faAnyFile, SearchRec) = 0 then&& begin&&&& FileSetAttr(SearchRec.Name, 32);&&&& while FindNext(SearchRec) = 0 do&&&&&& FileSetAttr(SearchRec.Name, 32);&&&& Result := T//为控件加边框procedure WMNCPaint(var Msg: TWMNCPaint); message WM_NCPAINT;procedure TForm1.WMNCPaint(var Msg: TWMNCPaint);vardc: hDC;Pen: hPOldPen: hPOldBrush: hBbegindc := GetWindowDC(Handle);msg.Result := 1;Pen := CreatePen(PS_SOLID, 1, RGB(255, 0, 0));OldPen := SelectObject(dc, Pen);OldBrush := SelectObject(dc, GetStockObject(NULL_BRUSH));Rectangle(dc, 0, 0, Self.Width, Self.Height);SelectObject(dc, OldBrush);SelectObject(dc, OldPen);DeleteObject(Pen);ReleaseDC(Handle, Canvas.Handle);//制作透明窗体procedure CreateParams(var Params: TCreateParams);&&//重载 CreateParams 过程的实现procedure TForm1.CreateParams(var Params: TCreateParams);begin//先继承原来的 CreateParams 过程//然后修改 Param.ExStyle 的值,使窗体具有透明效果Params.ExStyle := Params.ExStyle or WS_EX_TRANSPARENT;procedure TForm1.FormCreate(Sender: TObject);begin//将画布的笔刷样式改成 bsClear 以及时清除窗体原来的内容,这样窗体就有透明效果Canvas.Brush.Style := bsC//Memo 组件的光标定位procedure TForm1.Memo1MouseDown(Sender: TO Button: TMouseBShift: TShiftS X, Y: Integer);varLpos, Cpos, Linelength:beginLpos := SendMessage(Memo1.Handle, EM_LineFromChar, Memo1.SelStart, 0);Cpos := SendMessage(Memo1.Handle, EM_LineIndex, Lpos, 0);LineLength := SendMessage(Memo1.Handle, EM_LineLength, Cpos, 0);Cpos := Memo1.SelStart - CLabel1.Caption := IntToStr(Lpos);Label2.Caption := IntToStr(Cpos);Label3.Caption := IntToStr(LineLength);//点击客户区也能拖动窗口procedure WmNCHitTest(var Msg: TWMNCHitTest); message WM_NCHitTprocedure TForm1.WmNCHitTest(var Msg: TWMNCHitTest);beginDefaultHandler(Msg);if Msg.Result = HTClient then&& Msg.Result := HTC//自定义Memo控件的边界procedure TForm1.Button1Click(Sender: TObject);varRect: TRbeginSendMessage(Memo1.Handle, EM_GETRECT, 0, LongInt(@Rect));Rect.Left := 20;Rect.Top := 20;Rect.Right := Rect.Right - 19;Rect.Bottom := Rect.Bottom - 19;SendMessage(Memo1.Handle, EM_SETRECT, 0, LongInt(@Rect));Memo1.R//在系统菜单上添加自定义菜单项procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND;constidMyFunc = $f200;procedure TForm1.FormCreate(Sender: TObject);beginAppendMenu(GetSystemMenu(Handle, False), MF_STRING, idMyFunc, ’我的系统菜单项’);procedure TForm1.WMSysCommand(var Msg: TWMSysCommand);beginif Msg.CmdType and $FFF0 = idMyFunc then&& ShowMessage(’我的系统菜单项’);&COOLBAR内嵌TOOLBAR,但是TOOLBAR的按钮偏上的解决办法:把COOLBAR的COOLBAND的BORDERSTYLE设为SINGLE。另外,如果想把主菜单弄到TOOLBAR里面,只要把TOOLBAR的MENU设为主菜单名,并把主菜单的AUTOMERGE设为TRUE即可。------------------------------------listbox从文件中读取列表的操作ListBox1.Items.LoadFromFile(ExtractFilePath(Application.ExeName)+’aaa.txt’);ListBox1.Items.Add(Edit1.Text); //添加了一个项目ListBox1.Items.SaveToFile(ExtractFilePath(Application.ExeName)+’aaa.txt’);删除项目ListBox1.Items.Delete(listbox1.itemindex);------------------------------------判断窗体是否已经打开if frmPriceInput && nil then ....注意:有时窗体虽然已经关闭,但没完全释放,最好在该窗体关闭的CLOSE事件里加入 frmPrintInput =------------------------------------关闭MDI子窗口的方法在子窗口的OnClose事件处理过程中加入如下代码Action := caFDelphi为一个Form的关闭行为指定了四种方式,分别是:caNone -- 禁止Form被关闭caHide -- Form不被关闭,但是被隐藏。被隐藏的Form仍然可以被程序访问。caFree -- Form被关闭,并且释放其占用的资源。caMinimize -- Form被最小化而不是被关闭,这是MDI子窗口的默认关闭行为。------------------------------------系统配置文件 *.INI 的操作头部要引用IniFiles1、声明变量Inifile:TiniF2、指明路径IniFile := TIniFile.Create(ExtractFilePath(Application.ExeName)+’option.ini’);3、读取变量,注意变量有类型之分readstring,readinteger...等titleBMPfile:=IniFile.ReadString(’TitleImage’,’FileName’,’’);&&//IniFile.ReadString(’组名’,’变量’,’默认值’)IniFile.ReadIntegerIniFile.ReadBool4、写入或修改变量IniFile.WriteString(’标题’,’变量1’,’值’);5、用完后释放IniFile.F------------------------------------动态读取图象Image1.Picture.LoadFromFile(titleBMPFile);------------------------------------fastreport自定义函数的用法1、先在普通工程窗体上定义好函数2、在frreport控件的userfunction中写入&& if ansicomparetext( ’My_StrToRMB’ , Name ) = 0 then&&val:=My_StrToRMB(frparser.Calc(p1));//MY_STRTORMB是函数名//如果定义多个函数,就多来几个IF即可。在报表设计视图中就可以调用这个函数了。------------------------------------数组是这样定义的sbh:array [0....1]&&------------------------------------treeview的用法//先定义项目序数和节点n: INode: TTreeNNode := Tree1.Sif (Node = nil) or (Node.StateIndex = -1) then E//一般可以把不作反应的列的stateindex定为-1n := Node.StateI------------------------------------Fields[]&&&&&& 通过索引返回字段,要自己選擇返回的類型!FieldByName()&&通过名字返回字段,要自己選擇返回的類型!Fieldvalues[]&&通过名字返回字段的值,自動化類型!&&------------------------------------调用外部程序方法用ShellExecute,在USES段加入SHELLAPI,使用时如:&&ShellExecute(handle,’open’,’c:\myapp\myapp.exe’,’-s’,’’,SW_SHOWNORMAL);&&第一个参数为父窗口句柄;&&第二个参数为打开方式(OPEN,PRINT两种);&&第三个参数为执行文件全路径;&&第四个参数为执行文件参数;&&第五个参数为执行文件开始运行时的初始目录;&&第六个参数为为执行文件运行方式(SW_HIDE,SW_MAXIMIZE,SW_MINIMIZE,SW_RESTORE,SW_SHOW,SW_SHOWDEFAULT,SW_SHOWMAXIMIZED,SW_SHOWMINIMIZED,SW_SHOWMINNOACTIVE,SW_SHOWNA,SW_SHOWNOACTIVATE,SW_SHOWNORMAL);------------------------------------判断文件是否存在if not fileexists(’db2.mdb.bak’) then ...------------------------------------判断按键if Key=#13 then //如果回车则。。。------------------------------------退出关闭窗口关闭程序:Application.T退出事件------------------------------------检测软件是否已在运行if GetLastError = ERROR_ALREADY_EXISTS then...------------------------------------定义函数是这样写的function IsReadOnly(b: B colors: Tcolor): B------------------------------------fastreport直接打印FrReport1.PrepareR&&&& //初始化FrReport1.PrintPreparedReport(’1’,1,True,frAll);&&&&//打印预览FrReport1.------------------------------------找开浏览器,进入某站点。(或调用WINDOWS程序)进入站点ShellExecute(Handle, PChar(’OPEN’), PChar(’http://www.devexpress.com/downloads/index.asp’), nil, nil, SW_SHOWMAXIMIZED);发送邮件ShellExecute(Handle, ’open’, PChar(’mailto:’ + edtemail.Text + ’?subject=’), nil, nil, SW_SHOW);------------------------------------打开文件对话框if OpenPictureDialog.Execute then------------------------------------调用帮助文件Application.HelpFile := ’..\..\Help\eBars.hlp’;------------------------------------打开窗口TForm1.Create(self).ShowM------------------------------------取得当前执行程序的路径FPath := ExtractFilePath(Application.ExeName);或FileName := ExtractFilePath(ParamStr(0)) + ’\MDB\电子通讯录.mdb’;------------------------------------当前路径getcurrentdir------------------------------------判断当前鼠标处于某个位置(TAG)&& case TComponent(Sender).Tag of&&&& 0: begin&&&&&& ...&&&&&&&& lbBarBackgroud.Caption := sCustomI&&&&&&&&&&&& 1: begin&&&&&& ...&&&&&&&& lbBarBackgroud.Caption := sCustomI&&&&&&&&&&&& 2: begin&&&&&& ...&&&&&&&& lbBarBackgroud.Caption := sCustomI&&&&&&&&------------------------------------数据库连接1、建立一个adoconnection控件,命名为conn2、建立一个adodataset控件,命名为ds然后就可以用以下语句连接并执行SQL查询(本例是access的数据库,带密码)。conn.ConnectionString:=’Provider=Microsoft.Jet.OLEDB.4.0;Data Source=’+getcurrentdir+’\data\pn.Persist Security Info=Fjet oledb:database password=80513’;conn.Connected:=ds.Active:=ds.CommandText:=’select 拜访日期,拜访时间,拜访客户,拜访地点,谈话内容 from khbf order by 拜访日期 desc’;ds.Active:=------------------------------------ADODataSet1.State的用法if ADODataSet1.State in [dsEdit,dsInsert] then&&&& ADODataSet1.P------------------------------------ADOQuery.open和ADOQuery.execSQL的区别用于存贮时如insert 只能用execSQL------------------------------------------------------------------------------------------------------------------------------------------------回车光标移到另一个输入框if key=#13 thencmb_name.SetF------------------------------------播放声音playsound(’c:\windows\media\start.wav’,0,SND_ASYNC);------------------------------------列表框listbox增加项目cmb_name.Items.Add(adotable1.Fieldvalues[’帐号’]);------------------------------------listview用法ListView.Selected := ListView.Items[0];ListView.Selected.Focused := TListView.Selected.MakeVisible(False);ListView.Selected.IndexListView.Items.CountListView.Items.Delete(3) //删除第3个项目ListView.Items.Add.Caption:=’dddddddd’; //增加一个项目ListView.Items.BeginUListView.Items.EndUpdateListView.Canvas.Font.Color := clGrayTif ListView.Selected && nil then。。。。。//往listview添加项目先定义var itm: TListI然后listview.Items.Citm := listview.Items.Aitm.ImageIndex := 5;itm.Caption := Msg.Sitm.SubItems.Add(’aaaaa’);itm.SubItems.Add(’ffffff’);itm.SubItems.Add(’ffdfdfdf’);itm.SubItems.Add(’oooo’);------------------------------------静态调用DLL的方法有参数procedure CreateSms(Text: Pchar);External ’SmsLib.dll’;无参数procedure CreateSExternal ’SmsLib.dll’;------------------------------------确定、取消对话框作用if application.MessageBox(’真的退出?’,’提示’,mb_okcancel)=idok thenapplication.T&& //Terminate是终止程序showmessage(’请先选中要修改的班级’);&&&&//这个是简单的显示提示框messagebox(self.Handle ,’价格输入不合法!’,’提示’,MB_OK or MB_ICONASTERISK);------------------------------------调用窗体的步骤先引用该窗体的单元,然后建立窗体,最后显示出来。例1:Application.CreateForm(TFmXsgl, FmXsgl);fmxsgl.ShowM例2:Frm_LendDetail:=TFrm_LendDetail.Create(self);Try&& Frm_LendDetail.ShowMFinally&& Frm_LendDetail.FE------------------------------------数据库查询先建立数据源,然后添加一个TADOQUERYadoquery1.SQL.Cadoquery1.Cadoquery1.SQL.Add(’select * from tkcb order by ckcb_kh’);adoquery1.Oaaa=adoquery1.Fieldvalues[’ckcb_kc’];&&&&//取出当前记录某字段的值adoquery1.N&&&&&&&&//下一记录adoquery1.C&&&&//关闭查询------------------------------------判断键盘输入字符-chr(13)是回车if key=chr(13) then&&bitbtn1.SetF------------------------------------时间格式lblTime.Caption := FormatDateTime(’yyyymmdd hh:nn:ss’,Now);------------------------------------表数据的添加添加dmd是数据模块 tbl_zgdb是表名with dmd.tbl_zgdb do begin&& A&& Fieldvalues[’HYZH’] := Edt_HYZH.&& Fieldvalues[’XM’] := Edt_xm.&& Fieldvalues[’XB’] := Edt_xb.&& Fieldvalues[’dw’] := Edt_dw.&& Fieldvalues[’ZZMM’] :=&& Fieldvalues[’CSNY’] := trim(Edt_csny.text);&& Fieldvalues[’GZSJ’] := Edt_gzsj.&& Fieldvalues[’DBLB’] :=&& Fieldvalues[’ZCLB’] :=&& Fieldvalues[’XL’] :=&& Fieldvalues[’BZ’] := Edt_bz.&& P&&------------------------------------列表框的选项值Edit1.Text:=listbox1.Items.Strings[listbox1.itemindex];------------------------------------Delphi键盘按键伪码用法:if key = chr(VK_RETURN) then...常数名称 十六进制值 十进制值 对应按键VK_LBUTTON 01 1 鼠标的左键VK_RBUTTON 02 2 鼠标的右键VK-CANCEL 03 3 Contol-break 执行VK_MBUTTON 04 4 鼠标的中键(三按键鼠标)VK_BACK 08 8 Backspace键VK_TAB 09 9 Tab键VK_CLEAR 0C 12 Clear键VK_RETURN 0D 13 Enter键VK_SHIFT 10 16 Shift键VK_CONTROL 11 17 Ctrl键VK_MENU 12 18 Alt键VK_PAUSE 13 19 Pause键VK_CAPITAL 14 20 Caps Lock键VK_ESCAPE 1B 27 Ese键VK_SPACE 20 32 Spacebar键VK_PRIOR 21 33 Page Up键VK_NEXT 22 34 Page Domw键VK_END 23 35 End键VK_HOME 24 36 Home键VK_LEFT 25 37 LEFT ARROW 键(←)VK_UP 26 38 UP ARROW键(↑)VK_RIGHT 27 39 RIGHT ARROW键(→)VK_DOWN 28 40 DOWN ARROW键(↓)VK_SELECT 29 41 SELECT键VK_EXECUTE 2B 43 EXECUTE键VK_SNAPSHOT 2C 44 Print Screen键VK_INSERT 2D 45 Ins键VK_DELETE 2E 46 Del键VK_HELP 2F 47 Help键VK_0 30 48 0键VK_1 31 49 1键VK_2 32 50 2键VK_3 33 51 3键VK_4 34 52 4键VK_5 35 53 5键VK_6 36 54 6键VK_7 37 55 7键VK_8 38 56 8键VK_9 39 57 9键VK_A 41 65 A键VK_B 42 66 B键VK_C 43 67 C键VK_D 44 68 D键VK_E 45 69 E键VK_F 46 70 F键VK_G 47 71 G键VK_H 48 72 H键VK_I 49 73 I键VK_J 4A 74 J键VK_K 4B 75 K键VK_L 4C 76 L键VK_M 4D 77 M键VK_N 4E 78 N键VK_O 4F 79 O键VK_P 50 80 P键VK_Q 51 81 Q键VK_R 52 82 R键VK_S 53 83 S键VK_T 54 84 T键VK_U 55 85 U键VK_V 56 86 V键VK_W 57 87 W键VK_X 58 88 X键VK_Y 59 89 Y键VK_BZ 5A 90 Z键VK_NUMPAD0 60 96 数字键0键VK_NUMPAD1 61 97 数字键1键VK_NUMPAD2 62 98 数字键2键VK_NUMPAD3 63 99 数字键3键VK_NUMPAD4 64 100 数字键4键VK_NUMPAD5 65 101 数字键5键VK_NUMPAD6 66 102 数字键6键VK_NUMPAD7 67 103 数字键7键VK_NUMPAD8 68 104 数字键8键VK_NUMPAD9 69 105 数字键9键VK_MULTIPLY 6A 106 *键VK_ADD 6B 107 +键VK_SEPARATOR 6C 108 Separator键VK_SUBTRACT 6D 109 -键VK_DECIMAL 6E 110 .键VK_DIVIDE 6F 111 键VK_F1 70 112 F1键VK_F2 71 113 F2键VK_F3 72 114 F3键VK_F4 73 115 F4键VK_F5 74 116 F5键VK_F6 75 117 F6键VK_F7 76 118 F7键VK_F8 77 119 F8键VK_F9 78 120 F9键VK_F10 79 121 F10键VK_F11 7A 122 F11键VK_F12 7B 123 F12键VK_NUMLOCK 90 144 Num Lock 键VK_SCROLL 91 145 Scroll Lock键1、判断机器是否网络状态答:uses WinIprocedure TForm1.Button1Click(Sender: TObject);function GetOnlineStatus : Bvar ConTypes : IbeginConTypes := INTERNET_CONNECTION_MODEM + INTERNET_CONNECTION_LAN + INTERNET_CONNECTION_PROXY;if (InternetGetConnectedState(@ConTypes, 0) = False)then Result := Falseelse Result := Tbeginif not GetOnlineStatus then ShowMessage(’Not Connected’);=========================================2、[DELPHI]窗体渐渐出现答:AnimateWindow(Handle,1000,AW_CENTER);//在窗体创建事件中=========================================3、如何取得一台机器的CPU占用率 ?答:使用下面的方法interfaceusesWindows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,Dialogs, StdCconstSystemBasicInformation = 0;SystemPerformanceInformation = 2;SystemTimeInformation = 3;typeTPDWord = ^DWORD;TSystem_Basic_Information = packed recorddwUnknown1: DWORD;uKeMaximumIncrement: ULONG;uPageSize: ULONG;uMmNumberOfPhysicalPages: ULONG;uMmLowestPhysicalPage: ULONG;uMmHighestPhysicalPage: ULONG;uAllocationGranularity: ULONG;pLowestUserAddress: PpMmHighestUserAddress: PuKeActiveProcessors: ULONG;bKeNumberProcessors:bUnknown2:wUnknown3:typeTSystem_Performance_Information = packed recordliIdleTime: LARGE_INTEGER; {LARGE_INTEGER}dwSpare: array[0..75] of DWORD;typeTSystem_Time_Information = packed recordliKeBootTime: LARGE_INTEGER;liKeSystemTime: LARGE_INTEGER;liExpTimeZoneBias: LARGE_INTEGER;uCurrentTimeZoneId: ULONG;dwReserved: DWORD;varNtQuerySystemInformation: function(infoClass: DWORD;buffer: PbufSize: DWORD;returnSize: TPDword): DWORD; stdcall =liOldIdleTime: LARGE_INTEGER = ();liOldSystemTime: LARGE_INTEGER = ();SysBaseInfo: TSystem_Basic_ISysPerfInfo: TSystem_Performance_ISysTimeInfo: TSystem_Time_Istatus: L {long}dbSystemTime: DdbIdleTime: Dfunction GetCPUUsage:Dimplementationfunction Li2Double(x: LARGE_INTEGER): DbeginResult := x.HighPart * 4. + x.LowPartfunction GetCPUUsage:DvarbLoopAborted :beginif @NtQuerySystemInformation = nil thenNtQuerySystemInformation := GetProcAddress(GetModuleHandle(‘ntdll.dll‘),‘NtQuerySystemInformation‘);// get number of processors in the systemstatus := NtQuerySystemInformation(SystemBasicInformation, @SysBaseInfo, SizeOf(SysBaseInfo), nil);if status && 0 then E// Show some information{with SysBaseInfo dobeginShowMessage(Format(‘uKeMaximumIncrement: %d‘#13‘uPageSize: %d‘#13+‘uMmNumberOfPhysicalPages: %d‘+#13+‘uMmLowestPhysicalPage: %d‘+#13+‘uMmHighestPhysicalPage: %d‘+#13+‘uAllocationGranularity: %d‘#13+‘uKeActiveProcessors: %d‘#13‘bKeNumberProcessors: %d‘,[uKeMaximumIncrement, uPageSize, uMmNumberOfPhysicalPages,uMmLowestPhysicalPage, uMmHighestPhysicalPage, uAllocationGranularity,uKeActiveProcessors, bKeNumberProcessors]));}bLoopAborted := Fwhile not bLoopAborted dobegin// get new system timestatus := NtQuerySystemInformation(SystemTimeInformation, @SysTimeInfo, SizeOf(SysTimeInfo), 0);if status && 0 then E// get new CPU‘s idle timestatus := NtQuerySystemInformation(SystemPerformanceInformation, @SysPerfInfo, SizeOf(SysPerfInfo), nil);if status && 0 then E// if it‘s a first call - skip itif (liOldIdleTime.QuadPart && 0) thenbegin// Currentvalue = Newvalue - OldvaluedbIdleTime := Li2Double(SysPerfInfo.liIdleTime) - Li2Double(liOldIdleTime);dbSystemTime := Li2Double(SysTimeInfo.liKeSystemTime) - Li2Double(liOldSystemTime);// CurrentCpuIdle = IdleTime / SystemTimedbIdleTime := dbIdleTime / dbSystemT// CurrentCpuUsage% = 100 - (CurrentCpuIdle * 100) / NumberOfProcessorsdbIdleTime := 100.0 - dbIdleTime * 100.0 / SysBaseInfo.bKeNumberProcessors + 0.5;// Show Percentage//Form1.Label1.Caption := FormatFloat(‘CPU Usage: 0.0 %‘,dbIdleTime);//Application.ProcessM// Abort if user pressed ESC or Application is terminatedResult:=dbIdleTbLoopAborted:=T//bLoopAborted := (GetKeyState(VK_ESCAPE) and 128 = 128) or Application.T// store new CPU‘s idle and =========================================4、动态生成控件?答:varTeSpeedButtonX:TTeSpeedBbeginTeSpeedButtonX:=TTeSpeedButton.Create(nil);TeSpeedButtonX.Caption:=’标题’;TeSpeedButtonX.Name:=’按钮’+inttostr(X);TeSpeedButtonX.Parent:=Tetoolbar2;X:=X+1;=========================================5、我动态创建了多个button,使用时,我怎么判断出用户点击的是哪个button呢?button的各项属性都边成最后创建的那个button的了,怎么办哦?答1:教你一招,先设置每个button的tag属性.然后在onclick事件中用(sender as button).tag来判断,相信我,没错的!&&答2:如果你生成的控件不是很多的话,最简单的方法就是,假如你生成控件的父控件是FORM1,利用循环判断控件是否等于FORM1.ACTIVECONTROL,我就是这么用的。ACTIVECONTROL就是记录当前被点击的控件,你也可以直接用它,不过直接只能用到CONTROL的一般属性和方法,循环判断的话就可以用到你生成控件的相关属性。&&=========================================6、窗体释放问题答:在Form2.OnClose事件中Action:=caF1、怎么样在delphi中调动其它*.exe文件?例如:winexec(’d:\郑洽\Project1.exe’,sw_show);================================2、如何让工程运行时主窗体就是最大化的?答:设置主窗体的WindowsState属性为wsMaximized就可以了!wsNormal 窗体以普通状态显示wsMinimized 窗体以最小化状态显示。wsMaximized 窗体以最大化状态显示。================================3、我想先-&闪现窗体-&主窗体-&登录窗体,工程源文件怎么设置?答:⒈开始一个新工程。给表格起名为MainForm,MainForm的单元起名为Main, 工程文 件起名为Test。⒉在MainForm中插入一个Button部件,将其Caption属性设为“关闭”,为该部件 的onClick事件创建一个过程,并在过程的begin和end之间插入Close语句。⒊在应用程序添加一个表格,将这个表格起名为MoveForm,MoveForm 的单元起名 为Move。⒋为便于演示,在MoveForm中插入一个Label部件,设置其Caption 属性为“欢迎 进入本系统”。5.下一步修改工程的源代码。选择View/Project Source,修改begin和end之间的 语句如下:程序清单Test.Dprprogram Testusesforms,Main in ’MAIN.PAS’{MainForm},Move in ’Move.PAS’{MoveForm}{$R *.RES}beginMoveForm:=TMoveForm.Create(Application);{Create创建闪现窗口对象}MoveForm.SMoveForm.UApplication.CreateForm(TMainForm,MainForm);MoveForm.HMoveForm.F{Free从内存中释放对象}Application.Rend.  第一条语句创建了对象,该对象存在内存中,但还不能看见, 为了让它出现并更 新它的内容,调用对象的Show和Update成员函数:Show和Update。 当闪现窗口使 用完后,用Hide函数将它隐藏起来,然后用Free函数释放它所占据的内存。6.如果此刻你编译和运行程序,MoveForm窗口一闪而过, 你可能未来得及看 清。为使MoveForm窗口显示几秒种,我们可为MainForm的OnCreate 事件创建一个 处理程序,延迟MoveForm窗口的显现时间。program TMainForm.FormCreate(sender:Tobject);varcurrentTime:LongIbegincurrentTime:=GetTickCount div 1000;while ((GetTickCount div 1000)&(currentTime+3) do{不做任何事);end.  GetTickCount函数返回窗口启动后过去的毫秒数,这个值除以1000 转化为秒数。 此时你编译运行程序,就能得到一个延迟3秒多的闪现窗口。为闪现窗口添加上Image部件,再对字体及窗口进行修饰,我们就能为应用程 序,创建一个精美的封面或在程序启动时显示重要提示。制作登录窗体一个很方便的方法就是主窗体作为主窗体,登录成功Hide掉就行了。如果登录窗体不可以作为主窗体,那么和闪现窗体一样的方法创建登录窗体,加在Application.R之前,MoveForm.F之后,用showmodal显示登录窗体================================4、button上面的文字怎么样换行?答:button控件不行bitbtn控件可以。bitbtn1.caption:=’aaaa’#13’bbbbb’================================5、怎么样判别焦点是否在某个控件上?答:if Tobject.focused then//焦点在某某控件上else================================6、怎么样在程序中使一个节点的子节点展开及收闭?答:treeview1.selected.E //判断节点的子节点是否展开True展开,否则闭拢treeview1.selected.Expand(True);//子节点展开treeview1.selected.collapse(True)://子节点闭拢&&树节点全部展开:procedure TForm1.Button1Click(Sender: TObject);var node:TTreeNbeginif treeview1.Items[0]&&nil thenbegin&&node:=treeview1.Items[0];&&node.Expand(true);&&while node.getNextSibling&&nil do&&begin&&&&node:=node.getNextS&&&&node.Expand(true);&&树节点全部收缩:procedure TForm1.Button2Click(Sender: TObject);var node:TTreeNbeginif treeview1.Items[0]&&nil thenbegin&&node:=treeview1.Items[0];&&node.Collapse(true);&&while node.getNextSibling&&nil do&&begin&&&&node:=node.getNextS&&&&node.Collapse(true);&&================================7、如何用delphi编程实现给access数据库加密码?答:1,新建Project。  2,在FORM中放入ADOConnection控件。  3,双击ADOConnection控件,然后点击Build...按钮,在“提供者”页中选择“Microsoft Jet 4.0 OLE DB   Provider”,然后点击“下一步”按钮,在“连接”页中选择要连接的Access数据库的路径和数据库的文件名,这时如果点“测试连接”按钮时,出现“初始化提供者时发生错误,测试连接失败,密码无效”的错误提示。  4,这时点“所有”页,然后双击“Jet OLEDB:Database Password”,出现对话框,添入密码后,选择“连接”页中的“测试连接”按钮,出现“测试连接成功”的对话框。把ADOConnection控件的LoginPromtp设为false.  5,设置连接完成。================================8、如何判断Treeview中我选中的节点是否有子节点?如果没有给出提示啊?答:if Treeview.Selected.HasChildren then//有else//无varNode :TTreeNbeginNode :=TreeView1.Sif Node.HasChildren then....对复杂的程序最好用Node过渡================================9、能否解释一下try...except...end及try...finally...?1.(1)是用于扑捉异常,(2)是用于保证代码执行的完整性2.(1)中finally处的代码不管什么情况都会被执行,(2)中except处的代码仅在发生异常时才会执行3.try finally之间的代码虽可保证finally 和 end之间的程序能执行,但不能保证程序不崩溃,而try except就不会使程序崩溃================================10、怎么样在主程序控制器中加入音乐?在implementation下加入 mmsystem單元(windows多媒體函數動態聯結庫)。然後在的onShow,onCreate事件中編寫代碼:sndplaysound(’sound.wav’,snd_async)================================11、我在form1上有四个edit,输完后我想用下上箭头键进行上移下移?怎么办?答:procedure TForm1.Edit1KeyDown(Sender: TO var Key: WShift: TShiftState);beginif key=vk_down&&then perform(WM_NEXTDLGCTL,0,0) elseif key=vk_up&&then perform(WM_NEXTDLGCTL,1,0);================================12、如何用delphi5实现读文本文件指定的一行,并得到文本文件的总行数?谢谢!答:Delphi读文件文件一般使用Readln过程,如要读第3行可以这样:&& var&&&&i : I&&&&F: TextF&&&&S:&& begin&&&&if OpenDialog1.Execute then { Display Open dialog box }&&&&begin&&&&AssignFile(F, OpenDialog1.FileName); { File selected in dialog }&&&&Reset(F);&&&&For i = 1 To 3 Do&&&&Readln(F, S);&&&&Edit1.Text := S; { Put string in a TEdit control }&&&&CloseFile(F);&&&&.&&&& 要统计总行数,只能从头逐行读,直到文件尾(Eof函数为True),每读一行计数器加1。&& 不过由于文本文件的每行长度不相等,它不能象数据库文件那样想读那行就读哪行,只能顺序读。&& 上面的方法容易理解,也容易实现。如果希望提高速度,编程上要麻烦一些,可以以二进制方式打开文件,将所有内容读入一个内存变量,然后使用Pos函数查找其中的回车(#13)个数,这样可以快速地统计总行数并能快速地找到指定行。================================13、制作主窗口显示前的版权窗口答:在工程文件中选File-&New Form新建一个窗口,设计好窗口的外观。给窗口起名为AboutBox,选Project-&Options,将新建的窗口从自动建立中去掉。 选View-&Project Source,打开工程文件的源文件,在下面加入红色的句子。Uses AboutBoxVarlTime :TDateTBeginApplication.Initialize();AboutBox=TAboutBox.Create(AboutBox);AboutBox.SAboutBox.UlTime=GetTickCApplication.CreateForm(TMainForm,MainForm);while((GetTickCount-lTime) / 1000 &3)AboutBox.HAboutBox.FApplication.R================================14、Delphi中RichEdit的奥妙  一、如何得知当前行号     用RichEdit(或者memo)控件制作文本编辑器时,通过访问lines?count属性可以得到总行数,但是若想知道光标当前所在行的行号就麻烦了,因为delphi没有提供这个属性。要实现这个编辑器必备功能,就须调用em_ LineFromChar。  请试试下面的程序。  先在窗口中布置一个RichEdit或者memo(命名为editor),以及一个button。在button的onclick事件中写入下列代码。   var   CurrentLine:I   begin     CurrentLine:=Editor.Perform(em_ LineFromChar,SFFFF,0);        Application.MessageBox(PChar(′当前行号是′+IntToStr(CurrentLine)),′消息′,mb_ iconinformation);       需要注意的是,第一行的行号为零。  二、如何撤消操作(undo)  对于memo来说,实现undo是不需编程的,只要让popupmenu属性为空,运行时就能用鼠标右键激活一个常用操作菜单,其中包括撤消、剪切、复制、粘贴、删除和全选六项。   但可惜的是,这一招对于功能强大的RichEdit控件居然行不通,害得我们还要自己设计一个popupmemu。当你用CutToClipBoard等语句轻松而顺利地完成了“剪切”等功能,接着便会无奈地发现,竟找不到undo或cancel之类的语句来执行“撤消”。   这时你需要这样处理:    RichEdit1?Perform(EM_UNDO,0,0);  另外还应检查是否允许撤消,从而开启或关闭弹出菜单中的“撤消”项:    Undo1?Enabled:=RichEdit?    Perform(EM_CANUNDO,0,0)&&0;   以上程序在Delphi3中调试通过。  ================================15、在主窗口中打开另一个独立的窗口,而这个被打开的窗口固定显示在..?答:procedure TForm2.FormCreate(Sender: TObject);beginform2.Hself.Parent:=form1.Panel1;================================16、SaveDialog1确认文件存不存在的办法?答:procedure TForm1.SaveDialog1CanClose(Sender: TOvar CanClose: Boolean);&&beginif FileExists(SaveDialog1.FileName) then //如果文件已经存在if MessageDlg(’文件已经存在,保存吗?’, mtConfirmation, [mbYes, mbNo], 0) && mrYes thenButton2.C //如果选择了覆盖,则退出,否则,重新让用户选择文件================================17、正确关闭一个MDI子窗口?答:Delphi中MDI子窗口的关闭方式默认为缩小而不是关闭,所以当你单击子窗口右上角的关闭按钮时会发觉该子窗口只是最小化,而不是你预期的那样被关闭。解决办法是在子窗口的OnClose事件处理过程中加入如下代码,示例:procedure ChildForm.OnClose(Sender: TO var Action: TCloseAction);beginAction := caF  Delphi为一个Form的关闭行为指定了四种方式,分别是:caNone 禁止Form被关闭caHide Form不被关闭,但是被隐藏。被隐藏的Form仍然可以被程序访问。caFree Form被关闭,并且释放其占用的资源。caMinimize Form被最小化而不是被关闭,这是MDI子窗口的默认关闭行为。================================18、怎样记MDI子窗口不在母体运行时就被打开?答:&& 在project下的options中forms里面除了form1外,其余的移到右边的框里,然后在调用显示的按钮下编写语句,以form2调用为例:&&&&form2:=Tform2.create(self);&&&&form2.================================19、限制FORM的大小答:在FORM私有声明部分加上如下一行:procedure WMGetMinMaxInfo( var Message:TWMGetMinMaxInfo );message WM_GETMINMAXINFO;在声明部分加上如下几行:procedure TForm1.WMGetMinMaxInfo( var Message :TWMGetMinMaxInfo );beginwith Message.MinMaxInfo^ dobeginptMaxSize.X := 200; {最大化时宽度}ptMaxSize.Y := 200; {最大化时高度}ptMaxPosition.X := 99; {最大化时左上角横坐标}ptMaxPosition.Y := 99; {最大化时左上角纵坐标}Message.Result := 0; {告诉Windows你改变了 minmaxinfo}================================20、随机数生成法答:Rrn:=inttostr(random(9999));rn1:=inttostr(random(9999));.....================================21、怎样把程序隐藏起来,在WINDOWS界面上没有显示??答:在application.run之前加入application.showmain:=false!&&================================22、怎样将一个form1.free的form1窗体重新显示?答:form2:=TForm2.Create(application);form2.S如果你要创建的Form2窗体能嵌入一个Panel中,指定Parent:form2:=TForm2.Create(application);form2.Parent:=panel1;form2.S================================23、我想在bitbtn上设快捷按钮Esc,怎么办?答:procedure TForm1.BitBtn1KeyDown(Sender: TO var Key: WShift: TShiftState);beginif key=27 thenapplication.T设它的cancel属性为true就行了~~================================24、什么叫做托盘区?答:托盘区就是在windows的状态栏下方显示时钟、输入法状态的地方,要把你的程序显示在托盘区:下面是一个托盘类,只要把下面粘贴到文本文件中,改成TrayIcon.pas,使用时uses TrayIcon就可以了。先声明一个全局变量:var tray:TTrayNotifyI然后在窗体的OnCreate事件中:tray:=TTrayNotifyIcon.Create(self);//将窗体创建为托盘tray.Icon:=application.I//定义托盘的显示图标tray.IconVisible:=//托盘可见tray.PopupMenu:=//给托盘定义一个右击时的弹出菜单tray.OnDblClick:=trayDblC//给托盘定义一个双击事件(当然要自己写了,不过多数情况只有一行,就是Form1.show);unit TrayIinterfaceuses Windows, SysUtils, Messages, ShellAPI, Classes, Graphics, Forms, Menus,StdCtrls, ExtCtypeENotifyIconError = class(Exception);TTrayNotifyIcon = class(TComponent)private&&FDefaultIcon: TH&&FIcon: TI&&FHideTask: B&&FHint:&&FIconVisible: B&&FPopupMenu: TPopupM&&FonClick: TNotifyE&&FOnDblClick: TNotifyE&&FNoShowClick: B&&FTimer: TT&&Tnd: TNotifyIconD&&procedure SetIcon(value: TIcon);&&procedure SetHideTask(value: Boolean);&&procedure SetHint(value: string);&&procedure SetIconVisible(value: Boolean);&&procedure SetPopupMenu(value: TPopupMenu);&&procedure SendTrayMessage(Msg: DWORD; Flags: UINT);&&function ActiveIconHandle: TH&&procedure OnButtonTimer(Sender: TObject);protected&&procedure L&&procedure LoadDefaultI&&procedure Notification(AComponent: TC&&&&Operation: TOperation);public&&constructor Create(AOwner: TComponent);&&destructor Dpublished&&property Icon: TIcon read FIcon write SetI&&property HideTask: Boolean read FHideTask write SetHideTask default F&&property Hint: String read FHint write SetH&&property IconVisible: Boolean read FIconVisible write SetIconVisible default F&&property PopupMenu: TPopupMenu read FPopupMenu write SetPopupM&&property onClick: TNotifyEvent read FonClick write FonC&&property OnDblClick: TNotifyEvent read FOnDblClick write FOnDblCimplementation{ TIconManager }{ This class creates a hidden window which handles and routes }{ tray icon messages }typeTIconManager = classprivate&&FHWindow: HW&&procedure TrayWndProc(var Message: TMessage);public&&constructor C&&destructor D&&property HWindow: HWnd read FHWindow write FHWvarIconMgr: TIconMDDGM_TRAYICON: Cconstructor TIconManager.CbeginFHWindow := AllocateHWnd(TrayWndProc);destructor TIconManager.Dbeginif FHWindow && 0 then DeallocateHWnd(FHWindow);inherited Dprocedure TIconManager.TrayWndProc(var Message: TMessage);{ This allows us to handle all tray callback messages }{ from within the context of the component. }varPt: TPTheIcon: TTrayNotifyIbeginwith Message dobegin&&{ if it’s the tray callback message }&&if (Msg = DDGM_TRAYICON) then&&begin&&&&TheIcon := TTrayNotifyIcon(WParam);&&&&case lParam of&&&&&&{ enable timer on first mouse down. }&&&&&&{ onClick will be fired by OnTimer method, provided }&&&&&&{ double click has not occurred. }&&&&&&WM_LBUTTONDOWN: TheIcon.FTimer.Enabled := T&&&&&&{ Set no click flag on double click.&&This will supress }&&&&&&{ the single click. }&&&&&&WM_LBUTTONDBLCLK:&&&&&&&&begin&&&&&&&&&&TheIcon.FNoShowClick := T&&&&&&&&&&if Assigned(TheIcon.FOnDblClick) then TheIcon.FOnDblClick(Self);&&&&&&&&&&&&&&WM_RBUTTONDOWN:&&&&&&&&begin&&&&&&&&&&if Assigned(TheIcon.FPopupMenu) then&&&&&&&&&&begin&&&&&&&&&&&&{ Call to SetForegroundWindow is required by API }&&&&&&&&&&&&SetForegroundWindow(IconMgr.HWindow);&&&&&&&&&&&&{ Popup local menu at the cursor position. }&&&&&&&&&&&&GetCursorPos(Pt);&&&&&&&&&&&&TheIcon.FPopupMenu.Popup(Pt.X, Pt.Y);&&&&&&&&&&&&{ Message post required by API to force task switch }&&&&&&&&&&&&PostMessage(IconMgr.HWindow, WM_USER, 0, 0);&&&&&&&&&&&&&&&&&&&&&&&&end&&else&&&&{ If it isn’t a tray callback message, then call DefWindowProc }&&&&Result := DefWindowProc(FHWindow, Msg, wParam, lParam);{ TTrayNotifyIcon }constructor TTrayNotifyIcon.Create(AOwner: TComponent);begininherited Create(AOwner);FIcon := TIcon.CFTimer := TTimer.Create(Self);with FTimer dobegin&&Enabled := F&&Interval := GetDoubleClickT&&OnTimer := OnButtonT{ Keep default windows icon handy... }LoadDefaultIdestructor TTrayNotifyIcon.Dbeginif FIconVisible then SetIconVisible(False);&&&&// destroy iconFIcon.F&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&// free stuffFTimer.Finherited Dfunction TTrayNotifyIcon.ActiveIconHandle: TH{ Returns handle of active icon }begin{ If no icon is loaded, then return default icon }if (FIcon.Handle && 0) then&&Result := FIcon.Handleelse&&Result := FDefaultIprocedure TTrayNotifyIcon.LoadDefaultI{ Loads default window icon to keep it handy. }{ This will allow the component to use the windows logo }{ icon as the default when no icon is selected in the }{ Icon property. }beginFDefaultIcon := LoadIcon(0, IDI_WINLOGO);procedure TTrayNotifyIcon.L{ Called after component is loaded from stream }begininherited L{ if icon is supposed to be visible, create it. }if FIconVisible then&&SendTrayMessage(NIM_ADD, NIF_MESSAGE or NIF_ICON or NIF_TIP);procedure TTrayNotifyIcon.Notification(AComponent: TCOperation: TOperation);begininherited Notification(AComponent, Operation);if (Operation = opRemove) and (AComponent = PopupMenu) then&&PopupMenu :=procedure TTrayNotifyIcon.OnButtonTimer(Sender: TObject);{ Timer used to keep track of time between two clicks of a }{ double click. This delays the first click long enough to }{ ensure that a double click hasn’t occurred.&&The whole&& }{ point of these gymnastics is to allow the component to&& }{ receive onClicks and OnDblClicks independently. }begin{ Disable timer because we only want it to fire once. }FTimer.Enabled := F{ if double click has not occurred, then fire single click. }if (not FNoShowClick) and Assigned(FonClick) then&&FonClick(Self);FNoShowClick := F&& // reset flagprocedure TTrayNotifyIcon.SendTrayMessage(Msg: DWORD; Flags: UINT);{ This method wraps up the call to the API’s Shell_NotifyIcon }begin{ Fill up record with appropriate values }with Tnd dobegin&&cbSize := SizeOf(Tnd);&&StrPLCopy(szTip, PChar(FHint), SizeOf(szTip));&&uFlags := F&&uID := UINT(Self);&&Wnd := IconMgr.HW&&uCallbackMessage := DDGM_TRAYICON;&&hIcon&&:= ActiveIconHShell_NotifyIcon(Msg, @Tnd);procedure TTrayNotifyIcon.SetHideTask(value: Boolean);{ Write method for HideTask property }const{ Flags to show application normally or hide it }ShowArray: array[Boolean] of integer = (sw_ShowNormal, sw_Hide);beginif FHideTask && value thenbegin&&FHideTask :=&&{ Don’t do anything in design mode }&&if not (csDesigning in ComponentState) then&&&&ShowWindow(Application.Handle, ShowArray[FHideTask]);procedure TTrayNotifyIcon.SetHint(value: string);{ Set method for Hint property }beginif FHint && value thenbegin&&FHint :=&&if FIconVisible then&&&&{ Change hint on icon on tray notification area }&&&&SendTrayMessage(NIM_MODIFY, NIF_TIP);procedure TTrayNotifyIcon.SetIcon(value: TIcon);{ Write method for Icon property. }beginFIcon.Assign(value);&&// set new icon{ Change icon on notification tray }if FIconVisible then SendTrayMessage(NIM_MODIFY, NIF_ICON);procedure TTrayNotifyIcon.SetIconVisible(value: Boolean);{ Write method for IconVisible property }const{ Flags to add or delete a tray notification icon }MsgArray: array[Boolean] of DWORD = (NIM_DELETE, NIM_ADD);beginif FIconVisible && value thenbegin&&FIconVisible :=&&{ Set icon as appropriate }&&SendTrayMessage(MsgArray[value], NIF_MESSAGE or NIF_ICON or NIF_TIP);procedure TTrayNotifyIcon.SetPopupMenu(value: TPopupMenu);{ Write method for PopupMenu property }beginFPopupMenu :=if value && nil then value.FreeNotification(Self);const{ String to identify registered window message }TrayMsgStr = ’DDG.TrayNotifyIconMsg’;initialization{ Get a unique windows message ID for tray callback }DDGM_TRAYICON := RegisterWindowMessage(TrayMsgStr);IconMgr := TIconManager.CfinalizationIconMgr.Fend.================================25、关于窗体释放的问题(formX.free)?答:这个我知道,模式窗口用:form2 := TForm2.Create(Application);tryif form2.showModal = mrOK then&&{do Something}finallyform2.form2 := 非模式窗口用:if not Assigned(form2) thenform2 := Tfrom2.Create(Application);form2.//然后在form2的Close事件中加入以下句Action := caF//在from2的Destory事件中加入以下句form2 := 搞定!!!================================26、关于MDI窗体的问题?答:我不知道是如何实现,但我知道一个方法可以实现同样的功能,在打开子窗体前加一句button1.SendToB================================27、小数点’.’的键号是什么?回车是#13,’.’是什么?答:你可以用此得出所有键的值procedure TForm1.Edit1KeyDown(Sender: TO var Key: WShift: TShiftState);beginlabel1.caption:=IntToStr(key);&
at June 20, 2008. by 傻猫 . &&nbsp Views: 5388 &&nbsp
今天重新安装Delphi后,发现以前的程序不能编译,错误提示为:File not found: 'DBAccess.dcu',这个'DBAccess.dcu'j是什么东西呢? 在网上查了一下,也没有找到,后来在我以前的控件包里仔细找了一下,发现'DBAccess.dcu'原来是ODAC控件里的一个文件,ODAC是一个让Delphi连接Oracle的三方组件,安装以后就可以了,看一下ODAC官方介绍吧,英文的,将就看。Oracle Data Access ComponentsProduct DescriptionOracle Data Access Components (ODAC) is a library of components that provides native connectivity to Oracle from Delphi, Delphi for .NET, C++Builder and Kylix. The ODAC library is designed to help programmers develop faster and cleaner Oracle database applications. ODAC is a complete replacement for standard Oracle connectivity solutions and presents an efficient native alternative to the Borland Database Engine and dbExpress for access to Oracle.RequirementsIf you use ODAC to connect to Oracle in Direct mode, you do not need to install Oracle client software on your machine or deploy any additional libraries with your ODAC-based application. The only requirement for using in Direct mode is having the TCP/IP protocol support in the Operating System. Detailed requirements for using ODAC in Client mode can be found in the Requirements topic in the ODAC Help documentation. Client mode is enabled by default.InstallationCompiled versions of ODAC are installed automatically by the ODAC Installer for all supported IDEs except Kylix. Versions of ODAC with Source Code must be installed manually. For more information, see the Installation topic of the ODAC Help documentation.It is important to know that ODAC, SDAC, MyDAC, and IBDAC components use the common base packages, so product compatibility is provided for the current build only. In the other words, if you upgrade one of the installed products, it may conflict with older builds of other products. In order to continue using the products simultaneously, you should upgrade all of them at the same time.Documentation and informational resourcesODAC comes with full documentation, which includes a detailed reference for all the ODAC components and classes and set of articles that highlight ODAC advanced functionality. The ODAC documentation is integrated into your IDE at install time. It can be invoked from the Oracle menu added to the Menu Bar, or by pressing F1 in an object inspector or on a selected code segment. If you have a question regarding ODAC, look at the list of
or visit the ODAC forum online at .If your problem is not covered in the documentation, FAQ, or forum, see the
for information on how to contact the ODAC support team.
at May 24, 2008. by 傻猫 . &&nbsp Views: 5867 &&nbsp
SQL Server Data Access Components (SDAC) 是一组存取SQL&Server数据库的非可视控件,今天在盒子上看到这个控件,发行版本居然都V4.3了,怎么以前没有听说过呢,据说这个比ADO效率要高很多,我还没试过,只是据说,今天装上了,已经是破解版,带源码的,先学习一下。下载地址:
SQL Server Data Access Components Overview
SQL Server Data Access Components (SDAC) is a library of components that provides access to Microsoft SQL Server databases. SDAC connects to SQL Server directly through OLE DB, which is a native SQL Server interface. The SDAC library is designed to help programmers develop faster and cleaner SQL Server database applications.SDAC is a complete replacement for standard SQL Server connectivity solutions and presents an efficient alternative to the Borland Database Engine for access to SQL Server.Advantages of SDAC TechnologySDAC is a direct connectivity database wrapper built specifically for the SQL Server server. SDAC offers wide coverage of the SQL Server feature set and emphasizes optimized data access strategies.Wide Coverage of SQL Server FeaturesBy providing access to the most advanced database functionality, SDAC allows developers to harness the full capabilities of the SQL Server and optimize their database applications. SDAC provides complete support of working with SQL Server 2005 Compact Edition, Service Broker technology, the IRowsetFastLoad interface, working with metadata information, and MARS.
Optimized CodeThe goal of SDAC is to enable developers to write efficient and flexible database applications. The SDAC library is implemented using advanced data access algorithms and optimization techniques. Classes and components undergo comprehensive performance tests and are designed to help you write high-performance, lightweight data access layers.Compatibility with Other Connectivity MethodsThe SDAC interface retains compatibility with standard VCL data access components like BDE. Existing BDE-based applications can be easily migrated to SDAC and enhanced to take advantage of SQL Server-specific features. Project migration can be automated with the BDE/ADO Migration Wizard.&
How Does SDAC Work?SDAC allows you to connect to SQL Server through OLE DB, which is the lowest documented SQL Server interface.SDAC connects through OLE DB through a set of COM-based interfaces. SDAC is designed to be lightweight and consists of a minimal layer between your code and SQL Server databases.In comparison, the Borland Database Engine (BDE) uses several layers to access SQL Server, and requires additional data access software to be installed on client machines.The BDE data transfer protocol is shown below.BDE Connection ProtocolSDAC allows you to avoid using BDE and DBLibrary.SDAC Connection FlowComponentsAll editions of SDAC include the following basic components:
TMSConnection - lets you set up and control connections to SQL Server
TMSQuery - queries execution, operates record set, flexible way updating database tables
TMSTable - lets you retrieve and update data in a single table without writing SQL statements
TMSStoredProc - executes stored procedures and functions
TMSSQL - executes SQL statements and stored procedures, which do not return rowsets
TMSScript - executes sequences of SQL statements
TMSUpdateSQL - lets you tune update operations for a DataSet component
TMSDataSource - provides an interface between a SDAC dataset components and data-aware controls on a form
TMSSQLMonitor - allows to monitor dynamic SQL executing in SDAC based applications
TMSConnectDialog - allows you to build custom prompts for usernames, passwords, and servers
TVirtualTable - dataset stores data in memory
MSDataAdapter - .NET component, uses TDataSet as data source for retrieving and saving data to System.Data.DataSet
SDAC Professional Edition includes the following additional components:
TMSLoader - allows you to quickly load data into SQL Server databases
TMSDump - serves to store a database or its parts as a script and also to restore database from received script
TMSServiceBroker - lets you work with Service Broker technology to send and receive messages
TMSMetaData - allows to retrieve embracing metadata on specified SQL object
TMSChangeNotification - lets you react on different server side changes on-the-fly. Based on the Query Notifications mechanism of SQL Server 2005
TMSTransaction - lets you control distributed transactions via Microsoft Distributed Transaction Coordinator
TMSCompactConnection - lets you set up and control connections to SQL Server Compact Edition
TCRBatchMove - transfers data between all types of TDataSet descendants
Key FeaturesThe following list describes the main features of SQL Server Data Access Components.
Direct access to server data. Does not require installation of other data provider layers (such as BDE and ODBC)
VCL, VCL.NET, and CLX versions of library available
Full support of the latest Microsoft SQL Server versions, including
Support for all SQL Server data types
Disconnected Model with automatic connection control for working with data offline
Local Failover for detecting connection loss and implicitly reexecuting certain operations
All types of local sorting and filtering, including by calculated and lookup fields
Automatic data updating with TMSQuery, TMSTable, and TMSStoredProc components
Unicode support
Support for many SQL Server-specific features, such as MARS and bulk copy operations
Advanced script execution with TMSScript component
Support for using macros in SQL
Easy migration from BDE and ADO with Migration Wizard
Lets you use Professional Edition of Delphi and C++Builder to develop client/server applications
Includes annual SDAC Subscription with Priority Support
Licensed royalty-free per developer, per team, or per site
at March 19, 2008. by 傻猫 . &&nbsp Views: 5527 &&nbsp
&Delphi常用的函数库,引用作者的话&今天在整理以前写过的代码,发现有些函数还是挺实用的,决定将其贴到Blog上,与众多好友一起分享。&源文地址:{******************************************************************************** 模块名称: 公用函数库* 编写人员: Chris Mao* 编写日期: ******************************************************************************}unit JrCinterfaceusesWindows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,ShellAPI, CommDlg, MMSystem, StdCtrls, Registry, JrConsts, W//------------------------------------------------------------------------------//窗体类函数//------------------------------------------------------------------------------function FindFormClass(FormClassName: PChar): TFormCfunction HasInstance(FormClassName: PChar): B//------------------------------------------------------------------------------//公用对话框函数//------------------------------------------------------------------------------procedure InfoDlg(const Msg: S ACaption: String = SInformation);{ 信息对话框 }procedure ErrorDlg(const Msg: S ACaption: String = SError);{ 错误对话框 }procedure WarningDlg(const Msg: S ACaption: String = SWarning);{ 警告对话框 }function QueryDlg(const Msg: S ACaption: String = SQuery): B{ 确认对话框 }function QueryNoDlg(const Msg: ACaption: string = SQuery): B{ 确认对话框,默认按钮为&否& }function JrInputQuery(const ACaption, APrompt: S var Value: string): B{ 输入对话框 }function JrInputBox(const ACaption, APrompt, ADefault: string): S{ 输入对话框 }//------------------------------------------------------------------------------//扩展文件目录操作函数//------------------------------------------------------------------------------procedure RunFile(const FileName: S Handle: THandle = 0; Param: string = '');{ 运行一个文件 }function AppPath:{ 应用程序路径 }function GetProgramFilesDir:{ 取Program Files目录 }function GetWindowsDir:{ 取Windows目录}function GetWindowsTempPath:{ 取临时文件路径 }function GetSystemDir:{ 取系统目录 }//------------------------------------------------------------------------------//扩展字符串操作函数//------------------------------------------------------------------------------function InStr(const sShort: const sLong: string): B{ 判断s1是否包含在s2中 }function IntToStrSp(Value: I SpLen: Integer = 3; Sp: Char = ','):{ 带分隔符的整数-字符转换 }function ByteToBin(Value: Byte):{ 字节转二进制串 }function StrRight(Str: Len: Integer):{ 返回字符串右边的字符 }function StrLeft(Str: Len: Integer):{ 返回字符串左边的字符 }function Spc(Len: Integer):{ 返回空格串 }procedure SwapStr(var s1, s2: string);{ 交换字串 }//------------------------------------------------------------------------------// 扩展日期时间操作函数//------------------------------------------------------------------------------function GetYear(Date: TDate): W{ 取日期年份分量 }function GetMonth(Date: TDate): W{ 取日期月份分量 }function GetDay(Date: TDate): W{ 取日期天数分量 }function GetHour(Time: TTime): W{ 取时间小时分量 }function GetMinute(Time: TTime): W{ 取时间分钟分量 }function GetSecond(Time: TTime): W{ 取时间秒分量 }function GetMSecond(Time: TTime): W{ 取时间毫秒分量 }//------------------------------------------------------------------------------// 位操作函数//------------------------------------------------------------------------------typeTByteBit = 0..7; // Byte类型位数范围TWordBit = 0..15; // Word类型位数范围TDWordBit = 0..31; // DWord类型位数范围procedure SetBit(var Value: B Bit: TByteB IsSet: Boolean);{ 设置二进制位 }procedure SetBit(var Value: WORD; Bit: TWordB IsSet: Boolean);{ 设置二进制位 }procedure SetBit(var Value: DWORD; Bit: TDWordB IsSet: Boolean);{ 设置二进制位 }function GetBit(Value: B Bit: TByteBit): B{ 取二进制位 }function GetBit(Value: WORD; Bit: TWordBit): B{ 取二进制位 }function GetBit(Value: DWORD; Bit: TDWordBit): B{ 取二进制位 }//------------------------------------------------------------------------------// 系统功能函数//------------------------------------------------------------------------------procedure ChangeFocus(Handle: TH Forword: Boolean = False);{ 改变焦点 }procedure MoveMouseIntoControl(AWinControl: TControl);{ 移动鼠标到控件 }procedure AddComboBoxTextToItems(ComboBox: TComboB MaxItemsCount: Integer = 10);{ 将 ComboBox 的文本内容增加到下拉列表中 }function DynamicResolution(x, y: WORD): B{ 动态设置分辨率 }procedure StayOnTop(Handle: HWND; OnTop: Boolean);{ 窗口最上方显示 }procedure SetHidden(Hide: Boolean);{ 设置程序是否出现在任务栏 }procedure SetTaskBarVisible(Visible: Boolean);{ 设置任务栏是否可见 }procedure SetDesktopVisible(Visible: Boolean);{ 设置桌面是否可见 }function GetWorkRect: TR{ 取桌面区域 }procedure BeginW{ 显示等待光标 }procedure EndW{ 结束等待光标 }function CheckWindows9598: B{ 检测是否Win95/98平台 }function GetOSString:{ 返回操作系统标识串 }function GetComputeNameStr :{ 得到本机名 }function GetLocalUserName:{ 得到本机用户名 }function GetLocalIP: S{ 得到本机IP地址 }//------------------------------------------------------------------------------// 其它过程//------------------------------------------------------------------------------function TrimInt(Value, Min, Max: Integer): I{ 输出限制在Min..Max之间 }function InBound(Value: I Min, Max: Integer): B{ 判断整数Value是否在Min和Max之间 }procedure Delay(const uDelay: DWORD);{ 延时 }procedure BeepEx(const Freq: WORD = 1200; const Delay: WORD = 1);{ 在Win9X下让喇叭发声 }function GetHzPy(const AHzStr: string):{ 取汉字的拼音 }function UpperCaseMoney(const Money: Double): S{ 转换为大与金额 }function SoundCardExist: B{ 声卡是否存在 }implementation//------------------------------------------------------------------------------//窗体类函数//------------------------------------------------------------------------------function FindFormClass(FormClassName: PChar): TFormCbeginResult := TFormClass(GetClass(FormClassName));function HasInstance(FormClassName: PChar): Bvari:beginResult:=Ffor i := Screen.FormCount - 1 downto 0 do beginResult := SameText(Screen.Forms[i].ClassName, FormClassName);if Result then beginTForm(Screen.Forms[i]).BringToFB//------------------------------------------------------------------------------//公用对话框函数//------------------------------------------------------------------------------procedure InfoDlg(const Msg: S ACaption: String = SInformation);beginApplication.MessageBox(PChar(Msg), PChar(ACaption), MB_OK + MB_ICONINFORMATION);procedure ErrorDlg(const Msg: S ACaption: String = SError);beginApplication.MessageBox(PChar(Msg), PChar(ACaption), MB_OK + MB_ICONERROR);procedure WarningDlg(const Msg: S ACaption: String = SWarning);beginApplication.MessageBox(PChar(Msg), PChar(ACaption), MB_OK + MB_ICONWARNING);function QueryDlg(const Msg: S ACaption: String = SQuery): BbeginResult := Application.MessageBox(PChar(Msg), PChar(ACaption),MB_YESNO + MB_ICONQUESTION) = IDYES;function QueryNoDlg(const Msg: ACaption: string = SQuery): BbeginResult := Application.MessageBox(PChar(Msg), PChar(ACaption),MB_YESNO + MB_ICONQUESTION + MB_DEFBUTTON2) = IDYES;function GetAveCharSize(Canvas: TCanvas): TPvarI: IBuffer: array[0..51] of Cbeginfor I := 0 to 25 do Buffer[I] := Chr(I + Ord('A'));for I := 0 to 25 do Buffer[I + 26] := Chr(I + Ord('a'));GetTextExtentPoint(Canvas.Handle, Buffer, 52, TSize(Result));Result.X := Result.X div 52;function JrInputQuery(const ACaption, APrompt: S var Value: string): BvarForm: TFPrompt: TLEdit: TEDialogUnits: TPButtonTop, ButtonWidth, ButtonHeight: IbeginResult := FForm := TForm.Create(Application);with Form dotryScaled := FFont.Name := SDefaultFontNFont.Size := SDefaultFontSFont.Charset := SDefaultFontCCanvas.Font := FDialogUnits := GetAveCharSize(Canvas);BorderStyle := bsDCaption := ACClientWidth := MulDiv(180, DialogUnits.X, 4);ClientHeight := MulDiv(63, DialogUnits.Y, 8);Position := poScreenCPrompt := TLabel.Create(Form);with Prompt dobeginParent := FAutoSize := TLeft := MulDiv(8, DialogUnits.X, 4);Top := MulDiv(8, DialogUnits.Y, 8);Caption := APEdit := TEdit.Create(Form);with Edit dobeginParent := FLeft := Prompt.LTop := MulDiv(19, DialogUnits.Y, 8);Width := MulDiv(164, DialogUnits.X, 4);MaxLength := 255;Text := VSelectAButtonTop := MulDiv(41, DialogUnits.Y, 8);ButtonWidth := MulDiv(50, DialogUnits.X, 4);ButtonHeight := MulDiv(14, DialogUnits.Y, 8);with TButton.Create(Form) dobeginParent := FCaption := SMsgDlgOK;ModalResult := mrOk;Default := TSetBounds(MulDiv(38, DialogUnits.X, 4), ButtonTop, ButtonWidth,ButtonHeight);with TButton.Create(Form) dobeginParent := FCaption := SMsgDlgCModalResult := mrCCancel := TSetBounds(MulDiv(92, DialogUnits.X, 4), ButtonTop, ButtonWidth,ButtonHeight);if ShowModal = mrOk thenbeginValue := Edit.TResult := TfinallyForm.Ffunction JrInputBox(const ACaption, APrompt, ADefault: string): SbeginResult := ADJrInputQuery(ACaption, APrompt, Result);//------------------------------------------------------------------------------//扩展文件目录操作函数//------------------------------------------------------------------------------procedure RunFile(const FileName: S Handle: THandle = 0; Param: string = '');beginShellExecute(Handle, nil, PChar(FileName), PChar(Param), nil, SW_SHOWNORMAL);function AppPath:beginResult := ExtractFilePath(Application.ExeName);constHKLM_CURRENT_VERSION_WINDOWS = 'SoftwareMicrosoftWindowsCurrentVersion';function RelativeKey(const Key: string): PCbeginResult := PChar(Key);if (Key && '') and (Key[1] = '') thenInc(Result);function RegReadStringDef(const RootKey: HKEY; const Key, Name, Def: string):varRegKey: HKEY;Size: DWORD;StrVal:RegKind: DWORD;beginResult := Dif RegOpenKeyEx(RootKey, RelativeKey(Key), 0, KEY_READ, RegKey) = ERROR_SUCCESS thenbeginRegKind := 0;Size := 0;if RegQueryValueEx(RegKey, PChar(Name), nil, @RegKind, nil, @Size) = ERROR_SUCCESS thenif RegKind in [REG_SZ, REG_EXPAND_SZ] thenbeginSetLength(StrVal, Size);if RegQueryValueEx(RegKey, PChar(Name), nil, @RegKind, PByte(StrVal), @Size) = ERROR_SUCCESS thenbeginSetLength(StrVal, StrLen(PChar(StrVal)));Result := StrVRegCloseKey(RegKey);procedure StrResetLength(var S: AnsiString);beginSetLength(S, StrLen(PChar(S)));function GetProgramFilesDir:beginResult := RegReadStringDef(HKEY_LOCAL_MACHINE, HKLM_CURRENT_VERSION_WINDOWS, 'ProgramFilesDir', '');function GetWindowsDir:varRequired: CbeginResult := '';Required := GetWindowsDirectory(nil, 0);if Required && 0 thenbeginSetLength(Result, Required);GetWindowsDirectory(PChar(Result), Required);StrResetLength(Result);function GetWindowsTempPath:varRequired: CbeginResult := '';Required := GetTempPath(0, nil);if Required && 0 thenbeginSetLength(Result, Required);GetTempPath(Required, PChar(Result));StrResetLength(Result);function GetSystemDir:varRequired: CbeginResult := '';Required := GetSystemDirectory(nil, 0);if Required && 0 thenbeginSetLength(Result, Required);GetSystemDirectory(PChar(Result), Required);StrResetLength(Result);//------------------------------------------------------------------------------//扩展字符串操作函数//------------------------------------------------------------------------------function InStr(const sShort: const sLong: string): Bvars1, s2:begins1 := LowerCase(sShort);s2 := LowerCase(sLong);Result := Pos(s1, s2) & 0;function IntToStrSp(Value: I SpLen: Integer = 3; Sp: Char = ','):vars:i, j: Ibegins := IntToStr(Value);Result := '';j := 0;for i := Length(s) downto 1 dobeginResult := s[i] + RInc(j);if ((j mod SpLen) = 0) and (i && 1) then Result := Sp + Rfunction ByteToBin(Value: Byte):constV: Byte = 1;vari: Ibeginfor i := 7 downto 0 doif (V shl i) and Value && 0 thenResult := Result + '1'elseResult := Result + '0';function StrRight(Str: Len: Integer):beginif Len &= Length(Str) thenResult := StrelseResult := Copy(Str, Length(Str) - Len + 1, Len);function StrLeft(Str: Len: Integer):beginif Len &= Length(Str) thenResult := StrelseResult := Copy(Str, 1, Len);function Spc(Len: Integer):beginSetLength(Result, Len);FillChar(PChar(Result)^, Len, ' ');procedure SwapStr(var s1, s2: string);vartempstr:begintempstr := s1;s1 := s2;s2 :=//------------------------------------------------------------------------------// 扩展日期时间操作函数//------------------------------------------------------------------------------function GetYear(Date: TDate): Wvarm, d: WORD;beginDecodeDate(Date, Result, m, d);function GetMonth(Date: TDate): Wvary, d: WORD;beginDecodeDate(Date, y, Result, d);function GetDay(Date: TDate): Wvary, m: WORD;beginDecodeDate(Date, y, m, Result);function GetHour(Time: TTime): Wvarh, m, s, ms: WORD;beginDecodeTime(Time, Result, m, s, ms);function GetMinute(Time: TTime): Wvarh, s, ms: WORD;beginDecodeTime(Time, h, Result, s, ms);function GetSecond(Time: TTime): Wvarh, m, ms: WORD;beginDecodeTime(Time, h, m, Result, ms);function GetMSecond(Time: TTime): Wvarh, m, s: WORD;beginDecodeTime(Time, h, m, s, Result);//------------------------------------------------------------------------------// 位操作函数//------------------------------------------------------------------------------procedure SetBit(var Value: B Bit: TByteB IsSet: Boolean);beginif IsSet thenValue := Value or (1 shl Bit) elseValue := Value and not(1 shl Bit);procedure SetBit(var Value: WORD; Bit: TWordB IsSet: Boolean);beginif IsSet thenValue := Value or (1 shl Bit) elseValue := Value and not(1 shl Bit);procedure SetBit(var Value: DWORD; Bit: TDWordB IsSet: Boolean);beginif IsSet thenValue := Value or (1 shl Bit) elseValue := Value and not(1 shl Bit);function GetBit(Value: B Bit: TByteBit): BbeginResult := Value and (1 shl Bit) && 0;function GetBit(Value: WORD; Bit: TWordBit): BbeginResult := Value and (1 shl Bit) && 0;function GetBit(Value: DWORD; Bit: TDWordBit): BbeginResult := Value and (1 shl Bit) && 0;//------------------------------------------------------------------------------// 系统功能函数//------------------------------------------------------------------------------procedure ChangeFocus(Handle: TH Forword: Boolean = False);beginif ForWord thenPostMessage(Handle, WM_NEXTDLGCTL, 1, 0)elsePostMessage(Handle, WM_NEXTDLGCTL, 0, 0);procedure MoveMouseIntoControl(AWinControl: TControl);varrtControl: TRbeginrtControl := AWinControl.BoundsRMapWindowPoints(AWinControl.Parent.Handle, 0, rtControl, 2);SetCursorPos(rtControl.Left + (rtControl.Right - rtControl.Left) div 2,rtControl.Top + (rtControl.Bottom - rtControl.Top) div 2);procedure AddComboBoxTextToItems(ComboBox: TComboB MaxItemsCount: Integer = 10);beginif (ComboBox.Text && '') and (ComboBox.Items.IndexOf(ComboBox.Text) & 0) thenbeginComboBox.Items.Insert(0, ComboBox.Text);while (MaxItemsCount & 1) and (ComboBox.Items.Count & MaxItemsCount) doComboBox.Items.Delete(ComboBox.Items.Count - 1);function DynamicResolution(x, y: WORD): BvarlpDevMode: TDeviceMbeginResult := EnumDisplaySettings(nil, 0, lpDevMode);if Result thenbeginlpDevMode.dmFields := DM_PELSWIDTH or DM_PELSHEIGHT;lpDevMode.dmPelsWidth :=lpDevMode.dmPelsHeight :=Result := ChangeDisplaySettings(lpDevMode, 0) = DISP_CHANGE_SUCCESSFUL;procedure StayOnTop(Handle: HWND; OnTop: Boolean);constcsOnTop: array[Boolean] of HWND = (HWND_NOTOPMOST, HWND_TOPMOST);beginSetWindowPos(Handle, csOnTop[OnTop], 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE);varWndLong: Iprocedure SetHidden(Hide: Boolean);beginShowWindow(Application.Handle, SW_HIDE);if Hide thenSetWindowLong(Application.Handle, GWL_EXSTYLE,WndLong or WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW or WS_EX_TOPMOST)elseSetWindowLong(Application.Handle, GWL_EXSTYLE, WndLong);ShowWindow(Application.Handle, SW_SHOW);constcsWndShowFlag: array[Boolean] of DWORD = (SW_HIDE, SW_RESTORE);procedure SetTaskBarVisible(Visible: Boolean);varwndHandle: THbeginwndHandle := FindWindow('Shell_TrayWnd', nil);ShowWindow(wndHandle, csWndShowFlag[Visible]);procedure SetDesktopVisible(Visible: Boolean);varhDesktop: THbeginhDesktop := FindWindow('Progman', nil);ShowWindow(hDesktop, csWndShowFlag[Visible]);function GetWorkRect: TRbeginSystemParametersInfo(SPI_GETWORKAREA, 0, @Result, 0)procedure BeginWbeginScreen.Cursor := crHourGprocedure EndWbeginScreen.Cursor := crDfunction CheckWindows9598: BvarV: TOSVersionIbeginV.dwOSVersionInfoSize := SizeOf(V);Result := Fif not GetVersionEx(V) then Eif V.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS thenResult := Tfunction GetOSString:varOSPlatform:BuildNumber: IbeginResult := 'Unknown Windows Version';OSPlatform := 'Windows';BuildNumber := 0;case Win32Platform ofVER_PLATFORM_WIN32_WINDOWS:beginBuildNumber := Win32BuildNumber and $0000FFFF;case Win32MinorVersion of0..9:beginif Trim(Win32CSDVersion) = 'B' thenOSPlatform := 'Windows 95 OSR2'elseOSPlatform := 'Windows 95';10..89:beginif Trim(Win32CSDVersion) = 'A' thenOSPlatform := 'Windows 98'elseOSPlatform := 'Windows 98 SE';90:OSPlatform := 'Windows Millennium';VER_PLATFORM_WIN32_NT:beginif Win32MajorVersion in [3, 4] thenOSPlatform := 'Windows NT'else if Win32MajorVersion = 5 thenbegincase Win32MinorVersion of0: OSPlatform := 'Windows 2000';1: OSPlatform := 'Windows XP';BuildN}

我要回帖

更多关于 如何正确佩戴安全帽 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信