vb.net开机自启动 vbs开机自启

vb.net实现开机自启

程序源代码如下:

创新互联公司长期为成百上千家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为细河企业提供专业的网站设计、网站建设,细河网站改版等技术服务。拥有10余年丰富建站经验和众多成功案例,为您定制开发。

main()

{

int i,j,k;

printf("\n");

for(i=1;i5;i++)/*以下为三重循环*/

 for(j=1;j5;j++) 

for (k=1;k5;k++)

 {

if (i!=ki!=jj!=k)  /*确保i、j、k三位互不相同*/

printf("%d,%d,%d\n",i,j,k);

  }

}

main()

{

long int i;

int bonus1,bonus2,bonus4,bonus6,bonus10,bonus;

scanf("%ld",i);

bonus1=100000*0.1;bonus2=bonus1+100000*0.75;

bonus4=bonus2+200000*0.5;

bonus6=bonus4+200000*0.3;

bonus10=bonus6+400000*0.15;

 if(i=100000)

bonus=i*0.1;

 else if(i=200000)

 bonus=bonus1+(i-100000)*0.075;

else if(i=400000)

bonus=bonus2+(i-200000)*0.05;

 else if(i=600000)

 bonus=bonus4+(i-400000)*0.03;

else if(i=1000000)

bonus=bonus6+(i-600000)*0.015;

 else

bonus=bonus10+(i-1000000)*0.01;

printf("bonus=%d",bonus);

}

VB中怎么让自己写的程序在开机时自动启动?

给你提供我用到的代码:\x0d\x0a'初始化全局变量\x0d\x0aOption Explicit\x0d\x0aPublic pathini As String\x0d\x0aPublic mark As Integer '控制是否自启动的标志变量(1自启动,0不自启动)\x0d\x0a'添加删除自启动项目的API函数声明\x0d\x0aPublic Const HKEY_CLASSES_ROOT = H80000000\x0d\x0aPublic Const HKEY_CURRENT_USER = H80000001\x0d\x0aPublic Const HKEY_LOCAL_MACHINE = H80000002\x0d\x0aPublic Const HKEY_USERS = H80000003\x0d\x0aPublic Const HKEY_PERFORMANCE_DATA = H80000004\x0d\x0aPublic Const HKEY_CURRENT_CONFIG = H80000005\x0d\x0aPublic Const HKEY_DYN_DATA = H80000006\x0d\x0aPublic Const REG_NONE = 0\x0d\x0aPublic Const REG_SZ = 1\x0d\x0aPublic Const REG_EXPAND_SZ = 2\x0d\x0aPublic Const REG_BINARY = 3\x0d\x0aPublic Const REG_DWORD = 4\x0d\x0aPublic Const REG_DWORD_BIG_ENDIAN = 5\x0d\x0aPublic Const REG_MULTI_SZ = 7\x0d\x0aDeclare Function RegOpenKey Lib 'advapi32.dll' Alias 'RegOpenKeyA' (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long\x0d\x0aDeclare Function RegCreateKey Lib 'advapi32.dll' Alias 'RegCreateKeyA' (ByVal hKey As Long,ByVal lpSubKey As String, phkResult As Long) As Long\x0d\x0aDeclare Function RegCloseKey Lib 'advapi32.dll' (ByVal hKey As Long) As Long\x0d\x0aDeclare Function RegSetValue Lib 'advapi32.dll' Alias 'RegSetValueA' (ByVal hKey As Long, ByVal lpSubKey As String, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long\x0d\x0aDeclare Function RegSetValueEx Lib 'advapi32.dll' Alias 'RegSetValueExA' (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long\x0d\x0aDeclare Function RegDeleteValue Lib 'advapi32.dll' Alias 'RegDeleteValueA' (ByVal hKey As Long, ByVal lpValueName As String) As Long\x0d\x0a'在注册表中添加删除自启动项目的模块\x0d\x0aSub Main()\x0d\x0a' 定义hKey 为句柄变量、SubKey为注册表RUN项目变量、Exe为程序名变量\x0d\x0aDim hKey As Long, SubKey As String, Exe As String\x0d\x0a'将程序设定成随 Windows 启动而启动\x0d\x0a'取程序所在路径,判断是否为根目录并分别加上程序全名并赋值给变量Exe\x0d\x0aIf Right(App.Path, 1) = '\' Then\x0d\x0aExe = App.Path App.EXEName '.exe' ' 根目录情况\x0d\x0aElse: Exe = App.Path '\' App.EXEName '.exe' ' 非根目录情况\x0d\x0aEnd If\x0d\x0aSubKey = 'Software\Microsoft\Windows\CurrentVersion\Run' ' 设置项目\x0d\x0aRegCreateKey HKEY_LOCAL_MACHINE, SubKey, hKey ' 取得句柄\x0d\x0aRegSetValueEx hKey, '时间助手', 0, REG_SZ, ByVal Exe, LenB(StrConv(Exe, vbFromUnicode)) 1 ' 写入键值\x0d\x0aRegCloseKey hKey ' 关闭句柄\x0d\x0aEnd Sub\x0d\x0a自己看吧,很简单的,修改一下就可以用了.

怎样实现vb.net的开机自动运行

将你自己的程序添加到注册表的开机启动项中 具体路径如图所示

VB中如何让程序开机启动?

启动程序如下所示。

1:一种就是在安装软体时往注册表里添加,一种简单粗暴写个快捷方式丢到启动目录里,可以在安装软体时写个脚本bat解决。

2:以在注册表里添加启动项,前提是有足够的权限,也可以创建一个快捷方式放在startup目录中,也也可以把程序注册成windows 服务, 运行方式为auto。

3:vb中写一个代码让电脑一开机程序就运行Private Sub Form_Load() Set w = CreateObject("wscript.shell")w.regwrite"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\" App.EXEName, App.Path "\" App.EXEName ".exe"End Sub。

vb.net 开机自动启动 不需要登录桌面

vb.net是一个编程软件,启动后不需要登陆,而是让你选择是新建还是打开,新建的是winfowm、webform还是其它类型的源代码,所以你说的登录一次桌面看不太懂什么意思。


网站名称:vb.net开机自启动 vbs开机自启
网站路径:http://scyanting.com/article/hjjphg.html