i'm using visual basic 2008
for example have running notepad.exe
, can hide notepad window, , if need show again?
thanks.
- call
process.getprocessesbyname()
passing"notepad"
. - then read
mainwindowhandle
returned process. - p/invoke
showwindow()
passingsw_hide
orsw_show
hide/show window.
the p/invoke signature is:
<dllimport("user32.dll", setlasterror:=true, charset:=charset.auto)> _ private shared function showwindow(byval hwnd intptr, byval ncmdshow integer) boolean end function
the showwindow()
topic lists numeric values sw_*
flags.
thanks @alex k suggesting comment use of showwindowasync()
rather showwindow()
.
<dllimport("user32.dll", setlasterror:=true, charset:=charset.auto)> _ private shared function showwindowasync(byval hwnd intptr, byval ncmdshow integer) boolean end function
from documentation:
this function posts show-window event message queue of given window. application can use function avoid becoming nonresponsive while waiting nonresponsive application finish processing show-window event.
Comments
Post a Comment