本文整理汇总了C++中wxZeroMemory函数的典型用法代码示例。如果您正苦于以下问题:C++ wxZeroMemory函数的具体用法?C++ wxZeroMemory怎么用?C++ wxZeroMemory使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxZeroMemory函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxGetOsVersion
wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin)
{
OSVERSIONINFO info;
wxZeroMemory(info);
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if ( ::GetVersionEx(&info) )
{
if (verMaj) *verMaj = info.dwMajorVersion;
if (verMin) *verMin = info.dwMinorVersion;
}
#if defined( __WXWINCE__ )
return wxOS_WINDOWS_CE;
#elif defined( __WXMICROWIN__ )
return wxOS_WINDOWS_MICRO;
#else
switch ( info.dwPlatformId )
{
case VER_PLATFORM_WIN32_NT:
return wxOS_WINDOWS_NT;
case VER_PLATFORM_WIN32_WINDOWS:
return wxOS_WINDOWS_9X;
}
return wxOS_UNKNOWN;
#endif
}
示例2: wxZeroMemory
void wxStackFrame::OnGetName()
{
if ( m_hasName )
return;
m_hasName = true;
// get the name of the function for this stack frame entry
static const size_t MAX_NAME_LEN = 1024;
BYTE symbolBuffer[sizeof(SYMBOL_INFO) + MAX_NAME_LEN];
wxZeroMemory(symbolBuffer);
PSYMBOL_INFO pSymbol = (PSYMBOL_INFO)symbolBuffer;
pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO);
pSymbol->MaxNameLen = MAX_NAME_LEN;
DWORD64 symDisplacement = 0;
if ( !wxDbgHelpDLL::SymFromAddr
(
::GetCurrentProcess(),
GetSymAddr(),
&symDisplacement,
pSymbol
) )
{
wxDbgHelpDLL::LogError(_T("SymFromAddr"));
return;
}
m_name = wxString::FromAscii(pSymbol->Name);
m_offset = symDisplacement;
}
示例3: defined
void wxTopLevelWindowMSW::Init()
{
m_iconized =
m_maximizeOnShow = false;
// Data to save/restore when calling ShowFullScreen
m_fsStyle = 0;
m_fsOldWindowStyle = 0;
m_fsIsMaximized = false;
m_fsIsShowing = false;
m_winLastFocused = NULL;
#if defined(__SMARTPHONE__) && defined(__WXWINCE__)
m_MenuBarHWND = 0;
#endif
#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
SHACTIVATEINFO* info = new SHACTIVATEINFO;
wxZeroMemory(*info);
info->cbSize = sizeof(SHACTIVATEINFO);
m_activateInfo = (void*) info;
#endif
m_menuSystem = NULL;
}
示例4: wxT
/* static */
HWND wxTLWHiddenParentModule::GetHWND()
{
if ( !ms_hwnd )
{
if ( !ms_className )
{
static const wxChar *HIDDEN_PARENT_CLASS = wxT("wxTLWHiddenParent");
WNDCLASS wndclass;
wxZeroMemory(wndclass);
wndclass.lpfnWndProc = DefWindowProc;
wndclass.hInstance = wxGetInstance();
wndclass.lpszClassName = HIDDEN_PARENT_CLASS;
if ( !::RegisterClass(&wndclass) )
{
wxLogLastError(wxT("RegisterClass(\"wxTLWHiddenParent\")"));
}
else
{
ms_className = HIDDEN_PARENT_CLASS;
}
}
ms_hwnd = ::CreateWindow(ms_className, wxEmptyString, 0, 0, 0, 0, 0, NULL,
(HMENU)NULL, wxGetInstance(), NULL);
if ( !ms_hwnd )
{
wxLogLastError(wxT("CreateWindow(hidden TLW parent)"));
}
}
return ms_hwnd;
}
示例5: ListView_SetItemCount
int wxCheckListBox::DoInsertItems(const wxArrayStringsAdapter & items,
unsigned int pos,
void **clientData, wxClientDataType type)
{
const unsigned int count = items.GetCount();
ListView_SetItemCount( GetHwnd(), GetCount() + count );
int n = wxNOT_FOUND;
for( unsigned int i = 0; i < count; i++ )
{
LVITEM newItem;
wxZeroMemory(newItem);
newItem.iItem = pos + i;
n = ListView_InsertItem( (HWND)GetHWND(), & newItem );
wxCHECK_MSG( n != -1, -1, wxT("Item not added") );
SetString( n, items[i] );
m_itemsClientData.Insert(NULL, n);
AssignNewItemClientData(n, clientData, i, type);
}
return n;
}
示例6: defined
/* static */
const wxChar *wxApp::GetRegisteredClassName(const wxChar *name,
int bgBrushCol,
int extraStyles)
{
const size_t count = gs_regClassesInfo.size();
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
for ( size_t n = 0; n < count; n++ )
{
if ( gs_regClassesInfo[n].regname == name )
return gs_regClassesInfo[n].regname.c_str();
}
// we need to register this class
WNDCLASS wndclass;
wxZeroMemory(wndclass);
wndclass.lpfnWndProc = (WNDPROC)wxWndProc;
wndclass.hInstance = wxGetInstance();
wndclass.hCursor = ::LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)wxUIntToPtr(bgBrushCol + 1);
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | extraStyles;
ClassRegInfo regClass(name);
wndclass.lpszClassName = regClass.regname.t_str();
if ( !::RegisterClass(&wndclass) )
{
wxLogLastError(wxString::Format(wxT("RegisterClass(%s)"),
regClass.regname));
return NULL;
}
wndclass.style &= ~(CS_HREDRAW | CS_VREDRAW);
wndclass.lpszClassName = regClass.regnameNR.t_str();
if ( !::RegisterClass(&wndclass) )
{
wxLogLastError(wxString::Format(wxT("RegisterClass(%s)"),
regClass.regname));
::UnregisterClass(regClass.regname.c_str(), wxGetInstance());
return NULL;
}
gs_regClassesInfo.push_back(regClass);
// take care to return the pointer which will remain valid after the
// function returns (it could be invalidated later if new elements are
// added to the vector and it's reallocated but this shouldn't matter as
// this pointer should be used right now, not stored)
return gs_regClassesInfo.back().regname.t_str();
}
示例7: wxASSERT_MSG
/* static */
size_t wxDIB::ConvertFromBitmap(BITMAPINFO *pbi, HBITMAP hbmp)
{
wxASSERT_MSG( hbmp, wxT("invalid bmp can't be converted to DIB") );
// prepare all the info we need
BITMAP bm;
if ( !::GetObject(hbmp, sizeof(bm), &bm) )
{
wxLogLastError(wxT("GetObject(bitmap)"));
return 0;
}
// we need a BITMAPINFO anyhow and if we're not given a pointer to it we
// use this one
BITMAPINFO bi2;
const bool wantSizeOnly = pbi == NULL;
if ( wantSizeOnly )
pbi = &bi2;
// just for convenience
const int h = bm.bmHeight;
// init the header
BITMAPINFOHEADER& bi = pbi->bmiHeader;
wxZeroMemory(bi);
bi.biSize = sizeof(BITMAPINFOHEADER);
bi.biWidth = bm.bmWidth;
bi.biHeight = h;
bi.biPlanes = 1;
bi.biBitCount = bm.bmBitsPixel;
// memory we need for BITMAPINFO only
DWORD dwLen = bi.biSize + GetNumberOfColours(bm.bmBitsPixel) * sizeof(RGBQUAD);
// get either just the image size or the image bits
if ( !::GetDIBits
(
ScreenHDC(), // the DC to use
hbmp, // the source DDB
0, // first scan line
h, // number of lines to copy
wantSizeOnly ? NULL // pointer to the buffer or
: (char *)pbi + dwLen, // NULL if we don't have it
pbi, // bitmap header
DIB_RGB_COLORS // or DIB_PAL_COLORS
) )
{
wxLogLastError(wxT("GetDIBits()"));
return 0;
}
// return the total size
return dwLen + bi.biSizeImage;
}
示例8: delete
// save system data
HRESULT
wxIDataObject::SaveSystemData(FORMATETC *pformatetc,
STGMEDIUM *pmedium,
BOOL fRelease)
{
if ( pformatetc == NULL || pmedium == NULL )
return E_INVALIDARG;
// remove entry if already available
for ( SystemData::iterator it = m_systemData.begin();
it != m_systemData.end();
++it )
{
if ( pformatetc->tymed & (*it)->pformatetc->tymed &&
pformatetc->dwAspect == (*it)->pformatetc->dwAspect &&
pformatetc->cfFormat == (*it)->pformatetc->cfFormat )
{
delete (*it);
m_systemData.erase(it);
break;
}
}
// create new format/medium
FORMATETC* pnewformatEtc = new FORMATETC;
STGMEDIUM* pnewmedium = new STGMEDIUM;
wxZeroMemory(*pnewformatEtc);
wxZeroMemory(*pnewmedium);
// copy format
*pnewformatEtc = *pformatetc;
// copy or take ownerschip of medium
if ( fRelease )
*pnewmedium = *pmedium;
else
wxCopyStgMedium(pmedium, pnewmedium);
// save entry
m_systemData.push_back(new SystemDataEntry(pnewformatEtc, pnewmedium));
return S_OK;
}
示例9: wxZeroMemory
wxToolkitInfo& wxAppTraits::GetToolkitInfo()
{
// cache the version info, it's not going to change
//
// NB: this is MT-safe, we may use these static vars from different threads
// but as they always have the same value it doesn't matter
static int s_ver = -1,
s_major = -1,
s_minor = -1;
if ( s_ver == -1 )
{
OSVERSIONINFO info;
wxZeroMemory(info);
s_ver = wxWINDOWS;
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if ( ::GetVersionEx(&info) )
{
s_major = info.dwMajorVersion;
s_minor = info.dwMinorVersion;
#ifdef __SMARTPHONE__
s_ver = wxWINDOWS_SMARTPHONE;
#elif defined(__POCKETPC__)
s_ver = wxWINDOWS_POCKETPC;
#else
switch ( info.dwPlatformId )
{
case VER_PLATFORM_WIN32s:
s_ver = wxWIN32S;
break;
case VER_PLATFORM_WIN32_WINDOWS:
s_ver = wxWIN95;
break;
case VER_PLATFORM_WIN32_NT:
s_ver = wxWINDOWS_NT;
break;
#ifdef __WXWINCE__
case VER_PLATFORM_WIN32_CE:
s_ver = wxWINDOWS_CE;
#endif
}
#endif
}
}
static wxToolkitInfo info;
info.versionMajor = s_major;
info.versionMinor = s_minor;
info.os = s_ver;
info.name = _T("wxBase");
return info;
}
示例10: GetMenuState
UINT GetMenuState(HMENU hMenu, UINT id, UINT flags)
{
MENUITEMINFO info;
wxZeroMemory(info);
info.cbSize = sizeof(info);
info.fMask = MIIM_STATE;
// MF_BYCOMMAND is zero so test MF_BYPOSITION
if ( !::GetMenuItemInfo(hMenu, id, flags & MF_BYPOSITION ? TRUE : FALSE , & info) )
wxLogLastError(wxT("GetMenuItemInfo"));
return info.fState;
}
示例11: wxZeroMemory
int wxCheckListBox::DoAppend(const wxString& item)
{
int n = (int)GetCount();
LVITEM newItem;
wxZeroMemory(newItem);
newItem.iItem = n;
int ret = ListView_InsertItem( (HWND)GetHWND(), & newItem );
wxCHECK_MSG( n == ret , -1, _T("Item not added") );
SetString( ret , item );
m_itemsClientData.Insert(NULL, ret);
return ret;
}
示例12: wxZeroMemory
int wxScrollBar::GetThumbPosition(void) const
{
SCROLLINFO scrollInfo;
wxZeroMemory(scrollInfo);
scrollInfo.cbSize = sizeof(SCROLLINFO);
scrollInfo.fMask = SIF_POS;
if ( !::GetScrollInfo(GetHwnd(), SB_CTL, &scrollInfo) )
{
wxLogLastError(wxT("GetScrollInfo"));
}
return scrollInfo.nPos;
}
示例13: SetDefaultMenuItem
// make the given menu item default
static void SetDefaultMenuItem(HMENU WXUNUSED_IN_WINCE(hmenu),
UINT WXUNUSED_IN_WINCE(id))
{
#ifndef __WXWINCE__
MENUITEMINFO mii;
wxZeroMemory(mii);
mii.cbSize = sizeof(MENUITEMINFO);
mii.fMask = MIIM_STATE;
mii.fState = MFS_DEFAULT;
if ( !::SetMenuItemInfo(hmenu, id, FALSE, &mii) )
{
wxLogLastError(wxT("SetMenuItemInfo"));
}
#endif
}
示例14: wxCHECK_RET
void wxCheckListBox::DoInsertItems(const wxArrayString& items, unsigned int pos)
{
wxCHECK_RET( IsValidInsert( pos ),
wxT("invalid index in wxListBox::InsertItems") );
for( unsigned int i = 0; i < items.GetCount(); i++ )
{
LVITEM newItem;
wxZeroMemory(newItem);
newItem.iItem = i+pos;
int ret = ListView_InsertItem( (HWND)GetHWND(), & newItem );
wxASSERT_MSG( int(i+pos) == ret , _T("Item not added") );
SetString( ret , items[i] );
m_itemsClientData.Insert(NULL, ret);
}
}
示例15: necesssary
/*
Creates a hidden window with supplied window proc registering the class for
it if necesssary (i.e. the first time only). Caller is responsible for
destroying the window and unregistering the class (note that this must be
done because wxWidgets may be used as a DLL and so may be loaded/unloaded
multiple times into/from the same process so we cna't rely on automatic
Windows class unregistration).
pclassname is a pointer to a caller stored classname, which must initially be
NULL. classname is the desired wndclass classname. If function successfully
registers the class, pclassname will be set to classname.
*/
extern "C" WXDLLIMPEXP_BASE HWND
wxCreateHiddenWindow(LPCTSTR *pclassname, LPCTSTR classname, WNDPROC wndproc)
{
wxCHECK_MSG( classname && pclassname && wndproc, NULL,
_T("NULL parameter in wxCreateHiddenWindow") );
// register the class fi we need to first
if ( *pclassname == NULL )
{
WNDCLASS wndclass;
wxZeroMemory(wndclass);
wndclass.lpfnWndProc = wndproc;
wndclass.hInstance = wxGetInstance();
wndclass.lpszClassName = classname;
if ( !::RegisterClass(&wndclass) )
{
wxLogLastError(wxT("RegisterClass() in wxCreateHiddenWindow"));
return NULL;
}
*pclassname = classname;
}
// next create the window
HWND hwnd = ::CreateWindow
(
*pclassname,
NULL,
0, 0, 0, 0,
0,
(HWND) NULL,
(HMENU)NULL,
wxGetInstance(),
(LPVOID) NULL
);
if ( !hwnd )
{
wxLogLastError(wxT("CreateWindow() in wxCreateHiddenWindow"));
}
return hwnd;
}