mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
*SysInfo: Some updates after U++ changes and luoganda report
git-svn-id: svn://ultimatepp.org/upp/trunk@10515 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
d86c6aaf47
commit
d430edf45f
7 changed files with 53 additions and 37 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#include "SysInfo_in.h"
|
||||
|
||||
NAMESPACE_UPP
|
||||
using namespace Upp;
|
||||
|
||||
#ifdef PLATFORM_POSIX
|
||||
bool GetBatteryStatus(bool &discharging, int &percentage, int &remainingMin)
|
||||
|
|
@ -170,4 +170,4 @@ bool CloseCDTray(String drive)
|
|||
|
||||
#endif
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
//END_UPP_NAMESPACE
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include "SysInfo.h"
|
||||
|
||||
NAMESPACE_UPP
|
||||
using namespace Upp;
|
||||
|
||||
#if defined(PLATFORM_WIN32) || defined (PLATFORM_WIN64)
|
||||
uint64 start, end;
|
||||
|
|
@ -63,4 +63,4 @@ int GetCpuSpeed()
|
|||
}
|
||||
#endif
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
//END_UPP_NAMESPACE
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include "SysInfo_in.h"
|
||||
|
||||
NAMESPACE_UPP
|
||||
using namespace Upp;
|
||||
|
||||
struct KeyCodes {
|
||||
String key;
|
||||
|
|
@ -532,4 +532,4 @@ void Keyb_SendKeys(String text, long finalDelay, long delayBetweenKeys)
|
|||
|
||||
#endif
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
//END_UPP_NAMESPACE
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include "SysInfo_in.h"
|
||||
|
||||
NAMESPACE_UPP
|
||||
using namespace Upp;
|
||||
|
||||
#if defined(PLATFORM_WIN32) || defined (PLATFORM_WIN64)
|
||||
|
||||
|
|
@ -674,4 +674,4 @@ bool GetOsInfo(String &kernel, String &kerVersion, String &kerArchitecture, Stri
|
|||
|
||||
#endif
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
//END_UPP_NAMESPACE
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
#include <plugin/jpg/jpg.h>
|
||||
#include <plugin/bmp/bmp.h>
|
||||
|
||||
NAMESPACE_UPP
|
||||
using namespace Upp;
|
||||
|
||||
|
||||
bool Window_SaveCapture(int64 windowId, String fileName, int left, int top, int width, int height)
|
||||
|
|
@ -78,33 +78,47 @@ Image Window_SaveCapture(int64 windowId, int left, int top, int width, int heigh
|
|||
ImageBuffer b;
|
||||
|
||||
if ((hDC = GetDC(0)) == NULL)
|
||||
goto end;
|
||||
if ((memDC = CreateCompatibleDC(hDC)) == NULL)
|
||||
goto end;
|
||||
if ((hb = CreateCompatibleBitmap(hDC, width, height)) == NULL)
|
||||
goto end;
|
||||
if ((oldBM = (HBITMAP)SelectObject(memDC, hb)) == NULL)
|
||||
goto end;
|
||||
if (!BitBlt(memDC, 0, 0, width, height , hDC, left, top, SRCCOPY))
|
||||
goto end;
|
||||
return Null;
|
||||
if ((memDC = CreateCompatibleDC(hDC)) == NULL) {
|
||||
ReleaseDC(0, hDC);
|
||||
return Null;
|
||||
}
|
||||
if ((hb = CreateCompatibleBitmap(hDC, width, height)) == NULL) {
|
||||
DeleteDC(memDC);
|
||||
ReleaseDC(0, hDC);
|
||||
return Null;
|
||||
}
|
||||
if ((oldBM = (HBITMAP)SelectObject(memDC, hb)) == NULL) {
|
||||
DeleteObject(hb);
|
||||
DeleteDC(memDC);
|
||||
ReleaseDC(0, hDC);
|
||||
return Null;
|
||||
}
|
||||
if (!BitBlt(memDC, 0, 0, width, height , hDC, left, top, SRCCOPY)) {
|
||||
DeleteObject(hb);
|
||||
DeleteDC(memDC);
|
||||
ReleaseDC(0, hDC);
|
||||
return Null;
|
||||
}
|
||||
|
||||
BITMAPINFO bmpInfo;
|
||||
ZeroMemory(&bmpInfo, sizeof(BITMAPINFO));
|
||||
bmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
if (!GetDIBits(hDC, hb, 0, 0, NULL, &bmpInfo, DIB_RGB_COLORS))
|
||||
goto end;
|
||||
if (!GetDIBits(hDC, hb, 0, 0, NULL, &bmpInfo, DIB_RGB_COLORS)) {
|
||||
DeleteObject(hb);
|
||||
DeleteDC(memDC);
|
||||
ReleaseDC(0, hDC);
|
||||
return Null;
|
||||
}
|
||||
if(bmpInfo.bmiHeader.biSizeImage <= 0)
|
||||
bmpInfo.bmiHeader.biSizeImage = bmpInfo.bmiHeader.biWidth*labs(bmpInfo.bmiHeader.biHeight)*(bmpInfo.bmiHeader.biBitCount+7)/8;
|
||||
bmpInfo.bmiHeader.biCompression = BI_RGB;
|
||||
bmpInfo.bmiHeader.biHeight = -height;
|
||||
|
||||
b.Create(width, height);
|
||||
if (!GetDIBits(hDC, hb, 0, height, ~b, (BITMAPINFO *)&bmpInfo.bmiHeader, DIB_RGB_COLORS))
|
||||
goto end;
|
||||
if (GetDIBits(hDC, hb, 0, height, ~b, (BITMAPINFO *)&bmpInfo.bmiHeader, DIB_RGB_COLORS))
|
||||
img = b;
|
||||
|
||||
img = b;
|
||||
|
||||
end:
|
||||
SelectObject(hDC, oldBM);
|
||||
DeleteObject(hb);
|
||||
DeleteDC(memDC);
|
||||
|
|
@ -615,4 +629,4 @@ Image Snap_Window(int64 handle)
|
|||
return Window_SaveCapture(handle);
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
//END_UPP_NAMESPACE
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
NAMESPACE_UPP
|
||||
using namespace Upp;
|
||||
|
||||
#define TFILE <SysInfo/SysInfo.t>
|
||||
#include <Core/t.h>
|
||||
|
|
@ -24,10 +24,12 @@ NAMESPACE_UPP
|
|||
// Hardware Info
|
||||
#if defined(PLATFORM_WIN32)
|
||||
|
||||
#ifdef COMPILER_MINGW
|
||||
REFCLSID CLSID_WbemAdministrativeLocator =
|
||||
#ifdef COMPILER_MINGW
|
||||
REFCLSID ___CLSID_WbemAdministrativeLocator =
|
||||
{ 0xcb8555cc, 0x9128, 0x11d1, {0xad, 0x9b, 0x00, 0xc0, 0x4f, 0xd8, 0xfd, 0xff}};
|
||||
#endif
|
||||
#else
|
||||
#define ___CLSID_WbemAdministrativeLocator CLSID_WbemAdministrativeLocator
|
||||
#endif
|
||||
|
||||
bool GetWMIInfo(String system, Array <String> &data, Array <Value> *ret[], String nameSpace = "root\\cimv2") {
|
||||
HRESULT hRes;
|
||||
|
|
@ -43,7 +45,7 @@ bool GetWMIInfo(String system, Array <String> &data, Array <Value> *ret[], Strin
|
|||
return false;
|
||||
}
|
||||
IWbemLocator* pIWbemLocator = NULL;
|
||||
if (CoCreateInstance(CLSID_WbemAdministrativeLocator, NULL,
|
||||
if (CoCreateInstance(___CLSID_WbemAdministrativeLocator, NULL,
|
||||
CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, IID_IUnknown, (void **)&pIWbemLocator) != S_OK) {
|
||||
CoUninitialize();
|
||||
return false;
|
||||
|
|
@ -1874,17 +1876,17 @@ bool Window_SetRect(int64 windowId, long left, long top, long right, long bottom
|
|||
|
||||
void Window_Bottom(int64 windowId)
|
||||
{
|
||||
SetWindowPos(reinterpret_cast<HWND>(windowId), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE || SWP_NOSIZE || SWP_SHOWWINDOW);
|
||||
SetWindowPos(reinterpret_cast<HWND>(windowId), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
|
||||
}
|
||||
|
||||
void Window_Top(int64 windowId)
|
||||
{
|
||||
SetWindowPos(reinterpret_cast<HWND>(windowId), HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE || SWP_NOSIZE || SWP_SHOWWINDOW);
|
||||
SetWindowPos(reinterpret_cast<HWND>(windowId), HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
|
||||
}
|
||||
|
||||
void Window_TopMost(int64 windowId)
|
||||
{
|
||||
SetWindowPos(reinterpret_cast<HWND>(windowId), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE || SWP_NOSIZE || SWP_SHOWWINDOW);
|
||||
SetWindowPos(reinterpret_cast<HWND>(windowId), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -2220,4 +2222,4 @@ bool IsPortFree(int port) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
//END_UPP_NAMESPACE
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "Functions4U/Functions4U.h"
|
||||
|
||||
NAMESPACE_UPP
|
||||
using namespace Upp;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// Processor Info
|
||||
|
|
@ -223,7 +223,7 @@ struct SystemOverview : DeepCopyOption<SystemOverview> {
|
|||
void Serialize(Stream &stream);
|
||||
};
|
||||
|
||||
END_UPP_NAMESPACE
|
||||
//END_UPP_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue