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:
Włodzimierz Skiba 2005-07-18 13:43:42 +00:00
parent 0a13502d18
commit 78a054f667
2 changed files with 13 additions and 36 deletions

View File

@ -634,7 +634,7 @@ wxPalette *wxDIB::CreatePalette() const
// and the colour table
wxCharBuffer rgb(sizeof(RGBQUAD) * biClrUsed);
RGBQUAD *pRGB = (RGBQUAD*)rgb.data();
SelectInHDC(hDC, m_handle);
SelectInHDC selectHandle(hDC, m_handle);
::GetDIBColorTable(hDC, 0, biClrUsed, pRGB);
for ( DWORD i = 0; i < biClrUsed; i++, pRGB++ )
{

View File

@ -806,9 +806,11 @@ int wxKill(long pid, wxSignal sig, wxKillError *krc, int flags)
return 0;
}
HANDLE (WINAPI *lpfCreateToolhelp32Snapshot)(DWORD,DWORD) ;
BOOL (WINAPI *lpfProcess32First)(HANDLE,LPPROCESSENTRY32) ;
BOOL (WINAPI *lpfProcess32Next)(HANDLE,LPPROCESSENTRY32) ;
typedef HANDLE (WINAPI *CreateToolhelp32Snapshot_t)(DWORD,DWORD);
typedef BOOL (WINAPI *Process32_t)(HANDLE,LPPROCESSENTRY32);
CreateToolhelp32Snapshot_t lpfCreateToolhelp32Snapshot;
Process32_t lpfProcess32First, lpfProcess32Next;
static void InitToolHelp32()
{
@ -823,9 +825,7 @@ static void InitToolHelp32()
lpfProcess32First = NULL;
lpfProcess32Next = NULL;
HINSTANCE hInstLib = LoadLibrary( wxT("Kernel32.DLL") ) ;
if( hInstLib == NULL )
return ;
wxDynamicLibrary dllKernel(_T("kernel32.dll"), wxDL_VERBATIM);
// Get procedure addresses.
// We are linking to these functions of Kernel32
@ -833,37 +833,14 @@ static void InitToolHelp32()
// this code would fail to load under Windows NT,
// which does not have the Toolhelp32
// functions in the Kernel 32.
lpfCreateToolhelp32Snapshot=
(HANDLE(WINAPI *)(DWORD,DWORD))
GetProcAddress( hInstLib,
#ifdef __WXWINCE__
wxT("CreateToolhelp32Snapshot")
#else
"CreateToolhelp32Snapshot"
#endif
) ;
lpfCreateToolhelp32Snapshot =
(CreateToolhelp32Snapshot_t)dllKernel.RawGetSymbol(_T("CreateToolhelp32Snapshot"));
lpfProcess32First=
(BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))
GetProcAddress( hInstLib,
#ifdef __WXWINCE__
wxT("Process32First")
#else
"Process32First"
#endif
) ;
lpfProcess32First =
(Process32_t)dllKernel.RawGetSymbol(_T("Process32First"));
lpfProcess32Next=
(BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))
GetProcAddress( hInstLib,
#ifdef __WXWINCE__
wxT("Process32Next")
#else
"Process32Next"
#endif
) ;
FreeLibrary( hInstLib ) ;
lpfProcess32Next =
(Process32_t)dllKernel.RawGetSymbol(_T("Process32Next"));
}
// By John Skiff