Home » Developing U++ » UppHub » SysInfo - some bug fixes (Window_SaveCapture/Window_Top)
SysInfo - some bug fixes [message #47094] |
Fri, 02 December 2016 14:02 |
luoganda
Messages: 195 Registered: November 2016
|
Experienced Member |
|
|
Both is for windows version - v10502:
1)For all 3 this kind'a functions:
void Window_Top(int64 windowId){
SetWindowPos(reinterpret_cast<HWND>(windowId), HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE || SWP_NOSIZE || SWP_SHOWWINDOW);
}
from || into | -> thats SWP_NOMOVE | SWP_NOSIZE ...
Note: Window_Top will not set foreground window properly(at least not on windows xp) - to reproduce this
fully maximize some window(eg TheIDE) and use Window_Top/Window_TopMost on some background window - it won't work.
For one who want's properly set-foreground-window, try this link(scroll down to SwitchToWindow)
https:// groups.google.com/forum/#!topic/comp.os.ms-windows.programme r.win32/loryh6U6KFg
Note for code in link: SwitchToThisWindow seems that it doesnt need to be loaded by LoadLibrary - can be used directly.
On windows xp sp3/4 it works as expected.
2)Window_SaveCapture - gdi mem leak and incorrect results for lets say 16 bit screen depth:
end:
SelectObject(hDC, oldBM); into -> SelectObject(memDC, oldBM);
returned Image does not return proper 'bitmap', because requesting dib is not set:
-setting requested dib to 24bit(because generally 32bit seems to not work correctly?)
-convert to Image format, that's from requested 24bit-pixels to Image 32bit-pixels
Should do the trick.
The optimized way would be to copy pixels directly from ScreenDC(GetDC(0)) to 32Bit Image format.
[Updated on: Fri, 02 December 2016 14:06] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sat Apr 27 04:40:37 CEST 2024
Total time taken to generate the page: 1.06826 seconds
|