Code simplification and warning fixes.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34882 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -634,7 +634,7 @@ wxPalette *wxDIB::CreatePalette() const
|
|||||||
// and the colour table
|
// and the colour table
|
||||||
wxCharBuffer rgb(sizeof(RGBQUAD) * biClrUsed);
|
wxCharBuffer rgb(sizeof(RGBQUAD) * biClrUsed);
|
||||||
RGBQUAD *pRGB = (RGBQUAD*)rgb.data();
|
RGBQUAD *pRGB = (RGBQUAD*)rgb.data();
|
||||||
SelectInHDC(hDC, m_handle);
|
SelectInHDC selectHandle(hDC, m_handle);
|
||||||
::GetDIBColorTable(hDC, 0, biClrUsed, pRGB);
|
::GetDIBColorTable(hDC, 0, biClrUsed, pRGB);
|
||||||
for ( DWORD i = 0; i < biClrUsed; i++, pRGB++ )
|
for ( DWORD i = 0; i < biClrUsed; i++, pRGB++ )
|
||||||
{
|
{
|
||||||
|
@@ -806,9 +806,11 @@ int wxKill(long pid, wxSignal sig, wxKillError *krc, int flags)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
HANDLE (WINAPI *lpfCreateToolhelp32Snapshot)(DWORD,DWORD) ;
|
typedef HANDLE (WINAPI *CreateToolhelp32Snapshot_t)(DWORD,DWORD);
|
||||||
BOOL (WINAPI *lpfProcess32First)(HANDLE,LPPROCESSENTRY32) ;
|
typedef BOOL (WINAPI *Process32_t)(HANDLE,LPPROCESSENTRY32);
|
||||||
BOOL (WINAPI *lpfProcess32Next)(HANDLE,LPPROCESSENTRY32) ;
|
|
||||||
|
CreateToolhelp32Snapshot_t lpfCreateToolhelp32Snapshot;
|
||||||
|
Process32_t lpfProcess32First, lpfProcess32Next;
|
||||||
|
|
||||||
static void InitToolHelp32()
|
static void InitToolHelp32()
|
||||||
{
|
{
|
||||||
@@ -823,9 +825,7 @@ static void InitToolHelp32()
|
|||||||
lpfProcess32First = NULL;
|
lpfProcess32First = NULL;
|
||||||
lpfProcess32Next = NULL;
|
lpfProcess32Next = NULL;
|
||||||
|
|
||||||
HINSTANCE hInstLib = LoadLibrary( wxT("Kernel32.DLL") ) ;
|
wxDynamicLibrary dllKernel(_T("kernel32.dll"), wxDL_VERBATIM);
|
||||||
if( hInstLib == NULL )
|
|
||||||
return ;
|
|
||||||
|
|
||||||
// Get procedure addresses.
|
// Get procedure addresses.
|
||||||
// We are linking to these functions of Kernel32
|
// We are linking to these functions of Kernel32
|
||||||
@@ -834,36 +834,13 @@ static void InitToolHelp32()
|
|||||||
// which does not have the Toolhelp32
|
// which does not have the Toolhelp32
|
||||||
// functions in the Kernel 32.
|
// functions in the Kernel 32.
|
||||||
lpfCreateToolhelp32Snapshot =
|
lpfCreateToolhelp32Snapshot =
|
||||||
(HANDLE(WINAPI *)(DWORD,DWORD))
|
(CreateToolhelp32Snapshot_t)dllKernel.RawGetSymbol(_T("CreateToolhelp32Snapshot"));
|
||||||
GetProcAddress( hInstLib,
|
|
||||||
#ifdef __WXWINCE__
|
|
||||||
wxT("CreateToolhelp32Snapshot")
|
|
||||||
#else
|
|
||||||
"CreateToolhelp32Snapshot"
|
|
||||||
#endif
|
|
||||||
) ;
|
|
||||||
|
|
||||||
lpfProcess32First =
|
lpfProcess32First =
|
||||||
(BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))
|
(Process32_t)dllKernel.RawGetSymbol(_T("Process32First"));
|
||||||
GetProcAddress( hInstLib,
|
|
||||||
#ifdef __WXWINCE__
|
|
||||||
wxT("Process32First")
|
|
||||||
#else
|
|
||||||
"Process32First"
|
|
||||||
#endif
|
|
||||||
) ;
|
|
||||||
|
|
||||||
lpfProcess32Next =
|
lpfProcess32Next =
|
||||||
(BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))
|
(Process32_t)dllKernel.RawGetSymbol(_T("Process32Next"));
|
||||||
GetProcAddress( hInstLib,
|
|
||||||
#ifdef __WXWINCE__
|
|
||||||
wxT("Process32Next")
|
|
||||||
#else
|
|
||||||
"Process32Next"
|
|
||||||
#endif
|
|
||||||
) ;
|
|
||||||
|
|
||||||
FreeLibrary( hInstLib ) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// By John Skiff
|
// By John Skiff
|
||||||
|
Reference in New Issue
Block a user