您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GlobalReAlloc函数代码示例

51自学网 2021-06-01 21:18:57
  C++
这篇教程C++ GlobalReAlloc函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GlobalReAlloc函数的典型用法代码示例。如果您正苦于以下问题:C++ GlobalReAlloc函数的具体用法?C++ GlobalReAlloc怎么用?C++ GlobalReAlloc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GlobalReAlloc函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SelPrinter

void SelPrinter(HWND hDlg){  PRINTDLG pd;  ZeroMemory(&pd,sizeof(PRINTDLG));  pd.lStructSize = sizeof(PRINTDLG);  pd.hwndOwner = hDlg;  HGLOBAL hNewDevMode = NULL;  HGLOBAL hNewDevNames = NULL;  if(hDevMode != NULL && hDevNames != NULL){    int size = GetSizeOfDevMode(hDevMode);    hNewDevMode = GlobalAlloc(GHND,size);    GlobalCpy(hNewDevMode,hDevMode,size);    size = GetSizeOfDevNames(hDevNames);    hNewDevNames = GlobalAlloc(GHND,size);    GlobalCpy(hNewDevNames,hDevNames,size);  }  pd.hDevMode = hNewDevMode;  pd.hDevNames = hNewDevNames;  pd.Flags = PD_USEDEVMODECOPIESANDCOLLATE | PD_RETURNDC |              PD_NOPAGENUMS | PD_NOSELECTION | PD_HIDEPRINTTOFILE;  pd.nCopies = GetCurrentPrinterCopies();  pd.nFromPage = 1;  pd.nToPage = 1;  pd.nMinPage = 1;  pd.nMaxPage = 1;  if(PrintDlg(&pd)){    if(hPrintDC != NULL){      DeleteDC(hPrintDC);    }    hPrintDC = pd.hDC;    int size = GetSizeOfDevMode(pd.hDevMode);    if(hDevMode != NULL){      GlobalReAlloc(hDevMode,size,0);    }else{      hDevMode = GlobalAlloc(GHND,size);    }    GlobalCpy(hDevMode,pd.hDevMode,size);        size = GetSizeOfDevNames(pd.hDevNames);    if(hDevNames != NULL){      GlobalReAlloc(hDevNames,size,0);    }else{      hDevNames = GlobalAlloc(GHND,size);    }    GlobalCpy(hDevNames,pd.hDevNames,size);  }  SetCurrentDirectoryToExePath();  if(pd.hDevMode != NULL){    GlobalFree(pd.hDevMode);  }  if(pd.hDevMode != NULL){    GlobalFree(pd.hDevMode);  }}
开发者ID:pjmtdw,项目名称:kazesomiso,代码行数:59,


示例2: GlobalUnlock

UBOOL AfoDetectResize    (LPAFODETECT_STR lpafoDetectStr){    // If there is no more room, ...    if (lpafoDetectStr->uLineStrCnt EQ lpafoDetectStr->uLineStrNxt)    {        HGLOBAL hGlbLineStr;        // Unlock the global memory handle so we may resize it        GlobalUnlock (lpafoDetectStr->hGlbLineStr);        // Reallocate the AFOLINE_STR        //   moving the old data to the new location, and        //   freeing the old global memory        hGlbLineStr =          GlobalReAlloc (lpafoDetectStr->hGlbLineStr,                          (lpafoDetectStr->uLineStrCnt + AFOLINESTR_INCR) * sizeof (AFOLINE_STR),                          GMEM_MOVEABLE);        // Check for error        if (hGlbLineStr EQ NULL)            return FALSE;        // Save (possibly new) handle        lpafoDetectStr->hGlbLineStr  = hGlbLineStr;        lpafoDetectStr->lpafoLineStr = GlobalLock (hGlbLineStr);        return TRUE;    } else        return TRUE;} // End AfoDetectResize
开发者ID:PlanetAPL,项目名称:nars2000,代码行数:31,


示例3: HGLOBALStreamImpl_SetSize

/*** * This method is part of the IStream interface. * * It will change the size of a stream. * * TODO: Switch from small blocks to big blocks and vice versa. * * See the documentation of IStream for more info. */static HRESULT WINAPI HGLOBALStreamImpl_SetSize(				     IStream*      iface,				     ULARGE_INTEGER  libNewSize)   /* [in] */{  HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface;  HGLOBAL supportHandle;  TRACE("(%p, %d)/n", iface, libNewSize.u.LowPart);  /*   * HighPart is ignored as shown in tests   */  if (This->streamSize.u.LowPart == libNewSize.u.LowPart)    return S_OK;  /*   * Re allocate the HGlobal to fit the new size of the stream.   */  supportHandle = GlobalReAlloc(This->supportHandle, libNewSize.u.LowPart, 0);  if (supportHandle == 0)    return E_OUTOFMEMORY;  This->supportHandle = supportHandle;  This->streamSize.u.LowPart = libNewSize.u.LowPart;  return S_OK;}
开发者ID:MichaelMcDonnell,项目名称:wine,代码行数:38,


示例4: sizeof

long	UPSF::xxxx_To_UClr(	HGLOBAL&	hUniv,	long&			univSize,	long			natv,	void*			natvPtr,	long			natvLen)	{	univSize = sizeof(short)*3L;	if(!(hUniv = GlobalReAlloc(hUniv, univSize, MEMFLAGS)))		return AUPSF_MEMORYERROR;	short*	univPtr = (short*)GlobalLock(hUniv);	if(!univPtr)		return AUPSF_MEMORYERROR;  long	retValue;	if(natv==AUPSF_NATV_RGBCOLOR)		{		if(natvLen != sizeof(COLORREF))			retValue = AUPSF_SIZEERROR;    else			retValue = RGBColor_To_UClr(univPtr, *(COLORREF*)natvPtr);    }	else		retValue = AUPSF_CANTCONVERT;	GlobalUnlock(hUniv);	return retValue;	}
开发者ID:benbucksch,项目名称:AppWare,代码行数:31,


示例5: add_message

static void add_message(const struct message *msg){    if (!sequence) {        sequence_size = 10;        sequence =            (struct message *) GlobalAlloc(GMEM_DISCARDABLE,                                           sequence_size *                                           sizeof(struct message));    }    if (sequence_cnt == sequence_size) {        sequence_size *= 2;        sequence =            (struct message *) GlobalReAlloc((char NEAR *) sequence,                                             sequence_size *                                             sizeof(struct message)                                             , GMEM_DISCARDABLE);    }    assert(sequence);    sequence[sequence_cnt].message = msg->message;    sequence[sequence_cnt].flags = msg->flags;    sequence[sequence_cnt].wParam = msg->wParam;    sequence[sequence_cnt].lParam = msg->lParam;    sequence_cnt++;}
开发者ID:BackupGGCode,项目名称:win16test,代码行数:25,


示例6: defined

/* * MemReAlloc - allocate some memory */void *MemReAlloc( void *ptr, unsigned size ){    void *x;#ifndef __OS2_PM__#if defined( DEBUGMEM )    GLOBALHANDLE        h;    h = GlobalHandle( FP_SEG( ptr ) );    GlobalUnlock( h );    x = GlobalLock( GlobalReAlloc( h, size, GMEM_ZEROINIT | GMEM_MOVEABLE ) );#else    x = realloc( ptr, size );#endif#else    x = realloc( ptr, size );#endif#if defined( WANT_MSGS )    if( x == NULL ) {        MessageBox( HWND_DESKTOP, "AUUGH, Null Pointer", "Memory Allocation",                    MB_OK | MB_ICONHAND | MB_SYSTEMMODAL );    }#endif    return( x );} /* MemReAlloc */
开发者ID:hubei,项目名称:open-watcom,代码行数:28,


示例7:

long	UPSF::xxxx_To_UFon(	HGLOBAL&	hUniv,	long&			univSize,	long			natv,	void*			natvPtr,	long			natvLen)	{	univSize = natvLen;	if(!(hUniv = GlobalReAlloc(hUniv, univSize, MEMFLAGS)))		return AUPSF_MEMORYERROR;	long*	univPtr = (long*)GlobalLock(hUniv);	if(!univPtr)		return AUPSF_MEMORYERROR;	long	retValue = AUPSF_NOERROR;	if(natv==AUPSF_NATV_FONT)		{		// just store the font name--each platform will convert on import		// the attributes will be stored separately		hmemcpy(univPtr, natvPtr, natvLen);		}	else		retValue = AUPSF_CANTCONVERT;	GlobalUnlock(hUniv);	return retValue;	}
开发者ID:benbucksch,项目名称:AppWare,代码行数:30,


示例8: SetHandleSize

void SetHandleSize (Handle handle, size_t newSize){	Ptr p;	HANDLE hMem;	memError = noErr;	if (handle)	{		p = *handle;		if (p)		{			GlobalUnlockPtr (p);			hMem = GlobalReAlloc (GlobalPtrHandle (p), newSize, GHND);				if (hMem)				p = (Ptr)GlobalLock (hMem);			else				p = NULL;		} 		if (p)			*handle = p;		else			memError = memFullErr;	}	else		memError = memWZErr;}
开发者ID:jxfengzi,项目名称:AirPhoto,代码行数:35,


示例9: HGLOBALLockBytesImpl_SetSize

/****************************************************************************** * This method is part of the ILockBytes interface. * * It will change the size of the byte array. * * See the documentation of ILockBytes for more info. */static HRESULT WINAPI HGLOBALLockBytesImpl_SetSize(      ILockBytes*     iface,      ULARGE_INTEGER  libNewSize)   /* [in] */{  HGLOBALLockBytesImpl* const This=(HGLOBALLockBytesImpl*)iface;  HGLOBAL supportHandle;  /*   * As documented.   */  if (libNewSize.u.HighPart != 0)    return STG_E_INVALIDFUNCTION;  if (This->byteArraySize.u.LowPart == libNewSize.u.LowPart)    return S_OK;  /*   * Re allocate the HGlobal to fit the new size of the stream.   */  supportHandle = GlobalReAlloc(This->supportHandle, libNewSize.u.LowPart, 0);  if (supportHandle == 0)    return STG_E_MEDIUMFULL;  This->supportHandle = supportHandle;  This->byteArraySize.u.LowPart = libNewSize.u.LowPart;  return S_OK;}
开发者ID:howard5888,项目名称:wineT,代码行数:36,


示例10: AllocRoomForDIB

HANDLE AllocRoomForDIB(BITMAPINFOHEADER bi, HBITMAP hBitmap){    DWORD               dwLen;    HANDLE              hDIB;    HDC                 hDC;    LPBITMAPINFOHEADER  lpbi;    HANDLE              hTemp;    // Figure out the size needed to hold the BITMAPINFO structure    // (which includes the BITMAPINFOHEADER and the color table).    dwLen = bi.biSize + PaletteSize((LPSTR) &bi);    hDIB  = GlobalAlloc(GHND,dwLen);    // Check that DIB handle is valid    if (!hDIB)        return NULL;    // Set up the BITMAPINFOHEADER in the newly allocated global memory,    // then call GetDIBits() with lpBits = NULL to have it fill in the    // biSizeImage field for us.    lpbi  = (LPBITMAPINFOHEADER)GlobalLock(hDIB);    *lpbi = bi;    hDC   = GetDC(NULL);    GetDIBits(hDC, hBitmap, 0, (UINT) bi.biHeight, NULL, (LPBITMAPINFO)lpbi,            DIB_RGB_COLORS);    ReleaseDC(NULL, hDC);    // If the driver did not fill in the biSizeImage field,    // fill it in -- NOTE: this is a bug in the driver!        if (lpbi->biSizeImage == 0)        lpbi->biSizeImage = WIDTHBYTES((DWORD)lpbi->biWidth *                lpbi->biBitCount) * lpbi->biHeight;    // Get the size of the memory block we need    dwLen = lpbi->biSize + PaletteSize((LPSTR) &bi) + lpbi->biSizeImage;    // Unlock the memory block    GlobalUnlock(hDIB);    // ReAlloc the buffer big enough to hold all the bits     if (hTemp = GlobalReAlloc(hDIB,dwLen,0))        return hTemp;    else    {        // Else free memory block and return failure        GlobalFree(hDIB);        return NULL;    }}
开发者ID:CyberShadow,项目名称:Ditto,代码行数:59,


示例11: MyReAlloc

//********************************************************************Handle MyReAlloc(Handle hMem,				uint32_t dwSize,				uint32_t dwFlag){	return CFIO_ReAlloc?		CFIO_ReAlloc(hMem, dwSize, dwFlag):		GlobalReAlloc(hMem, dwSize, dwFlag);}
开发者ID:PauloMigAlmeida,项目名称:cuneiform,代码行数:9,


示例12: My_GlobalReAlloc

BOOL My_GlobalReAlloc(){	HGLOBAL hMem=NULL;	SIZE_T dwBytes=NULL;	UINT uFlags=NULL;	HGLOBAL returnVal_Real = NULL;	HGLOBAL returnVal_Intercepted = NULL;	DWORD error_Real = 0;	DWORD error_Intercepted = 0;	__try{	disableInterception();	returnVal_Real = GlobalReAlloc (hMem,dwBytes,uFlags);	error_Real = GetLastError();	enableInterception();	returnVal_Intercepted = GlobalReAlloc (hMem,dwBytes,uFlags);	error_Intercepted = GetLastError();	}__except(puts("in filter"), 1){puts("exception caught");}	return ((returnVal_Real == returnVal_Intercepted) && (error_Real == error_Intercepted));}
开发者ID:IFGHou,项目名称:Holodeck,代码行数:20,


示例13: gmem_realloc

static HGLOBAL gmem_realloc(HGLOBAL *hg, unsigned size){ HGLOBAL hn; if (hn = *hg? GlobalReAlloc(*hg, size, loGMEM_FLAG):               GlobalAlloc(loGMEM_FLAG, size)) *hg = hn;/* else   {    UL_WARNING((LOGID, "%!L gmem_alloc(%u) FAILED", size));   }*/ return hn;}
开发者ID:Nerovi,项目名称:LightOPC,代码行数:11,


示例14: GlobalAlloc

void CMenuSpawn::AddImageItem(const int idx, WORD cmd){	if (iImageItem == 0)		pImageItem = (ImageItem *) GlobalAlloc(GPTR, sizeof(ImageItem));	else		pImageItem = (ImageItem *) GlobalReAlloc((HGLOBAL) pImageItem, sizeof(ImageItem) * (iImageItem + 1), GMEM_MOVEABLE|GMEM_ZEROINIT);		ASSERT(pImageItem);	pImageItem[iImageItem].iCmd = (int) cmd;	pImageItem[iImageItem].iImageIdx = idx;	iImageItem ++;}
开发者ID:axxapp,项目名称:winxgui,代码行数:12,


示例15: _TIFFrealloc

tdata_t_TIFFrealloc(tdata_t p, tsize_t s){	void* pvTmp;	if ((pvTmp = GlobalReAlloc(p, s, 0)) == NULL) {		if ((pvTmp = GlobalAlloc(GMEM_FIXED, s)) != NULL) {			CopyMemory(pvTmp, p, GlobalSize(p));			GlobalFree(p);		}	}	return ((tdata_t)pvTmp);}
开发者ID:shivshankardayal,项目名称:Universal-C-C--,代码行数:12,


示例16: prim_globalReAlloc

void* prim_globalReAlloc(HGLOBAL arg1,DWORD arg2,UINT arg3){ static struct {HsPtr res1;HsInt gc_failed;HsPtr gc_failstring;} gc_result;  HGLOBAL res1;int gc_failed;	       char* gc_failstring;  do {res1 = GlobalReAlloc(arg1, arg2, arg3);      if ((gc_failed = ( res1==NULL ))) {gc_failstring = ErrorWin("GlobalReAlloc") ;}      else {gc_failed = 0;}      gc_result.res1 = (HGLOBAL)(res1);      gc_result.gc_failed = gc_failed;      gc_result.gc_failstring = gc_failstring;            return(&gc_result);} while(0);}
开发者ID:ygmpkk,项目名称:house,代码行数:13,


示例17: get_rtf_text

static HGLOBAL get_rtf_text(ME_TextEditor *editor, const ME_Cursor *start, int nChars){    EDITSTREAM es;    ME_GlobalDestStruct gds;    gds.hData = GlobalAlloc(GMEM_MOVEABLE, 0);    gds.nLength = 0;    es.dwCookie = (DWORD_PTR)&gds;    es.pfnCallback = ME_AppendToHGLOBAL;    ME_StreamOutRange(editor, SF_RTF, start, nChars, &es);    GlobalReAlloc(gds.hData, gds.nLength+1, 0);    return gds.hData;}
开发者ID:AlexSteel,项目名称:wine,代码行数:13,


示例18: AddScriptCmdArgs

void AddScriptCmdArgs(const TCHAR *arg){  g_sdata.script_cmd_args = GlobalReAlloc(g_sdata.script_cmd_args,    GlobalSize(g_sdata.script_cmd_args) + (lstrlen(arg) + 2/* quotes */ + 1 /* space */)*sizeof(TCHAR),    0);  TCHAR *args = (TCHAR *) GlobalLock(g_sdata.script_cmd_args);  lstrcat(args, _T(" /""));  lstrcat(args, arg);  lstrcat(args, _T("/""));  GlobalUnlock(g_sdata.script_cmd_args);}
开发者ID:engineer0x47,项目名称:NSIS,代码行数:14,


示例19: ReAllocHGlobal

void _fastcall ReAllocHGlobal(ParamBlk *parm){	HGLOBAL hMem;	hMem = GlobalReAlloc((HGLOBAL)p1.ev_long,(SIZE_T)p2.ev_long,GMEM_MOVEABLE|GMEM_ZEROINIT);	if (hMem)	{		REPLACEDEBUGALLOC(p1.ev_long,hMem,p2.ev_long);				RET_INTEGER(hMem);	}	else	{		SAVEWIN32ERROR(GlobalReAlloc,GetLastError());		RAISEERROREX(0);	}}
开发者ID:akrisiun,项目名称:VfpProj,代码行数:15,


示例20: NoStatStreamImpl_SetSize

static HRESULT WINAPI NoStatStreamImpl_SetSize(				     IStream*      iface,				     ULARGE_INTEGER  libNewSize)   /* [in] */{  NoStatStreamImpl* const This=(NoStatStreamImpl*)iface;  HGLOBAL supportHandle;  if (libNewSize.u.HighPart != 0)    return STG_E_INVALIDFUNCTION;  if (This->streamSize.u.LowPart == libNewSize.u.LowPart)    return S_OK;  supportHandle = GlobalReAlloc(This->supportHandle, libNewSize.u.LowPart, 0);  if (supportHandle == 0)    return STG_E_MEDIUMFULL;  This->supportHandle = supportHandle;  This->streamSize.u.LowPart = libNewSize.u.LowPart;  return S_OK;}
开发者ID:howard5888,项目名称:wineT,代码行数:17,


示例21: IT_GLOBALREALLOC

voidIT_GLOBALREALLOC (ENV *envp,LONGPROC f)		/* GlobalReAlloc */{    UINT uiFlags, uSel;    HGLOBAL hGlobal;    LPBYTE  lpSeg;    WORD wSP=0,wBP=0;    DWORD dwNewSize;    uSel = GETWORD(SP+10) | 1;    uiFlags = (UINT)GETWORD(SP+4);    dwNewSize = GETDWORD(SP+6);    if (dwNewSize != 0) {#ifdef LATER	dwNewSize = max(dwNewSize,32);	dwNewSize = (dwNewSize + 31) & 0xffffffe0;#endif        	lpSeg = GetPhysicalAddress(uSel);	if (uSel == envp->reg.ss) {	    wSP = (WORD)(SP - lpSeg);	    wBP = (WORD)(BP - lpSeg);	}	uSel = TWIN_ReallocSelector(uSel,dwNewSize,uiFlags);	hGlobal = GetSelectorHandle(uSel);	if (uSel == envp->reg.ss) {	    envp->reg.sp = (REGISTER)(GetPhysicalAddress(uSel) + wSP);	    envp->reg.bp = (REGISTER)(GetPhysicalAddress(uSel) + wBP);	}	if (uiFlags & GMEM_MOVEABLE) {	    GlobalUnlock(hGlobal);	    uSel &= 0xfffe;	}    } else {	/* check if we are discarding, size 0,... */	hGlobal = GetSelectorHandle(uSel);	(void) GlobalReAlloc(hGlobal,0,uiFlags);    }    envp->reg.sp += HANDLE_86 + UINT_86 + DWORD_86 + RET_86;    envp->reg.ax = LOWORD(uSel);    envp->reg.dx = 0;}
开发者ID:ErisBlastar,项目名称:osfree,代码行数:45,


示例22: DownloadToMemory

LPBYTE DownloadToMemory(IN LPCTSTR lpszURL, OUT PDWORD_PTR lpSize){	LPBYTE lpszReturn = 0;	*lpSize = 0;	const HINTERNET hSession = InternetOpen(TEXT("GetGitHubRepositoryList"), INTERNET_OPEN_TYPE_PRECONFIG, 0, 0, INTERNET_FLAG_NO_COOKIES);	if (hSession)	{		URL_COMPONENTS uc = { 0 };		TCHAR HostName[MAX_PATH];		TCHAR UrlPath[MAX_PATH];		uc.dwStructSize = sizeof(uc);		uc.lpszHostName = HostName;		uc.lpszUrlPath = UrlPath;		uc.dwHostNameLength = MAX_PATH;		uc.dwUrlPathLength = MAX_PATH;		InternetCrackUrl(lpszURL, 0, 0, &uc);		const HINTERNET hConnection = InternetConnect(hSession, HostName, INTERNET_DEFAULT_HTTPS_PORT, 0, 0, INTERNET_SERVICE_HTTP, 0, 0);		if (hConnection)		{			const HINTERNET hRequest = HttpOpenRequest(hConnection, TEXT("GET"), UrlPath, 0, 0, 0, INTERNET_FLAG_SECURE | INTERNET_FLAG_RELOAD, 0);			if (hRequest)			{				HttpSendRequest(hRequest, 0, 0, 0, 0);				lpszReturn = (LPBYTE)GlobalAlloc(GMEM_FIXED, 1);				DWORD dwRead;				static BYTE szBuf[1024 * 4];				LPBYTE lpTmp;				for (;;)				{					if (!InternetReadFile(hRequest, szBuf, (DWORD)sizeof(szBuf), &dwRead) || !dwRead) break;					lpTmp = (LPBYTE)GlobalReAlloc(lpszReturn, (SIZE_T)(*lpSize + dwRead), GMEM_MOVEABLE);					if (lpTmp == NULL) break;					lpszReturn = lpTmp;					CopyMemory(lpszReturn + *lpSize, szBuf, dwRead);					*lpSize += dwRead;				}				InternetCloseHandle(hRequest);			}			InternetCloseHandle(hConnection);		}		InternetCloseHandle(hSession);	}	return lpszReturn;}
开发者ID:kenjinote,项目名称:GetGitHubRepositoryList,代码行数:44,


示例23: GlobalLock

long	UPSF::xxxx_To_xxxx(	HGLOBAL&	hUniv,	long&			univSize,	void*			natvPtr,	long			natvLen)	{	univSize = natvLen;	if((hUniv = GlobalReAlloc(hUniv, natvLen, MEMFLAGS))==NULL)		return AUPSF_MEMORYERROR;	void*	univPtr = GlobalLock(hUniv);	if(!univPtr)		return AUPSF_MEMORYERROR;	hmemcpy(univPtr, natvPtr, natvLen);	GlobalUnlock(hUniv);	return AUPSF_NOERROR;	}
开发者ID:benbucksch,项目名称:AppWare,代码行数:19,


示例24: GlobalReAllocP

HGLOBALGlobalReAllocP(    HGLOBAL hglbMem,    DWORD   cbBytes,    UINT    fuFlags){   HGLOBAL hReturn;   DWORD   dwBeforeSize = 0;   DWORD   dwAfterSize  = 0;   // get size of block before re-alloc-ing it   dwBeforeSize = (DWORD) GlobalSize(hglbMem);   if (dwBeforeSize > 0)   {      // size was obtained OK so realloc the block      hReturn = GlobalReAlloc(hglbMem, cbBytes, fuFlags);      if (hReturn != NULL)      {         // memory was re alloc'd so get the new size         dwAfterSize = (DWORD) GlobalSize(hReturn);      }      else      {         // memory was not re-alloced so set after size to 0      }      if (pAppData != NULL)      {         // update call count         pAppData->dwReAllocCalls ++;         pAppData->dwApplicationBytes -= dwBeforeSize;         pAppData->dwApplicationBytes += dwAfterSize;      }   }   else   {      // unable to read memory size nothing has changed      // return original pointer      hReturn = hglbMem;   }   return hReturn;}
开发者ID:SatishSara,项目名称:zxlooong,代码行数:42,


示例25: ME_AppendToHGLOBAL

static DWORD CALLBACK ME_AppendToHGLOBAL(DWORD_PTR dwCookie, LPBYTE lpBuff, LONG cb, LONG *pcb){    ME_GlobalDestStruct *pData = (ME_GlobalDestStruct *)dwCookie;    int nMaxSize;    BYTE *pDest;    nMaxSize = GlobalSize(pData->hData);    if (pData->nLength+cb+1 >= cb) {        /* round up to 2^17 */        int nNewSize = (((nMaxSize+cb+1)|0x1FFFF)+1) & 0xFFFE0000;        pData->hData = GlobalReAlloc(pData->hData, nNewSize, 0);    }    pDest = GlobalLock(pData->hData);    memcpy(pDest + pData->nLength, lpBuff, cb);    pData->nLength += cb;    pDest[pData->nLength] = '/0';    GlobalUnlock(pData->hData);    *pcb = cb;    return 0;}
开发者ID:AlexSteel,项目名称:wine,代码行数:21,


示例26: My_GlobalReAlloc

bool My_GlobalReAlloc(HGLOBAL ret, DWORD error){	HGLOBAL dwRet = 0;	////	dwRet = GlobalReAlloc(GlobalAlloc(GMEM_MOVEABLE, 2), 2, GMEM_MODIFY);	if (dwRet != ret)		goto FAILED;	if (!checkErrorCode(error))		goto FAILED;	uninterceptedPrint("GlobalReAlloc PASSED!/n");return TRUE;FAILED:	uninterceptedPrint("GlobalReAlloc FAILED!/n");	return FALSE;}
开发者ID:IFGHou,项目名称:Holodeck,代码行数:21,



注:本文中的GlobalReAlloc函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ GlobalRegistry函数代码示例
C++ GlobalRNG函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。