当前位置: 首页>>代码示例>>C++>>正文


C++ LocalLock函数代码示例

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


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

示例1: PROGRAM_ModifyProgram

VOID PROGRAM_ModifyProgram(HLOCAL hProgram)
{
  PROGRAM *program = LocalLock(hProgram);
  CHAR szName[MAX_PATHNAME_LEN];
  CHAR szCmdLine[MAX_PATHNAME_LEN];
  CHAR szIconFile[MAX_PATHNAME_LEN];
  CHAR szWorkDir[MAX_PATHNAME_LEN];

  lstrcpyn(szName, LocalLock(program->hName), MAX_PATHNAME_LEN);
  lstrcpyn(szCmdLine, LocalLock(program->hCmdLine), MAX_PATHNAME_LEN);
  lstrcpyn(szIconFile, LocalLock(program->hIconFile), MAX_PATHNAME_LEN);
  lstrcpyn(szWorkDir, LocalLock(program->hWorkDir), MAX_PATHNAME_LEN);

  if (!DIALOG_ProgramAttributes(szName, szCmdLine, szWorkDir, szIconFile,
				&program->hIcon, &program->nIconIndex,
				&program->nHotKey, &program->nCmdShow,
				MAX_PATHNAME_LEN))
    return;

  MAIN_ReplaceString(&program->hName, szName);
  MAIN_ReplaceString(&program->hCmdLine, szCmdLine);
  MAIN_ReplaceString(&program->hIconFile, szIconFile);
  MAIN_ReplaceString(&program->hWorkDir, szWorkDir);

  SetWindowText(program->hWnd, szName);
  UpdateWindow(program->hWnd);

  GRPFILE_WriteGroupFile(program->hGroup);

  return;
}
开发者ID:Sunmonds,项目名称:wine,代码行数:31,代码来源:program.c

示例2: PROGRAM_ProgramName

LPCSTR PROGRAM_ProgramName(HLOCAL hProgram)
{
  PROGRAM *program;
  if (!hProgram) return(0);
  program = LocalLock(hProgram);
  return(LocalLock(program->hName));
}
开发者ID:Sunmonds,项目名称:wine,代码行数:7,代码来源:program.c

示例3: GRPFILE_WriteGroupFile

BOOL GRPFILE_WriteGroupFile(HLOCAL hGroup)
{
  CHAR szPath[MAX_PATHNAME_LEN];
  PROGGROUP *group = LocalLock(hGroup);
  OFSTRUCT dummy;
  HFILE file;
  BOOL ret;

  GRPFILE_ModifyFileName(szPath, LocalLock(group->hGrpFile),
			 MAX_PATHNAME_LEN,
			 group->bFileNameModified);

  /* Try not to overwrite original files */

  /* group->bOverwriteFileOk == TRUE only if a file has the modified format */
  if (!group->bOverwriteFileOk &&
      OpenFile(szPath, &dummy, OF_EXIST) != HFILE_ERROR)
    {
      /* Original file exists, try `.gr' extension */
      GRPFILE_ModifyFileName(szPath, LocalLock(group->hGrpFile),
			     MAX_PATHNAME_LEN, TRUE);
      if (OpenFile(szPath, &dummy, OF_EXIST) != HFILE_ERROR)
	{
	  /* File exists. Do not overwrite */
	  MAIN_MessageBoxIDS_s(IDS_FILE_NOT_OVERWRITTEN_s, szPath,
			       IDS_INFO, MB_OK);
	  return FALSE;
	}
      /* Inform about the modified file name */
      if (IDCANCEL ==
	  MAIN_MessageBoxIDS_s(IDS_SAVE_GROUP_AS_s, szPath, IDS_INFO,
			       MB_OKCANCEL | MB_ICONINFORMATION))
	return FALSE;
    }

  {
    /* Warn about the (possible) incompatibility */
    CHAR msg[MAX_PATHNAME_LEN + 200];
    wsprintf(msg,
	     "Group files written by this DRAFT Program Manager "
	     "possibly cannot be read by the Microsoft Program Manager!!\n"
	     "Are you sure to write %s?", szPath);
    if (IDOK != MessageBox(Globals.hMainWnd, msg, "WARNING",
			   MB_OKCANCEL | MB_DEFBUTTON2)) return FALSE;
  }

  /* Open file */
  file = _lcreat(szPath, 0);
  if (file != HFILE_ERROR)
    {
      ret = GRPFILE_DoWriteGroupFile(file, group);
      _lclose(file);
    }
  else ret = FALSE;

  if (!ret)
    MAIN_MessageBoxIDS_s(IDS_FILE_WRITE_ERROR_s, szPath, IDS_ERROR, MB_OK);

  return(ret);
}
开发者ID:Sunmonds,项目名称:wine,代码行数:60,代码来源:grpfile.c

示例4: GROUP_GroupName

LPCSTR GROUP_GroupName(HLOCAL hGroup)
{
  PROGGROUP *group;
  if (!hGroup) return(0);
  group = LocalLock(hGroup);
  return(LocalLock(group->hName));
}
开发者ID:Sunmonds,项目名称:wine,代码行数:7,代码来源:group.c

示例5: MyQueryValue

unsigned long NEAR PASCAL MyQueryValue(HKEY hKey, PSTR pSubKey, HANDLE *hBuf)
{
   HANDLE hTemp;
   PSTR pBuf;
   WORD wBufSize = BLOCKLEN;
   unsigned long result = ERROR_OUTOFMEMORY;
   LONG lSize;

   if(!(*hBuf=LocalAlloc(LMEM_MOVEABLE, wBufSize)))
      goto Error1;
   if(!(pBuf=LocalLock(*hBuf)))
      goto Error2;

   while((lSize=wBufSize, (result=RegQueryValue(hKey, pSubKey, pBuf, &lSize))
         ==ERROR_SUCCESS) && (WORD)lSize>wBufSize-10) {
      LocalUnlock(*hBuf);
      wBufSize += BLOCKLEN;
      if(!(hTemp=LocalReAlloc(*hBuf, wBufSize, LMEM_MOVEABLE))) {
         result = ERROR_OUTOFMEMORY;
         goto Error2;
      }
      pBuf = LocalLock(*hBuf=hTemp);
   }
   LocalUnlock(*hBuf);
   if(result!=ERROR_SUCCESS || !lSize)
      goto Error2;
   goto Error1;

Error2:
   LocalFree(*hBuf);
   *hBuf = NULL;
Error1:
   return(result);
}
开发者ID:chunhualiu,项目名称:OpenNT,代码行数:34,代码来源:cutils1.c

示例6: MyEnumKey

unsigned long NEAR PASCAL MyEnumKey(HKEY hKey, WORD wIndex, HANDLE *hBuf)
{
   HANDLE hTemp;
   PSTR pBuf;
   WORD wBufSize = BLOCKLEN, wSize;
   unsigned long result = ERROR_OUTOFMEMORY;

   if(!(*hBuf=LocalAlloc(LMEM_MOVEABLE, wBufSize)))
      goto Error1;
   if(!(pBuf=LocalLock(*hBuf)))
      goto Error2;

   while((result=RegEnumKey(hKey, wIndex, pBuf, (DWORD)wBufSize))
         ==ERROR_SUCCESS && (wSize=lstrlen(pBuf))>wBufSize-10) {
      LocalUnlock(*hBuf);
      wBufSize += BLOCKLEN;
      if(!(hTemp=LocalReAlloc(*hBuf, wBufSize, LMEM_MOVEABLE))) {
         result = ERROR_OUTOFMEMORY;
         goto Error2;
      }
      pBuf = LocalLock(*hBuf=hTemp);
   }
   LocalUnlock(*hBuf);
   if(result!=ERROR_SUCCESS || !wSize)
      goto Error2;
   goto Error1;

Error2:
   LocalFree(*hBuf);
   *hBuf = NULL;
Error1:
   return(result);
}
开发者ID:chunhualiu,项目名称:OpenNT,代码行数:33,代码来源:cutils1.c

示例7: HandleSetHandlePrintHex

static
VOID
HandleSetHandlePrintHex(HWND handle,DWORD Msg,WPARAM wParam,LPARAM lParam)
    {
      LPVOID pMem;
      HANDLE hNewBuffer;
      int ret;

      LocalFree((HLOCAL)SendMessage(handle, EM_GETHANDLE, 0, 0L));
      if (UnicodeUsed)
          {
            hNewBuffer = LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT, 100);
            pMem = LocalLock(hNewBuffer);
            strcpyw_((wchar_t*)pMem,NewTextW);
          }
      else
          {
            hNewBuffer = LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT,50);
            pMem = LocalLock(hNewBuffer);
            strcpy_((char*)pMem,NewText);
          }

      LocalUnlock(pMem);
      hNewBuffer = LocalHandle(pMem);

	  /* Updates the buffer and displays new buffer */
      ret =  SendMessage(handle, EM_SETHANDLE, (WPARAM)hNewBuffer, 0L);

      htoa(ret,&TextBuffer[8]);
      PrintTextXY(TextBuffer,ResultX,ResultY,16);
    }
开发者ID:hoangduit,项目名称:reactos,代码行数:31,代码来源:edittest.c

示例8: PROGRAM_DeleteProgram

VOID PROGRAM_DeleteProgram(HLOCAL hProgram, BOOL bUpdateGrpFile)
{
  PROGRAM *program = LocalLock(hProgram);
  PROGGROUP   *group   = LocalLock(program->hGroup);

  group->hActiveProgram = 0;

  if (program->hPrior)
    ((PROGRAM*)LocalLock(program->hPrior))->hNext = program->hNext;
  else
    ((PROGGROUP*)LocalLock(program->hGroup))->hPrograms = program->hNext;

  if (program->hNext)
    ((PROGRAM*)LocalLock(program->hNext))->hPrior = program->hPrior;

  if (bUpdateGrpFile)
    GRPFILE_WriteGroupFile(program->hGroup);

  DestroyWindow(program->hWnd);
#if 0
  if (program->hIcon)
    DestroyIcon(program->hIcon);
#endif
  LocalFree(program->hName);
  LocalFree(program->hCmdLine);
  LocalFree(program->hIconFile);
  LocalFree(program->hWorkDir);
  LocalFree(hProgram);
}
开发者ID:Sunmonds,项目名称:wine,代码行数:29,代码来源:program.c

示例9: GetProcAddress

// ---------------------------------------------------------------------------
//
HBITMAP __fastcall TForm1::SPI_LoadImage(String fileName) {
	/* 対応プラグインの検索 */
	for (int i = 0; i < hSPI->Count; i++) { // プラグイン関数の取得
		SPI_ISSUPPORTED spi_issupported = (SPI_ISSUPPORTED) GetProcAddress((HMODULE) hSPI->Items[i], SPIPROC_ISSUPPORTED);
		SPI_GETPICTURE spi_getpicture = (SPI_GETPICTURE) GetProcAddress((HMODULE) hSPI->Items[i], SPIPROC_GETPICTURE);

		if (spi_issupported == NULL || spi_getpicture == NULL) {
			continue;
		}

		// File内容をロードする
		HANDLE handle; // = NULL;

		if ((handle = CreateFile_Read(fileName.w_str())) == INVALID_HANDLE_VALUE) {
			return NULL;
		}

		DWORD filesize = GetFileSize(handle, NULL), readsize;
		LPSTR data = (LPSTR) Heap_Malloc(filesize);
		SetFilePointer(handle, 0, NULL, FILE_BEGIN);

		if (!ReadFile(handle, data, filesize, &readsize, NULL)) {
			CloseHandle(handle);
		}

		CloseHandle(handle);

		// ロードできる形式かどうかをチェックする
		if (spi_issupported(AnsiString(fileName).c_str(), (DWORD) data) == 0) {
			Heap_Free(data);
			continue;
		}

		// 画像を展開する
		HLOCAL info, bm;
		if (spi_getpicture(data, filesize, 1, &info, &bm, NULL, 0) != 0) {
			Heap_Free(data);
		}

		LPBITMAPINFO bmpinfo = (LPBITMAPINFO) LocalLock(info); // BITMAPINFO構造体
		LPBYTE bmbits = (LPBYTE) LocalLock(bm); // 画像データ

		// 取得した情報からBITMAPハンドルを生成する
		HDC dc = GetDC(0);
		HBITMAP bitmap = CreateDIBitmap(dc, &bmpinfo->bmiHeader, CBM_INIT, bmbits, bmpinfo, DIB_RGB_COLORS);
		ReleaseDC(0, dc);

		// Free etc...
		LocalUnlock(info);
		LocalFree(info);
		LocalUnlock(bm);
		LocalFree(bm);
		Heap_Free(data);

		return bitmap;
	}

	return NULL;
}
开发者ID:leiqunni,项目名称:v2iewx,代码行数:61,代码来源:main.cpp

示例10: MDIWndProc

/*
	MDIWndProc
*/
LRESULT CALLBACK MDIWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    HANDLE      hInfo;
	PINFO       pInfo;
	MSG			msg;
	EventRecord	macEvent;
	LONG		thePoints = GetMessagePos();
	PAINTSTRUCT	ps;

	msg.hwnd = hwnd;
	msg.message = message;
	msg.wParam = wParam;
	msg.lParam = lParam;
	msg.time = GetMessageTime();
	msg.pt.x = LOWORD(thePoints);
	msg.pt.y = HIWORD(thePoints);
	WinEventToMacEvent(&msg, &macEvent);           

    switch (message) 
    {
		case WM_CREATE:
		case WM_MDICREATE:
			break;
		case WM_DESTROY:
			hInfo = (HANDLE)GetWindowLong(hwnd, GWL_USERDATA);
            if (hInfo) 
            {
                if ((pInfo = (PINFO)LocalLock(hInfo)) != NULL){
					if (pInfo->gi) 
						// close the graphic import component
						CloseComponent(pInfo->gi);

						// Destroy our port association
						DestroyPortAssociation((CGrafPort *)GetHWNDPort(pInfo->hwndChildWindow));
				}
                LocalUnlock(hInfo);
			}
			break;

		// Draw our graphic
		case WM_PAINT:
			BeginPaint(hwnd, &ps); 
			hInfo = (HANDLE)GetWindowLong(hwnd, GWL_USERDATA);
            if (hInfo) 
            {
                if ((pInfo = (PINFO)LocalLock(hInfo)) != NULL)
					GraphicsImportDraw(pInfo->gi);
			
                LocalUnlock(hInfo);
			}
			EndPaint(hwnd, &ps);
			break;

        default:
            return DefMDIChildProc(hwnd, message, wParam, lParam);

    }
    return DefMDIChildProc(hwnd, message, wParam, lParam);
}
开发者ID:fruitsamples,项目名称:graphicimporter.win,代码行数:62,代码来源:GraphicImporter.c

示例11: PROGRAM_ExecuteProgram

VOID PROGRAM_ExecuteProgram(HLOCAL hProgram)
{
  PROGRAM *program = LocalLock(hProgram);
  LPSTR lpszCmdLine = LocalLock(program->hCmdLine);

  /* FIXME set working directory from program->hWorkDir */

  WinExec(lpszCmdLine, program->nCmdShow);
  if (Globals.bMinOnRun) CloseWindow(Globals.hMainWnd);
}
开发者ID:Sunmonds,项目名称:wine,代码行数:10,代码来源:program.c

示例12: PROGRAM_CopyMoveProgram

VOID PROGRAM_CopyMoveProgram(HLOCAL hProgram, BOOL bMove)
{
  PROGRAM *program = LocalLock(hProgram);
  PROGGROUP   *fromgroup = LocalLock(program->hGroup);
  HLOCAL hGroup = DIALOG_CopyMove(LocalLock(program->hName),
				  LocalLock(fromgroup->hName), bMove);
  if (!hGroup) return;

  /* FIXME shouldn't be necessary */
  OpenIcon(((PROGGROUP*)LocalLock(hGroup))->hWnd);

  if (!PROGRAM_AddProgram(hGroup,
#if 0
			  CopyIcon(program->hIcon),
#else
			  program->hIcon,
#endif
			  LocalLock(program->hName),
			  program->x, program->y,
			  LocalLock(program->hCmdLine),
			  LocalLock(program->hIconFile),
			  program->nIconIndex,
			  LocalLock(program->hWorkDir),
			  program->nHotKey, program->nCmdShow)) return;
  GRPFILE_WriteGroupFile(hGroup);

  if (bMove) PROGRAM_DeleteProgram(hProgram, TRUE);
}
开发者ID:Sunmonds,项目名称:wine,代码行数:28,代码来源:program.c

示例13: GRPFILE_ReadGroupFile

HLOCAL GRPFILE_ReadGroupFile(LPCSTR lpszPath)
{
  CHAR   szPath_gr[MAX_PATHNAME_LEN];
  BOOL   bFileNameModified = FALSE;
  OFSTRUCT dummy;
  HLOCAL hBuffer, hGroup;
  INT    size;

  /* if `.gr' file exists use that */
  GRPFILE_ModifyFileName(szPath_gr, lpszPath, MAX_PATHNAME_LEN, TRUE);
  if (OpenFile(szPath_gr, &dummy, OF_EXIST) != HFILE_ERROR)
    {
      lpszPath = szPath_gr;
      bFileNameModified = TRUE;
    }

  /* Read the whole file into a buffer */
  if (!GRPFILE_ReadFileToBuffer(lpszPath, &hBuffer, &size))
    {
      MAIN_MessageBoxIDS_s(IDS_GRPFILE_READ_ERROR_s, lpszPath, IDS_ERROR, MB_YESNO);
      return(0);
    }

  /* Interpret buffer */
  hGroup = GRPFILE_ScanGroup(LocalLock(hBuffer), size,
			     lpszPath, bFileNameModified);
  if (!hGroup)
    MAIN_MessageBoxIDS_s(IDS_GRPFILE_READ_ERROR_s, lpszPath, IDS_ERROR, MB_YESNO);

  LocalFree(hBuffer);

  return(hGroup);
}
开发者ID:Sunmonds,项目名称:wine,代码行数:33,代码来源:grpfile.c

示例14: getItemMsg

/*
 * getItemMsg - find the hint message for the specified menu item
 */
static msg_id getItemMsg( statwnd *wnd, ctl_id menuid )
{
    int                 i;
    HWND                hint;
    HLOCAL              hinfo;
    HintWndInfo         *info;
    const MenuItemHint  *hinttable;
    msg_id              msgid;

    hint = GetHintHwnd( wnd );
    hinfo = GetProp( hint, HINT_PROP_ID );
    info = LocalLock( hinfo );
    hinttable = info->hints;
    msgid = HINT_EMPTY;
    if( hinttable != NULL ) {
        for( i = 0; i < info->hint_num_items; i++ ) {
            if( hinttable[i].menuid == menuid ) {
                msgid = hinttable[i].msgid;
                break;
            }
        }
    }
    LocalUnlock( hinfo );
    return( msgid );

} /* getItemMsg */
开发者ID:ArmstrongJ,项目名称:open-watcom-v2,代码行数:29,代码来源:hint.c

示例15: SizeHintBar

/*
 * SizeHintBar - resize the hint bar
 */
WORD SizeHintBar( statwnd *wnd )
{
    HLOCAL      hinfo;
    HintWndInfo *info;
    HFONT       font;
    HFONT       oldfont;
    HDC         dc;
    SIZE        sz;
    RECT        area;
    HWND        hint;

    hint = GetHintHwnd( wnd );
    hinfo = GetProp( hint, HINT_PROP_ID );
    info = LocalLock( hinfo );
    dc = GetDC( hint );
    font = GetMonoFont();
    oldfont = SelectObject( dc, font );
    GetTextExtentPoint( dc, "A", 1, &sz );
    SelectObject( dc, oldfont );
    ReleaseDC( hint, dc );
    GetClientRect( info->parent, &area );
    area.top = area.bottom - sz.cy - TOTAL_VERT;
    MoveWindow( hint, area.left, area.top, area.right - area.left, area.bottom - area.top, TRUE );
    updateHintText( wnd, info->curmsg );
    GetWindowRect( hint, &area );
    LocalUnlock( hinfo );
    return( (WORD)( area.bottom - area.top ) );

} /* SizeHintBar */
开发者ID:ArmstrongJ,项目名称:open-watcom-v2,代码行数:32,代码来源:hint.c


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