选择显示字体大小

vb 高手搜集-常见问题总结(1)

  如何检查软盘驱动器里是否有软盘


  使用:

dim flag as boolean
flag = fun_floppydrive("a:")
if flag = false then msgbox "a:驱没有准备好,请将磁盘插入驱动器!", vbcritical

'-------------------------------
'函数:检查软驱中是否有盘的存在
'-------------------------------
private function fun_floppydrive(sdrive as string) as boolean
on error resume next
fun_floppydrive = dir(sdrive) <> ""
end function




  如何弹出和关闭光驱托盘


option explicit
private declare function mcisendstring lib "winmm.dll" alias "mcisendstringa" (byval lpstrcommand as string, byval lpstrreturnstring as string, byval ureturnlength as long, byval hwndcallback as long) as long

private sub command1_click()
mciexecute "set cdaudio door open" '弹出光驱
label2.caption = "弹 出"
end sub

private sub command2_click()
label2.caption = "关 闭"
mciexecute "set cdaudio door closed" '合上光驱
unload me
end
end sub



  如何让你的程序在任务列表隐藏


private declare function registerserviceprocess lib "kernel32" (byval processid as long, byval serviceflags as long) as long
private declare function getcurrentprocessid lib "kernel32" () as long

'请你试试 ctrl+alt+del 是不是你的程序隐藏了
private sub command1_click()
i = registerserviceprocess(getcurrentprocessid, 1)
end sub



  如何用程序控制滑鼠游标 (mouse cursor) 到指定位置

  以下这个例子,当 user 在 text1 中按下 'enter' 键后,滑鼠游标会自动移到 command2 按钮上方

  请在声明区中加入以下声明:

  16 位版本: ( sub 无传回值 )

declare sub setcursorpos lib "user" (byval x as integer, byval y as integer)



  32 位版本: ( function 有传回值,integer 改成 long )

declare function setcursorpos lib "user32" (byval x as long, byval y as long) as long



  在 form1 中加入以下程序码:

private sub text1_keypress(keyascii as integer)
if keyascii = 13 then
x&#37; = (form1.left + command2.left + command2.width / 2 + 60) / screen.twipsperpixelx
y&#37; = (form1.top + command2.top + command2.height / 2 + 360) / screen.twipsperpixely
setcursorpos x&#37;, y&#37;
end if
end sub





 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons