Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Основная";
Текущий архив: 2004.07.04;
Скачать: [xml.tar.bz2];

Вниз

Стили окна   Найти похожие ветки 

 
alex870   (2004-06-18 19:23) [0]

Здравствуйте!
У меня такая проблема: при создании окна в параметрах функции (ну например CreateWindowEx) передаются стили окна (dwStyle и dwStyleEx), они состоят из комбинации стилей, т.е. я сложил значения стилей, получил dword и передал его функции, а как сделать наоборот, т.е. зная dword получить значения стилей его составивших?
Зарание спасибо!


 
Fay ©   (2004-06-18 19:26) [1]

Ку?

GetWindowLongPtr
The GetWindowLongPtr function retrieves information about the specified window. The function also retrieves the value at a specified offset into the extra window memory.

If you are retrieving a pointer or a handle, this function supersedes the GetWindowLong function. (Pointers and handles are 32 bits on 32-bit Windows and 64 bits on 64-bit Windows.) To write code that is compatible with both 32-bit and 64-bit versions of Windows, use GetWindowLongPtr.

LONG_PTR GetWindowLongPtr(
 HWND hWnd,  // handle to window
 int nIndex  // offset of value to retrieve
);
Parameters
hWnd
[in] Handle to the window and, indirectly, the class to which the window belongs.
nIndex
[in] Specifies the zero-based offset to the value to be retrieved. Valid values are in the range zero through the number of bytes of extra window memory, minus the size of an integer. To retrieve any other value, specify one of the following values. Value Action
GWL_EXSTYLE Retrieves the extended window styles. For more information, see CreateWindowEx.  
GWL_STYLE Retrieves the window styles.
GWLP_WNDPROC Retrieves the pointer to the window procedure, or a handle representing the pointer to the window procedure. You must use the CallWindowProc function to call the window procedure.
GWLP_HINSTANCE Retrieves a handle to the application instance.
GWLP_HWNDPARENT Retrieves a handle to the parent window, if there is one.
GWLP_ID Retrieves the identifier of the window.
GWLP_USERDATA Retrieves the user data associated with the window. This data is intended for use by the application that created the window. Its value is initially zero.

The following values are also available when the hWnd parameter identifies a dialog box. Value Action
DWLP_DLGPROC Retrieves the pointer to the dialog box procedure, or a handle representing the pointer to the dialog box procedure. You must use the CallWindowProc function to call the dialog box procedure.
DWLP_MSGRESULT Retrieves the return value of a message processed in the dialog box procedure.
DWLP_USER Retrieves extra information private to the application, such as handles or pointers.

Return Values
If the function succeeds, the return value is the requested value.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

If SetWindowLong or SetWindowLongPtr has not been called previously, GetWindowLongPtr returns zero for values in the extra window or class memory.


 
nikkie ©   (2004-06-18 19:35) [2]

>alex870
учить битовую арифметику. and, or, xor, not, shl, shr.


 
alex870   (2004-06-18 19:36) [3]

Вот-вот, этой функцией я и пользуюсь (если быть точным, то GetWindowLong, т.к. под 98-й пишу), но она возвращает dword, т.е. сумму значений стилей, а мне нужно получить список стилей. Ну например $11000000 - это (ws_maximize or ws_visible) ну тут просто $10000000 - это ws_visible, а $1000000 - это ws_maximize, а если стилей много... ну в общем как разложить dwStyle на отдельные стили?


 
GuAV ©   (2004-06-18 19:51) [4]


>  а если стилей много...

если чего-то одинакового много - то это цикл.
используй, например цикл с or и shl.


 
jack128 ©   (2004-06-18 19:57) [5]

if (ws_maximize and MyStyle) = ws_maximize then
 // есть стиль

if (ws_visible and MyStyle) = ws_visible then
 //


 
alex870   (2004-06-18 21:24) [6]

Спасибо большое jack128, вы единственный, кто дал однозначный и в тему ответ! Но тут, кроме битовой логики, есть еще и заковырки со стилями, например ws_overlapped = $4000000 и ws_clipibling равен тому же $4000000. В window style таких приколов штуки 3-4, а если брать еще и BS_, CS_ и т.д. то запаришся писать обработчик. Дело то в том, что понимание одного и тогоже значения переменной может зависить от кучи параметров, например если окно класса BUTTON, то $4000000 понимается как ws_clipibling, а если это главное окно, то считается, что у него есть и ws_overlapped и ws_clipibling, а еще в определенных комбинациях нельзя применять стили. Может есть уже готовая функция в windows?


 
Fay ©   (2004-06-18 22:07) [7]

2alex870   (18.06.04 21:24) [6]
На сайте имеется Лицей. Не стесняйтесь.



Страницы: 1 вся ветка

Форум: "Основная";
Текущий архив: 2004.07.04;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.46 MB
Время: 0.041 c
4-1085132393
nexxiss
2004-05-21 13:39
2004.07.04
Цикл обработки сообщений


14-1086741817
begin
2004-06-09 04:43
2004.07.04
Помогите нач. программисту !!!


6-1084000571
eNZo
2004-05-08 11:16
2004.07.04
Приложение клиент - сервер для работы с MSSQL на удаленном компе


1-1087755757
terra0
2004-06-20 22:22
2004.07.04
передача глобальной переменной в DLL


14-1087295931
IamVampireVsDrakula
2004-06-15 14:38
2004.07.04
ВОт так задачка





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский