分享成果,隨喜正能量】過去已成回憶,未來還沒到來,只有當下是屬于我們的。不要因為失去而捶胸頓足,也不要因為未知而感到焦慮,珍惜當下,才是人生的精華。生活,永遠不需要活在別人的眼里,更不需要活在自己的情緒里 ??。
跟我學VBA,我這里專注VBA, 授人以漁。我98年開始,從源碼接觸VBA已經(jīng)20余年了,隨著年齡的增長,越來越覺得有必要把這項技能傳遞給需要這項技術(shù)的職場人員。希望職場和數(shù)據(jù)打交道的朋友,都來學習VBA,利用VBA,起碼可以提高自己的工作效率,可以有時間多陪陪父母,多陪陪家人,何樂而不為呢?
這講我們繼續(xù)學習64位Office API聲明語句第91講,這些內(nèi)容是MS的權(quán)威資料,看似枯燥,但對于想學習API函數(shù)的朋友是非常有用的。
當學員學習到高級階段,如果引用API,這個資料可以直接查到64位寫法。大多數(shù)情況下我們是將低版本的程序文件升級到高版本,這時您就不必為如下的錯誤提示所困擾了:
Declare PtrSafe Function midiStreamProperty Lib "winmm.dll" Alias "midiStreamProperty" (ByVal hms As LongPtr, lppropdata As Byte, ByVal dwProperty As Long) As Long
Declare PtrSafe Function midiStreamPosition Lib "winmm.dll" Alias "midiStreamPosition" (ByVal hms As LongPtr, lpmmt As MMTIME, ByVal cbmmt As Long) As Long
Declare PtrSafe Function midiStreamOut Lib "winmm.dll" Alias "midiStreamOut" (ByVal hms As LongPtr, pmh As MIDIHDR, ByVal cbmh As Long) As Long
Declare PtrSafe Function midiStreamPause Lib "winmm.dll" Alias "midiStreamPause" (ByVal hms As LongPtr) As Long
Declare PtrSafe Function midiStreamRestart Lib "winmm.dll" Alias "midiStreamRestart" (ByVal hms As LongPtr) As Long
Declare PtrSafe Function midiStreamStop Lib "winmm.dll" Alias "midiStreamStop" (ByVal hms As LongPtr) As Long
Declare PtrSafe Function midiConnect Lib "winmm.dll" Alias "midiConnect" (ByVal hmi As LongPtr, ByVal hmo As LongPtr, pReserved As Any) As Long
Declare PtrSafe Function midiDisconnect Lib "winmm.dll" Alias "midiDisconnect" (ByVal hmi As LongPtr, ByVal hmo As LongPtr, pReserved As Any) As Long
Type JOYINFOEX
dwSize As Long ' size of structure
dwFlags As Long ' flags to indicate what to return
dwXpos As Long ' x position
dwYpos As Long ' y position
dwZpos As Long ' z position
dwRpos As Long ' rudder/4th axis position
dwUpos As Long ' 5th axis position
dwVpos As Long ' 6th axis position
dwButtons As Long ' button states
dwButtonNumber As Long ' current button number pressed
dwPOV As Long ' point of view state
dwReserved1 As Long ' reserved for communication between winmm driver
dwReserved2 As Long ' reserved for future expansion
End Type
' Installable driver support
' Driver messages
Const DRV_LOAD=&H1
Const DRV_ENABLE=&H2
Const DRV_OPEN=&H3
Const DRV_CLOSE=&H4
Const DRV_DISABLE=&H5
Const DRV_FREE=&H6
Const DRV_CONFIGURE=&H7
Const DRV_QUERYCONFIGURE=&H8
Const DRV_INSTALL=&H9
Const DRV_REMOVE=&HA
Const DRV_EXITSESSION=&HB
Const DRV_POWER=&HF
Const DRV_RESERVED=&H800
Const DRV_USER=&H4000
Type DRVCONFIGINFO
dwDCISize As Long
lpszDCISectionName As String
lpszDCIAliasName As String
dnDevNode As Long
End Type
' Supported return values for DRV_CONFIGURE message
Const DRVCNF_CANCEL=&H0
Const DRVCNF_OK=&H1
Const DRVCNF_RESTART=&H2
' return values from DriverProc() function
Const DRV_CANCEL=DRVCNF_CANCEL
Const DRV_OK=DRVCNF_OK
Const DRV_RESTART=DRVCNF_RESTART
Declare PtrSafe Function CloseDriver Lib "winmm.dll" Alias "CloseDriver" (ByVal hDriver As LongPtr, ByVal lParam1 As LongPtr, ByVal lParam2 As LongPtr) As LongPtr
Declare PtrSafe Function OpenDriver Lib "winmm.dll" Alias "OpenDriver" (ByVal szDriverName As String, ByVal szSectionName As String, ByVal lParam2 As LongPtr) As LongPtr
Declare PtrSafe Function SendDriverMessage Lib "winmm.dll" Alias "SendDriverMessage" (ByVal hDriver As LongPtr, ByVal message As Long, ByVal lParam1 As LongPtr, ByVal lParam2 As LongPtr) As LongPtr
Declare PtrSafe Function DrvGetModuleHandle Lib "winmm.dll" Alias "DrvGetModuleHandle" (ByVal hDriver As LongPtr) As LongPtr
Declare PtrSafe Function GetDriverModuleHandle Lib "winmm.dll" Alias "GetDriverModuleHandle" (ByVal hDriver As LongPtr) As LongPtr
Declare PtrSafe Function DefDriverProc Lib "winmm.dll" Alias "DefDriverProc" (ByVal dwDriverIdentifier As LongPtr, ByVal hdrvr As LongPtr, ByVal uMsg As Long, ByVal lParam1 As LongPtr, ByVal lParam2 As LongPtr) As LongPtr
Const DRV_MCI_FIRST=DRV_RESERVED
Const DRV_MCI_LAST=DRV_RESERVED + &HFFF
' Driver callback support
' flags used with waveOutOpen(), waveInOpen(), midiInOpen(), and
' midiOutOpen() to specify the type of the dwCallback parameter.
Const CALLBACK_TYPEMASK=&H70000 ' callback type mask
Const CALLBACK_NULL=&H0 ' no callback
Const CALLBACK_WINDOW=&H10000 ' dwCallback is a HWND
Const CALLBACK_TASK=&H20000 ' dwCallback is a HTASK
Const CALLBACK_FUNCTION=&H30000 ' dwCallback is a FARPROC
' manufacturer IDs
Const MM_MICROSOFT=1 ' Microsoft Corp.
' product IDs
Const MM_MIDI_MAPPER=1 ' MIDI Mapper
Const MM_WAVE_MAPPER=2 ' Wave Mapper
Const MM_SNDBLST_MIDIOUT=3 ' Sound Blaster MIDI output port
Const MM_SNDBLST_MIDIIN=4 ' Sound Blaster MIDI input port
Const MM_SNDBLST_SYNTH=5 ' Sound Blaster internal synthesizer
Const MM_SNDBLST_WAVEOUT=6 ' Sound Blaster waveform output
Const MM_SNDBLST_WAVEIN=7 ' Sound Blaster waveform input
Const MM_ADLIB=9 ' Ad Lib-compatible synthesizer
Const MM_MPU401_MIDIOUT=10 ' MPU401-compatible MIDI output port
Const MM_MPU401_MIDIIN=11 ' MPU401-compatible MIDI input port
Const MM_PC_JOYSTICK=12 ' Joystick adapter
Declare PtrSafe Function mmsystemGetVersion Lib "winmm.dll" Alias "mmsystemGetVersion" () As Long
Declare PtrSafe Sub OutputDebugStr Lib "winmm.dll" Alias "OutputDebugStr" (ByVal lpszOutputString As String)
Declare PtrSafe Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
' flag values for uFlags parameter
Const SND_SYNC=&H0 ' play synchronously (default)
Const SND_ASYNC=&H1 ' play asynchronously
Const SND_NODEFAULT=&H2 ' silence not default, if sound not found
Const SND_MEMORY=&H4 ' lpszSoundName points to a memory file
Const SND_ALIAS=&H10000 ' name is a WIN.INI [sounds] entry
Const SND_FILENAME=&H20000 ' name is a file name
Const SND_RESOURCE=&H40004 ' name is a resource name or atom
Const SND_ALIAS_ID=&H110000 ' name is a WIN.INI [sounds] entry identifier
Const SND_ALIAS_START=0 ' must be > 4096 to keep strings in same section of resource file
Const SND_LOOP=&H8 ' loop the sound until next sndPlaySound
Const SND_NOSTOP=&H10 ' don't stop any currently playing sound
Const SND_VALID=&H1F ' valid flags / ;Internal /
Const SND_NOWAIT=&H2000 ' don't wait if the driver is busy
Const SND_VALIDFLAGS=&H17201F ' Set of valid flag bits. Anything outside
' this range will raise an error
Const SND_RESERVED=&HFF000000 ' In particular these flags are reserved
Const SND_TYPE_MASK=&H170007
Declare PtrSafe Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As LongPtr, ByVal dwFlags As Long) As Long
' waveform audio error return values
Const WAVERR_BADFORMAT=(WAVERR_BASE + 0) ' unsupported wave format
Const WAVERR_STILLPLAYING=(WAVERR_BASE + 1) ' still something playing
Const WAVERR_UNPREPARED=(WAVERR_BASE + 2) ' header not prepared
Const WAVERR_SYNC=(WAVERR_BASE + 3) ' device is synchronous
Const WAVERR_LASTERROR=(WAVERR_BASE + 3) ' last error in range
' wave callback messages
Const WOM_OPEN=MM_WOM_OPEN
Const WOM_CLOSE=MM_WOM_CLOSE
Const WOM_DONE=MM_WOM_DONE
Const WIM_OPEN=MM_WIM_OPEN
Const WIM_CLOSE=MM_WIM_CLOSE
Const WIM_DATA=MM_WIM_DATA
' device ID for wave device mapper
Const WAVE_MAPPER=-1&
' flags for dwFlags parameter in waveOutOpen() and waveInOpen()
Const WAVE_ALLOWSYNC=&H2
Const WAVE_VALID=&H3 ' ;Internal
我20多年的VBA實踐經(jīng)驗,全部濃縮在下面的各個教程中:
【分享成果,隨喜正能量】總想占人便宜的人,別人就會敬而遠之。不想占人便宜的人,別人反而會主動幫助。人都有逆反心理,所以財旺或劫財旺為忌者人緣不好,除非有梟印或食傷來緩解。。
在Windows中我們常用的截圖方法之一便是按鍵盤上的PrintScreen健或Alt + PrintScreen組合鍵,其中前者為截取整個屏幕,后者為截取當前活動窗口,不過這兩個操作都沒有任何提示。對于經(jīng)常需要截圖的朋友來說,可能特別需要在按下快捷鍵后得到系統(tǒng)確定的反饋,而添加聲音效果是個不錯的主意。
慶幸的是微軟在系統(tǒng)中提供了這樣的功能,不過需要修改注冊表來實現(xiàn)。具體方法可參考如下:
注意:此法需要修改注冊表,在操作之前建議先按照《Win10如何創(chuàng)建還原點及系統(tǒng)還原完全攻略》為你的系統(tǒng)創(chuàng)建一個還原點,以便在出錯時還原。該方法適用于Win7、Win8.1、Win10、Vista等系統(tǒng)。
1、首先下載注冊表和聲音文件(點此下載);
2、下載后解壓,雙擊其中的add screenshot sound.reg導入相關(guān)注冊表項;
3、按Win+R打開運行,輸入下面的字符回車打開聲音設(shè)置窗口:
rundll32.exe shell32.dll,Control_RunDLL mmsys.cpl ,2
4、在打開的窗口中你會看到名為SnapShot的“程序事件”項目,選中該項,點擊底部的“瀏覽”,然后選擇壓縮包中的shot.wav文件,最后點擊確定即可。
之后按PrintScreen健或Alt + PrintScreen組合鍵測試一下,看是否出現(xiàn)了拍照的提示聲音?為避免聲音文件被誤刪,建議你將shot.wav文件保存到C:\Windows\Media目錄目錄下。你可以挑選一些自己喜歡的個性聲音來替換,但注意文件格式必須為wav。
如果你想取消這個聲效,只需要雙擊壓縮包中的remove screenshot sound.reg導入注冊表項,再刪除聲音文件即可。(via: WinAero)
微信搜索“IT之家”關(guān)注搶6s大禮!下載IT之家客戶端(戳這里)也可參與評論抽樓層大獎!