コード例 #1
0
ファイル: hookdll.c プロジェクト: Oyatsumi/ulteo4Kode4kids
static void
update_icon(HWND hwnd, HICON icon, int large)
{
	int i, j, size, chunks;
	char buf[32 * 32 * 4];
	char asciibuf[ICON_CHUNK * 2 + 1];

	size = extract_icon(icon, buf, sizeof(buf));
	if (size <= 0)
		return;

	if ((!large && size != 16 * 16 * 4) || (large && size != 32 * 32 * 4))
	{
		debug("Unexpected icon size.");
		return;
	}

	chunks = (size + ICON_CHUNK - 1) / ICON_CHUNK;
	for (i = 0; i < chunks; i++)
	{
		for (j = 0; j < ICON_CHUNK; j++)
		{
			if (i * ICON_CHUNK + j >= size)
				break;
			sprintf(asciibuf + j * 2, "%02x",
				(int) (unsigned char) buf[i * ICON_CHUNK + j]);
		}

		vchannel_write("SETICON", "0x%08lx,%d,RGBA,%d,%d,%s", hwnd, i,
			       large ? 32 : 16, large ? 32 : 16, asciibuf);
	}
}
コード例 #2
0
ファイル: desktop.c プロジェクト: Dimillian/wine
static BOOL add_launcher( const WCHAR *folder, const WCHAR *filename, int len_filename )
{
    struct launcher *launcher;
    IShellLinkW *link;

    if (nb_launchers == nb_allocated)
    {
        unsigned int count = nb_allocated * 2;
        struct launcher **tmp = HeapReAlloc( GetProcessHeap(), 0, launchers, count * sizeof(*tmp) );
        if (!tmp) return FALSE;
        launchers = tmp;
        nb_allocated = count;
    }

    if (!(launcher = HeapAlloc( GetProcessHeap(), 0, sizeof(*launcher) ))) return FALSE;
    if (!(launcher->path = append_path( folder, filename, len_filename ))) goto error;
    if (!(link = load_shelllink( launcher->path ))) goto error;

    launcher->icon = extract_icon( link );
    launcher->title = build_title( filename, len_filename );
    IShellLinkW_Release( link );
    if (launcher->icon && launcher->title)
    {
        launchers[nb_launchers++] = launcher;
        return TRUE;
    }
    HeapFree( GetProcessHeap(), 0, launcher->title );
    DestroyIcon( launcher->icon );

error:
    HeapFree( GetProcessHeap(), 0, launcher->path );
    HeapFree( GetProcessHeap(), 0, launcher );
    return FALSE;
}
コード例 #3
0
ファイル: entries.cpp プロジェクト: GYGit/reactos
int Entry::safe_extract_icon(ICONCACHE_FLAGS flags)
{
	try {
		return extract_icon(flags);
	} catch(COMException&) {
		// ignore unexpected exceptions while extracting icons
	}

	return ICID_NONE;
}
コード例 #4
0
ファイル: entries.cpp プロジェクト: svn2github/ros-explorer
int ShellEntry::safe_extract_icon()
{
	try {
		return extract_icon();
	} catch(COMException&) {
		// ignore unexpected exceptions while extracting icons
	}

	return ICID_NONE;
}