找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 70058|回复: 15

[其他] 批处理调用dll函数的工具_call.exe(2009-06-01)

[复制链接]
发表于 2009-4-28 15:12:20 | 显示全部楼层 |阅读模式
http://www.dostips.com/forum/viewtopic.php?t=504

Hi all,

I have created handy and portable command line utility that is
able to call dllexported functions:
http://www.2shared.com/file/5485995/4b969d2c/_call.html


弹出一个包含 yes 和 no 按钮的窗口
  1. @echo off
  2. _call user32.dll MessageBoxA -d 0 -s "Yes or No?" -s "Question" -d 36
  3. rem 36 = MB_ICONQUESTION+MB_YESNO

  4. if %errorlevel% == 6 (goto :yes) else (goto :no)

  5. :yes
  6. echo Yes!
  7. pause
  8. exit
  9. :no
  10. echo No!
  11. pause
  12. exit
复制代码
计算两个时间的差值
  1. @echo off
  2. _call kernel32.dll GetTickCount
  3. set /a start=%errorlevel%
  4. set /p name=请输入你的名字:
  5. _call kernel32.dll GetTickCount
  6. set /a end=%errorlevel%
  7. set /a diff=%end%-%start%
  8. echo 你好 %name%,你花了 %diff% 秒钟来输入你的名字。
  9. pause
  10. exit
复制代码
更换桌面壁纸
  1. @echo off
  2. set /p img=请输入需要设置为壁纸的bmp格式图片路径:
  3. _call user32.dll SystemParametersInfoA -d 20 -d 0 -s "%img%" -d 3
  4. pause
  5. exit
复制代码
获取字符串长度
  1. @echo off
  2. set /p str=Type something :
  3. _call msvcrt.dll strlen -s "%str%"
  4. echo String length: %errorlevel% chars
  5. pause
  6. exit
复制代码
===============================以下为原作者2009-04-30更新===============================

Hello again, I'm back with a new release!

New features and fixes:
- It has now support for string pointers (dll out, in/out)
- Support for hex decimals
- Return value can be used as handle to anyting!
-> Three new definition selectors: -s' (str in/out), -s# (str in) and -x (hex decimal)
- Better help screen

Still missing:
- Support for structures (e.g. COORD {X,Y})
- Decimal pointers (app may crash if you try)


可执行文件、实例、更新日志下载

原作者提供的下载地址:http://drop.io/cmd_call
本地下载:http://bcn.bathome.net/s/tool/index.html?key=_call

评分

参与人数 1PB +10 收起 理由
pusofalse + 10 感谢分享

查看全部评分

发表于 2009-4-28 17:18:20 | 显示全部楼层
看了下貌似只有-d 和-s两种参数类型,涉及到指针的API可能就不能调用了吧~

弹出光驱:
  1. _call ntmsapi.dll EjectDiskFromSADriveA -s "" -s "" -s "\\.\CdRom0" -d "" -s "" -s "" -d 4
复制代码

[ 本帖最后由 pusofalse 于 2009-4-28 17:28 编辑 ]
 楼主| 发表于 2009-4-28 19:15:08 | 显示全部楼层

回复 2楼 的帖子

你可以到dostips论坛问问原作者,或者我帮你问也行。
^_^
发表于 2009-4-28 22:32:55 | 显示全部楼层
我顶 学习了 ,谢谢楼主
 楼主| 发表于 2009-4-29 00:35:01 | 显示全部楼层
Our users have posted a total of 1131 articles
We have 395 registered users
The newest registered user is pusofalse


看到你注册了,你自己问吧,呵呵。
发表于 2009-4-30 11:15:58 | 显示全部楼层
請問,rundll32與這個相比,有什麽不同呢?
发表于 2009-5-16 14:54:20 | 显示全部楼层
calldll.zip - 2.40 KB - compiled 2006-03-08 - Calls a function in a dll file. The function must use the stdcall calling convention and accept only one single parameter, a pointer to a character string as or a NULL pointer. If you e.g. want to connect to a network printer from a batch file you can write: "calldll winspool.drv AddPrinterConnectionA \\server\printerq". The ZIP file also contains calldllw.exe which is exactly the same except that it passes a unicode string instead of ansi. That version can only be used in Windows NT/2000/XP/2003.
发表于 2009-5-30 20:08:29 | 显示全部楼层
额。。好像不支持or运算...好想让CMD的黑色透明。。可惜..
 楼主| 发表于 2009-5-30 20:32:04 | 显示全部楼层

回复 8楼 的帖子

7楼那个试了没?
发表于 2009-5-31 10:19:26 | 显示全部楼层
7楼的不懂...下了,好像只支持String?
能不能高诉下用法。
发表于 2009-6-1 20:10:00 | 显示全部楼层
好像又更新了。
额、、帮俺问下。。怎么使cmd的背景透明。。俺英语不大好。

VB中使窗体透明的代码:
VB 窗口透明调节2007-01-07 04:56添加Slider控键.用于调节透明度

Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
  
   
   
Public Const GWL_EXSTYLE = (-20)
Public Const WS_EX_LAYERED = &H80000
Public Const LWA_ALPHA = &H2

Public Function TranslucentForm(frm As Form, TranslucenceLevel As Byte) As Boolean
SetWindowLong frm.hwnd, GWL_EXSTYLE, WS_EX_LAYERED
SetLayeredWindowAttributes frm.hwnd, 0, TranslucenceLevel, LWA_ALPHA
TranslucentForm = Err.LastDllError = 0
End Function


TranslucentForm 窗口名(me), 透明度大小(0-255)
TranslucentForm Me, Slider1.Value(例子)


改为批处理之后。。。

  1. @echo off&&setlocal EnableDelayedExpansion
  2. set GWL_EXSTYLE=-20
  3. set /a WS_EX_LAYERED =80000
  4. set /a LWA_ALPHA=2
  5. set /a LWA_COLORKEY=1
  6. ext\func.dll user32.dll GetForegroundWindow
  7. ::返回当前窗口句柄
  8. set "hnd=%errorlevel%"
  9. ext\func.dll user32.dll SetWindowLongA -d %hnd% -d %GWL_EXSTYLE% -x %WS_EX_LAYERED%
  10. echo %errorlevel%
  11. pause>nul
复制代码
返回句柄很正常。。可是下面就遇到了问题。。
发表于 2012-1-21 01:09:11 | 显示全部楼层
回复 11# czl1378


    CMD 背景透明似乎不可能的~
发表于 2013-3-2 12:22:01 | 显示全部楼层
带指针的不行吗?
发表于 2018-1-25 13:12:51 | 显示全部楼层
很强,作者原链接失效了 好像也不更新了。
发表于 2018-1-26 14:51:35 | 显示全部楼层
厉害!!!!!!!!!!!!!!!!!!!!!!!!!!!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-17 02:25 , Processed in 0.012701 second(s), 9 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表