Форум программистов «Весельчак У»
  *
Добро пожаловать, Гость. Пожалуйста, войдите или зарегистрируйтесь.
Вам не пришло письмо с кодом активации?

  • Рекомендуем проверить настройки временной зоны в вашем профиле (страница "Внешний вид форума", пункт "Часовой пояс:").
  • У нас больше нет рассылок. Если вам приходят письма от наших бывших рассылок mail.ru и subscribe.ru, то знайте, что это не мы рассылаем.
   Начало  
Наши сайты
Помощь Поиск Календарь Почта Войти Регистрация  
 
Страниц: [1]   Вниз
  Печать  
Автор Тема: курсор из архива  (Прочитано 10099 раз)
0 Пользователей и 1 Гость смотрят эту тему.
Aleexeey
Постоялец

ru
Offline Offline

« : 01-11-2008 18:11 » 

Доброе всем время суток  Улыбаюсь

Загружаю системный курсор в свою прогу вот так:
HCURSOR cur = LoadCursor(NULL, IDC_ARROW);

Загружаю свой курсор из ресурсов в прогу вот так:
HCURSOR cur = LoadCursor(hResource, MAKEINTRESOURCE(IDC_MY_ARROW);

А как загрузить курсор *.cur из архива  Меня одолевают смутные сомнения

У кого есть идеи, или кто-нибудь сталкивался с подобным поделитесь
за ранее Всем благодарен!  Да-да
Записан
Алексей++
глобальный и пушистый
Глобальный модератор

ru
Offline Offline
Сообщений: 13


« Ответ #1 : 01-11-2008 18:12 » 

Aleexeey,

1) узнать формат архива
2) распаковать (самому или утилитой, специальной для)
3) далее - как обычно

мне кажется, так Улыбаюсь
Записан

Aleexeey
Постоялец

ru
Offline Offline

« Ответ #2 : 01-11-2008 18:42 » 

Ну к примеру мне нужно распаковать курсор в поток, (1. определил формат архива 2. распаковал в поток)
далее нужно его извлечь! а как?

Если использовать функцию CreateCursor и затем DestroyCursor
как можно заполнить битовую маску AND и XOR из потока?

Есть какие-нибудь идеи?
Записан
Алексей++
глобальный и пушистый
Глобальный модератор

ru
Offline Offline
Сообщений: 13


« Ответ #3 : 01-11-2008 18:45 » 

Aleexeey, а в файл сохранить ? Или курсоры в архиве как-то особенно хранятся ?
Записан

Aleexeey
Постоялец

ru
Offline Offline

« Ответ #4 : 01-11-2008 18:49 » 

Да, нужно избежать сохранения курсора на жесткий диск.
Записан
Алексей++
глобальный и пушистый
Глобальный модератор

ru
Offline Offline
Сообщений: 13


« Ответ #5 : 01-11-2008 18:52 » 

а почему надо этого избегать ? Улыбаюсь Это и быстрее работать будет - сохранил один раз и работай
Код:
HCURSOR LoadCursorFromFile(          LPCTSTR lpFileName
);


есть ещё
Код:
HICON CreateIconIndirect(          PICONINFO piconinfo
);

typedef struct _ICONINFO {
    BOOL fIcon;
    DWORD xHotspot;
    DWORD yHotspot;
    HBITMAP hbmMask;
    HBITMAP hbmColor;
} ICONINFO;
Members

fIcon
Specifies whether this structure defines an icon or a cursor. A value of TRUE specifies an icon; FALSE specifies a cursor.
xHotspot
Specifies the x-coordinate of a cursor's hot spot. If this structure defines an icon, the hot spot is always in the center of the icon, and this member is ignored.
yHotspot
Specifies the y-coordinate of the cursor's hot spot. If this structure defines an icon, the hot spot is always in the center of the icon, and this member is ignored.
hbmMask
Specifies the icon bitmask bitmap. If this structure defines a black and white icon, this bitmask is formatted so that the upper half is the icon AND bitmask and the lower half is the icon XOR bitmask. Under this condition, the height should be an even multiple of two. If this structure defines a color icon, this mask only defines the AND bitmask of the icon.
hbmColor
Handle to the icon color bitmap. This member can be optional if this structure defines a black and white icon. The AND bitmask of hbmMask is applied with the SRCAND flag to the destination; subsequently, the color bitmap is applied (using XOR) to the destination by using the SRCINVERT flag.

больше я ничего не нашёл вот так сразу
« Последнее редактирование: 01-11-2008 18:56 от Алексей1153++ » Записан

Алексей++
глобальный и пушистый
Глобальный модератор

ru
Offline Offline
Сообщений: 13


« Ответ #6 : 01-11-2008 18:54 » 

а, если не ошибаюсь, вот тебе подойдёт
Код:
The CreateIconFromResourceEx function creates an icon or cursor from resource bits describing the icon.
HICON CreateIconFromResourceEx(          PBYTE pbIconBits,
    DWORD cbIconBits,
    BOOL fIcon,
    DWORD dwVersion,
    int cxDesired,
    int cyDesired,
    UINT uFlags
);
Parameters

pbIconBits
[in] Pointer to a buffer containing the icon or cursor resource bits. These bits are typically loaded by calls to the LookupIconIdFromDirectoryEx and LoadResource functions.
cbIconBits
[in] Specifies the size, in bytes, of the set of bits pointed to by the pbIconBits parameter.
fIcon
[in] Specifies whether an icon or a cursor is to be created. If this parameter is TRUE, an icon is to be created. If it is FALSE, a cursor is to be created.
dwVersion
[in] Specifies the version number of the icon or cursor format for the resource bits pointed to by the pbIconBits parameter. This parameter can be 0x00030000.
cxDesired
[in] Specifies the desired width, in pixels, of the icon or cursor. If this parameter is zero, the function uses the SM_CXICON or SM_CXCURSOR system metric value to set the width.
cyDesired
[in] Specifies the desired height, in pixels, of the icon or cursor. If this parameter is zero, the function uses the SM_CYICON or SM_CYCURSOR system metric value to set the height.
uFlags
[in] Specifies a combination of the following values:
LR_DEFAULTCOLOR
Uses the default color format.
LR_DEFAULTSIZE
Uses the width or height specified by the system metric values for cursors or icons, if the cxDesired or cyDesired values are set to zero. If this flag is not specified and cxDesired and cyDesired are set to zero, the function uses the actual resource size. If the resource contains multiple images, the function uses the size of the first image.
LR_MONOCHROME
Creates a monochrome icon or cursor.
LR_SHARED
Shares the icon or cursor handle if the icon or cursor is created multiple times. If LR_SHARED is not set, a second call to CreateIconFromResourceEx for the same resource will create the icon or cursor again and return a different handle.
When you use this flag, the system will destroy the resource when it is no longer needed.

Do not use LR_SHARED for icons or cursors that have non-standard sizes, that may change after loading, or that are loaded from a file.

When loading a system icon or cursor, you must use LR_SHARED or the function will fail to load the resource.

Windows 95/98/Me: The function finds the first image with the requested resource name in the cache, regardless of the size requested.


Записан

Aleexeey
Постоялец

ru
Offline Offline

« Ответ #7 : 01-11-2008 18:58 » new

Алексей1153++ спасибо за идеи!!!
Буду пробовать  Да-да
Записан
Страниц: [1]   Вверх
  Печать  
 

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines