VB.NET自动操作其他程序(3)--捕获窗口句柄、单击菜单、按钮、COMBOBOX、EditBox

4.1、捕获其他程序窗口句柄
要对其他程序进行操作,首先要捕获其他程序的窗口句柄。
‘查找标题栏包含“inWindowText  ”  的窗口,窗口标题内容不确定的可以使用,例如动态变化标题的窗口,如果标题固定,直接用FindWindowEx()就可以了。
Public
 Function MyFindWindow(ByVal className As String, ByVal inWindowText As String) As Integer   '查找标题栏包含“inWindowText”的窗口
 
        
Dim hMyWindow As Integer 
        
Dim sss As New String("", 256) 

        hMyWindow = FindWindowEx(0, 0, className, 
Nothing)    '以desktop window为父,按照Z order查找第一个子窗口 
        
'hMyButton = FindWindowEx(hMyWindow, 0&, Nothing, Nothing)       '为遍历所有类型窗口,将第三个参数设为“Nothing” 
        MyFindWindow = 0 
        
While hMyWindow 
            GetWindowText(hMyWindow, sss, 256)     '获取窗口标题
         
   If InStr(sss, inWindowText) > 0 Then          '进行比较 
                MyFindWindow = hMyWindow 
                
Exit Function        ‘找到退出 
            
End If 
            hMyWindow = FindWindowEx(0, hMyWindow, className, 
Nothing)    '以desktop window为父,按照Z order查找在hMyWindow后的下一个子窗口 
        
End While 
    
End Function 
4.2、单击其他程序的菜单
 '点击级菜单的第个子项(从0算起)   
 
Public Function ClickMenu(ByVal hMyWindow As Integer,ByVal nSubMenu As Integer, ByVal nMenuItemID As Integer) As Integer 

        
Dim hMyWindow As Integer 
        
Dim MyMenu As Integer 
        
Dim MyGetMenuItemID As Integer 
        
Dim nReturn As Integer 

        
If hMyWindow = 0 Then 
            MsgBox(
"没有找到相应窗口!") 
        
Else 
            MyMenu = GetMenu(hMyWindow) 

            MyMenu = GetSubMenu(MyMenu, nSubMenu) 
            MyGetMenuItemID = GetMenuItemID(MyMenu, nMenuItemID)      
'“按条件选择设备”菜单 

            BringWindowToTop(hMyWindow) 
            nReturn = PostMessage(hMyWindow, WM_SYSCOMMAND, MyGetMenuItemID, 0) 
            nReturn = PostMessage(hMyWindow, WM_COMMAND, MyGetMenuItemID, 0) 
        
End If 
  End Function 

 4.3、ListView相关操作见另文。

 4.4.1、'读COMBOBOX 
    
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click 
        
Dim hMyWindow, hMyButton As Integer 
        hMyWindow = FindWindow(
"WindowsForms10.Window.8.app3", "远程浏览") 
        hMyButton = FindWindowEx(hMyWindow, 0, 
"WindowsForms10.COMBOBOX.app3", Nothing) '获取第二个WindowsForms10.COMBOBOX.app3窗口:ATMID 下拉选择框 
        hMyButton = FindWindowEx(hMyWindow, hMyButton, 
"WindowsForms10.COMBOBOX.app3", Nothing) '获取第二个WindowsForms10.COMBOBOX.app3窗口:ATMID 下拉选择框 
        MsgBox(hMyButton) 

        
Dim i As Integer = SendMessage(hMyButton, CB_GETCURSEL, 0, 0)   '读取当前COMBOBOX索引值,  第三个参数为列表框的索引 
        MsgBox(i) 
        
Dim k As Integer = SendMessage(hMyButton, CB_GETLBTEXTLEN, i, 0)  ' 读取索引位置文本长度
        MsgBox(k) 
        
Dim ptr As IntPtr = Marshal.AllocHGlobal(256) 
        i = SendMessage(hMyButton, CB_GETLBTEXT, i, ptr)     ' 读取索引位置文本
        MsgBox(i) 
        MsgBox(IntPtrToStr(ptr)) 
    
End Sub 

 4.4.2、设置其他程序的下拉框的选择
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click 
        
Dim hMyWindow, hMyButton As Integer 
        hMyWindow = FindWindow(
"WindowsForms10.Window.8.app3", "远程浏览") 
        hMyButton = FindWindowEx(hMyWindow, 0, 
"WindowsForms10.COMBOBOX.app3", Nothing) '获取第二个WindowsForms10.COMBOBOX.app3窗口:ATMID 下拉选择框 
        MsgBox(hMyButton) 
        hMyButton = FindWindowEx(hMyWindow, hMyButton, 
"WindowsForms10.COMBOBOX.app3", Nothing) '获取第二个WindowsForms10.COMBOBOX.app3窗口:ATMID 下拉选择框 
        MsgBox(hMyButton) 
        SendMessage(hMyButton, CB_SETCURSEL, 1, 0)  
'第三个参数为列表框的索引 
 
 End Sub 
4.5.1、读Edit 
    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click 
        Dim processId As Integer 

        hwnd = FindWindow("WindowsForms10.Window.8.app3", "远程浏览") 
        hwnd = FindWindowEx(hwnd, 0, "WindowsForms10.COMBOBOX.app3", Nothing) '获取第一个WindowsForms10.COMBOBOX.app3窗口: 
        hwnd = FindWindowEx(hwnd, 0, "Edit", Nothing) 

        Dim ptr As IntPtr = Marshal.AllocHGlobal(256) 

        SendMessage(hwnd, WM_GETTEXT, 255, ptr) 

        MsgBox(IntPtrToStr(ptr)) 
        MsgBox(Marshal.PtrToStringAnsi(ptr)) 


    End Sub 
 

4.5.2、设置其他程序Edit框的值
'浏览路径 
    
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click 
        
Dim hMyWindow, hMyButton, MyEditbox As Integer 
        
Dim processId As Integer 

        hMyWindow = FindWindow(
"WindowsForms10.Window.8.app3", "远程浏览") 

        hMyButton = FindWindowEx(hMyWindow, 0, 
"WindowsForms10.COMBOBOX.app3", Nothing) '获取第一个WindowsForms10.COMBOBOX.app3窗口: 
        MyEditbox = GetDlgItem(hMyButton, 1001)          '获
        hMyButton = FindWindowEx(hMyButton, 0, 
"Edit", Nothing)                         '获取“浏览路径”输入框 
        
Dim str As String = "D:\Image\" 

        SendMessage(hMyButton, WM_SETTEXT, 0, StrToIntPtr(str)) 

    
End Sub 

    
'将字符串存储到IntPtr 指针中。 
    
'Dim ptr As IntPtr = Marshal.StringToHGlobalAuto("1234") 
    
'指针ptr 存放内容格式为:1个数据,1个结束符0,例如上面数据,存放如下:49、0,50、0,51、0,52、0 
    
'而很多时,传递字符指针,要求数据是连续存放的,最后才是结束符0,例如SendMessage(hMyButton, WM_SETTEXT, 0, StrToIntPtr(str))。 
    
Public Function StrToIntPtr(ByVal inStrText As String) As IntPtr 
        
Dim nLen As Integer = Len(inStrText) 
        
'分配内存,以免内存区域给其他进程改写。 
        
Dim ptr As IntPtr = Marshal.AllocHGlobal(nLen + 1) 
        
Dim mstr As Byte() = Encoding.Unicode.GetBytes(inStrText) 
        
For i = 0 To nLen - 1 
            Marshal.WriteByte(ptr, i, mstr(i * 2)) 
        
Next 
        Marshal.WriteByte(ptr, nLen, 0) 
        
Return ptr 
    
End Function 

4.6、单击其他程序按钮

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click 
        
Dim hMyWindow, hMyButton As Integer 
        hMyWindow = FindWindow(
"WindowsForms10.Window.8.app3", "远程浏览") 

        hMyButton = FindWindowEx(hMyWindow, 0, 
"WindowsForms10.BUTTON.app3", "远程浏览(&B)")    '“远程浏览(&B)”按钮 
        MsgBox(hMyButton) 
        SendMessage(hMyButton, BM_CLICK, 0, 0) 
 End Sub 

转载于:https://www.cnblogs.com/lefour/p/5464111.html

vb.net遍历窗口内所有控件的句柄类名和标题(黑铁世界) vb.net资源:运用递归遍历其它程序窗口内所有控件的类名,控件的句柄,和控件的标题。所用函数有FindWindow、EnumChildWindows、GetClassName、GetWindowText、GetWindowTextLength 立即下载

相关推荐

地方工信局想通过技术转移联合体推动产业升级,推荐哪种合作模式?.docx

科易网(厦门科易网科技有限公司)创立于2007年,是技术转移与科技创新数智化服务平台,拥有国家科技成果转化服务示范基地、国家技术转移示范机构等资质。平台以“AI+科技成果转化”为核心,整合成果、专利、专家、政策等多维数据,构建知识图谱与科创智能体,面向企业、政府、高校院所提供成果转化、技术需求对接、产业服务等数智化解决方案。截至目前,已服务全国企业超43万家,推动落地项目11800余项,总金额逾80亿元

[VB.NET]关于强制控制函数退出的方法

关于强制控制函数退出的方法函数A正在运行中,我想单击按钮A后使函数A强制结束运行,请问我该怎么做,对按钮A单击的响应事件函数该怎么写?__________________________________________________________________________函数A正在运行中,我想单击按钮A后使函数A强制结束运行,请问我该怎么做,对按钮A单击的响应事件函数该怎么写?___

VB.NET学习网-VB.NET实例、VB.NET教程、VB.NET源码下载 1477

FPGA学习之路—应用程序—原码二位乘法器及Verilog代码分析

FPGA学习之路——原码二位乘法器及Verilog代码分析 原理 原码乘法可以分为原码一位乘和原码二位乘,两者在实现规则上大同小异。原码一位乘每次判断乘数的最低位,对被乘数和部分积进行相应操作。而原码二位乘则是对乘数的低二位进行判断,并执行相关操作。 两位乘数的取值可以有四种可能组合,每种组合对应于以下操作: 00相当于0x,部分积Dresult右移2位,不进行其他运算; 01相当于1x,部分积D...

谦豫 3725

VB.net学习笔记(二十三)再识委托

一、调用静态方法 1、声明         委托须使用前声明定义,可以带参数(一个或多个),可以有返回值。 '位于一个模块或类的声明部分 Delegate Sub OneArgSub{ByVal msg As String) '带一个参数,且无返回类型        定义了一个委托的类。后台创建了一个名为OneArgSub的新类,这个类是从System.Delegate类继承

白话魔法师 1万+

[官方培训]22-UE资产优化 Epic 肖月 笔记

Nanite+Lumen目标:面向TA,美术,不影响视觉的前提下,优化运行和编辑效率引擎:UE5.1延迟管线平台:主流PC,Windows 10 with DX12。

Tcohneyn的博客 1587

使用QGIS配准无人机航片

随着无人机在各个行业的普及,无人机航片成为很多应用系统空间数据的重要来源。无人机航片具有成像快、分辨率高、针对性强的优点,广泛用于保险定损、灾情应急监测、设施巡检、农作物面积调查等方面。 然而,由于种种原因,通过无人机拍摄的照片拼接得到的正射航片与其他地理空间数据叠加时经常出现较明显的偏差,需要进行配准以校正其空间位置,因此,本文将使用QGIS的配准工具演示无人机正射航片配准的过程。 01数据情况 本文选用的示范数据为2020年7月中左右无人机拍摄的河北省某地系列照片,经过拼接得到CG...

QGISClass的博客 5255

消除递归的方法_递归转非递归

1. 栈结构 利用栈来人工模拟系统堆栈的操作过程,其实这种方法本质上还是递归,只不过本来计算机帮你完成的事由你自己做了,所以这对算法的优化效果不明显。 2. 递推 如果递归函数是尾递归(在函数末尾递归调用本函数的方式,且递归调用语句只有一个),就可以很容易的将递归消除,用推导出来的数学公式代替。 其效率与循环的代码执行效率基本上是相当的。其优化主要是对栈内空间的优化,这个优化是O(n)到O(1)的;至于时间的优化,其实是由于对空间的优化导致内存分配的工作减少所产生的,并不会带来质的飞跃。下面是尾递归的形式:

weixin_44415250的博客 4719

动力锂电池-二阶RC模型等效电路-RLS参数辨识-Simulink

1.锂电池二阶RC等效电路模型

QQ1978009424的博客 1万+

VB.NET绘图9----获取图片的某点的颜色

'======================================================== '函数名称:OpenXFile() '函数参数: '函数功能:首先就是选择打开一个图片,显示在PictureBox控件上 '======================================================= Pr...

weixin_43075782的博客 1872

LVGL 组件对齐方式说明

本文说明 LVGL(以 v8 为例)中常用的 lv_align_t对齐选项的含义与用法,对应界面设计工具里下拉列表中的以及等命名。

摸鱼专家 140

嵌入式系统开发笔记112:通过有人云测试MQTT

项目中使用到“有人”公司的WH-LTE-7S0模块,本文讲解通过有人云进行MQTT测试的方法。

snmplink的博客 1010

用C#实现递归调用方法

首先,我们要知道什么是递归函数(方法) 那什么是递归函数?函数和方法没有本质区别,但函数仅在类的内部使用。以前C#中只有方法,从.NET3.5开始才有了匿名函数。所以,我们最好叫递归方法,而非递归函数,本文中将统一称之为递归。 那么递归方法或者递归是任何一个方法既可以调用其他方法也可以调用自己,而当这个方法调用自己时,我们就叫它递归函数或递归方法。 然后,我们要知道递归函数/方法有什么特点: 通常递归有两个特点: 1.递归方法一直会调用自己直到某些条件被满足(在方法中如果没有满足就会一...

weixin_57726539的博客 1770

Python 爬虫实战:攻克小红书种草笔记,抓取美妆好物推荐数据

通过本次 Python 爬虫实战,我们成功地从小红书爬取了美妆种草笔记的数据,并进行了存储、处理、分析和可视化展示。在这个过程中,我们不仅掌握了爬虫技术的基本应用,还学会了如何对动态加载的数据进行处理和分析。然而,本次爬虫任务也存在一些局限性,例如仅爬取了部分笔记的数据,且未对笔记中的图片和视频内容进行分析。在未来的工作中,我们可以进一步优化爬虫程序,爬取更多笔记的数据,并深入分析笔记中的多媒体内容、用户行为模式等,为美妆品牌和消费者提供更有价值的数据支持。

u014481728的博客 3288

VB.Net内存管理与内存释放的方法

<br />引言<br />托管代码的内存管理是自动的,.NET可以保证我们的托管程序在结束时全部释放,这为我们编程人员省去了不少麻烦,我们可以连想都不想怎么去管理内存,反正.NET自己会保证一切。好吧,有道理,有一定的道理。问题是,当我们用到非托管资源时.NET就不能自动管理了。这是因为非托管代码不受CLR(Common Language Runtime)控制,超出CLR的管理范围。那么如何处理这些非托管资源呢,. NET又是如何管理并释放托管资源的呢?<br />--------------------

2179

YOLOv8源码解析与复现:ShuffleAttention:高效的混合注意力机制 实现通道和空间混合注意力

随着深度学习在计算机视觉领域的飞速发展,卷积神经网络(CNNs)已经成为图像分类、目标检测、语义分割等任务的核心。为了进一步提升模型的性能,研究者们引入了“注意力机制”,旨在让网络能够动态地关注输入数据中最具信息量的部分。经典的注意力模块,如SE-Net(Squeeze-and-Excitation Networks)和CBAM(Convolutional Block Attention Module),通过通道注意力或结合通道与空间注意力,显著增强了模型的特征表达能力。

FJN110的博客 560

深度学习工具包 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&#39;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(&#39;DeepLearnToolbox&#39;));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(&#39;state&#39;,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&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,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 = &#39;sigm&#39;;%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, &#39;Too big error&#39;);```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(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;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)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;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, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% 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&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 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, &#39;Too big error&#39;);```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(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % 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, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);%% 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(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

C#面试题(.net开发人员必备)

1. .NET和C#有什么区别 答:.NET一般指 .NET FrameWork框架,它是一种平台,一种技术。 C#是一种编程语言,可以基于.NET平台的应用。 2.一列数的规则如下: 1、1、2、3、5、8、13、21、34…… 求第30位数是多少,用递归算法实现。 答:public class MainClass { ...

琦琦的博客 7万+

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

VB和VB.NET中获得其他窗体控件句柄

http://fengzhixue168.blog.163.com/blog/static/95761592009648525675/   一、必不可少的API函数               1.FindWindow                此函数用于寻找其他程序的句柄。这里用来寻找音量控制系统的窗口句柄。               2.FindWindowEx        

李木的专栏 7654

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

VB.NET调用Windows API函数(整理中)

1、发送Windows消息: Private Declare Auto Function SendMessage Lib "user32" Alias "SendMessageW" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Integer

4962

VB.net 进程通信中FindWindow、FindWindowEX、SendMessage函数的理解

目录 一、代码背景 二、主要工具 三、函数解析 1、FindWindow: 2、 FindWindowEx: 3、SendMessage: 四、具体代码示例: 1、第一部分功能: A、接收端: B、发送端 C、运行测试 2.第二部分功能: A、接收端 B、发送端 C、运行测试 一、代码背景 针对复杂的多进程软件的编写,各进程间的通信能够保证任务的并行处理,而非多线程的伪并行。针对VB.net进程通信,本文所采用的是调用USER32内的Windows API函数。 二、..

qq835128030的专栏 4020

VB.NET 通过窗口句柄,获取webbrowser控件HTML内容

VB.NET通过窗口句柄,获取webbrowser控件HTML内容 通过Sendmessage获取IE浏览器内容 webbrowser控件内容获取 Class Win32API     _     Public Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) A

Rock的专栏 8109

找到webbrowser中的控件句柄发送消息-转

Win32ApiWrapper类:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Runtime.InteropServices;namespace projectfortab4{ public class Win32ApiWrapper {...

weixin_30587025的博客 163

VB.NET获取窗体按键并绑定到Button事件

今天有朋友问到如何把按键响应到按钮事件,做成类似遥控器的形式。简单的写了个小程序,顺便分享出来: 首先新建个窗体应用程序,在界面添加如下四个按钮: 我们利用重写Form中的ProcessCmdKey事件来获取按键值,从而绑定到按钮事件: Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData A...

羽木落凡的博客 1580

vb.net获取html,VB.NET 通过窗口句柄,获取webbrowser控件HTML内容

VB.NET通过窗口句柄,获取webbrowser控件HTML内容通过Sendmessage获取IE浏览器内容 webbrowser控件内容获取Class Win32API _Public Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtrEnd Functi...

weixin_32412839的博客 659

用vb.net怎么样能得到一个应用程序窗口的句柄,并将窗口最大化

<br />用API+Process: <br />Declare   Function   ShowWindow   Lib   "user32 "   Alias   "ShowWindow "   (ByVal   hwnd   As   Integer,   ByVal   nCmdShow   As   Integer)   As   Integer <br /><br />运行时用Process.getProcessById或Process.GetProcessByName来取得一个进程,用Pr

5424

VB.NET操作其它软件界面

通过控件ID去操作文本框和按钮

Pwwwqq的博客 688
上一篇: 窗体的keypreview属性的作用是什么?(设置快捷键和钩子)
下一篇: jpa,querydsl
weixin_30627381
博客等级 码龄11年 96粉丝 0原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值