ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¦b¦Û©wªí³æ¤¤ ¦p¦ó ½Ð¿é±K½X®É show **** ¥N´À ¤å¦r¼Æ¦r ÁÂÁÂ!

[µo°Ý] ¦b¦Û©wªí³æ¤¤ ¦p¦ó ½Ð¿é±K½X®É show **** ¥N´À ¤å¦r¼Æ¦r ÁÂÁÂ!

¦Û©wªí³æ
strPassword = InputBox("½Ð¿é¤J±K½X¡G",  "°T®§µøµ¡")
max

¥»©«³Ì«á¥Ñ Hsieh ©ó 2011-12-3 21:57 ½s¿è

¦^´_ 1# user999


    http://blog.xuite.net/crdotlin/excel/13554651
'¤@¯ë¼Ò²Õ Module1 µ{¦¡½X
  1. Option Explicit

  2. 'API«Å§i
  3. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
  4.             (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
  5. Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
  6.             (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
  7. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
  8.             (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
  9. 'timeSetEvent¨ç¼Æ½Ð°Ñ¦Ò:http://msdn2.microsoft.com/en-us/library/ms713423.aspx
  10. Private Declare Function timeSetEvent Lib "winmm.dll" (ByVal uDelay As Long, ByVal uResolution As Long, _
  11.             ByVal lpFunction As Long, ByVal dwUser As Long, ByVal uFlags As Long) As Long
  12. Private Declare Function timeKillEvent Lib "winmm.dll" (ByVal uID As Long) As Long
  13. Private Const EM_SETPASSWORDCHAR = &HCC

  14. Dim lTimeID     As Long          'Timer ID
  15. Const pswdInputBoxTitle = "pswdInputBox"     '¿é¤J±K½Xªº¹ï¸Ü®Ø¼ÐÃD

  16.   
  17. 'TimeProc callback ¨ç¼Æ½Ð°Ñ¦Ò:http://msdn2.microsoft.com/en-us/library/ms713420.aspx
  18. Sub TimeProc(ByVal uID As Long, ByVal uMsg As Long, ByVal dwUser As Long, _
  19.     ByVal dw1 As Long, ByVal dw2 As Long)
  20.     Dim hwd As Long         '¿é¤J±K½Xªº¹ï¸Ü®Ø¥y¬`
  21.     'VBA InputBox¹ï¸Ü®Ø¤§Class Name¬O "#32770",
  22.     '¼ÐÃD¬° "pswdInputBox", ³o¬O¦bInputBox¨ç¼ÆªºTitle¤Þ­z¤¤¦Û­qªº
  23.     '½Ðª`·NApplication.InputBox¤èªk©Ò¥X²{ªº¹ï¸Ü®ØClass Name¬O "bosa_sdm_XL9"
  24.     hwd = FindWindow("#32770", pswdInputBoxTitle)
  25.     If hwd <> 0 Then        '­Y¹ï¸Ü®Ø¦s¦b
  26.         '¨ú±o¿é¤Jªº¤å¦r®Ø¥y¬`, ¸Ó¤å¦r®ØªºClass Name¬O"Edit", µL¼ÐÃD,
  27.         '¦ÓApplication.InputBox¤èªk©Ò¥X²{ªº¹ï¸Ü®Ø¤§¤å¦r®ØªºClass Name¬O"EDTBX"
  28.         hwd = FindWindowEx(hwd, 0, "Edit", vbNullString)
  29.         '³]©w±K½X¦r¤¸¬° "*", "*"ªºASCII½X¬°42
  30.         SendMessage hwd, EM_SETPASSWORDCHAR, 42, 0
  31.         '³]©w§¹¦¨, ¨ú®ø­p®É¾¹
  32.         timeKillEvent lTimeID
  33.     End If
  34. End Sub


  35. '¦Û©w¸q¨ç¼ÆpswdInputBox, ¬O¤@­Ó¿é¤J±K½X¨Ï¥ÎªºInputBox, ¿é¤Jªº¤º®e³£¥H "*" Åã¥Ü.
  36. Function pswdInputBox() As Variant
  37.     '±Ò°Ê¤@­Ó¯S©wªºTimer¨Æ¥ó, 0.01¬í©µ¿ð, 0.05¬í¬Ý¤@¦¸
  38.     lTimeID = timeSetEvent(10, 50, AddressOf TimeProc, 1, 1)
  39.     'Åã¥ÜInputBox¹ï¸Ü®Ø
  40.     pswdInputBox = InputBox(Prompt:="½Ð¿é¤J½s¿è±K½X", Title:=pswdInputBoxTitle)
  41. End Function
½Æ»s¥N½X
'ªí³æ¼Ò²ÕUserform1µ{¦¡½X
ªí³æ¤W³]¸m¤@­Ó¼ÐÅÒLabel1¡B¤Î1­Ó«ö¶sCommandButton1
  1. Private Sub CommandButton1_Click()
  2. Label1.Caption = ""
  3.     If pswdInputBox <> 123456 Then
  4.         '±K½X¤£¥¿½T, Åã¥Ü°T®§
  5.         Label1.Caption = "¹ï¤£°_¡A±K½X¿ù»~¡A§AµL½s¿èÅv­­!"
  6.         Else
  7.         Label1.Caption = "Åwªï¨Ï¥Î¥»¨t²Î"
  8.     End If
  9. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 2# Hsieh


    «D±`ÁÂÁ±z! ¬Ý°_¨Ó¦n½ÆÂø,§Ú·|¦n¦n¾Ç²ß,´ú¸Õ¦n¥Î,¯u·PÁÂ.
max

TOP

        ÀR«ä¦Û¦b : ¤H¥Í¤£¤@©w²y²y¬O¦n²y¡A¦ý¬O¦³¾ú½mªº±j¥´ªÌ¡AÀH®É³£¥i¥H´§´Î¡C
ªð¦^¦Cªí ¤W¤@¥DÃD