vb.net - Me.Handle in Module - Alternative? -
i programming i've hit small problem, is:
using me.handle
in module used source codedom-compiler.
i want or rather need use in following procedure:
private const appcommand_volume_mute integer = &h80000 private const wm_appcommand integer = &h319 declare function sendmessagew lib "user32.dll" (byval hwnd intptr, byval msg integer, byval wparam intptr, byval lparam intptr) intptr private sub mute() sendmessagew(me.handle, wm_appcommand, me.handle, ctype(appcommand_volume_mute, intptr)) end sub
you idea, want mute system-sound. more or less searching way of doing without using me.handle
, not working in module reason...
any appreciated, in advance guys!
sendmessage requires handle form, don't have in module or standard class.
three options either pass in reference form this:
private sub mute(formref form) sendmessagew(formref.handle, wm_appcommand, formref.handle, ctype(appcommand_volume_mute, intptr)) end sub
or use handle first form in collection:
private sub mute() sendmessagew(application.openforms(0).handle, wm_appcommand, application.openforms(0).handle, ctype(appcommand_volume_mute, intptr)) end sub
or use reference mainwindowhandle:
private sub mute() sendmessagew(process.getcurrentprocess().mainwindowhandle, wm_appcommand, process.getcurrentprocess().mainwindowhandle, ctype(appcommand_volume_mute, intptr)) end sub
Comments
Post a Comment