delphi 中CreateOleObject函数产生的对象的释放问题

delphi操作word delphi操作word一、Delphi程序启动Word采用CreateOleObjects的方法来启动Word,调用VBA代码,具体实现过程为:首先使用GetActiveOleObject(Word.Application)判断当前内存中是否存在Word程序,如果存在,则直接连接,如果没有Word程序,则使用CreateOleObject(Word.Application)启动Wor 阅读详情

只需要将它设为nil就可以了,系统会自动释放。因为com是基于引用管理的,当它的计数为零时,会自动释放。

Delphi和Office程序开发 1.引言在利用Delphi开发应用程序的时候,通常我们要设计出很多各种格式的文档、报表,经常要进行文件的创建、编辑及修改,虽然Delphi本身提供了很多设计报表的控件或方法,但是存在明显的不足,比如中文输入,数据格式的控制等操作起来比较麻烦。利用大家都很熟悉的Office工具结合开发,能够很好的解决这方面的问题。以下就以Delphi为例详细介绍怎么利用Office完成各种文档、报表的制作。2.实现 阅读详情

相关推荐

delphi中用CreateOleObject操作word的例子

delphi中用CreateOleObject操作word的例子,自己写的。可以添加,保存,修改,支持word的好几种格式,把word嵌入到pannel中等。很好用的开发程序例子。比olecontiner好用多了。需要引用单元comobj.pas 我用的是delphixe版本写的。

Delphi 控制Excel 例子,参考资料

个人收藏:Delphi  控制Excel(一) 使用动态创建的方法首先创建 Excel 对象,使用ComObj:var ExcelApp: Variant;ExcelApp := CreateOleObject( Excel.Application );1) 显示当前窗口:ExcelApp.Visible := True;2) 更改 Excel 标题栏:ExcelApp.Caption :=

阿锋--专栏 4068

HAL库STM32CubeMX+DHT11温湿度传感器模块化驱动与OLED显示实战

本文详细介绍了基于HAL库和STM32CubeMX开发DHT11温湿度传感器模块化驱动的实战过程。通过精确的时序控制和模块化封装,实现了传感器数据采集,并结合OLED显示模块实时展示温湿度信息,为嵌入式开发者提供了完整的解决方案。

h6j7k8l9p0的博客 1134

delphi中关于使用CreateOleObject方法控制word的一些心得。将word放入到pannel中

delphi中关于使用CreateOleObject方法控制word的一些心得,需要引用comobj单元。我只打开的函数,供大家分享。 打开word时,处理异常。使用GetActiveOleObject方法如果存在内存存在就直接调用,否则得创建;插入数据等操作…… procedure TfrmMain.N1Click(Sender: TObject); var    h:THandle

lenovo455的专栏 4338

忘记安卓锁屏密码怎么办?3种方法教你用ADB恢复访问(含gesture.key解密)

本文详细解析了安卓设备锁屏密码的存储与加密机制,特别是gesture.key文件的解密原理。针对遗忘密码的常见问题,提供了三种核心恢复方法:利用ADB调试接口删除密码文件、对gesture.key进行离线分析与解密,以及应对高版本系统的替代方案。重点介绍了通过ADB工具在Recovery模式下操作的具体步骤,帮助用户在合法合规前提下恢复设备访问权限。

php55的博客 959

实战解析:利用Wireshark解密QQ通信协议

本文提供了一份利用Wireshark工具分析QQ通信协议的实战指南。文章详细介绍了从环境准备、捕获数据包到解析协议层的完整流程,重点演示了如何识别QQ号码字段、观察加密数据特征以及区分不同通信类型(如文本、文件传输)。通过此实践,读者可以深入理解网络分层模型和现代应用加密通信机制,提升网络协议分析与安全诊断能力。

weixin_29210727的博客 408

在Delphi中使用CreateOleObject方法对WORD文件进行操作

使用CreateOleObject方法对WORD文档操作具有先天所具备的优势,与delphi所提供的那些控件方式的访问相比,CreateOleObject方法距离WORD核心的操作“更近”,因为它直接使用OFFICE所提供的VBA语言对WORD文档的操作进行编程。以下是我在本机上所做的实验,机器软件配置如下:Windows XP+delphi7.0+OFFICE 2003这个程序很简单,在页面上放

windlazio的专栏 3397

ClaudeCode 通过 CC Switch 配置 Ollama 本地大模型

本文介绍了如何让Claude Code使用本地免费模型qwen3.5:9b而无需Anthropic API Key的方法。主要内容包括:1)安装Claude Code、CC Switch代理工具和Ollama本地模型运行时;2)配置环境变量和设置文件将请求转发到本地服务;3)详细说明了系统架构和工作原理,展示请求如何从Claude Code经CC Switch代理到Ollama本地模型。该方案通过代理拦截和转发机制,实现了使用免费开源模型替代官方API的功能。

稚枭天卓 3222

delphi excel 对象释放

代码如下:    ...    ExcelApp,workbook:   Variant;      ...    ExcelApp:=CreateOleObject( 'Excel.Application ');    workbook:=CreateOleObject( 'Excel.sheet '); 上次大家给我的代码是:  workbook.close;  Exc

harvardfeng的专栏 2250

CHNS数据库下载与使用指南:从申请到导入的全流程解析

面板数据是经济学与公共卫生实证研究的重要支撑。中国健康与营养调查(CHNS)自1989年持续追踪中国居民的家庭与个人健康、营养及经济行为,为研究者提供了跨度近三十年的纵向微观数据。理解CHNS的数据组织原理与申请机制,是高效利用该数据的前提。该数据广泛适用于健康经济学、膳食营养分析及公共政策评估等场景。围绕CHNS的下载流程,完整梳理了注册申请、数据文件解析以及Stata、R、Python三种工具的读取方法,并针对邮箱验证、文件损坏、ID匹配等常见问题提供排查建议,帮助研究者快速建立数据处理基础。

weixin_33624741的博客 285

Newton & Nvidia 开源 GPU 加速机器人仿真器入门教程(一)

Newton 是一个 GPU 加速、可扩展和可微分的物理仿真引擎,专为机器人、研究和高级仿真工作流而设计。Newton 基于 NVIDIA Warp 并集成了 MuJoCo Warp,为用户和开发人员提供了高性能仿真、现代 Python API 和灵活的架构。

机器人控制与仿真应用 1482

使用CreateOleObject时报错--'无效的类别字符串'

使用CreateOleObject时报错--'无效的类别字符串' Delphi / Windows SDK/APIhttp://www.delphi2007.net/DelphiAPI/html/delphi_20061127173640163.html 我在使用函数CreateOleObject(Purchasing.COM)时报如下的错误。在执行该语句之前,我已经用Registe...

aibi9196的博客 1545

【基于深度学习的脑电图识别】数据集篇:THE TUH EEG CORPUS: A Big Data Resource for Automated EEG Interpretation

【基于机器学习的脑电图识别】数据集篇:脑电信号自动判读的大数据摘要: 摘要: 这个数据集包括超过 25000 个脑电图研究,包括一个神经学家对测试的解释,一个简短的病人病史和关于病人的人口统计信息,如性别和年龄。这是第一次有足够的数据来支持最先进的机器学习算法的应用。在这篇论文中,我们使用了3762个语料库的会话子集,展示了从原始脑电图信号数据预测脑电图的一些基本属性的初步实验结果。在闭环测试中,...

梁瑛平的博客 5615

delphi中使用词霸2005的动态库XdictGrb.dll实现屏幕取词

     近日来,在网上发现关于屏幕取词技术的捷径,搜索很长时间,发现实现方式以VB出现的居多,但是通过Delphi来实现的却好象没有看到,自己参考着VB的相关代码琢磨了一下通过delphi来实现的方式。     其实也差不多,唯一不同的只有一个地方就是取词对象GrabProxy的AdviseGrab这个方法,该方法的参数是一个IXDictGrabSink的接口类型,在Vb中是AdviseGr

不得闲.闲忆居 3246

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

关于CreateOleObject函数的调用问题(用友U86登陆界面调用)

关于CreateOleObject函数的调用问题(用友U86登陆界面调用) Delphi / Windows SDK/APIhttp://www.delphi2007.net/DelphiAPI/html/delphi_20061129223145148.html 我用CreateOleObject调用COM控件,跟踪发现他在使用该函数时没有问题,当调用里面的函数时,第一次调试调用成...

aibi9196的博客 476

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

delphi中通过CreateOleObject操控Word

上图为最终的WORD内容,看似简单,实则不易(研究了一天才得出所要的结果)。 在开发的过程中,请配合Word中的宏与VBA帮助文档(Microsoft Office\OFFICE11\2052\VBAWD10.CHM) 开发环境:delphi7+xp+word2003        uses comobj, word2000; procedure TForm1.Button1Clic

csm2432的专栏 7399

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

Delphi 对象的创建(create)与释放(free/destory)

create后一定要free吗? 简单举例  procedure   a;  var   x:TX;  begin      x:=TX.create;      //do   someting;      x.free   //如果我这里不free,到了这个end不就是相当于C中的}自动释放吗?                        也就是说在此处这个free是多余的

冷月宫主的专栏 1423

delphi公用函数

{*******************************************************}{ }{ Delphi公用函数单元 }{

靠别人不如靠自已。 9841

delphi 编写的com 对象 用delphi 的调用实例

delphi 编写的com 对象 用delphi 的调用实例COM 对象与 前一篇文章的 PHP调用的COM为同一个对象,故不例出COM. procedure TForm1.Button4Click(Sender: TObject);var  myCounter, mReturn: variant;begin  myCounter := CreateOleObject(

潇湘博客 1090

DELPHI,Office编程1

====================================================== 注:本文源代码点此下载 ====================================================== 1、可供选择的技术: (1) 通过delphi的控件tolecontainer 将office嵌入,这是最简单的ole嵌入,能够直接将offic

javazhuanzai的专栏 695

delphi 在多线程中使用 CreateOleObject 导致失败

原帖地址 http://bbs.youkuaiyun.com/topics/390481350 解决办法 procedure DisplayVideoInfo; var wmi, objs, obj : OleVariant; enum : IEnumVariant; value : Cardinal; beg

warrially的专栏 3240
上一篇: delphi virtual dynamic
下一篇: EnumWindows函数
一剑平江湖
博客等级 码龄18年 207粉丝 1070原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值