随笔分类 -  delphi

delphi xe2样式的一个小bug
摘要:在一个偶然的下,在xe2下创建了一个vcl窗体, 然后在project>options>apperrance里customs styles里选 上了一个样式(windows外),再在下的default styles下选中刚添加的样式, ok, F9运行,点击标题栏最大化,问题来了: 这样你谅不能点击右上角的最大化,最小化 ,关闭, 也不能双击标题栏了 ,也只能标题栏右击。 不知道这算不算是bug, 或者是我那里设置有问题 呵呵 阅读全文

posted @ 2012-03-26 10:03 long6 阅读(422) 评论(0) 推荐(1)

Variant和Tstream这间相互转化
摘要:所在单元VariantsfunctionVarArrayLock(constA: Variant): Pointer; VarArrayLock锁定给定的变量数组,并返回一个指针数组中存储的数据。锁定时,一个Variant数组不能被调整和任何VarArrayRedim的调用将失败。一旦锁定,一个Variant数组必须使用VarArrayUnlock后来被解锁。如果由一个给定的变种,是不是一个数组,一个EVariantError将引发异常。返回的指针数组元素,其中最左边的尺寸先增加VarArrayLock点。换句话说,返回的数组指针的尺寸逆转从变异阵列的尺寸。VarArrayLock一旦被证.. 阅读全文

posted @ 2012-03-07 15:22 long6 阅读(677) 评论(0) 推荐(1)

获得一个网页的所有的URL(WebBrowser)
摘要://记得要引用MSHTMLprocedure TForm1.Button6Click(Sender: TObject);var Doc: IHTMLDocument2; Len: Integer; item: OleVariant; all: IHTMLElementCollection; I: Integer;begin Doc := WebBrowser1.Document as IHTMLDocument2; all := Doc.links; Len := all.length; for I := 0 to Len -1 do begin item :=... 阅读全文

posted @ 2012-02-22 15:55 long6 阅读(1705) 评论(0) 推荐(1)

DELPHI自动分析表单(WebBrowser)
摘要://-----先创建一个WebBrowser,以及自己Negative,也就是先打开一个页面///----------------stringgrid初始化-------------procedure TForm1.stringCreate(StringGrid: TStringGrid);begin StringGrid.Cells[0, 0] := '序号 '; StringGrid.Cells[1, 0] := 'ID号 '; StringGrid.Cells[2, 0] := '类别 '; StringGrid.Cells[3, 0] : 阅读全文

posted @ 2012-02-22 11:03 long6 阅读(1490) 评论(0) 推荐(1)

取得任意位的随机数
摘要:function TForm1.RandomStr(UP: boolean; Low: boolean; Number: boolean; Digit: integer):string;//--大写字母,小写字母,数字,字符串的位数var i: Byte; s: string;begin if UP then s := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' else s := ''; if Low then s := s + 'abcdefghijklmnopqrstuvwxyz'; if Number then s := s 阅读全文

posted @ 2012-02-08 10:58 long6 阅读(282) 评论(0) 推荐(1)

delphi XE2 托盘程序
摘要://----------这是在 delphi xe2-----------//unit Umain;interfaceuses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls, Vcl.Menus, Winapi.ShellAPI;type TForm1 = class(TForm) Button1: TBut... 阅读全文

posted @ 2012-02-07 17:49 long6 阅读(975) 评论(0) 推荐(1)

屏蔽F1的练习(hook)
摘要://-----------勾子判断按键方法-------function LowLevelKeyboardProc(Wnode: Integer; Wparam: WPARAM; Lparam: LPARAM):LRESULT;stdcall;type KeyHook = record VKcode: DWORD; ScanCode: DWord; Flags: DWord; Time: DWord; dwExtraInfo: DWord; end;var p : ^keyhook;begin Result := 0; p := Pointer(Lpar... 阅读全文

posted @ 2012-02-02 15:48 long6 阅读(428) 评论(0) 推荐(1)

隐藏系统的任务栏、桌面图标
摘要://--------Flag 为全局变量,初始化为false//--------Shell_TrayWnd 为系统任务栏窗口的类名//------这里是隐藏任务栏的---------------------procedure TForm2.Button3Click(Sender: TObject);var h: HWND;begin h := FindWindow('Shell_TrayWnd', nil); if (h <> 0) and (flag = False) then begin ShowWindow(h, SW_SHOW); flag := True 阅读全文

posted @ 2012-02-02 14:38 long6 阅读(448) 评论(0) 推荐(0)

取得计算机名(delphi )
摘要://------非常简单------------------------procedure TForm2.Button2Click(Sender: TObject);var s: Cardinal; p: PChar;begin s := MAX_COMPUTERNAME_LENGTH + 1; GetMem(p, s); if GetComputerName(p,s) then begin caption := StrPas(p); end else ShowMessage('取不到计算机名'); FreeMem(p); //记得一定要释放end; 阅读全文

posted @ 2012-02-02 11:56 long6 阅读(305) 评论(0) 推荐(1)

TWebBrowser取得一个页面的所有链接
摘要://--------列出一个页面的所有的链接---------procedure TForm1.Button6Click(Sender: TObject);var Doc: IHTMLDocument2; Len: Integer; item: OleVariant; all: IHTMLElementCollection; I: Integer;begin Doc := WebBrowser1.Document as IHTMLDocument2; all := Doc.links; Len := all.length; for I := 0 to Len -1 do... 阅读全文

posted @ 2012-02-01 18:00 long6 阅读(339) 评论(0) 推荐(1)

cxgrid对经过筛选过的数据的选择(反选)
摘要:// 下面这个主要是对查询出来的数据, 经过筛选后得到的数据中进行反选操作 ,然后对选择的数据进行修改(全选或选择一部分也可以根据些代码修改) Screen.Cursor := crHourGlass; cxGrid2DBTableView1.DataController.GotoFirst; for i := 0 to cxgrid2DBTableView1.DataController.FilteredRecordCount - 1 do begin if cxGrid2DBTableView1.DataController.GetItemByFieldName('IsChec.. 阅读全文

posted @ 2012-01-31 14:45 long6 阅读(2968) 评论(1) 推荐(1)

向cxgrid里嵌套panel
摘要:有的时候,我们需要对每一个cxgrid数据显示组件上都 有一个'另存'的字段来执行导出操作。 下面的则是主要代码:var n: integer; //此为局变量。 procedure TForm1.FormCreate(Sender: TObject);var I: Integer; p: Tpanel;begin for i := 0 to Self.ComponentCount -1 do if Self.Components[i] is Tcxgrid then begin p := TPanel.Create(nil); p.Parent := TcxGrid(Self 阅读全文

posted @ 2011-06-21 13:40 long6 阅读(753) 评论(0) 推荐(1)

formate()用法
摘要:delphi的format用法: 一般来说这样写比较些,变量和赋值一目了然。with adoquery dobegin close; SQL.clear; SQL.text := Format('select * from table where A=''%S'' and B =%d',[valueA, valueB]);end;-- 一般来说,%s对应的是字符串,%d对应的则是数字,还有一些别的%6.3f等等。 阅读全文

posted @ 2011-06-21 13:21 long6 阅读(2429) 评论(2) 推荐(1)

导航