Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is it not possible to use this in a VBScript macro?
Declare Function GetDesktopWindow Lib "User32" () As Long
Declare Function GetWindowRect Lib "User32" (ByVal hWnd As Long, rectangle As RECT) As Long
What I want is a macro that will query Windows to determine the current screen resolution. This is simple in VB but I don't see how it can be done from within QlikView.
modified from something found on the internet. remember to allow system access.
Sub GetDisplayConfiguration
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_DisplayConfiguration")
For Each objItem in colItems
msgbox("Name: " & objItem.DeviceName)
msgbox("Color depth: " & objItem.BitsPerPel)
msgbox("Horizontal resolution: " & objItem.PelsWidth)
msgbox("Vertical resolution: " & objItem.PelsHeight)
Next
End Sub
modified from something found on the internet. remember to allow system access.
Sub GetDisplayConfiguration
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_DisplayConfiguration")
For Each objItem in colItems
msgbox("Name: " & objItem.DeviceName)
msgbox("Color depth: " & objItem.BitsPerPel)
msgbox("Horizontal resolution: " & objItem.PelsWidth)
msgbox("Vertical resolution: " & objItem.PelsHeight)
Next
End Sub
Brian,
Here is a little macro I use that fetches screen height/width
sub ZoomToFitWindow
ActiveDocument.GetApplication.WaitForIdle
If ActiveDocument.GetApplication.ScreenWidth = 1280 and ActiveDocument.GetApplication.ScreenHeight = 1024 then
set thisSheet=ActiveDocument.ActiveSheet
set sp=thisSheet.GetProperties
sp.ZoomFactor = 1.0
thisSheet.SetProperties sp
else
ActiveDocument.ActiveSheet.FitZoomToWindow
end if
end sub
Regards,
Gordon
Perfect, thanks!