• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ LoadBitmap函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: CreateToolbar

void CManageBookmarksDialog::SetupToolbar()
{
	m_hToolbar = CreateToolbar(m_hDlg,
		WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|
		TBSTYLE_TOOLTIPS|TBSTYLE_LIST|TBSTYLE_TRANSPARENT|
		TBSTYLE_FLAT|CCS_NODIVIDER|CCS_NORESIZE,
		TBSTYLE_EX_MIXEDBUTTONS|TBSTYLE_EX_DRAWDDARROWS|
		TBSTYLE_EX_DOUBLEBUFFER|TBSTYLE_EX_HIDECLIPPEDBUTTONS);

	SendMessage(m_hToolbar,TB_SETBITMAPSIZE,0,MAKELONG(16,16));
	SendMessage(m_hToolbar,TB_BUTTONSTRUCTSIZE,static_cast<WPARAM>(sizeof(TBBUTTON)),0);

	m_himlToolbar = ImageList_Create(16,16,ILC_COLOR32|ILC_MASK,0,48);
	HBITMAP hBitmap = LoadBitmap(GetInstance(),MAKEINTRESOURCE(IDB_SHELLIMAGES));
	ImageList_Add(m_himlToolbar,hBitmap,NULL);
	DeleteObject(hBitmap);
	SendMessage(m_hToolbar,TB_SETIMAGELIST,0,reinterpret_cast<LPARAM>(m_himlToolbar));

	TBBUTTON tbb;
	TCHAR szTemp[64];

	tbb.iBitmap		= SHELLIMAGES_BACK;
	tbb.idCommand	= TOOLBAR_ID_BACK;
	tbb.fsState		= TBSTATE_ENABLED;
	tbb.fsStyle		= BTNS_BUTTON|BTNS_AUTOSIZE;
	tbb.dwData		= 0;
	SendMessage(m_hToolbar,TB_INSERTBUTTON,0,reinterpret_cast<LPARAM>(&tbb));

	tbb.iBitmap		= SHELLIMAGES_FORWARD;
	tbb.idCommand	= TOOLBAR_ID_FORWARD;
	tbb.fsState		= TBSTATE_ENABLED;
	tbb.fsStyle		= BTNS_BUTTON|BTNS_AUTOSIZE;
	tbb.dwData		= 0;
	SendMessage(m_hToolbar,TB_INSERTBUTTON,1,reinterpret_cast<LPARAM>(&tbb));

	LoadString(GetInstance(),IDS_MANAGE_BOOKMARKS_TOOLBAR_ORGANIZE,szTemp,SIZEOF_ARRAY(szTemp));

	tbb.iBitmap		= SHELLIMAGES_COPY;
	tbb.idCommand	= TOOLBAR_ID_ORGANIZE;
	tbb.fsState		= TBSTATE_ENABLED;
	tbb.fsStyle		= BTNS_BUTTON|BTNS_AUTOSIZE|BTNS_SHOWTEXT|BTNS_DROPDOWN;
	tbb.dwData		= 0;
	tbb.iString		= reinterpret_cast<INT_PTR>(szTemp);
	SendMessage(m_hToolbar,TB_INSERTBUTTON,2,reinterpret_cast<LPARAM>(&tbb));

	LoadString(GetInstance(),IDS_MANAGE_BOOKMARKS_TOOLBAR_VIEWS,szTemp,SIZEOF_ARRAY(szTemp));

	tbb.iBitmap		= SHELLIMAGES_VIEWS;
	tbb.idCommand	= TOOLBAR_ID_VIEWS;
	tbb.fsState		= TBSTATE_ENABLED;
	tbb.fsStyle		= BTNS_BUTTON|BTNS_AUTOSIZE|BTNS_SHOWTEXT|BTNS_DROPDOWN;
	tbb.dwData		= 0;
	tbb.iString		= reinterpret_cast<INT_PTR>(szTemp);
	SendMessage(m_hToolbar,TB_INSERTBUTTON,3,reinterpret_cast<LPARAM>(&tbb));

	LoadString(GetInstance(),IDS_MANAGE_BOOKMARKS_TOOLBAR_IMPORTEXPORT,szTemp,SIZEOF_ARRAY(szTemp));

	tbb.iBitmap		= SHELLIMAGES_PROPERTIES;
	tbb.idCommand	= TOOLBAR_ID_IMPORTEXPORT;
	tbb.fsState		= TBSTATE_ENABLED;
	tbb.fsStyle		= BTNS_BUTTON|BTNS_AUTOSIZE|BTNS_SHOWTEXT|BTNS_DROPDOWN;
	tbb.dwData		= 0;
	tbb.iString		= reinterpret_cast<INT_PTR>(szTemp);
	SendMessage(m_hToolbar,TB_INSERTBUTTON,4,reinterpret_cast<LPARAM>(&tbb));

	RECT rcTreeView;
	GetWindowRect(GetDlgItem(m_hDlg,IDC_MANAGEBOOKMARKS_TREEVIEW),&rcTreeView);
	MapWindowPoints(HWND_DESKTOP,m_hDlg,reinterpret_cast<LPPOINT>(&rcTreeView),2);

	RECT rcSearch;
	GetWindowRect(GetDlgItem(m_hDlg,IDC_MANAGEBOOKMARKS_EDITSEARCH),&rcSearch);
	MapWindowPoints(HWND_DESKTOP,m_hDlg,reinterpret_cast<LPPOINT>(&rcSearch),2);

	DWORD dwButtonSize = static_cast<DWORD>(SendMessage(m_hToolbar,TB_GETBUTTONSIZE,0,0));
	SetWindowPos(m_hToolbar,NULL,rcTreeView.left,rcSearch.top - (HIWORD(dwButtonSize) - GetRectHeight(&rcSearch)) / 2,
		rcSearch.left - rcTreeView.left - 10,HIWORD(dwButtonSize),0);
}
开发者ID:defhook,项目名称:explorerplusplus,代码行数:77,代码来源:ManageBookmarksDialog.cpp


示例2: GETSTRING_DLG

dlgWndBadPIN::dlgWndBadPIN( std::wstring & PINName, unsigned long RemainingTries, HWND Parent )
:Win32Dialog(L"WndBadPIN")
{
	std::wstring tmpTitle = L"";

	if(wcscmp(L"nl",langbad.c_str())==0)
		tmpTitle += (L"Atenção");
	else
		tmpTitle += GETSTRING_DLG(Notification);
	tmpTitle += L": ";
	tmpTitle += GETSTRING_DLG(Bad); 
	tmpTitle += L" ";

	if ( wcsstr(const_cast<wchar_t*>( PINName.c_str()), (L"PIN da Autentica")) != 0)
		tmpTitle += (L"Pin da Autenticação");
	else
		tmpTitle += PINName;

	wchar_t tmpBuf[128];
	std::wstring tmpStr = L"";
	_itow_s( RemainingTries, tmpBuf, 128, 10 ); 
	szHeader = new wchar_t[128];
	szBody = L"";

	tmpStr = GETSTRING_DLG(Bad);
	tmpStr += L" \""; 
	if ( wcsstr(const_cast<wchar_t*>( PINName.c_str()), (L"PIN da Autentica")) != 0)
		tmpStr += (L"Pin da Autenticação");
	else
		tmpStr += PINName;
	tmpStr += L"\": ";
	tmpStr += tmpBuf;
	tmpStr += L" "; 
	tmpStr += GETSTRING_DLG(RemainingAttempts); 
	wcscpy_s( szHeader, 128, tmpStr.c_str() );
	if( RemainingTries == 0 )
	{
		if ( wcsstr(const_cast<wchar_t*>( PINName.c_str()), (L"PIN da Autentica")) != 0)
			tmpTitle += (L"Pin da Autenticação");
		else
			tmpTitle += PINName;
		tmpStr += L" ";
		tmpStr = GETSTRING_DLG(PinBlocked);
		szBody = tmpStr.c_str();
	}
	else
	{
		szBody = GETSTRING_DLG(TryAgainOrCancel);
	}

	if( CreateWnd( tmpTitle.c_str() , 280, 230, 0,  Parent ) )
	{
		RECT clientRect;
		GetClientRect( m_hWnd, &clientRect );

		TextFont = CreateFont( 16, 0, 0, 0, FW_DONTCARE, 0, 0, 0,
				DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
				DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"MS Shell Dlg" );

		if( RemainingTries == 0 )
		{
			HWND hOkButton = CreateWindow(
				L"BUTTON", GETSTRING_DLG(Ok), WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_DEFPUSHBUTTON, 
				clientRect.right - 160, clientRect.bottom - 36, 72, 24, 
				m_hWnd, (HMENU)IDB_OK, m_hInstance, NULL );
			SendMessage( hOkButton, WM_SETFONT, (WPARAM)TextFont, 0 );
		}
		else
		{
			HWND hRetryButton = CreateWindow(
				L"BUTTON", GETSTRING_DLG(Retry), WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_DEFPUSHBUTTON, 
				clientRect.right - 160, clientRect.bottom - 36, 72, 24, 
				m_hWnd, (HMENU)IDB_RETRY, m_hInstance, NULL );
			SendMessage( hRetryButton, WM_SETFONT, (WPARAM)TextFont, 0 );

			HWND hCancelButton = CreateWindow(
				L"BUTTON", GETSTRING_DLG(Cancel), WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_TEXT, 
				clientRect.right - 80, clientRect.bottom - 36, 72, 24, 
				m_hWnd, (HMENU)IDB_CANCEL, m_hInstance, NULL );
			SendMessage( hCancelButton, WM_SETFONT, (WPARAM)TextFont, 0 );
		}

		HWND hStaticText = CreateWindow( 
			L"STATIC", szBody, WS_CHILD | WS_VISIBLE | SS_CENTER, 
			0, clientRect.bottom - 76, clientRect.right, 22, 
			m_hWnd, (HMENU)IDC_STATIC, m_hInstance, NULL );
		SendMessage( hStaticText, WM_SETFONT, (WPARAM)TextFont, 0 );

		ImagePIN = LoadBitmap( m_hInstance, MAKEINTRESOURCE(IDB_PIN) );
		CreateBitapMask( ImagePIN, ImagePIN_Mask );
	}
}
开发者ID:12019,项目名称:svn.gov.pt,代码行数:92,代码来源:dlgWndBadPIN.cpp


示例3: PixelTranspType

int PixelTranspType (short nTexture, short nOrient, short nFrame, fix u, fix v)
{
	CBitmap *bmP;
	int bmx, bmy, w, h, offs;
	ubyte	c;
#if 0
	tBitmapIndex *bmiP;

bmiP = gameData.pig.tex.bmIndexP + (nTexture);
LoadBitmap (*bmiP, gameStates.app.bD1Data);
bmP = BmOverride (gameData.pig.tex.bitmapP + bmiP->index);
#else
bmP = LoadFaceBitmap (nTexture, nFrame);
if (!bmP->Buffer ())
	return 0;
#endif
if (bmP->Flags () & BM_FLAG_RLE)
	bmP = rle_expand_texture (bmP);
w = bmP->Width ();
h = ((bmP->Type () == BM_TYPE_ALT) && bmP->Frames ()) ? w : bmP->Height ();
if (nOrient == 0) {
	bmx = ((unsigned) X2I (u * w)) % w;
	bmy = ((unsigned) X2I (v * h)) % h;
	}
else if (nOrient == 1) {
	bmx = ((unsigned) X2I ((I2X (1) - v) * w)) % w;
	bmy = ((unsigned) X2I (u * h)) % h;
	}
else if (nOrient == 2) {
	bmx = ((unsigned) X2I ((I2X (1) - u) * w)) % w;
	bmy = ((unsigned) X2I ((I2X (1) - v) * h)) % h;
	}
else {
	bmx = ((unsigned) X2I (v * w)) % w;
	bmy = ((unsigned) X2I ((I2X (1) - u) * h)) % h;
	}
offs = bmy * w + bmx;
if (bmP->Flags () & BM_FLAG_TGA) {
	ubyte *p;

	if (bmP->BPP () == 3)	//no alpha -> no transparency
		return 0;
	p = bmP->Buffer () + offs * bmP->BPP ();
	// check super transparency color
#if 1
	if ((p [0] == 120) && (p [1] == 88) && (p [2] == 128))
#else
	if ((gameOpts->ogl.bGlTexMerge) ?
	    (p [3] == 1) : ((p [0] == 120) && (p [1] == 88) && (p [2] == 128)))
#endif
		return -1;
	// check alpha
	if (!p [3])
		return 1;
	}
else {
	c = bmP->Buffer () [offs];
	if (c == SUPER_TRANSP_COLOR)
		return -1;
	if (c == TRANSPARENCY_COLOR)
		return 1;
	}
return 0;
}
开发者ID:stephengeorgewest,项目名称:diiscent,代码行数:64,代码来源:visibility.cpp


示例4: lcd_init

static int lcd_init (void)
{
	DWORD ret;
	lgLcdOpenContext octx;
	HBITMAP bmp;
	BITMAP binfo;
	HDC dc;
	int x, y;

	old_pri = 0;
	ret = lgLcdInit ();
	if (ret != ERROR_SUCCESS) {
		if (ret == RPC_S_SERVER_UNAVAILABLE || ret == ERROR_OLD_WIN_VERSION) {
			write_log (_T("LCD: Logitech LCD system not detected\n"));
			return 0;
		}
		write_log (_T("LCD: lgLcdInit() returned %d\n"), ret);
		return 0;
	}
	memset (&cctx, 0, sizeof (cctx));
	cctx.appFriendlyName = _T("WinUAE");
	cctx.isPersistent = TRUE;
	cctx.isAutostartable = FALSE;
	ret = lgLcdConnect (&cctx);
	if (ret != ERROR_SUCCESS) {
		write_log (_T("LCD: lgLcdConnect() returned %d\n"), ret);
		lcd_close ();
		return 0;
	}
	ret = lgLcdEnumerateEx (cctx.connection, 0, &desc);
	if (ret != ERROR_SUCCESS) {
		write_log (_T("LCD: lgLcdEnumerateEx() returned %d\n"), ret);
		lcd_close ();
		return 0;
	}
	lbh = (lgLcdBitmapHeader*)xcalloc (uae_u8, sizeof (lgLcdBitmapHeader) + desc.Width * (desc.Height + 20));
	lbh->Format = LGLCD_BMP_FORMAT_160x43x1;
	bitmap = (uae_u8*)lbh + sizeof (lgLcdBitmapHeader);
	origbitmap = xcalloc (uae_u8, desc.Width * desc.Height);
	memset (&octx, 0, sizeof (octx));
	octx.connection = cctx.connection;
	octx.index = 0;
	ret = lgLcdOpen (&octx);
	if (ret != ERROR_SUCCESS) {
		write_log (_T("LCD: lgLcdOpen() returned %d\n"), ret);
		lcd_close ();
		return 0;
	}
	device = octx.device;

	bmp = LoadBitmap (hInst, MAKEINTRESOURCE(IDB_LCD160X43));
	dc = CreateCompatibleDC (NULL);
	SelectObject (dc, bmp);
	GetObject (bmp, sizeof (binfo), &binfo);
	for (y = 0; y < binfo.bmHeight; y++) {
		for (x = 0; x < binfo.bmWidth; x++) {
			bitmap[y * binfo.bmWidth + x] = GetPixel (dc, x, y) == 0 ? 0xff : 0;
		}
	}
	numbers = bitmap + desc.Width * desc.Height;
	memcpy (origbitmap, bitmap, desc.Width * desc.Height);
	DeleteDC (dc);

	write_log (_T("LCD: '%s' enabled\n"), desc.deviceDisplayName);
	return 1;
}
开发者ID:FoxKyong,项目名称:WinUAE,代码行数:66,代码来源:lcd.cpp


示例5: ImageList_Create

INT_PTR CSearchDialog::OnInitDialog()
{
	HIMAGELIST himl = ImageList_Create(16,16,ILC_COLOR32|ILC_MASK,0,48);
	HBITMAP hBitmap = LoadBitmap(GetModuleHandle(0),MAKEINTRESOURCE(IDB_SHELLIMAGES));
	ImageList_Add(himl,hBitmap,NULL);

	m_hDirectoryIcon = ImageList_GetIcon(himl,SHELLIMAGES_NEWTAB,ILD_NORMAL);
	m_hDialogIcon = ImageList_GetIcon(himl,SHELLIMAGES_SEARCH,ILD_NORMAL);

	SendMessage(GetDlgItem(m_hDlg,IDC_BUTTON_DIRECTORY),BM_SETIMAGE,
		IMAGE_ICON,reinterpret_cast<LPARAM>(m_hDirectoryIcon));

	SetClassLongPtr(m_hDlg,GCLP_HICONSM,reinterpret_cast<LONG_PTR>(m_hDialogIcon));

	DeleteObject(hBitmap);
	ImageList_Destroy(himl);

	HWND hListView = GetDlgItem(m_hDlg,IDC_LISTVIEW_SEARCHRESULTS);

	ListView_SetExtendedListViewStyleEx(hListView,LVS_EX_GRIDLINES|LVS_EX_DOUBLEBUFFER,
		LVS_EX_GRIDLINES|LVS_EX_DOUBLEBUFFER);

	HIMAGELIST himlSmall;
	Shell_GetImageLists(NULL,&himlSmall);
	ListView_SetImageList(hListView,himlSmall,LVSIL_SMALL);

	SetWindowTheme(hListView,L"Explorer",NULL);

	int i = 0;

	for each(auto ci in m_sdps->m_Columns)
	{
		TCHAR szTemp[128];
		LoadString(GetInstance(),ci.uStringID,szTemp,SIZEOF_ARRAY(szTemp));

		LVCOLUMN lvColumn;
		lvColumn.mask		= LVCF_TEXT;
		lvColumn.pszText	= szTemp;
		ListView_InsertColumn(hListView,i,&lvColumn);

		i++;
	}

	RECT rc;
	GetClientRect(hListView,&rc);

	ListView_SetColumnWidth(hListView,0,(1.0/3.0) * GetRectWidth(&rc));
	ListView_SetColumnWidth(hListView,1,(1.80/3.0) * GetRectWidth(&rc));

	UpdateListViewHeader();

	lCheckDlgButton(m_hDlg,IDC_CHECK_ARCHIVE,m_sdps->m_bArchive);
	lCheckDlgButton(m_hDlg,IDC_CHECK_HIDDEN,m_sdps->m_bHidden);
	lCheckDlgButton(m_hDlg,IDC_CHECK_READONLY,m_sdps->m_bReadOnly);
	lCheckDlgButton(m_hDlg,IDC_CHECK_SYSTEM,m_sdps->m_bSystem);
	lCheckDlgButton(m_hDlg,IDC_CHECK_SEARCHSUBFOLDERS,m_sdps->m_bSearchSubFolders);
	lCheckDlgButton(m_hDlg,IDC_CHECK_CASEINSENSITIVE,m_sdps->m_bCaseInsensitive);
	lCheckDlgButton(m_hDlg,IDC_CHECK_USEREGULAREXPRESSIONS,m_sdps->m_bUseRegularExpressions);

	for each(auto strDirectory in *m_sdps->m_pSearchDirectories)
	{
		SendDlgItemMessage(m_hDlg,IDC_COMBO_DIRECTORY,CB_INSERTSTRING,static_cast<WPARAM>(-1),
			reinterpret_cast<LPARAM>(strDirectory.c_str()));
	}

	for each(auto strPattern in *m_sdps->m_pSearchPatterns)
	{
		SendDlgItemMessage(m_hDlg,IDC_COMBO_NAME,CB_INSERTSTRING,static_cast<WPARAM>(-1),
			reinterpret_cast<LPARAM>(strPattern.c_str()));
	}

	SetDlgItemText(m_hDlg,IDC_COMBO_NAME,m_sdps->m_szSearchPattern);
	SetDlgItemText(m_hDlg,IDC_COMBO_DIRECTORY,m_szSearchDirectory);

	CComboBox::CreateNew(GetDlgItem(m_hDlg,IDC_COMBO_NAME));
	CComboBox::CreateNew(GetDlgItem(m_hDlg,IDC_COMBO_DIRECTORY));

	if(m_sdps->m_bStateSaved)
	{
		/* These dummy values will be in use if these values
		have not previously been saved. */
		if(m_sdps->m_iColumnWidth1 != -1 && m_sdps->m_iColumnWidth2 != -1)
		{
			ListView_SetColumnWidth(hListView,0,m_sdps->m_iColumnWidth1);
			ListView_SetColumnWidth(hListView,1,m_sdps->m_iColumnWidth2);
		}
	}

	m_sdps->RestoreDialogPosition(m_hDlg,true);

	SetFocus(GetDlgItem(m_hDlg,IDC_COMBO_NAME));

	return FALSE;
}
开发者ID:menghun3,项目名称:explorerplusplus,代码行数:94,代码来源:SearchDialog.cpp


示例6: LoadBitmap

ResBitmap::ResBitmap(UINT nid)
{
    _hBmp = LoadBitmap(g_Globals._hInstance, MAKEINTRESOURCE(nid));
}
开发者ID:darkvaderXD2014,项目名称:reactos,代码行数:4,代码来源:explorer.cpp


示例7: SelProc

static BOOL CALLBACK SelProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
  static HTREEITEM *hTreeItems;
  static HIMAGELIST hImageList;
  HWND hwndCombo1 = GetUIItem(IDC_COMBO1);
  HWND hwndTree1 = GetUIItem(IDC_TREE1);
  extern HWND g_SectionHack;
  section *sections=g_sections;
  if (uMsg == WM_INITDIALOG)
  {
    int doLines=0;
    HTREEITEM Par;
    HBITMAP hBMcheck1;
    int x, lastGoodX, i, noCombo=2;

    g_SectionHack=hwndDlg;

    if (hTreeItems) GlobalFree(hTreeItems);
    hTreeItems=(HTREEITEM*)my_GlobalAlloc(sizeof(HTREEITEM)*num_sections);

    hBMcheck1=LoadBitmap(g_hInstance, MAKEINTRESOURCE(IDB_BITMAP1));

    oldTreeWndProc=SetWindowLong(hwndTree1,GWL_WNDPROC,(DWORD)newTreeWndProc);

    if (hImageList) ImageList_Destroy(hImageList);

    hImageList = ImageList_Create(16,16, ILC_COLOR32|ILC_MASK, 6, 0);
    ImageList_AddMasked(hImageList,hBMcheck1,RGB(255,0,255));

    TreeView_SetImageList(hwndTree1, hImageList, TVSIL_STATE);

#ifndef TVM_SETITEMHEIGHT
#define TVM_SETITEMHEIGHT (TV_FIRST + 27)
#endif
#ifndef TVM_GETITEMHEIGHT
#define TVM_GETITEMHEIGHT (TV_FIRST + 28)
#endif

    if (SendMessage(hwndTree1, TVM_GETITEMHEIGHT, 0, 0) < 16)
      SendMessage(hwndTree1, TVM_SETITEMHEIGHT, 16, 0);

    DeleteObject(hBMcheck1);

    for (i = 0; i < NSIS_MAX_INST_TYPES+1; i++)
    {
      if (g_header->install_types[i])
      {
        int j;
        if (i != NSIS_MAX_INST_TYPES) noCombo = 0;
        GetNSISString(g_tmp,g_header->install_types[i]);
        j=SendMessage(hwndCombo1,CB_ADDSTRING,0,(LPARAM)g_tmp);
        SendMessage(hwndCombo1,CB_SETITEMDATA,j,i);
        if (i == g_exec_flags.cur_insttype)
          SendMessage(hwndCombo1, CB_SETCURSEL, j, 0);
      }
    }

    if (!noCombo)
      ShowWindow(hwndCombo1,SW_SHOW);

    SetUITextFromLang(IDC_TEXT1,this_page->parms[1+noCombo]);
    SetUITextFromLang(IDC_TEXT2,this_page->parms[2+noCombo]);

    Par=NULL;

    for (lastGoodX = x = 0; x < num_sections; x ++)
    {
      section *sec=sections+x;

      if (sec->name_ptr)
      {
        TVINSERTSTRUCT tv;
        tv.hParent=Par;
        tv.hInsertAfter=TVI_LAST;
        tv.item.mask=TVIF_PARAM|TVIF_TEXT|TVIF_STATE;
        tv.item.lParam=x;
        tv.item.pszText=GetNSISStringTT(sec->name_ptr);
        tv.item.stateMask=TVIS_STATEIMAGEMASK|TVIS_EXPANDED|TVIS_BOLD;

        {
          int l=1;
          // Sf_SELECTED == 1
          l += sec->flags & SF_SELECTED;
          //if (sec->flags & SF_SELECTED) l++;
          if (sec->flags & SF_RO) l+=3;

          tv.item.state=INDEXTOSTATEIMAGEMASK(l);
        }

        //if (sec->flags&SF_BOLD)
        {
          // SF_BOLD << 1 == 16 == TVIS_BOLD
          tv.item.state|=(sec->flags&SF_BOLD)<<1;
        }

        if (sec->flags&SF_SUBSEC)
        {
          tv.item.mask|=TVIF_CHILDREN;
          tv.item.cChildren=1;
          //if (sec->flags&SF_EXPAND)
//.........这里部分代码省略.........
开发者ID:kichik,项目名称:nsis-1,代码行数:101,代码来源:Ui.c


示例8: initAudioDeviceTree

static void initAudioDeviceTree(HWND hDlg)
{
    const AUDIO_DRIVER *pAudioDrv = NULL;
    int i, j;
    TVINSERTSTRUCTW insert;
    HTREEITEM root, driver[10];
    HWND tree = NULL;
    HIMAGELIST hImageList;
    HBITMAP hBitMap;
    HCURSOR old_cursor;
    WCHAR driver_type[64], dev_type[64];

    tree = GetDlgItem(hDlg, IDC_AUDIO_TREE);

    if (!tree)
        return;

    /* set tree view style */
    SetWindowLong(tree, GWL_STYLE, GetWindowLong(tree, GWL_STYLE) | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT);

    /* state checkbox */
    hImageList = ImageList_Create(16, 16, FALSE, 3, 0);
    hBitMap = LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_CHECKBOX));
    ImageList_Add(hImageList, hBitMap, NULL);
    DeleteObject(hBitMap);
    SendMessageW( tree, TVM_SETIMAGELIST, TVSIL_STATE, (LPARAM)hImageList );

    /* root item */
    LoadStringW (GetModuleHandle (NULL), IDS_SOUNDDRIVERS, driver_type,
        sizeof(driver_type)/sizeof(driver_type[0]));
    insert.hParent = TVI_ROOT;
    insert.hInsertAfter = TVI_LAST;
    insert.u.item.mask = TVIF_TEXT | TVIF_CHILDREN;
    insert.u.item.pszText = driver_type;
    insert.u.item.cChildren = 1;
    root = (HTREEITEM)SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);

    /* change to the wait cursor because this can take a while if there is a
     * misbehaving driver that takes a long time to open
     */
    old_cursor = SetCursor(LoadCursor(0, IDC_WAIT));

    /* iterate over list of loaded drivers */
    for (pAudioDrv = loadedAudioDrv, i = 0; pAudioDrv->nameID; i++, pAudioDrv++) {
        HDRVR hdrv;
        char name[MAX_PATH];
        WCHAR text[MAX_PATH];

        sprintf(name, "wine%s.drv", pAudioDrv->szDriver);
        LoadStringW (GetModuleHandle (NULL), pAudioDrv->nameID, text,
            sizeof(text)/sizeof(text[0]));

        if ((hdrv = OpenDriverA(name, 0, 0)))
        {
            HMODULE lib;
            if ((lib = GetDriverModuleHandle(hdrv)))
            {
                int num_wod = 0, num_wid = 0, num_mod = 0, num_mid = 0, num_aux = 0, num_mxd = 0;
                MessagePtr wodMessagePtr = (MessagePtr)GetProcAddress(lib, "wodMessage");
                MessagePtr widMessagePtr = (MessagePtr)GetProcAddress(lib, "widMessage");
                MessagePtr modMessagePtr = (MessagePtr)GetProcAddress(lib, "modMessage");
                MessagePtr midMessagePtr = (MessagePtr)GetProcAddress(lib, "midMessage");
                MessagePtr auxMessagePtr = (MessagePtr)GetProcAddress(lib, "auxMessage");
                MessagePtr mxdMessagePtr = (MessagePtr)GetProcAddress(lib, "mxdMessage");

                if (wodMessagePtr)
                    num_wod = wodMessagePtr(0, WODM_GETNUMDEVS, 0, 0, 0);

                if (widMessagePtr)
                    num_wid = widMessagePtr(0, WIDM_GETNUMDEVS, 0, 0, 0);

                if (modMessagePtr)
                    num_mod = modMessagePtr(0, MODM_GETNUMDEVS, 0, 0, 0);

                if (midMessagePtr)
                    num_mid = midMessagePtr(0, MIDM_GETNUMDEVS, 0, 0, 0);

                if (auxMessagePtr)
                    num_aux = auxMessagePtr(0, AUXDM_GETNUMDEVS, 0, 0, 0);

                if (mxdMessagePtr)
                    num_mxd = mxdMessagePtr(0, MXDM_GETNUMDEVS, 0, 0, 0);

                if (num_wod == 0 && num_wid == 0 && num_mod == 0 && num_mid == 0 && num_aux == 0 && num_mxd == 0)
                {
                    insert.hParent = root;
                    insert.u.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_PARAM;
                    insert.u.item.pszText = text;
                    insert.u.item.stateMask = TVIS_STATEIMAGEMASK;
                    insert.u.item.lParam =  i + DRIVER_MASK;
                    if (isDriverSet(pAudioDrv->szDriver))
                        insert.u.item.state = INDEXTOSTATEIMAGEMASK(2);
                    else
                        insert.u.item.state = INDEXTOSTATEIMAGEMASK(1);

                    driver[i] = (HTREEITEM)SendDlgItemMessageW (hDlg, IDC_AUDIO_TREE, TVM_INSERTITEMW, 0, (LPARAM)&insert);
                }
                else
                {
                    HTREEITEM type;
//.........这里部分代码省略.........
开发者ID:bilboed,项目名称:wine,代码行数:101,代码来源:audio.c


示例9: gr_init

void ScreenRecoveryUI::Init()
{
    gr_init();

    gr_font_size(&char_width, &char_height);

    text_col = text_row = 0;
    text_rows = gr_fb_height() / char_height;
    if (text_rows > kMaxRows) text_rows = kMaxRows;
    text_top = 1;

    text_cols = gr_fb_width() / char_width;
    if (text_cols > kMaxCols - 1) text_cols = kMaxCols - 1;

    backgroundIcon[NONE] = NULL;
    LoadBitmapArray("icon_installing", &installing_frames, &installation);
    backgroundIcon[INSTALLING_UPDATE] = installing_frames ? installation[0] : NULL;
    backgroundIcon[ERASING] = backgroundIcon[INSTALLING_UPDATE];
    LoadBitmap("icon_error", &backgroundIcon[ERROR]);
    backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR];

    LoadBitmap("progress_empty", &progressBarEmpty);
    LoadBitmap("progress_fill", &progressBarFill);
    LoadBitmap("stage_empty", &stageMarkerEmpty);
    LoadBitmap("stage_fill", &stageMarkerFill);

    LoadLocalizedBitmap("installing_text", &backgroundText[INSTALLING_UPDATE]);
    LoadLocalizedBitmap("erasing_text", &backgroundText[ERASING]);
    LoadLocalizedBitmap("no_command_text", &backgroundText[NO_COMMAND]);
    LoadLocalizedBitmap("error_text", &backgroundText[ERROR]);

    // MStar Android Patch Begin
    //load title/tip bitmaps ,added by mstar semiconductor
    LoadBitmap("title_not_power_off",&titleNotPowerOff);
    LoadBitmap("title_not_unplug",&titleNotUnplug);
    LoadBitmap("tip_error", &tipTitle[TIP_TITLE_ERROR]);
    LoadBitmap("tip_ready", &tipTitle[TIP_TITLE_READY]);
    LoadBitmap("tip_success", &tipTitle[TIP_TITLE_SUCCESS]);
    LoadBitmap("tip_wipe_cache", &tipTitle[TIP_TITLE_WIPE_CACHE]);
    LoadBitmap("tip_wipe_data", &tipTitle[TIP_TITLE_WIPE_DATA]);
    LoadBitmap("tip_install_package", &tipTitle[TIP_TITLE_INSTALL_PACKAGE]);
    LoadBitmap("tip_backup_system", &tipTitle[TIP_TITLE_BACKUP_SYSTEM]);
    LoadBitmap("tip_restore_system", &tipTitle[TIP_TITLE_RESTORE_SYSTEM]);
    LoadBitmap("tip_blank_screen", &tipTitle[TIP_TITLE_BLANK_SCREEN]);

    // init exit recovery tip picture
    int j=0;
    char tipFileNmae[40];
    exitRecoveryTipTitle = (gr_surface*)malloc(exitRecoveryTipTitleNum *
                                                   sizeof(gr_surface));
    for (j = 0;j < exitRecoveryTipTitleNum;++j) {
        // "tip_exit_recovery_1.png", "tip_exit_recovery_2.png", ...
        sprintf(tipFileNmae, "tip_exit_recovery_%d", j+1);
        LoadBitmap(tipFileNmae, exitRecoveryTipTitle+j);
    }
    // MStar Android Patch End

    pthread_create(&progress_t, NULL, progress_thread, NULL);

    RecoveryUI::Init();
}
开发者ID:FrankEos,项目名称:Android,代码行数:61,代码来源:screen_ui.cpp


示例10: LoadCursor

void TLDisplay::createStaticResources(HINSTANCE hInstance)
{
    //
	//----> Cursors
	//
	TLDisplay::hcursor_arrow = LoadCursor(NULL, (char *)IDC_ARROW);
	TLDisplay::hcursor_hand = LoadCursor(hInstance, (char *)IDC_HAND);
	TLDisplay::hcursor_handdn = LoadCursor(hInstance, (char *)IDC_HANDDN);
	TLDisplay::hcursor_handzoom = LoadCursor(hInstance, (char *)IDC_HANDZOOM);
	//
	//----> Bitmaps...
	//
	TLDisplay::hbmpfilmholes = LoadBitmap(hInstance, (char*)IDB_FILMHOLES);
	//
	//----> Brushes
	//
	TLDisplay::hbrush_filmholes = CreatePatternBrush(TLDisplay::hbmpfilmholes);
	COLORREF color;
	color = RGB(200,200,200);
	TLDisplay::hbrush_bgnd = CreateSolidBrush(color);
	color = RGB(0,0,0);
	TLDisplay::hbrush_middlesepare = CreateSolidBrush(color);
	color = RGB(0,0,0);
	TLDisplay::hbrush_frametxt = CreateSolidBrush(color);
	color = RGB(128,100,100);
	TLDisplay::hbrush_fov = CreateSolidBrush(color);
	color = RGB(180,180,200);
	TLDisplay::hbrush_blocs = CreateSolidBrush(color);
	color = RGB(200,180,180);
	TLDisplay::hbrush_frames = CreateSolidBrush(color);
	color = RGB(14,103,146);
	TLDisplay::hbrush_blocs_hightlight = CreateSolidBrush(color);
	color = RGB(0,0,0);
	TLDisplay::hbrush_filmsepare = CreateSolidBrush(color);
	color = RGB(200,210,200);
	TLDisplay::hbrush_annot = CreateSolidBrush(color);
	color = RGB(220,220,210);
	TLDisplay::hbrush_annot_selected = CreateSolidBrush(color);
	//
	//----> Pens
	//
	color = RGB(1,10,20);
	TLDisplay::hpen_tline = CreatePen(PS_SOLID, 0, color);
	color = RGB(25,25,0);
	TLDisplay::hpen_arrows = CreatePen(PS_SOLID, 1, color);
	color = RGB(180,180,180);
	TLDisplay::hpen_grid = CreatePen(PS_SOLID, 1, color);
	color = RGB(255,255,50);
	TLDisplay::hpen_arrows_sel[0] = CreatePen(PS_SOLID, 0, color);
	color = RGB(100,255,100);
	TLDisplay::hpen_arrows_sel[1] = CreatePen(PS_SOLID, 0, color);
	color = RGB(100,100,255);
	TLDisplay::hpen_arrows_sel[2] = CreatePen(PS_SOLID, 0, color);
	color = RGB(200,60,200);
	TLDisplay::hpen_arrows_sel[3] = CreatePen(PS_SOLID, 0, color);

    //
    // Brush/Pens in misc colors
	// Let's split them in color trends
    //
	COLORREF colors[] = {
	RGB(80,200,80),		//green
	RGB(200,70,80),		// red
	RGB(247,107,4),		// orange
	RGB(80,140,190),	//blue
	RGB(0,160,160),		//blue2
	RGB(160,160,0),		// yellow
	RGB(140,140,140),	// gray
	RGB(0,0,200),		// blue
	RGB(118,199,120),	//green2
	RGB(21,183,33),		//green3
	RGB(162,182,22)	//green4
	};

	for(int i=0; i< NUM_COLORS; i++)
	{
		TLDisplay::hbrush_colors[i] = CreateSolidBrush(colors[i]);
		TLDisplay::hpen_colors[i] = CreatePen(PS_SOLID, 0, colors[i]);
	}
	//
	//----> Icons
	//
	TLDisplay::hicon = LoadIcon(hInstance, (char*)IDI_ANNOT1);
}
开发者ID:tlorach,项目名称:nvGraphy,代码行数:84,代码来源:Display.cpp


示例11: AboutStc

// ----------------------------------------------------------------------------------------
// NOTE: Resource type of rgnName must be of type ABOUT_STC_RGN_RESOURCE_TYPE
// ----------------------------------------------------------------------------------------
void AboutStc(CWnd* i_pParent, HINSTANCE i_hInstance,LPCTSTR bmpName,LPCTSTR rgnName,LPCTSTR product, LPCTSTR description, bool splashScreen, int timeToShow)
{
 static WNDCLASSEX wcex;
 TCHAR  szWindowClass[100];
 static HWND       hWnd;
 static BITMAP     bm;
 static HBITMAP    hWindowBitmap = NULL;
 int sx,sy;

 if (is_instance)
  return;  //only one instance allowed!

 d_about.d_lprgnname = rgnName;
 d_about.hInstance = i_hInstance;

 //following parameters depends on splash screen mode
 d_about.showCloseButton = splashScreen ? false : true;
 d_about.modal = splashScreen ? false : true;
 d_about.autoClose = splashScreen ? timeToShow : -1;

 hWindowBitmap = LoadBitmap(i_hInstance,bmpName);
 if (NULL==hWindowBitmap)
 {
  AfxMessageBox(_T("Can't load bitmap"),MB_OK|MB_ICONSTOP);
  return;
 }

 wsprintf(szWindowClass,_T("%s%d"),_T("STC_about"),i_pParent);

 _tcscpy(d_about.about_product,product);
 _tcscpy(d_about.about_description,description);

 GetObject(hWindowBitmap,sizeof(BITMAP),&bm);

 wcex.cbSize        = sizeof(WNDCLASSEX);
 wcex.style         = CS_HREDRAW|CS_VREDRAW|CS_BYTEALIGNWINDOW;
 wcex.lpfnWndProc   = (WNDPROC)WndProc;
 wcex.cbClsExtra    = 0;
 wcex.cbWndExtra    = 0;
 wcex.hInstance     = i_hInstance;
 wcex.hIcon         = NULL;
 wcex.hCursor       = ::LoadCursor(NULL, IDC_CROSS);
 wcex.hbrBackground = CreatePatternBrush((HBITMAP)hWindowBitmap);
 wcex.lpszMenuName  = NULL;
 wcex.lpszClassName = szWindowClass;
 wcex.hIconSm       = NULL;
 RegisterClassEx(&wcex);

 sx = GetSystemMetrics(SM_CXSCREEN);
 sy = GetSystemMetrics(SM_CYSCREEN);
 sx = (sx / 2) - bm.bmWidth / 2;
 sy = (sy / 2) - bm.bmHeight / 2;

 hWnd = CreateWindowEx(WS_EX_LEFT | WS_EX_TOPMOST,
	          szWindowClass,
	          _T("About"),
			  WS_POPUP,
              sx,
			  sy,
			  bm.bmWidth,
			  bm.bmHeight,
			  i_pParent->m_hWnd,
			  NULL,
			  i_hInstance,
			  NULL);
	  
 if (hWnd == NULL)
 {
  AfxMessageBox(_T("Can't create window"),MB_OK | MB_ICONSTOP);
  return;
 }

 ShowWindow(hWnd,SW_SHOWNORMAL);
 UpdateWindow(hWnd);

 //set flag wich indicates that instance has been created!
 is_instance = true;
}
开发者ID:fredcooke,项目名称:secu3man,代码行数:81,代码来源:STCAbout.cpp


示例12: WInitRibbons

bool WInitRibbons( HINSTANCE inst )
{
    int i;

    WRibbonInfo = WAllocToolBarInfo( NUM_TOOLS );
    WSORibbonInfo = WAllocToolBarInfo( NUM_SOTOOLS );

    if( WRibbonInfo == NULL || WSORibbonInfo == NULL ) {
        return( false );
    }

    for( i = 0; i < NUM_TOOLS; i++ ) {
        if( WRibbonNames[i].up != NULL ) {
            WRibbonInfo->items[i].u.bmp = LoadBitmap( inst, WRibbonNames[i].up );
            WRibbonInfo->items[i].id = WRibbonNames[i].menu_id;
            WRibbonInfo->items[i].flags = ITEM_DOWNBMP;
            if( WRibbonNames[i].down != NULL ) {
                WRibbonInfo->items[i].depressed = LoadBitmap( inst, WRibbonNames[i].down );
            } else {
                WRibbonInfo->items[i].depressed = WRibbonInfo->items[i].u.bmp;
            }
            if( WRibbonNames[i].tip_id >= 0 ) {
                LoadString( inst, WRibbonNames[i].tip_id, WRibbonInfo->items[i].tip, MAX_TIP );
            } else {
                WRibbonInfo->items[i].tip[0] = '\0';
            }
        } else {
            WRibbonInfo->items[i].flags = ITEM_BLANK;
            WRibbonInfo->items[i].u.blank_space = WRibbonNames[i].menu_id;
        }
    }

    for( i = 0; i < NUM_SOTOOLS; i++ ) {
        if( WSORibbonNames[i].up != NULL ) {
            WSORibbonInfo->items[i].u.bmp = LoadBitmap( inst, WSORibbonNames[i].up );
            WSORibbonInfo->items[i].id = WSORibbonNames[i].menu_id;
            WSORibbonInfo->items[i].flags = ITEM_DOWNBMP;
            if( WSORibbonNames[i].down != NULL ) {
                WSORibbonInfo->items[i].depressed =
                    LoadBitmap( inst, WSORibbonNames[i].down );
            } else {
                WSORibbonInfo->items[i].depressed = WSORibbonInfo->items[i].u.bmp;
            }
            if( WSORibbonNames[i].tip_id >= 0 ) {
                LoadString( inst, WSORibbonNames[i].tip_id, WSORibbonInfo->items[i].tip, MAX_TIP );
            } else {
                WSORibbonInfo->items[i].tip[0] = '\0';
            }
        } else {
            WSORibbonInfo->items[i].flags = ITEM_BLANK;
            WSORibbonInfo->items[i].u.blank_space = WSORibbonNames[i].menu_id;
        }
    }

    WRibbonInfo->dinfo.button_size.x = BUTTONX + BUTTON_PAD;
    WRibbonInfo->dinfo.button_size.y = BUTTONY + BUTTON_PAD;
    WRibbonInfo->dinfo.border_size.x = TOOL_BORDERX;
    WRibbonInfo->dinfo.border_size.y = TOOL_BORDERY;
    WRibbonInfo->dinfo.style = TOOLBAR_FIXED_STYLE;
    WRibbonInfo->dinfo.hook = WRibbonHook;
    WRibbonInfo->dinfo.helphook = WRibbonHelpHook;
    WRibbonInfo->dinfo.foreground = NULL;
    WRibbonInfo->dinfo.background = NULL;
    WRibbonInfo->dinfo.is_fixed = TRUE;
    WRibbonInfo->dinfo.use_tips = TRUE;

    WSORibbonInfo->dinfo.button_size.x = BUTTONX + BUTTON_PAD;
    WSORibbonInfo->dinfo.button_size.y = BUTTONY + BUTTON_PAD;
    WSORibbonInfo->dinfo.border_size.x = TOOL_BORDERX;
    WSORibbonInfo->dinfo.border_size.y = TOOL_BORDERY;
    WSORibbonInfo->dinfo.style = TOOLBAR_FIXED_STYLE;
    WSORibbonInfo->dinfo.hook = WRibbonHook;
    WSORibbonInfo->dinfo.helphook = WRibbonHelpHook;
    WSORibbonInfo->dinfo.foreground = NULL;
    WSORibbonInfo->dinfo.background = NULL;
    WSORibbonInfo->dinfo.is_fixed = TRUE;
    WSORibbonInfo->dinfo.use_tips = TRUE;

    WRibbonHeight = 2 * WRibbonInfo->dinfo.border_size.y +
                    WRibbonInfo->dinfo.button_size.y +
                    2 * GetSystemMetrics( SM_CYBORDER );

    WRibbonInfo->dinfo.area.bottom = WRibbonHeight;
    WSORibbonInfo->dinfo.area.bottom = WRibbonHeight;

    return( true );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:87,代码来源:wribbon.c


示例13: DlgProc

int CALLBACK DlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
	HDC hdc,khdc;
	HBITMAP oldbmp,newbmp;
	PAINTSTRUCT paint;
	RECT rect;
	char s[32];
	LPDRAWITEMSTRUCT dw;
	int i=0;
	HBRUSH hb;

	switch(msg)
	{
	case WM_INITDIALOG:

		ShowWindow(hWnd,SW_SHOW);
		OldListProc = (WNDPROC)SetWindowLong(GetDlgItem(hWnd,IDC_LIST1),GWL_WNDPROC,(long)NewWindowProc);
//		for(i=0;i<50;i++)
//			SendMessage(GetDlgItem(hWnd,IDC_LIST1),LB_ADDSTRING,0,(LPARAM)s);
//		GetWindowRect(GetDlgItem(hWnd,IDC_LIST1),&rect);
//		InvalidateRect(GetDlgItem(hWnd,IDC_LIST1),&rect,TRUE);
		GetCallAddress(GetDlgItem(hWnd,IDC_LIST1));
		if(SendMessage(GetDlgItem(hWnd,IDC_LIST1),LB_GETCOUNT,wParam,lParam)>0)
			SendMessage(GetDlgItem(hWnd,IDC_LIST1),LB_SETCURSEL,0,0);

		
		break;

	case WM_CLOSE:
		
		EndDialog(hWnd,0);
		break;
	case WM_PAINT:
		hdc=BeginPaint(hWnd,&paint);
		newbmp = LoadBitmap(hin,MAKEINTRESOURCE(IDB_BITMAP1));		
		GetClientRect(hWnd,&rect);
		khdc = CreateCompatibleDC( hdc );
		oldbmp = (HBITMAP)SelectObject(khdc,(HGDIOBJ)newbmp);
		BitBlt(hdc,0,0,rect.right-rect.left,rect.bottom-rect.top,khdc,0,0,SRCCOPY);
		SelectObject(khdc,(HGDIOBJ)oldbmp);
		DeleteObject(khdc);
		DeleteObject((HGDIOBJ)newbmp);
		EndPaint(hWnd,&paint);
		
		break;
	case WM_DRAWITEM:
		if(wParam == IDC_LIST1)
		{
			dw = (LPDRAWITEMSTRUCT) lParam;
			SendMessage(dw->hwndItem,LB_GETITEMRECT,dw->itemID,(WPARAM)&rect);
			if(dw->itemState & ODS_SELECTED||dw->itemState)
			{
				hb = CreateSolidBrush(RGB(0xff,0xff,0xff));
				FillRect(dw->hDC,&rect,hb);
				DeleteObject(hb);
			}

//			SendMessage(hWnd,LB_GETITEMDATA,dw->itemID,(LPARAM)s);
			wsprintf(s,"0x%08x",(dw->itemData)&0x7fffffff);
			if((dw->itemData&0x80000000)==0)
				SetTextColor(dw->hDC,RGB(0,0,0));
			else
				SetTextColor(dw->hDC,RGB(0xff,0,0));
			TextOut(dw->hDC,rect.left+2,rect.top+2,s,lstrlen(s));

		}

		else		return DefWindowProc(hWnd,msg,wParam,lParam);
		break;
	case WM_CTLCOLORLISTBOX:
		hdc=(HDC)wParam;
		::SetBkMode(hdc,TRANSPARENT);
		SetTextColor(hdc,RGB(64,32,0));
		return (int)GetStockObject(HOLLOW_BRUSH);
		break;
	}
	return 0;
}
开发者ID:LegalEagle,项目名称:Arianrhod,代码行数:78,代码来源:OllyGal.cpp


示例14: NewWindowProc

int CALLBACK NewWindowProc(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam )
{
	HDC hdc,khdc;
	HBITMAP oldbmp,newbmp;
	RECT rect;
	POINT p;
	HMENU hmenu;
	DWORD addr,index,i,count;
	switch(Msg)
	{
	case WM_ERASEBKGND:
		hdc=(HDC)wParam;
		newbmp = LoadBitmap(hin,MAKEINTRESOURCE(IDB_BITMAP1));	
		GetClientRect(hWnd,&rect);
		khdc = CreateCompatibleDC( hdc );
		oldbmp = (HBITMAP)SelectObject(khdc,(HGDIOBJ)newbmp);
		BitBlt(hdc,rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top,khdc,rect.left,rect.top,SRCCOPY);
		SelectObject(khdc,(HGDIOBJ)oldbmp);
		DeleteObject(khdc);
		DeleteObject((HGDIOBJ)newbmp);
		FlashListBox(hWnd);
		return TRUE;
	case WM_KEYDOWN:
		if(wParam == VK_RETURN)
			ShowDisasmAddr(hWnd);
		else if(wParam == VK_F2)
		{
			index = SendMessage(hWnd,LB_GETCURSEL,0,0);
			addr = SendMessage(hWnd,LB_GETITEMDATA,index,0);
			addr ^= 0x80000000;
			SendMessage(hWnd,LB_SETITEMDATA,index,addr);
			Manualbreakpoint(addr&0x7fffffff,VK_F2,0,0,FIXEDFONT);
		}
		break;
	case WM_RBUTTONDOWN:
		p.x = lParam&0x0000ffff;
		p.y = lParam>>16;
		ClientToScreen(hWnd,&p);
		hmenu = MyCreatMenu();
		TrackPopupMenu(hmenu,TPM_RIGHTBUTTON,p.x,p.y,0,hWnd,NULL);
		DestroyMenu(hmenu);
		break;
	case WM_LBUTTONDBLCLK:
		ShowDisasmAddr(hWnd);
		break;
	case WM_COMMAND:
		switch(LOWORD(wParam))
		{
		case 200:
			ShowOriAddr(hWnd);
			break;
		case 201:
			ShowDisasmAddr(hWnd);
			break;
		case 203:
			MySetBreakpoint(hWnd,TRUE);
			break;
		case 204:
			index = SendMessage(hWnd,LB_GETCURSEL,0,0);
			addr = SendMessage(hWnd,LB_GETITEMDATA,index,0);
			if(DialogBox(hin,MAKEINTRESOURCE(IDD_DIALOG4),NULL,NameDlgProc)==1)
			{
				Insertname(addr&0x7fffffff,NM_COMMENT,note);
			}
			break;
		case 205:
			MyDeleteBreakpoint(hWnd,TRUE);
			break;
		case 206:
			index = SendMessage(hWnd,LB_GETCURSEL,0,0);
			addr = SendMessage(hWnd,LB_GETITEMDATA,index,0);
			Zero_Memory(note, 64);
			Insertname(addr&0x7fffffff,NM_COMMENT,note);
			break;
		case 207:
			MySetBreakpoint(hWnd,FALSE);
			break;
		case 208:
			count = SendMessage(hWnd,LB_GETCOUNT,0,0);
			if(DialogBox(hin,MAKEINTRESOURCE(IDD_DIALOG4),NULL,NameDlgProc)==1)
			{
				for(i=0;i<count;i++)
				{
					addr = SendMessage(hWnd,LB_GETITEMDATA,i,0);
					Insertname(addr&0x7fffffff,NM_COMMENT,note);
				}
			}
			break;
		case 209:
			MyDeleteBreakpoint(hWnd,FALSE);
			break;
		case 210:
			count = SendMessage(hWnd,LB_GETCOUNT,0,0);
			Zero_Memory(note, 64);
			for(i=0;i<count;i++)
			{
				addr = SendMessage(hWnd,LB_GETITEMDATA,i,0);
				Insertname(addr&0x7fffffff,NM_COMMENT,note);
			}
			break;
//.........这里部分代码省略.........
开发者ID:LegalEagle,项目名称:Arianrhod,代码行数:101,代码来源:OllyGal.cpp


示例15: TrayIcon_GetProcessorUsageIcon

static HICON TrayIcon_GetProcessorUsageIcon(void)
{
    HICON        hTrayIcon = NULL;
    HDC            hScreenDC = NULL;
    HDC            hDC = NULL;
    HBITMAP        hBitmap = NULL;
    HBITMAP        hOldBitmap;
    HBITMAP        hBitmapMask = NULL;
    ICONINFO    iconInfo;
    ULONG        ProcessorUsage;
    int            nLinesToDraw;
    HBRUSH        hBitmapBrush = NULL;
    RECT        rc;

    /*
     * Get a handle to the screen DC
     */
    hScreenDC = GetDC(NULL);
    if (!hScreenDC)
        goto done;
    
    /*
     * Create our own DC from it
     */
    hDC = CreateCompatibleDC(hScreenDC);
    if (!hDC)
        goto done;

    /*
     * Load the bitmaps
     */
    hBitmap = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_TRAYICON));
    hBitmapMask = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_TRAYMASK));
    if (!hBitmap || !hBitmapMask)
        goto done;

    hBitmapBrush = CreateSolidBrush(RGB(0, 255, 0));
    if (!hBitmapBrush)
        goto done;
    
    /*
     * Select the bitmap into our device context
     * so we can draw on it.
     */
    hOldBitmap = SelectObject(hDC, hBitmap);

    /*
     * Get the cpu usage
     */
    ProcessorUsage = PerfDataGetProcessorUsage();

    /*
     * Calculate how many lines to draw
     * since we have 11 rows of space
     * to draw the cpu usage instead of
     * just having 10.
     */
    nLinesToDraw = (ProcessorUsage + (ProcessorUsage / 10)) / 11;
    rc.left = 3;
    rc.top = 12 - nLinesToDraw;
    rc.right = 13;
    rc.bottom = 13;

    /*
     * Now draw the cpu usage
     */
    if (nLinesToDraw)
        FillRect(hDC, &rc, hBitmapBrush);

    /*
     * Now that we are done drawing put the
     * old bitmap back.
     */
    SelectObject(hDC, hOldBitmap);

    iconInfo.fIcon = TRUE;
    iconInfo.xHotspot = 0;
    iconInfo.yHotspot = 0;
    iconInfo.hbmMask = hBitmapMask;
    iconInfo.hbmColor = hBitmap;

    hTrayIcon = CreateIconIndirect(&iconInfo);

done:
    /*
     * Cleanup
     */
    if (hScreenDC)
        ReleaseDC(NULL, hScreenDC);
    if (hDC)
        DeleteDC(hDC);
    if (hBitmapBrush)
        DeleteObject(hBitmapBrush);
    if (hBitmap)
        DeleteObject(hBitmap);
    if (hBitmapMask)
        DeleteObject(hBitmapMask);
    
    /*
     * Return the newly created tray icon (if successful)
//.........这里部分代码省略.........
开发者ID:bilboed,项目名称:wine,代码行数:101,代码来源:trayicon.c


示例16: WndProc

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
     static HINSTANCE hLibrary ;
     static int       iCurrent = 1 ;
     HBITMAP          hBitmap ;
     HDC              hdc ;
     PAINTSTRUCT      ps ;

     switch (message)
     {
     case WM_CREATE:
    	  // Load a pure resource dll here and get HINSTANCE variable.
    	  // More about LoadLibrary function:
    	  // Because of GDI32.LIB import lib file has been linked to our exe, so we can use Rectangle(hdc, xLeft, yTop, xRight, yBottom) function directly,
    	  // if you do not have .lib file, you can load dll at runtime, or the .lib file you have is older one but you need new functions in current dll. this is why we need this technology.
    	  // Below are the steps about this technology.
//    	 typedef BOOL (WINAPI * PFNRECT) (HDC, int, int, int, int) ;
//
//    	 You then define two variables: 
//
//    	 HANDLE  hLibrary ;
//    	 PFNRECT pfnRectangle ;
//
//    	 Now you set hLibrary to the handle of the library and lpfnRectangle to the address of the Rectangle function: 
//
//    	 hLibrary = LoadLibrary (TEXT ("GDI32.DLL"))
//    	 pfnRectangle = (PFNPRECT) GetProcAddress (hLibrary, TEXT ("Rectangle"))
//
//    	 The LoadLibrary function returns NULL if the library file can't be found or if some other error occurs. Now you can call the function and then free the library: 
//
//    	 pfnRectangle (hdc, xLeft, yTop, xRight, yBottom) ;
//    	 FreeLibrary (hLibrary) ;

          if ((hLibrary = LoadLibrary (TEXT ("BITLIB.DLL"))) == NULL)
          {
               MessageBox (hwnd, TEXT ("Can't load BITLIB.DLL."),
                           szAppName, 0) ;
               return -1 ;
          }
          return 0 ;
          
     case WM_CHAR:
          if (hLibrary)
          {
               iCurrent ++ ;
               InvalidateRect (hwnd, NULL, TRUE) ;
          }
          return 0 ;
          
     case WM_PAINT:
          hdc = BeginPaint (hwnd, &ps) ;
          
          if (hLibrary)
          {
        	   // Load resource from pure resource dll with hinstance and id here.
        	   // MAKEINTRESOURCE here means we are using id in bitlib.rc file just as one line I picked  

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LoadBlock函数代码示例发布时间:2022-05-30
下一篇:
C++ LoadBMP函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap