thanks Doug.
I get the variable by searching for the MS mappoint window, and when I find
it, I use it's process property. I msgbox the module name and executable
info from this process to make sure it's indicating ms mappoint before I
then try to use blockevent.
how does this all sound? I'll post an example program below:
'-- Open the Map Point application and get an object reference to
it.
set goMPApp = nothing
dim goMPApp
on error Resume next
Set goMPApp = createobject("MapPoint.Application")
ON ERROR goto 0
IF not (goMPApp is Nothing) then
loadClassInformation goMPApp
'if debugging then speakAlert "using MapPoint version " & goMPApp.version
' get MapPoint window
dim loWindows
Set loWindows = DesktopWindow.Children.FilterByTitle ("Map - Microsoft
MapPoint", fmStartsWith, false)
if loWindows.count > 0 then
dim goNPWindow
set goMPWindow = loWindows(1)
dim goMPProcess
set goMPProcess = goMPWindow.process
if goMPProcess is nothing then
speak "internal error: unable to get MapPoint process"
else
' block all MSAA events from this process because they trigger a bug in
window eyes (7.11) causing it to speak the focused item repeatedly and
non-stop.
' it appears to be the MapPoint .findNearBy method, called in a repeating
loop, which is causing MapPoint to generate the MSAA events.
' my guess is that this is causing a lot of window updating activity for the
hidden MapPoint window, and some of it is eroneously triggering WE to speak.
sleep 2*1000
blockAllMSAAEvents goMPProcess
end if
else ' loWindows.count > 0
speak "internal error: unable to get MapPoint window"
end if ' loWindows.count > 0
' minimize MapPoint
goMPApp.WindowState = geoWindowStateMinimize ' 1
' hide the window
goMPApp.Visible = FALSE
goMPApp.userControl = false
goMPApp.PaneState = geoPaneNone ' 3
'-- Map Point only lets us have one map open, so create our map
object
'-- reference now.
dim goMap
Set goMap = goMPApp.ActiveMap
'turn off optional rendering to increase performance
goMap.BasicRenderingOnly()
goMap.Altitude = 1 ' make the active map zoom into a small scale view
' set up routing directions
goMap.MapStyle = 0 ' road map
goMap.ActiveRoute.DriverProfile.IncludeRefuelWarnings = FALSE
goMap.ActiveRoute.DriverProfile.IncludeRestStops = FALSE
' make all place categories visible
dim j
FOR J = 1 TO goMap.PlaceCategories.Count
goMap.PlaceCategories(J).Visible = TRUE
Next
'-------------
' loop every 2 seconds to show problem. execute loop for only 30 seconds
dim i, oCurLoc, x
set oCurLoc = goMap.GetLocation(30.5, -84.2)
for i = 1 to 0
set x = oCurLoc.findNearBy (2)
sleep 2000
next
goMap.saved = true
set goMPApp = nothing
Else ' not (goMPApp is Nothing)
speakAlert "Unable to Find MapPoint Installed on This Computer"
err.clear
End If ' not (goMPApp is Nothing)
sub blockAllMSAAEvents (forProcess)
' tell window eyes to ignore all MSAA activity from a given process.
dim i,x
msgBox forProcess.moduleName
set x = msaaEventSource
for i = event_SYSTEM_SOUND to event_SYSTEM_MINIMIZEEND ' first group
x.blockEvent i, forProcess
next
for i = event_CONSOLE_CARET to event_CONSOLE_END_APPLICATION ' second group
x.blockEvent i, forProcess
next
for i = event_OBJECT_SHOW to event_OBJECT_CONTENTSCROLLED ' third and last
group
x.blockEvent i, forProcess
next
end sub
-----Original Message-----
From: Doug Geoffray [mailto:[email protected]]
Sent: Monday, November 02, 2009 3:59 PM
To: [email protected]
Subject: Re: getting error when trying to block msaa event
Chip,
I know you said you verified your forProcess variable is a process but I
would double check. This works fine for me as long as the process is valid.
But if the process isn't valid then I get the error you are getting. How
did you verify forProcess is a process and what are you setting it to?
Doug
Chip Orange wrote:
> Hi all,
>
> I guess this is really to GW:
>
> I'm getting an "invalid procedure call or argument" when I try to
> block an msaa event from another process. I have first verified by
> displaying the name that my variable does hold a valid process. here
> are the lines I'm using:
>
> set x = msaaEventSource
> x.blockEvent event_SYSTEM_SOUND, forProcess
>
>
> I also get the error if I don't make a copy of msaaEventSource, but
> try to execute blockEvent from it.
>
> does anyone know why this is?
>
> I'm trying to work around another WE problem having to do with
> possibly MSAA output from this process, this is getting silly!
>
> thanks.
>
> Chip
>
>