十万站长的理想国度,来寻找站长自己的梦想岛吧!

好站长论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
贴内随机文字广告征订中(500租金/月)E6600双核机器+2G内存+500G硬盘+10M独享带宽=399元/月1600M空间+100MMYSQL数据库+100M企业邮局=106元赶紧甩掉常去迪吧的女友
诚信合租网-服务器合租先锋梦想天堂招友情链接久久商务淘宝店打折没商量合租站长评合租
非法信息站长自查系统心里健康积分换空间久久商务联手拍拍网打折销售
楼主: 97cjp9wy

[推荐][分享]VB窗体技术资料集锦[请求加精]

[复制链接]
发表于 2008-8-13 13:49:34 | 显示全部楼层
打印机技巧
  L# ^1 {: v# q& }& Z
1 u4 ?9 \8 G0 C; q
: p/ h, W& N, }; s用 API 打开打印对话框
: P5 K: }+ ?! m% U) \使用通用对话框控件当然可以打开打印对话框, 不过要浪费更多的资源和增加了一个 OCX 部件。 而用 API 会高效。4 y7 i" K: K$ W1 }" o
声明:; t5 P* c6 Y  z1 i
Declare Function PRINTDLG Lib "comdlg32.dll" Alias _: X. m: T* p. l( A/ ^
"PrintDlgA" (pPrintdlg As PRINTDLG) As Long) c& @+ A4 S# \( Q3 t8 s
Type PRINTDLG# E) j) n- C( @$ X, o
lStructSize As Long
* z* O; m# [; e6 b6 r$ @) B* ehwndOwner As Long, a$ p5 F. z' \- x) x9 a+ L) |( Z. ~
hDevMode As Long' D7 ?- R7 V$ x" k$ G
hDevNames As Long. r+ o$ W2 N9 r7 e* W' T% a
hdc As Long4 V+ j1 g/ G8 l  G! |2 U1 p
flags As Long
' x$ }" y$ B( a8 ^nFromPage As Integer
' K5 b$ j  v. q# S' RnToPage As Integer8 @2 C+ Q  }. @% J. Z+ m* V
nMinPage As Integer
8 J9 M+ l/ T* Q- |8 inMaxPage As Integer
  i. ?: s. w4 \1 D( w! D0 H6 wnCopies As Integer8 G9 p/ l$ _6 ~- V  {# G
hInstance As Long, {' K7 M7 l  N  d, Z$ f
lCustData As Long6 M* R8 Y, ^9 `2 x
lpfnPrintHook As Long8 I8 T! n8 \; M* ~; E$ P5 k
lpfnSetupHook As Long; R+ z' R- X# o" `6 G' {1 d( |
lpPrintTemplateName As String; N# X$ R$ g4 @* \2 O3 R
lpSetupTemplateName As String
4 s2 t9 S; v, g* i) EhPrintTemplate As Long
5 S' q7 M5 i# X6 k4 ehSetupTemplate As Long
% N# X( e+ N3 b4 mEnd Type7 J6 S; S2 |/ S
使用:. F9 _/ _+ t8 a, m
Private Sub Command1_Click()
% S2 e; i, U$ x! P1 ]: C  Z" RDim p As PRINTDLG
; c7 Q1 ^/ U: [' P3 r  xp.lStructSize = Len(p)  F- _  e% W/ a% D
p.hwndOwner = Me.hWnd
: z5 e0 h8 `, H% O! S5 |1 Pp.nFromPage = 19 G9 O- Y$ a% y- `- V
p.nToPage = 1
/ U$ |9 a1 C" Yp.nMinPage = 1
. o& o5 @) u$ J% S7 Op.nMaxPage = 16 E4 u, j6 ?' R$ H# r* f. ^, r
p.nCopies = 1- e! X4 @& C3 I9 g' @4 d
x = PRINTDLG(p)& B; I  c9 g  |
Printer.Print Text1.Text
  M; ~9 v2 N, z2 k( }3 p3 lEnd Sub$ y, M4 C2 d  s- J
在打印字符串时自动换行
4 }; d0 Z1 Y' A& J感谢 shijia 的代码测试。" z; l3 j0 }# \8 @1 P$ ^
其中 len1 为打印的宽度, Str 为打印的文本。1 {, m9 L# j' U+ @" [
Do While Len(Str) > 0
/ u4 W. k0 x9 }& }7 p, ^0 J  Sstr1 = Str
9 x( U* X: J( X7 S# d& jDo While len1 > 0 And Printer.TextWidth(str1) > len1! s& Q/ @- M( j) x3 Y: }5 O% D
str1 = Left(str1, Len(str1) - 1)
4 a8 O& V, y! Q$ c7 ZLoop/ o0 s  m: h& C1 S) ~, l
Printer.Print str1 '打印
; d/ \% R( }3 q& e: v& v: pIf Len(str1) = 0 Then Exit Do '不匹配
6 F' ~8 m+ ]  s( j: R, V; nStr = Mid(Str, Len(Str1)+1) '截断!: _: ?+ N4 E0 H6 w) J4 S1 `+ p6 h
Loop
" \. r& r* b) V6 Y5 M7 \3 X0 t9 U4 A让打印机只打印一行3 |9 K) e, ?" f2 ?
在 Win95 下,只有在使用 EndDoc 或 NewPage 时,打印机才开始打印,而且每次都要换页。使用以下的方法,可以只打印一行,并且可以把打印机的控制字符也直接发到打印机。( l* K: a( K+ d; w
注意:如果打印机无汉字库,不能输出中文。
; h6 y1 j2 g3 \; fOpen "PRN" For Output As #1. m) w% p' M6 m* [0 m& }8 Y* ]& S
Print #1, "一行"2 T+ l) `0 k( |, v3 E9 @( s

* z& }2 L2 J  w
4 {' \; E+ z- B6 ?+ K
5 Y0 o+ k# s8 Q3 t“绿色IT 从我做起”圈子有奖活动话须通俗方传远,语必关风始动人... " h" w1 W! W6 S/ X; P) t
发表于 2008-8-13 13:49:38 | 显示全部楼层
得知目前Mouse所指的Menu Item是哪一个4 }, H' V4 p! T* w" k* b  O

. ]7 ^! s) f$ ]0 j7 x0 Y2 q( L$ g请先查阅有BitMap的Menu取得Menu的相关知识,再查" W" S0 m0 z1 G" i
如何拦截ComboBox MouseMove的SubClass之技巧' o9 J! K6 E) w) m
一些商业软件中,当滑鼠指向某个Menu Item时,在表单的底部STATUSBAR中会显示有该Item
9 z3 E  G/ G/ p' {; F功能的简要说明。而VB5中有关Menu的捕捉事件只有一个 CLICK,那该如何做呢。其实当
: H- c% ^+ f# S" j: z9 Y2 c% X选择了Menu後,Mouse在Menu SubMenu MenuItem上移来移去时,会产生WM_MENUSELECT的
" q$ D; i' Z2 I& JMessage给Menu所在的表单,而其wParam的Low Word有两个意义,如果Mouse指到的Item$ T/ R8 e- s3 g/ E& t8 o: A! [
之下还有子Menu,该LowWord of wParam指的是该Item是第几个SubMenu,而lParam便是
4 b2 T" l$ {2 V! {8 [Menu的Handle;相反的,如果Mouse所指的Item底下没有PopupMenu了,那 LowWord of
5 Y3 v+ u: H0 e$ t0 w1 C# h+ N$ TwParam指的是MenuID,而lParam是hSubMenu。
' V; w. F) u) _2 |' I& d1 u% B1 k/ G9 P$ z" \

$ P0 s: \  t5 z6 t6 q8 x7 c档案 编辑 选项 --> hMenu (功能表, Menu)4 h0 |, D: a9 K- v
+-------+) p0 G& j1 R3 g1 h- K
|复制 |---------> hSubMenu (子功能表, SubMenu)
% v3 k8 v9 b: e|贴上 |
6 H; [1 E# H3 N. R|减下 -------------> MenuID (功能表项目,MenuItem)3 r$ q0 T8 c1 G
| |
; F4 V, O7 C: L' [+-------+, X6 B& X/ N5 B6 r4 K) g
% V" O/ i# s: o5 ?+ }! |
所以了,这就得使用SubClass的技巧,取得WM_MENUSELECT的Message,进而得知到底是
4 Q; C/ {' M- \! _选到了哪一个MenuItem。当然了,我们可以使用GetMenu GetSubMenu GetMenuItemID3 }* _; S1 g8 X% ^) Q+ T
等API来得知功能表上每一个项目的hMenu hSubMenu MenuID,如此一来,和WM_MENUSELECT
7 `+ f" p( }' o讯息所取得的lParam wParam做做比较,就可得知到底选上了哪一个,而本例则是使用# S& r4 ?- w1 B3 O  ^7 r7 c
GetMenuString取得MenuItem的title,如果您的MenuItems没有相同的title,也不失一5 ?0 C- U& B* X+ N
得知方式。1 \2 o% Q/ n/ ^
% {) j; t& ?' a% J+ |0 @/ q! G2 Q  o! w
'以下在form,请自行加Menu於Form上8 v" s2 X- e( \$ k" M/ }9 x$ L
Private Sub Form_Load()7 p" O5 X$ e& X' p) F/ Y
Dim ret As Long
$ L% y% S$ x) A$ x  ihMenu = GetMenu(Me.hwnd)4 j' W) U  D4 _4 D, q6 s2 D

% q3 h# d. k( l7 ^'记录原本的Window Procedure的位址8 B* E0 y/ l2 B. A5 [1 o/ s/ K
preWinProc = GetWindowLong(Me.hwnd, GWL_WNDPROC), z/ F: Z  g, [
'设定Combo1的window Procedure到wndproc2 g) d: G" I4 m4 E; p
ret = SetWindowLong(Me.hwnd, GWL_WNDPROC, AddressOf wndproc)
/ ~/ }3 C# u8 K- c7 U4 u  q2 HEnd Sub# f7 j5 P) M5 i: l
, f- x  e, S* L4 ~1 m
Private Sub Form_Unload(Cancel As Integer)
& n0 c& K, i; S6 ]' p% iDim ret As Long
0 F, G- O5 @1 `'取消Message的截取,而使之又只送往原来的Window Procedure( w# z) y0 N+ ^. o$ K, l
ret = SetWindowLong(Me.hwnd, GWL_WNDPROC, preWinProc)
3 P: {/ |& t7 E3 y4 GEnd Sub# p! b! w. d7 X9 I, g' e

2 p, z$ S+ q5 F/ R0 @+ s7 |0 m& ~( m( C) Z% A; \: t
'以下在.Bas& F6 o3 R( }6 F4 e, |- U& t/ c3 S
'以下程式在module1.bas
+ t1 [# q1 ~  s+ bDeclare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
8 Y% m$ E8 Q! }9 i8 K(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
9 z) w0 G/ r& C4 x/ p+ ]' ^Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _9 U  k* G% _, e5 y( z
(ByVal hwnd As Long, ByVal nIndex As Long) As Long% R2 N3 g) P, n+ y0 K
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" _- I( I2 }5 c! K2 r
(ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, _4 T8 `9 i. g' [9 O
ByVal wParam As Long, ByVal lParam As Long) As Long2 T$ N+ a5 @7 n' u0 o
Declare Function GetMenuString Lib "user32" Alias "GetMenuStringA" (ByVal hMenu As Long, ByVal wIDItem As Long, ByVal lpString As String, ByVal nMaxCount As Long, ByVal wFlag As Long) As Long
% C" c; f! k3 W; eDeclare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long
5 }4 N) g. R- KDeclare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, ByVal nPos As Long) As Long. F6 s; v" P) j9 E* ~, V

6 |" r$ e+ W  K9 `( I" r/ ~Public Const GWL_WNDPROC = (-4)
- l# m* b$ e7 F8 J7 t, \Public Const WM_MENUSELECT = &H11F* [0 n, J/ ?2 c
Public Const MF_BYCOMMAND = &H0&
& j& l* \% j4 s* |( V- D( x7 x) Q  tPublic Const MF_BYPOSITION = &H400&) |4 C+ c) H9 T: e7 [5 T! Q

. p) `( P8 u! y+ u6 O! pPublic hMenu As Long
) o6 U9 T  h3 }0 S8 f) jPublic preWinProc As Long
4 p0 p- q' t+ z' QPrivate Type tLong$ _& r6 ?. B1 I5 l: A  {
ll As Long" R+ z/ I! l- ~1 K4 ~2 S1 A
End Type
6 ]4 k9 u9 p' H' _Private Type TwoWord
8 ^2 ?6 y# j2 B3 Q3 @& QLowWord As Integer; k3 X4 W- r  q' g
HiWord As Integer
4 t/ i2 y* x* j( H0 V  \End Type
& T8 c5 R! F2 d7 r- L# Y) k) Y( ~Public Function wndproc(ByVal hwnd As Long, ByVal Msg As Long, _
: g# c, T* _$ t4 N2 T. mByVal wParam As Long, ByVal lParam As Long) As Long
5 m8 C" U6 ]% l( O# P- s. ]Dim MenuItemStr As String, SubMenuStr As String
" U' g; ~# B; M" r; ^Dim hSubmenu As Long, MenuId As Long, i As Long8 m7 S  ^: E4 e
Dim tmpl As tLong, tmpt As TwoWord( X" `7 `4 t0 @( I4 x, @
'以下程式会截取WM_MENUSELECT处理完後,再将之送往原来的Window Procedure
" i( S2 f9 }3 a: ZIf Msg = WM_MENUSELECT Then2 c( y: s4 W! S( l/ M2 c8 c
SubMenuStr = String(255, 0)
- S) W6 B$ H. qMenuItemStr = String(255, 0)
3 f* u& F3 W5 O1 f- a$ X- P
# {4 d5 p: n% |- Qtmpl.ll = wParam
$ @5 e1 d( Q6 d  VLSet tmpt = tmpl3 F; x8 `2 [9 F9 ]4 V
MenuId = tmpt.LowWord6 E2 \3 {! T8 ^- t' }+ ]
) c& ?" r# E5 q" e
hSubmenu = GetSubMenu(lParam, MenuId)
8 e& H( w5 }* ^; \8 X( U5 c# EIf hSubmenu = 0 Then '表示该item之下没有popupMenu了
5 h/ ^0 W% S7 `6 W* {; oCall GetMenuString(lParam, MenuId, MenuItemStr, 256, MF_BYCOMMAND)
/ I& ~0 I0 H" n  Y" U3 ^MenuItemStr = Left(MenuItemStr, InStr(1, MenuItemStr, Chr(0)) - 1)
+ X) c  W( D8 x# KDebug.Print "正在 MenuItem " + MenuItemStr  r( E( n1 ^1 k+ R' e
Else
- W$ |9 Q# L# M% h1 lCall GetMenuString(hMenu, hSubmenu, SubMenuStr, 256, MF_BYCOMMAND)
0 O# n* X2 J& [SubMenuStr = Left(SubMenuStr, InStr(1, SubMenuStr, Chr(0)) - 1)- {, I. k; H7 Q% E
Debug.Print "正在 PopUpMenu " + SubMenuStr) w/ J# z9 b# s  x
End If
5 B: t3 |# w6 J; FEnd If
/ M$ h, Q1 @9 z9 p( i7 z. J'将之送往原来的Window Procedure, Z) q2 {2 k1 v5 h
wndproc = CallWindowProc(preWinProc, hwnd, Msg, wParam, lParam)
# p; @2 @5 \8 u0 NEnd Function0 G7 G4 e2 o0 Q
“绿色IT 从我做起”圈子有奖活动话须通俗方传远,语必关风始动人... 6 `0 j+ L  u" G7 _/ Q: d5 m5 p1 v
发表于 2008-8-13 13:49:39 | 显示全部楼层
调整 Combo 下拉部分的宽度   8 ^$ e6 h$ l! c6 ]% e
声明:0 {9 O: T2 @- V. J# ]" s
- @2 X8 _: a9 W' X
Private Declare Function SendMessage Lib _
% h$ s2 v: H$ H& W; m/ r0 _
$ V' R- U: R. }3 g/ V! G# B6 o"USER32" Alias "SendMessageA" _3 m: m8 w+ P# E; G6 c5 z% X

: x  L* a, w+ c& C0 _; O* {9 P(ByVal hwnd As Long, ByVal Msg As Long, _
# |6 V' B8 D, O* X0 J9 R
, ]+ q$ a) c, `5 K6 I; z, V4 [ByVal wParam As Long, ByVal lParam As Long) As Long, V  {" w1 a& {( k+ K; O$ F
7 E1 R: I, C  o; T
Private Const CB_GETDROPPEDWIDTH = &H15F0 r( |/ P' @4 `" V& o

& x/ E& t/ {2 H# Y. q+ ]4 \5 yPrivate Const CB_SETDROPPEDWIDTH = &H1601 `$ |6 U; i9 d+ R

2 t3 F) S# e; a5 F0 D  k% \+ k+ {Private Const CB_ERR = -1
  ?8 N% o# @/ b6 W/ y1 h5 S; l8 H6 M' N% L, U, S6 y/ ]- @
    函数:
, `4 L- u1 I+ J. I
1 |; T- G7 T( X% r  w' 取得 Combo 下拉的宽度% t! ~2 x- }0 h8 H
) y; d# W. k2 M5 n& K4 z4 D- O( n
' 可以利用该函数比例放大或缩小宽度
6 N1 {: G, Y) w( A% L- j7 ?' a
$ ~9 i# M" E. S' n7 e" w: r! N  dPublic Function GetDropdownWidth(cboHwnd As Long) As Long
8 C  s& M; b6 }1 ]
% W. _) e3 L. ^Dim lRetVal As Long) n/ B0 r& I9 P, Y/ Q2 I) P

5 O, B6 v" M  l: B0 C2 k; wlRetVal = SendMessage(cboHwnd, CB_GETDROPPEDWIDTH, 0, 0)( X3 ~, x* i( X( J2 L6 L
* Y. }: l9 `' ^  n+ ~" f& `. i
If lRetVal <> CB_ERR Then
) S2 T8 G, r: W) D$ i0 V% F# w: T
GetDropdownWidth = lRetVal
* b% q1 y$ u( q/ C6 \4 S$ r6 a, M+ G7 m' j8 T1 s- V
'单位为 pixels5 h' q5 S$ }+ ]: b. L1 ^0 {
) i, G8 W, L1 h
Else
& V. j+ e& K! o) H+ H( U1 w' s* }' |# {  U, O5 g8 S8 M2 |, R1 O! A
GetDropdownWidth = 0
' F  l. Y  B5 j
8 M1 l- V" f# l# d  ^2 X! kEnd If1 [" V7 v% J, `. ]$ d

1 L3 {! q4 Q1 q9 C7 [3 X- HEnd Function" M$ a3 G- U0 f- ?9 `

- c  d: L1 B5 @5 l4 ]% r9 u'设置 Combo 下拉的宽度* n2 {* S# [; d/ n
) D  P* o" H8 U! K
'单位为 pixels
8 s1 _7 Y0 Y: E- m; }0 S( i0 y# f+ v/ n
Public Function SetDropdownWidth(cboHwnd As _
. I& M: `; u6 B# c( @
6 E; K7 u1 Q& }$ Z; K3 f( WLong, NewWidthPixel As Long) As Boolean
$ r9 h, {: J, \' ^+ ^% Q
/ \9 X/ I/ F4 G# v6 R. }Dim lRetVal As Long
# x- j' Z$ W3 g+ K! b  @
  ?# ?0 \) ]  b1 j7 f" Q8 ?9 LlRetVal = SendMessage(cboHwnd, _+ u" _+ |, y0 X. f! j" Y4 g

9 c# D) D0 Y, d4 ^( ]CB_SETDROPPEDWIDTH, NewWidthPixel, 0). O) H. T  o" U+ J, v9 W+ ]
& C$ c: f5 V# h6 J; E# E
If lRetVal <> CB_ERR Then
: H: A) y* r% ~5 C1 ^
$ }4 @  @  y. B& K8 `/ nSetDropdownWidth = True
8 d& ^0 l7 _- z" s; I! r
+ v0 r5 l( f2 i  c  |Else
/ Y# p& o: j* H, |' C- Y9 K' L4 H6 ~% p$ U( D" I
SetDropdownWidth = False
# p: I( h6 n) Z4 I: O  q7 u4 M  c
+ p& D; n: K/ c7 B0 H2 fEnd If
* x( _# W6 H4 ]# ~* Q" t
: u9 O6 x5 Q8 t, A+ B2 ZEnd Function “绿色IT 从我做起”圈子有奖活动话须通俗方传远,语必关风始动人...
7 S# [5 s$ R9 a* C# [- _
 楼主| 发表于 2008-8-13 13:49:41 | 显示全部楼层
对文本框添加 IE5 的自动完成功能   
( D6 I% p/ F0 w
; t3 W7 x1 H0 Z7 H) K IE5 introduced the AutoComplete feature, and its available for both standard VB text boxes and combo boxes using style 0 or 1. The routine here just demonstrates the textbox, but its easily extended to include the combo by passing the handle of the edit control (not the handle to the combo box - see related topics above). When used with the combo box, the AutoComplete dropdown appears in addition to the standard drop down; its data does not replace the dropdown contents. 4 o( ^4 W4 f. O* ~* x
 Use of this API is limited to systems with IE5 or greater, so a handy routine for determining the IE version is included. And although the MSDN states that CoInitialize must be called before using this API, and CoUninitialize called when the edit control has been destroyed, VB takes care of handling this task naturally.
) |: z1 ^, m' v" U' W( i% e
% r: X9 I0 f" t& Z$ `. N8 U# D' pAdd a label (Label1), and text box (Text1) and a command button (Command1) to a form, and add the following: * w" E* }5 b' q% V$ |
----------------------------------------------------------------------------- : Z  Z2 }  t9 k9 j, I, k/ j9 M

5 [; y) R1 Y9 }+ IOption Explicit3 i( X9 i* ^) t4 |

% ]$ ]# H( h" S5 h'Flags to control the operation of SHAutoComplete.5 X2 ?% d5 T, y4 v
'The first four are used to override the Internet
% X$ P& f: ~0 f9 ], l'Explorer registry settings. The user can change
# t6 N. E  n+ l" o. r3 f'these settings manually by launching the Internet
8 c0 Y$ G4 O+ Q  H) z'Options property sheet from the Tools menu and
% o7 C7 w8 _: Q% y* v4 W'clicking the Advanced tab.The last five can be
0 q7 h% p1 L- d9 ^* b3 {1 o) I0 E'used to specify which files or URLs will be
" o$ H( p6 q! d2 z; ['available for autoappend or autosuggest operations.
7 _+ Z" U8 S& l% @) M- X+ `& t2 X, L4 Y5 u5 m
'Ignore registry default and force feature on
! d! `% Y- }3 d, CPrivate Const SHACF_AUTOSUGGEST_FORCE_ON As Long = &H10000000
( Q. F4 R& K% Z% D$ L9 Y9 T1 l) {* n' ?% B; y" W' l
'Ignore registry default and force feature off.3 d( d1 T, ?8 j9 ?; c5 d
Private Const SHACF_AUTOSUGGEST_FORCE_OFF As Long = &H20000000
; K* c6 D1 `( t) a& r2 `  }' B8 U
7 z, O: l- \% e% M'Ignore registry default and force feature on. (Also know as AutoComplete)
$ B4 ?- \+ d# L; u$ L5 R  V' `Private Const SHACF_AUTOAPPEND_FORCE_ON As Long = &H40000000$ y1 e9 m+ w" N9 x1 Z! B
# |" O7 B% s* O2 L- k1 ^
'Ignore registry default and force feature off. (Also know as AutoComplete)+ V) I9 ^! n. C8 D' ]0 v7 A
Private Const SHACF_AUTOAPPEND_FORCE_OFF As Long = &H80000000
3 j( R$ ^4 W& a$ g) h/ [
3 j# N' u4 y; O# C- V9 D- r: i& J'Currently (SHACF_FILESYSTEM | SHACF_URLALL)7 F3 B2 s  f! l; }( B
Private Const SHACF_DEFAULT As Long = &H0
$ M; n. N; S- z8 Y, _) @' \
4 [  r6 o1 I$ o  I* |6 ~1 O'Includes the File System as well as the rest9 l7 S3 q/ J8 n1 H1 [$ [! U8 u
'of the shell (Desktop\My Computer\Control Panel\)
* e, S+ s7 R4 U5 @; b% NPrivate Const SHACF_FILESYSTEM As Long = &H11 s7 E* e7 u, r! |
" M& L/ V0 _! }) R( p0 O( y6 z
'URLs in the User's History
; O% }# z5 D  [. CPrivate Const SHACF_URLHISTORY As Long = &H23 U" K& ]/ T: _* F$ L; r
( Y9 H2 ?4 A: n* l
'URLs in the User's Recently Used list$ l. Y$ U- Z8 {9 z9 k# [
Private Const SHACF_URLMRU As Long = &H4
; Y5 Q# [/ D: l% O& v( g% {* f  t: M) H  H
Private Const SHACF_URLALL As Long = (SHACF_URLHISTORY Or SHACF_URLMRU)
3 o) w* I! G. U! K& s+ S0 U: L  c% d+ z7 ?* `5 Z
'Identifies the platform for which the DLL was built.
. V% ?( L; Z! L, Z# t. u; pPrivate Const DLLVER_PLATFORM_WINDOWS As Long = &H1 'Windows 95
6 c. ?  G  j7 d) ?3 b& gPrivate Const DLLVER_PLATFORM_NT As Long = &H2    'Windows NT9 z7 Y( G( r+ ?  y9 {4 h" P$ W5 G7 p# W

$ i) _) S: r9 U$ ?4 k! M! OPrivate Type DllVersionInfo5 K* [2 C- D9 t( b# D
  cbSize As Long  P) H# p4 t5 C
  dwMajorVersion As Long
  @" v8 X5 v9 t) Q9 |+ m  dwMinorVersion As Long0 D7 V" \/ ~2 _
  dwBuildNumber As Long
# u; q( i' Q5 J" v8 m# Y" F. V. q  dwPlatformID As Long
; A; {; _" ]: a. R6 |End Type# y, g: F7 D6 e* l* n' A
) ?( e: d& G2 Z1 A; ?
Private Declare Function SHAutoComplete _
. X% C6 B3 T' U: h; Y  Lib "Shlwapi.dll" _9 E  }# S$ d  x( k. \  `
 (ByVal hwndEdit As Long, _$ D! b3 l3 R- }- K0 @& @  D
  ByVal dwFlags As Long) As Long
" \/ U, U: f8 n
  i& i0 j- n) T7 EPrivate Declare Function DllGetVersion _
  d) Q) f6 P+ W' B' v  Lib "Shlwapi.dll" _( }6 N, g: p  c5 E1 J+ l, w8 ^
 (dwVersion As DllVersionInfo) As Long4 \8 [+ E/ y" Y$ x6 r; y8 h
# b% a' x% }* X
4 T- ?+ N! `$ G  ]9 J
Private Function GetIEVersion(DVI As DllVersionInfo) As Long' d- d7 O% \9 x7 n
1 _) t3 g3 @$ P
  DVI.cbSize = Len(DVI)2 d- V0 l' ?0 V' t/ n
  Call DllGetVersion(DVI). W0 O2 V  }4 G& J# i

8 S( c% L+ c% F( B1 @3 \  GetIEVersion = DVI.dwMajorVersion2 K% t/ r" Z" Z0 N$ ^$ G
0 A% q6 r# c: N0 s
End Function
* {. j- e0 b& h9 |& P0 o0 q8 E: y2 S, V: G6 |
6 |1 d, ]1 N2 m: o
Private Function GetIEVersionString() As String
' ]7 M5 Y! r; L. N8 w! W$ I
# v4 h  I7 ?3 c  Dim DVI As DllVersionInfo4 _' B+ @" X* ^; h, M" Z
- M& S: B- F6 s- U+ {
  DVI.cbSize = Len(DVI)0 p; z$ h& D$ k  b* p/ M$ L' [
  Call DllGetVersion(DVI)
* H, B# I) v7 Q8 ~! o) N. P; d
( G- t. V$ [3 q3 F$ L$ [  GetIEVersionString = "Internet Explorer " & _
: X/ D+ \9 s# B/ C            DVI.dwMajorVersion & "." & _2 U# w$ `% [8 P! ]. r
            DVI.dwMinorVersion & "." & _+ r; d! `$ h3 h' V. |% R! A
            DVI.dwBuildNumber
) k' p# Q" d. ]' B0 |' n: s5 R3 Y4 T9 K% |) A$ O- S- ?* l. b1 [
End Function
  a: \' r) a5 ~1 _1 F3 {& C
3 z  _$ I0 |: h) A  Y- r  d' n3 l0 J: Y; w6 t4 ?
Private Sub Command1_Click()
# \" u9 C" p4 C8 L
9 F/ \, g4 Z. H6 k  Dim DVI As DllVersionInfo
. D# J6 h% ^* A  }! Z1 f
  K+ `" {8 S2 b8 y" L8 q+ K  If GetIEVersion(DVI) >= 5 Then
3 s" d' N7 a& f+ B$ m  `% f  p& `0 Y  @# @8 {: M
   'Turn on auto-complete, e8 r( b* K0 o# O# L' J
   Call SHAutoComplete(Text1.hWnd, SHACF_DEFAULT)
* S* E  x, [5 |8 ?$ A* O. y5 T
" s1 U/ q4 B) Q$ @4 ]+ D  p   'update the captions and set focus to the textbox
: g7 M9 A: ]8 h( b& M' {   Command1.Caption = "SHAutoComplete is On"
! @# G; x5 e( T% B6 h: D! \" W   Command1.Enabled = False
# a1 R1 c$ ?0 A+ u# I* g4 P, w   Text1.SetFocus
& z/ i( Q& z  w$ b% H; N( ^: H3 |, d   Text1.SelStart = Len(Text1.Text)
: ]- Z3 S# }  e4 G- h. t
  v% |! T+ ?* I% ]% w. O! C  Else2 {4 v3 z! P9 E
8 F# H1 T3 C' H' ~( M1 z
   'damn!
* `& ^* z" o; i: B% X   MsgBox "Sorry ... you need IE5 to use this demo", vbExclamation
6 S7 M$ }4 |0 h
( s- j' k1 j$ i! w  End If
4 f( F5 f5 L; T$ K% _* l
2 v' \# |* D( J1 V5 MEnd Sub0 F+ c5 ^/ Y* m' ?6 l

' L7 P* |% c. O1 G8 y3 `$ v% c* m1 _3 b3 l
Private Sub Form_Load()
0 _* `* T9 P. F( g( D6 E# g  h4 j) Q, s1 ^; N0 [% n$ m0 m
 'dim a DllVersionInfo type
4 K- N! X' _% [  Dim DVI As DllVersionInfo/ u: \6 Z9 i+ ]3 K
2 V( M' l4 z( \) Z1 i
 'display the version of Shlwapi8 G9 Y7 e* |+ ~1 z
  Label1 = "Using Shlwapi.dll for " & GetIEVersionString
8 h0 A& b; }* j4 w6 E
! y: }+ s2 v4 s 'if not 5 or greater, can't do it
+ W* \; s$ C( x+ l  Command1.Enabled = GetIEVersion(DVI) >= 5- \- `/ y! t; U4 ?/ H
  Command1.Caption = "SHAutoComplete is Off"+ U: i* e6 f4 Q8 k8 y4 ]2 Q* @

7 y6 _( g- G, x- \0 T7 ~' S; }3 p( P. d6 qEnd Sub
. i' _/ ^# O  t$ C! j
% V' h; w3 U% A8 \0 p$ X'--end block--'    i4 X% w# j( A+ b
“绿色IT 从我做起”圈子有奖活动话须通俗方传远,语必关风始动人...
  B4 Y! _7 ~. S9 r0 c- O$ r+ K& x
发表于 2011-8-9 02:48:22 | 显示全部楼层
我也想了解,谢谢发帖的人
. D" z8 e+ ^; m8 D4 v( r7 `2 v% I8 j2 V2 n) z

+ j  k+ y0 Z, B( b: |2 W5 w
6 t# \  Q0 P8 c" d+ U
' q! H% m0 J# W# B2 J. b" _' d
% `" `+ H0 F4 p' K0 }
" J* H, H3 D. S2 R& Y+ |2 _% m" q  p3 x: g+ a1 x; N

0 r# B6 B& V; ^# U9 b- ?( t5 u5 l* t7 I, ]% ^' I$ |$ E. f4 F
6 q3 g6 O5 `# v- R. c
! n) X4 R& n7 w4 r

$ z& W+ k0 @4 Z: A9 Q4 i
, c* v2 A. B1 U4 M2 ?$ P
发表于 2011-11-1 18:03:51 | 显示全部楼层
好帖还是要收藏,请继续9 L9 q% n" z6 K2 R; i

( ~8 `6 T6 d1 n
( Y  Z$ ~  P1 o* ~* E0 z. y
' _! M8 L4 g4 c  j3 K1 j0 i0 O/ X* _. A2 C+ e- H
. Q7 g. i2 J  i3 D

; b* z7 M1 \. N  Z  H; y% Q
3 y4 ^9 Q: B: a3 d
! X* w. d' X3 @4 p
6 O7 ]$ L, G3 l
. ^4 P/ T( f6 W8 c' d0 r0 }( h, ?' x
0 ^% z2 e+ G/ n  X  O5 c7 P. c* O) ]
十大防辐射孕妇装http://www.at5158.com/yunfu/113.html
发表于 2011-11-7 21:13:17 | 显示全部楼层
看看吧,大家都会支持你
& n2 z& F, O# _
7 v9 b: G# U* C& l- K
) y8 a& _! o& ^# L+ Y7 q
4 C; ~9 f& k2 J7 S2 X. F2 F- Q/ p4 m
2 C# h9 Z9 D: H/ [) i% Q# h6 m( i) c
3 o% H  O$ U" }& a+ ]. A# Z6 T  b
: W  B) I3 B+ Q3 c3 L. z
7 }7 M2 o( X$ }5 Y" p/ v. {
# p+ b, b6 `" I) C' Z+ E2 G# W
" P( P/ p8 e0 [+ P0 s

$ u% F! E! {# o
; h2 \, V3 a6 P. q# R
& p) R' Q& Z1 @, m
发表于 2011-12-8 08:41:29 | 显示全部楼层
ding呀 支持
6 J4 B, {# k+ J: R! j
# j; p* {1 O$ J' Z3 S6 ^2 V( K+ N1 B3 T$ e# y/ K5 N
( X( t' o' u+ p5 F
  W/ s% C& L. U; {9 p# Q* e5 f

  C( S. k/ {( ?5 Z- S% y
, U: F0 B9 O* Q8 l' {( w
8 O& ~2 r0 V2 T
3 y5 ?. u# O8 p3 p2 n
9 Z. J1 w2 c* P% x- n$ n3 l8 v
4 B; A. t8 x3 ~+ I- w
, I9 z# u: S( W* b
0 \. v) W$ _+ d7 b* ]! @' a# \商标注册费用
发表于 2011-12-18 08:54:35 | 显示全部楼层
能发这么好的帖子,太谢谢了
发表于 2011-12-23 00:48:38 | 显示全部楼层
希望大家踊跃发言,02健康网,我顶先; C% }! U) Y: n  j. d5 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则

阮姓人报名

小黑屋|手机版|Archiver|中国好站之家 ( 皖ICP备07008304号 )

GMT+8, 2019-11-14 12:19 , Processed in 0.696389 second(s), 16 queries .

Powered by DX! X3.4

© 2001-2088 服务器赞助商:久久商务网

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