社区
Delphi
帖子详情
怎么把一个LongInt转化成TForm1呢??
alphagx
2003-07-06 11:03:04
我使用了回调函数,并使用TForm1的指针作为参数,
即 LongInt(@TForm1)
然后在VC里面调用这个DELPHI的回调,
当回调函数得到响应的时候,我得到的只是一个longint
我想把他转化成TForm1,怎么办??
...全文
76
7
打赏
收藏
怎么把一个LongInt转化成TForm1呢??
我使用了回调函数,并使用TForm1的指针作为参数, 即 LongInt(@TForm1) 然后在VC里面调用这个DELPHI的回调, 当回调函数得到响应的时候,我得到的只是一个longint 我想把他转化成TForm1,怎么办??
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
7 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
alphagx
2003-07-06
打赏
举报
回复
成功了,呵呵。感谢杀手。
alphagx
2003-07-06
打赏
举报
回复
倒,没看见,呵呵。SORRY,分不是问题,
几万分都可以给的。
Eastunfail
2003-07-06
打赏
举报
回复
http://expert.csdn.net/Expert/TopicView1.asp?id=1991882
55555555~~~~~~~~~~~~我在那个帖子里面写那么多,你一分都不给......................................
Eastunfail
2003-07-06
打赏
举报
回复
假设你的对象为Form1。那么要将Form1的指针转换为Longint,可以直接:
Longint(Form1),而不用@取指针.这是因为Delphi无法像C++那样可以在栈上面创建对象,只可以在堆上面创建对象.类似于: TForm1 *Form1=new TForm1()这样创建的Form1.
所以如果要将一个Longint转换成Form1,可以直接 TForm1(i)这来转,(假设i为longint类型).
gub
2003-07-06
打赏
举报
回复
关注
alphagx
2003-07-06
打赏
举报
回复
对,我的那个longint是地址值,
在DELPHI中怎么用那个值呢??
ghui
2003-07-06
打赏
举报
回复
这个longint只是一个地址值
TForm1 *f=(TForm1 *)v; // v 就是你的 longint
以下是在 C++ Builder 中通过
int x;
//Form2是一个已经创建的窗体,只是没有显示
//现在将地址的值赋到Int类型中
x=(int)Form2;
//将Int类型强制转换为地址值
//并将地址值赋到 TForm对象变量上
TForm *t=(TForm *)x;
//TForm对象变量t获得了Form2的地址,即t已经是Form2的对象变量
t->ShowModal();
VC中也差不多
我的函数库
首先十分感谢你的使用. 同时也希望你能对这个功能包进行扩充...发布你的扩充后的版本. --------------------------------------------------------- ^^ 声明这个组件包只能在delphi7上正常安装. 如果您用的是delphi6.则会在安装时出错。 ------------------------------------------------- 作者:李金浩 QQ:67260745 E-mail:lijinjie2793311@163.com 功能包中的大部分功能模块为本人自己所写。。部分收录我的网友的作品及网上比较精典的程序段。 Function HexBCDTo
int
(sHexBCD:Byte):
int
eger; Function
Int
ToBCD(
Int
:Byte):word; Function MinuteToTime(Minute:Double):TdateTime;overload;//分钟到标准时间的转换 Function MinuteToTime(Minute:Double;var DayCount:
int
eger):TdateTime;overload; //------------------------------------------------------------------------------ Function GetWeekOfChina(dDay:TdateTime):string;//得到星期 Function GetWeekOfNum(dDay:TdateTime):
int
eger; //------------------------------------------------------------------------------ Function IsStrAsNumber(NumStr:string):Bool;//判断字符串是不是有效数字在字符串 Function IsStrInOtherStr(mainStr,FindStr:string):Bool;//检测在
一个
字符串中是否包括另
一个
字符串 function IsCOMClassRegistered(GUID:TGUID):Boolean;//判断
一个
COM对像是否已注册 Function IsBDEInstalled:boolean;//查看BDE是否安装 function GetPYIndexChar( hzchar:string):char;//得到汉字的首字母 Function Squ(X,Y:
int
eger):
int
eger;overload;//计算x的Y次方 Function Squ(X:Double;Y:
int
eger):Double;overload;//计算x的Y次方 Function RandomNumByGUID:String; //--------------系统功能------------ Function AppRunOnce:Boolean;//让程序只能运行
一个
实例 procedure AutoRunByReg(FileName:string='');//让程序自动运行 procedure DelAutoRunByReg(KeyName:string='');//删除
一个
自启动项 procedure MoveWindow(handle:Thandle);overload;//托动无标题窗体 Function GetAppPath(AddLastName:string=''):string;//得到程序的当前目录 Procedure ReMoveW
inT
itle(
Form
:T
form
);//移去窗体的Title; procedure BeepEx(Freq:Word;MSecs:
Long
Int
); //DoBeep调用 procedure ClickStartMenu;//通过代码击活开始菜单 procedure OpenScreenSave;//打开屏幕保护 // procedure DelTree(DirName:String);//删除目录 procedure DeleteDir(SourcePath: String); //删除指定文件夹(含子文件夹),文件夹及其夹内文件可以具有只读或隐藏属性 procedure DelSelfApp;//程序在运行完后就删除自己 (*-----------------*) procedure HideTaskBar(bHide:boolean=False);//显示或掩藏TaskBar procedure DisplayOFFON(SW: boolean);//关闭和打开显示器 procedure HideDesktop(sw:Boolean=false);//显示和隐藏桌面 procedure HideDesktopAndTaskBar(sw:Boolean=false);//同时隐藏桌面和任务栏 procedure HideTrayNotify(sw:Boolean=false);//隐藏系统通知区域 procedure HideWinButton(sw:Boolean=false);//隐藏开始按钮 procedure HideQuickLaunchBar(sw:Boolean=false);//隐藏快速启动按钮栏 // procedure HideApp
InT
astWin(sw:Boolean=False);//使程序在任务管理器中隐藏 procedure DisbleQuikKey(sw:boolean=false);//屏蔽ALT+F4和ALT+Ctrl+Del Function GetTaskBarHeight:
int
eger;//得到任务栏的高度 //------------------------------------------------------------------------------ function GetDesktopListViewHandle: THandle; { 得到桌面列表试图的句柄 } procedure MinWinAll;//最小化所有的窗体 procedure CloseWinAll;//关闭所有窗体 procedure DrawWindowRect(handle: Thandle;wColor: Tcolor=clBlack;PenWidth:
int
eger=1);//给窗体加个边框 Procedure SetParentWinDefFont(Sender:TObject;const defFont:Tfont=nil);//设置parent窗体的默认字体 {得到memo中光标所在的位置,行号,行长} procedure GetMemoMousePos(m:Tmemo;var posValue:TmemoPos);overload; procedure GetMemoMousePos(m:TRichEdit;var posValue:TmemoPos);overload; //Memo翻页 procedure setScrollPos(MHandle:Thandle;const pos:TClickType=PageDown);overload; //得到指定窗体的大小 procedure GetWinRect(const WinHandle:HWND;var winRect:TwinRect); procedure TimeDelay(DT:Dword);//精确毫秒级延时 procedure SetIPaddress(SIP: TNetValue;const isAuto:boolean=false);//设定网络Ip地址 Function GetLocalIP:string;//得到本机的IP地址 Procedure OpenURL(URL:string);//打开1个web URL //============================================================================== // 这一部分的函数摘自其他作者处.姓名不详 //============================================================================== function GetDisplayFrequency:
Int
eger; //获取显示刷新率 function GetIdeSerialNumber: String; //获取第
一个
硬盘的序列号 function GetCPUSpeed: Double; //获取当前CPU速率 Function GetCPUID:string; //获取CPU ID Function GetCPUVendor: string; //获取CPU 类型 Function GetFileLastAccessTime(sFileName:string):TDateTime; //获取文件最后访问日期和时间 Function GetFileCreateTime(const strFileName:string):TDateTime; //获取文件创建时间 Function GetFileModifyTime(const strFileName:string):TDateTime; //获取文件修改时间 Function GetDNSTOIP(DNSName:String):String; //把域名转化为IP地址 Function GetDNSName(IPAddress:String):String; //把IP地址转化为域名
Delphi网络公用函数
//文件操作部分起 //拷贝
一个
文件,封装CopyFile procedure FileCopyFile(const sSrcFile, sDstFile: string); //给定路径复制文件到同一目录下 bRecursive:true所有 procedure FileCopyDirectory(sDir, tDir: string; bRecursive: Boolean);overload; //给定路径原样复制文件 ,自编 procedure FileCopyDirectory(sDir, tDir: string);overload; //给定路径原样复制文件 ,用WinAPI ,若原目录下有相同文件则再生成
一个
procedure FileCopyDirectory(sDir, tDir:string;AHandle:Thandle);overload; //移动文件夹 procedure FileMoveDirectory(sDir, tDir:string;AHandle:Thandle); //删除给定路径及以下的所有路径和文件 procedure FileDeleteDirectory(sDir: string);overload; //删除给定路径及以下的所有路径和文件 用WinApi procedure FileDeleteDirectory(AHandle: THandle;const ADirName: string);overload; //删除给定路径及以下的所有路径和文件 到回收站 procedure FileDeleteDirectoryToCycle(AHandle: THandle;const ADirName: string); //取得指定文件的大小 function FileGetFileSize(const Filename: string): DWORD; //在Path下取得唯一FilenameX文件 function FileGetUniqueFileName(const Path: string; Filename: string): string; //取得临时文件 function FileGetTemporaryFileName: string; //取得系统路径 function PathGetSystemPath: string; //取得Windows路径 function PathGetWindowsPath: string; //给定文件名取得在系统目录下的路径,复制时用 function PathSystemDirFile(const Filename: string): string; //给定文件名取得在Windows目录下的路径,复制时用 function PathWindowsDirFile(const Filename: string): string; //给定文件名取得在系统盘下的路径,复制时用 function PathSystemDriveFile(const Filename: string): string; //路径最后有'/'则去'/' function PathWithoutSlash(const Path: string): string; //路径最后没有'/'则加'/' function PathWithSlash(const Path: string): string; //取得两路径的不同部分,条件是前半部分相同 function PathRelativePath(BaseDir, FilePath: string): string; //取得去掉属性的路径,文件名也作为DIR function PathExtractFileNameNoExt(Filename: string): string; //判断两路径是否相等 function PathComparePath(const Path1, Path2: string): Boolean; //取得给定路径的父路径 function PathParentDirectory(Path: string): string; //分割路径,Result=根(如d:)sPath = 除根外的其他部分 function PathGetRootDir(var sPath: string): string; //取得路径最后部分和其他部分 如d:\aa\aa result:=aa sPath:=d:\aa\ function PathGetLeafDir(var sPath: string): string; //取得当前应用程序的路径 function PathExeDir(FileName: string = ''): string; //文件操作部分止 //系统处理起 //提示窗口 procedure MsgBox(const Msg: string); //错误显示窗口 procedure MsgErrBox(const Msg: string); //询问窗口 带'是','否'按钮 function MsgYesNoBox(const Msg: string): Boolean; //询问窗口 带'是','否,'取消'按钮//返回值smbYes,smbNo,smbCancel function MsgYesNoCancelBox(const Msg: string):
Int
eger; //使鼠标变忙和恢复正常 procedure DoBusy(Busy: Boolean); //显示错误信息 procedure ShowLastError(const Msg: string = 'API Error'); //发出错误信息 procedure RaiseLastError(const Msg: string = 'API Error'); //释放Strings连接的相关资源 procedure FreeStringsObjects(SL: TStrings); //系统处理止 //时间处理起 //整数到时间 function TimeT_To_DateTime(TimeT:
Long
int
): TDateTime; //转化为秒 function TimeToSecond(const H, M, S:
Int
eger):
Int
eger; //秒转化 procedure TimeSecondToTime(const secs:
Int
eger; var H, M, S: Word); //秒转化 function TimeSecondToTimeStr(secs:
Int
eger): string; //时间处理止 //控件处理起 //设置控件是否能使用 procedure ConEnableControl(AControl: TControl; Enable: Boolean); //设置控件是否能使用,包子控件 procedure ConEnableChildControls(AControl: TControl; Enable: Boolean); procedure ConEnableClassControl(AControl: TControl; Enable: Boolean; ControlClass: TControlClass); procedure ConFree(aCon: TWinControl);//释放aCon上的控件 //从文件本中导入,类似LoadfromFile procedure ConLoadTreeViewFromTextFile(Nodes: TTreeNodes; Filename: string); //存为文本,类似SaveToFile procedure ConSaveTreeViewToTextFile(Nodes: TTreeNodes; Filename: string); //在控件上写文本 procedure ConWriteText(aContr: TControl;sText: string); //控件处理止 //字符串处理起 //取以Delimiters分隔的字符串 bTrail如果为True则把第index个后的也取出来 function StrGetToken(const S: string; index:
Int
eger; bTrail: Boolean = False; Delimiters: TSysCharSet = DEFAULT_DELIMITERS): string; //取以Delimiters分隔的字符串的个数 function StrCountWords(S: string; Delimiters: TSysCharSet = DEFAULT_DELIMITERS):
Int
eger; //用NewToken替换S中所有Token bCaseSensitive:=true大小写敏感 function StrReplaceString(var S: string; const Token, NewToken: string; bCaseSensitive: Boolean): Boolean; //从第Index个起以Substr替换Count个字符 procedure StrSimple_ReplaceString(var S: string; const Substr: string; index, Count:
Int
eger); //去掉S中的回车返行符 procedure StrTruncateCRLF(var S: string); //判定S是否以回车返行符结束 function StrIsContainingCRLF(const S: string): Boolean; //把SL中的各项数据转化为以Delimiter分隔的Str function StrCompositeStrings(SL: TStrings; const Delimiter: string): string; //封装TStrings的LoadFromFile function StrSafeLoadStrings(SL: TStrings; const Filename: string): Boolean; //封装TStrings的SaveToFile procedure StrSafeSaveStrings(SL: TStrings; const Filename: string); //字符串处理止 //字体处理起 procedure StringToFont(sFont: string; Font: TFont; bIncludeColor: Boolean = True); function FontToString(Font: TFont; bIncludeColor: Boolean = True): string; //字体处理止 //网络起 //判定是否在线 function NetJudgeOnline:boolean; //得到本机的局域网Ip地址 Function NetGetLocalIp(var LocalIp:string): Boolean; //通过Ip返回机器名 Function NetGetNameByIPAddr(IPAddr: string; var MacName: string): Boolean ; //获取网络中SQLServer列表 Function NetGetSQLServerList(var List: Tstringlist): Boolean; //获取网络中的所有网络类型 Function NetGetNetList(var List: Tstringlist): Boolean; //获取网络中的工作组 Function NetGetGroupList(var List: TStringList): Boolean; //获取工作组中所有计算机 Function NetGetUsers(GroupName: string; var List: TStringList): Boolean; //获取网络中的资源 Function NetGetUserResource(IpAddr: string; var List: TStringList): Boolean; //映射网络驱动器 Function NetAddConnection(NetPath: Pchar; PassWord: Pchar;LocalPath: Pchar): Boolean; //检测网络状态 Function NetCheckNet(IpAddr:string): Boolean; //检测机器是否登入网络 Function NetCheckMacAttachNet: Boolean; //判断Ip协议有没有安装 这个函数有问题 Function NetIsIPInstalled : boolean; //检测机器是否上网 Function Net
Int
ernetConnected: Boolean; //网络止 //窗口起 function
Form
CreateProcessFrm(MsgTitle: string):T
Form
; //窗口止 //EMail起 function CheckMailAddress(Text: string): boolean; //EMail止
delphi通用函数单元一
//▎============================================================▎// //▎================① 扩展的字符串操作函数 ===================▎// //▎============================================================▎// //从文件中返回Ado连接字串。 function GetConnectionString(DataBaseName:string):string; //返回服务器的机器名称. function GetRemoteServerName:string; function InStr(const sShort: string; const s
Long
: string): Boolean; {测试通过} {* 判断s1是否包含在s2中} function
Int
ToStrEx(Value:
Int
eger; Len:
Int
eger; FillChar: Char = '0'): string; {测试通过} {* 扩展整数转字符串函数 Example:
Int
ToStrEx(1,5,'0'); 返回:"00001"} function
Int
ToStrSp(Value:
Int
eger; SpLen:
Int
eger = 3; Sp: Char = ','): string; {测试通过} {* 带分隔符的整数-字符转换} function ByteToBin(Value: Byte): string; {测试通过} {* 字节转二进制串} function StrRight(Str: string; Len:
Int
eger): string; {测试通过} {* 返回字符串右边的字符 Examples: StrRight('ABCEDFG',3); 返回:'DFG' } function StrLeft(Str: string; Len:
Int
eger): string; {测试通过} {* 返回字符串左边的字符} function Spc(Len:
Int
eger): string; {测试通过} {* 返回空格串} function Replace(Str,s1,s2:string;CaseSensitive:Boolean):string; {测试通过} {* 返回将指定字符s1用字符串s2替换后的字符串,可支持大小写敏感由CaseSensitive操作} {example: replace('We know what we want','we','I',false) = 'I Know what I want'} function Replicate(pcChar:Char; piCount:
int
eger):string; {在
一个
字符串中查找某个字符串的位置} function StrNum(ShortStr:string;
Long
String:string):
Int
eger; {测试通过} {* 返回某个字符串中某个字符串中出现的次数} function FindStr(ShortStr:String;
Long
StrIng:String):
Int
eger; {测试通过} {* 返回某个字符串中查找某个字符串的位置} function SubStr(psInput:String; BeginPlace,CutLeng:
Int
eger):String; {测试通过} {* 返回从位置BeginPlace开始切取长度为CatLeng字符串} function LeftStr(psInput:String; CutLeng:
Int
eger):String; {测试通过} {* 返回从左边第一为开始切取 CutLeng长度的字符串} function RightStr(psInput:String; CutLeng:
Int
eger):String; {测试通过} {* 返回从右边第一为开始切取 CutLeng长度的字符串} function PadLStr(psInput:String; piWidth:
Int
eger; pcPadWith:Char):String; {测试通过} {* 返回从psInput字符串左边开始用pcPadWith填充后总长度为PiWidth的字符串} function PadRStr(psInput:String; piWidth:
Int
eger; pcPadWith:Char):String; {测试通过} {* 返回从psInput字符串右边开始用pcPadWith填充后总长度为PiWidth的字符串} function PadCStr(psInput:String; piWidth:
Int
eger; pcPadWith:Char):String; {测试通过} {* 返回从psInput字符串两边开始用pcPadWith填充后总长度为PiWidth的字符串} function ChrTran(psInput:String; pcSearch:Char; pcTranWith:Char):String; {测试通过} {* 返回替换后字符串[替换单个字符] Examples: ChrTran('abCdEgdlkh','d','#'); 返回'abC#Eg#lkh'} function StrTran(psInput:String; psSearch:String; psTranWith:String):String; {测试通过} {* 返回替换后字符串[替换字符串] Examples: StrTran('aruyfbn','ruy','=====');; 返回'a=====fbn'} function Stuff(psInput:String; piBeginPlace,piCount:
Int
eger; psStuffWith:String):String; { *返回替换后字符串[替换字符串] Examples: Stuff('ABCDEFGHI',3,4,'12345');返回'AB12345GHI'} procedure SwapStr(var s1, s2: string); {测试通过} {* 交换字串} function LinesToStr(const Lines: string): string; {测试通过} {* 多行文本转单行(换行符转'\n')} function StrToLines(const Str: string): string; {测试通过} {* 单行文本转多行('\n'转换行符)} function Encrypt(const S: String; Key: Word): String; {* 字符串加密函数} function Decrypt(const S: String; Key: Word): String; {* 字符串解密函数} function varIIF(aTest: Boolean; TrueValue, FalseValue: Variant): Variant; function varToStr(const V: Variant): string; {* VarIIF及VartoStr为变体函数} function IsDigital(Value: string): boolean; {功能说明:判断string是否全是数字} function RandomStr(aLength :
Long
int
) : String; {随机字符串函数} //▎============================================================▎// //▎================② 扩展的日期时间操作函数 =================▎// //▎============================================================▎// function GetYear(Date: TDate):
Int
eger; {测试通过} {* 取日期年份分量} function GetMonth(Date: TDate):
Int
eger; {测试通过} {* 取日期月份分量} function GetDay(Date: TDate):
Int
eger; {测试通过} {* 取日期天数分量} function GetHour(Time: TTime):
Int
eger; {测试通过} {* 取时间小时分量} function GetMinute(Time: TTime):
Int
eger; {测试通过} {* 取时间分钟分量} function GetSecond(Time: TTime):
Int
eger; {测试通过} {* 取时间秒分量} function GetMSecond(Time: TTime):
Int
eger; {测试通过} {* 取时间毫秒分量} function GetMonthLastDay(Cs_Year,Cs_Month:string):string; { *传入年、月,得到该月份最后一天} function IsLeapYear( nYear:
Int
eger ): Boolean; {*/判断某年是否为闰年} function MaxDateTime(const Values: array of TDateTime): TDateTime; {//两个日期取较大的日期} function MinDateTime(const Values: array of TDateTime): TDateTime; {//两个日期取较小的日期} function dateBeginOfMonth(D: TDateTime): TDateTime; {//得到本月的第一天} function DateEndOfMonth(D: TDateTime): TDateTime; {//得到本月的最后一天} function DateEndOfYear(D: TDateTime): TDateTime; {//得到本年的最后一天} function DaysBetween(Date1, Date2: TDateTime):
int
eger; {//得到两个日期相隔的天数} //▎============================================================▎// //▎===================③ 扩展的位操作函数 ====================▎// //▎============================================================▎// type TByteBit = 0..7; {* Byte类型位数范围} TWordBit = 0..15; {* Word类型位数范围} TDWordBit = 0..31; {* DWord类型位数范围} procedure SetBit(var Value: Byte; Bit: TByteBit; IsSet: Boolean); overload; {* 设置二进制位} procedure SetBit(var Value: WORD; Bit: TWordBit; IsSet: Boolean); overload; {* 设置二进制位} procedure SetBit(var Value: DWORD; Bit: TDWordBit; IsSet: Boolean); overload; {* 设置二进制位} function GetBit(Value: Byte; Bit: TByteBit): Boolean; overload; {* 取二进制位} function GetBit(Value: WORD; Bit: TWordBit): Boolean; overload; {* 取二进制位} function GetBit(Value: DWORD; Bit: TDWordBit): Boolean; overload; {* 取二进制位} //▎============================================================▎// //▎=================④扩展的文件及目录操作函数=================▎// //▎============================================================▎// function MoveFile(const sName, dName: string): Boolean; {测试通过} {* 移动文件、目录,参数为源、目标名} procedure FileProperties(const FName: string); {测试通过} {* 打开文件属性窗口} function CreatePath(path : string) : Boolean; function OpenDialog(var FileName: string; Title: string; Filter: string; Ext: string): Boolean; {* 打开文件框} function
Form
atPath(APath: string; Width:
Int
eger): string; {测试通过} {* 缩短显示不下的长路径名} function GetRelativePath(Source, Dest: string): string; {测试通过} {* 取两个目录的相对路径,注意串尾不能是'\'字符!} procedure RunFile(const FName: string; Handle: THandle = 0; const Param: string = ''); {测试通过} {* 运行
一个
文件} function WinExecAndWait32(FileName: string; Visibility:
Int
eger = SW_NORMAL):
Int
eger; {测试通过} {* 运行
一个
文件并等待其结束} function AppPath: string; {测试通过} {* 应用程序路径} function GetDiskInfo(sFile : string; var nDiskFree,nDiskSize :
Int
64): boolean; {测试通过} {* 取sFile 所在磁盘空间状态 } function GetWindowsDir: string; {测试通过} {* 取Windows系统目录} function GetW
inT
empDir: string; {测试通过} {* 取临时文件目录} function AddDirSuffix(Dir: string): string; {测试通过} {* 目录尾加'\'修正} function MakePath(Dir: string): string; {测试通过} {* 目录尾加'\'修正} function IsFileInUse(FName: string): Boolean; {测试通过} {* 判断文件是否正在使用} function GetFileSize(FileName: string):
Int
eger; {测试通过} {* 取文件长度} function SetFileDate(FileName: string; CreationTime, LastWriteTime, LastAccessTime: TFileTime): Boolean; {测试通过} {* 设置文件时间 Example: FileSetDate('c:\Test\Test1.exe',753160662); } function GetFileDate(FileName: string; var CreationTime, LastWriteTime, LastAccessTime: TFileTime): Boolean; {测试通过} {* 取文件时间} function FileTimeToLocalSystemTime(FTime: TFileTime): TSystemTime; {测试通过} {* 文件时间转本地时间} function LocalSystemTimeToFileTime(STime: TSystemTime): TFileTime; {测试通过} {* 本地时间转文件时间} function GetFileIcon(FileName: string; var Icon: TIcon): Boolean; {测试通过} {* 取得与文件相关的图标,成功则返回True} function CreateBakFile(FileName, Ext: string): Boolean; {测试通过} {* 创建备份文件} function Deltree(Dir: string): Boolean; {测试通过} {* 删除整个目录} function GetDirFiles(Dir: string):
Int
eger; {测试通过} {* 取文件夹文件数} type TFindCallBack = procedure(const FileName: string; const Info: TSearchRec; var Abort: Boolean); {* 查找指定目录下文件的回调函数} procedure FindFile(const Path: string; const FileName: string = '*.*'; Proc: TFindCallBack = nil; bSub: Boolean = True; const bMsg: Boolean = True); {* 查找指定目录下文件} procedure FindFileList(Path:string;Filter,FileList:TStrings;ContainSubDir:Boolean; lb: TLabel=nil); { 功能说明:查找
一个
路径下的所有文件。 参数: path:路径,filter:文件扩展名过滤,FileList:文件列表, ContainSubDir:是否包含子目录} function Txtline(const txt: string):
int
eger; {* 返回一文本文件的行数} function Html2Txt(htmlfilename: string): string; {* Html文件
转化成
文本文件} function OpenWith(const FileName: string):
Int
eger; {测试通过} {* 文件打开方式} //▎============================================================▎// //▎====================⑤扩展的对话框函数======================▎// //▎============================================================▎// procedure InfoDlg(Mess: string; Caption: string = SCnIn
form
ation; Flags:
Int
eger = MB_OK + MB_ICONIN
FORM
ATION); {测试通过} {* 显示提示窗口} function InfoOk(Mess: string; Caption: string = SCnIn
form
ation): Boolean; {测试通过} {* 显示提示确认窗口} procedure ErrorDlg(Mess: string; Caption: string = SCnError); {测试通过} {* 显示错误窗口} procedure WarningDlg(Mess: string; Caption: string = SCnWarning); {测试通过} {* 显示警告窗口} function QueryDlg(Mess: string; Caption: string = SCnIn
form
ation): Boolean; {测试通过} {* 显示查询是否窗口} procedure SetWindowAnimate(Sender : T
Form
; IsSetAni : bool); //▎============================================================▎// //▎=====================⑥系统功能函数=========================▎// //▎============================================================▎// procedure MoveMouse
Int
oControl(AWinControl: TControl); {测试通过} {* 移动鼠标到控件} function DynamicResolution(x, y: WORD): Boolean; {测试通过} {* 动态设置分辨率} procedure StayOnTop(Handle: HWND; OnTop: Boolean); {测试通过} {* 窗口最上方显示} procedure SetHidden(Hide: Boolean); {测试通过} {* 设置程序是否出现在任务栏} procedure SetTaskBarVisible(Visible: Boolean); {测试通过} {* 设置任务栏是否可见} procedure SetDesktopVisible(Visible: Boolean); {测试通过} {* 设置桌面是否可见} procedure BeginWait; {测试通过} {* 显示等待光标} procedure EndWait; {测试通过} {* 结束等待光标} function CheckWindows9598NT: string; {测试通过} {* 检测是否Win95/98/NT平台} function GetOSInfo : String; {测试通过} {* 取得当前操作平台是 Windows 95/98 还是NT} function GetCurrentUserName : string; {*获取当前Windows登录名的用户} function GetRegistryOrg_User(UserKeyType:string):string; {*获取当前注册的单位及用户名称} function GetSysVersion:string; {*//获取操作系统版本号} function WinBootMode:string; {//Windows启动模式} type PShutType = (UPowerOff, UShutdown, UReboot, ULogOff, USuspend, UHibernate); procedure WinShutDown(ShutW
inT
ype:PShutType; PForce:Boolean); {//Windows ShutDown等} //▎============================================================▎// //▎=====================⑦硬件功能函数=========================▎// //▎============================================================▎// function GetClientGUID:string; { 功能描述:在本机上得到
一个
GUID.去掉两端的大括号和中间的横线 返回值:去掉两端的大括号和中间的横线的
一个
GUID 适用范围:windows } function SoundCardExist: Boolean; {测试通过} {* 声卡是否存在} function GetDiskSerial(DiskChar: Char): string; {* 获取磁盘序列号} function DiskReady(Root: string) : Boolean; {*检查磁盘准备是否就绪} procedure WritePortB( wPort : Word; bValue : Byte ); {* 写串口} function ReadPortB( wPort : Word ) : Byte; {*读串口} function CPUSpeed: Double; {* 获知当前机器CPU的速率(MHz)} type TCPUID = array[1..4] of
Long
int
; function GetCPUID : TCPUID; assembler; register; {*获取CPU的标识ID号*} function GetMemoryTotalPhys : Dword; {*获取计算机的物理内存} type TDriveState = (DSNODISK, DSUN
FORM
ATTEDDISK, DSEMPTYDISK, DSDISK_WITHFILES); function DriveState (driveletter: Char) : TDriveState; {* 检查驱动器A中磁盘是否有效} //▎============================================================▎// //▎=====================⑧网络功能函数=========================▎// //▎============================================================▎// function GetComputerName:string; {* 获取网络计算机名称} function GetHostIP:string; {* 获取计算机的IP地址} function NetUserChangePassword(Domain:PWideChar; UserName:PWideChar; OldPassword:PWideChar; NewPassword:PWideChar):
Long
Int
; stdcall; external 'netapi32.dll' name 'NetUserChangePassword'; {* // 运行平台:Windows NT/2000/XP {* // Windows 95/98/Me平台:可以用该函数修改用户的Windows登录密码} //▎============================================================▎// //▎=====================⑨汉字拼音功能函数=====================▎// //▎============================================================▎// function GetHzPy(const AHzStr: string): string; {测试通过} {* 取汉字的拼音} function HowManyChineseChar(Const s:String):
Int
eger; {* 判断
一个
字符串中有多少各汉字} //▎============================================================▎// //▎===================⑩数据库功能函数及过程===================▎// //▎============================================================▎// {function PackDbDbf(Var StatusMsg: String): Boolean;} {* 物理删除数据库(Db,Dbf)中的数据[着了删除标记的记录]} procedure RepairDb(DbName: string); {* 修复Access表} function CreateODBCCfgInRegistry(ODBCSourceName:WideString;ServerName, DataBaseDescription:String):boolean; {* 通过注册表创建ODBC配置[创建在系统DSN页下]} function ADOConnectSysBase(Const Adocon:TadoConnection):boolean; {* 用Ado连接SysBase数据库函数} function ADOConnectLocalDB(Const Adocon:TadoConnection;Const Dbname,DbServerName:string;ValidateMode:
Int
eger):boolean; {* 用Ado连接数据库函数} function ADOODBCConnectLocalDB(Const Adocon:TadoConnection;Const Dbname:string;ValidateMode:
Int
eger):boolean; {* 用Ado与ODBC共同连接数据库函数} function CreatTable(LpDataBaseName,LpTableName,LpSentence:string):Boolean; {* //建立新表} function AddField(LpFieldName:string; LpDataType: TFieldType; LpSize: Word):string; {*//在表中添加字段} function KillField(LpFieldName:string):String; {* //在表中删除字段} function AlterTableExec(LpDataBaseName,LpSentence:string):Boolean; {* //修改表结构} function GetSQLSentence(LpTableName,LpSQLsentence:string): string; {* /修改、添加、删除表结构时的SQL句体} //▎============================================================▎// //▎======================⑾进制函数及过程======================▎// //▎============================================================▎// function StrToHex(AStr: string): string; {* 字符
转化成
十六进制} function HexToStr(AStr: string): string; {* 十六进制
转化成
字符} function TransChar(AChar: Char):
Int
eger; //▎============================================================▎// //▎=====================⑿其它函数及过程=======================▎// //▎============================================================▎// function Trim
Int
(Value, Min, Max:
Int
eger):
Int
eger; overload; {测试通过} {* 输出限制在Min..Max之间} function
Int
ToByte(Value:
Int
eger): Byte; overload; {测试通过} {* 输出限制在0..255之间} function InBound(Value:
Int
eger; Min, Max:
Int
eger): Boolean; {测试通过} {* 判断整数Value是否在Min和Max之间} procedure CnSwap(var A, B: Byte); overload; {* 交换两个数} procedure CnSwap(var A, B:
Int
eger); overload; {* 交换两个数} procedure CnSwap(var A, B: Single); overload; {* 交换两个数} procedure CnSwap(var A, B: Double); overload; {* 交换两个数} function RectEqu(Rect1, Rect2: TRect): Boolean; {* 比较两个Rect是否相等} procedure DeRect(Rect: TRect; var x, y, Width, Height:
Int
eger); {* 分解
一个
TRect为左上角坐标x, y和宽度Width、高度Height} function EnSize(cx, cy:
Int
eger): TSize; {* 返回
一个
TSize类型} function RectWidth(Rect: TRect):
Int
eger; {* 计算TRect的宽度} function RectHeight(Rect: TRect):
Int
eger; {* 计算TRect的高度} procedure Delay(const uDelay: DWORD); {测试通过} {* 延时} procedure BeepEx(const Freq: WORD = 1200; const Delay: WORD = 1); {Win9X下测试通过} {* 只能在Win9X下让喇叭发声} procedure ShowLastError; {测试通过} {* 显示Win32 Api运行结果信息} function writeFontStyle(FS: TFontStyles; inifile: string; write: boolean):string; {* 将字体Font.Style写入INI文件} function readFontStyle(inifile: string): TFontStyles; {* 从INI文件中读取字体Font.Style文件} //function ReadCursorPos(SourceMemo: TMemo): TPo
int
; function ReadCursorPos(SourceMemo: TMemo): string; {* 取得TMemo 控件当前光标的行和列信息到Tpo
int
中} function CanUndo(AMemo: TMemo): Boolean; {* 检查Tmemo控件能否Undo} procedure Undo(Amemo: Tmemo); {*实现Undo功能} procedure AutoListDisplay(ACombox:TComboBox); {* 实现ComBoBox自动下拉} function UpperMoney(small:real):string; {* 小写金额转换为大写 } function Myrandom(Num:
Int
eger):
int
eger; {*利用系统时间产生随机数)} procedure OpenIME(ImeName: string); {*打开输入法} procedure CloseIME; {*关闭输入法} procedure ToChinese(hWindows: THandle; bChinese: boolean); {*打开中文输入法} //数据备份 procedure BackUpData(LpBackDispMessTitle:String); procedure ImageLoadGif(Picture: TPicture; filename: string); procedure ImageLoadJpg(Picture: TPicture; filename: string);
怎样调用dll里的窗体
创建DLL:
1、在application中,把begin..end之间的东西去掉
2、把project改成library
3、在uses和{$R *.RES}后面,begin end前面,加:
procedure CreateDll
Form
(Parameter:
Long
int
);stdcall;
var
//这里定义要显示的Dll窗体
Form
1:T
Form
1;
begin
Application.Han
c#语言基础
一、了解Windows 内部机制 Windows 是
一个
“基于事件的,消息驱动的”操作系统。 在Windows下执行
一个
程序,只要用户进行了影响窗口的动作(如改变窗口大小或移动、单击鼠标等)该动作就会触发
一个
相应的“事件”。系统每次检测到
一个
事件时,就会给程序发送
一个
“消息”,从而使程序可以处理该事件。每个Windows 应用程序都是基于事件和消息的,而且包含
一个
主事件循环,它不
Delphi
5,930
社区成员
262,936
社区内容
发帖
与我相关
我的任务
Delphi
Delphi 开发及应用
复制链接
扫一扫
分享
社区描述
Delphi 开发及应用
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章