FeyFre
Thank you very much for the information. Please still, tell me how to get following arguments for the function FindResourceEx:
IDS_STRING,
RT_STRING,
langid.
Posted: Mon Dec 31, 2012 1:01 am
by FeyFre
KDJ
RT_STRING is value of resource type identifiers for string resource type, number(WORD 2 bytes only) or \0-terminated string. Equals to 6. You can find its and of other predefined types values in Win32\kernel32.js of mine Win32 Constants Library (you should use it effectively like AkelPad.Include("win32\\kernel32.js"), instead of manual definition if those constants or direct usage of *magic numbers*).
IDS_STRING is resource item identifier, number(WORD) or string(\0 termonated). You must specified value you need to load. Where to obtain it? From the author of module you want to load from. Since you want to load it from AkelPad's language modules, you should get it source(download from Download section here). You need file AkelFiles/Langs/Resources/resource.h there are all resource ID's used in AP and language modules.
I cannot say more. It is number Windows use to identify language. In C code is obtained by using macro MAKELANGID(p,s) ((s<<10)+p).
Where
p - primary language code, like:
LANG_ENGLISH (equals 9) for English,
LANG_RUSSIAN =25
LANG_UKRAINIAN =34
LANG_POLISH =21
etc(list is long - 1024 items)
s - secondary language code. For most of languages valid values for it are only(generic):
SUBLANG_NEUTRAL =0 (actually it is valid only for LANG_NEUTRAL =0)
SUBLANG_DEFAULT =1
SUBLANG_SYS_DEFAULT =2
You should use SUBLANG_DEFAULT for them since it used almost everywhere in resources. MAKELANGID(LANG_RUSSIAN,SUBLANG_DEFAULT)= 1<<10+25= familiar for you 1049 = 0x0419
Some languages are a bit harder to encode, for instance:
LANG_ENGLISH can be:
so MAKELANGID(LANG_CHINESE,SUBLANG_CHINESE_SIMPLIFIED) gives 2<<10 +4 = familiar for you 2052 = 0x0804
If you will use this constants from kernel32.js you must do s + p only, not shifting because it already done in definition(didn't noticed).
This tripe (resource type, resource id, langid) uniquely identifies any resource in resource package(resource archive or image file).
I just realised I mislead you a little. If you going to seek localised version of button on standard AP's dialog, you must load dialog resource using resource type constant RT_DIALOG =5, not string resource, and in returned piece of memory you must parse it as DLGTEMPLATE or DLGTEMPLATEEX structure(see MSDN).
Posted: Mon Dec 31, 2012 7:24 am
by cnnnc
FeyFre and VladSh, Thank you for your criticism. FeyFre
Zen-coding is a great toolkit for html and css workflow, and it has been renamed and moved to emmet for a while. It seems some update in it. Could you take a little time to update your script with that?
Posted: Mon Dec 31, 2012 6:31 pm
by KDJ
FeyFre
I have a problem with the function FindResourceEx.
In the following script, FindResourceEx returns 0.
What have I done wrong?
KDJ
First of all you Resource type argument is second, not third. I.e You should comment 16 line and uncomment 17.
Next, in order to determine error you should use GetLastError function immediately after call:
In script you posted here lasterror will be ERROR_RESOURCE_TYPE_NOT_FOUND=1813
(you can obtain human readable error text by calling function FormatMessageW/A)
if you fix 16,17 line you will get good result, or another error(you will get ERROR_RESOURCE_NAME_NOT_FOUND=1814).
And it is not their error. It is peculiarities of FindResourceEx function. It works with raw data stored in resources directory of image(and returns raw data). Don't worry, what I say next not every developer for windows knows, and even I know it accidentally. RT_STRING resources are stored in chunks of string(16 per chunk). That resource ID you use( 150) it threats as Chunk ID, and tries to find it. Fails. So you must convert you string id into chunk id, get raw string chunk, and extract required string manually. I never done that before, but here you can see example(in Russian)
Use ResourceHacker to inspect String resources(you will see strings are chunked)
Posted: Tue Jan 01, 2013 9:07 pm
by KDJ
FeyFre
Great thanks. At last I understood how it works.
Below I posted three scripts, which can be used to extract some data from resources.
cnnnc wrote:FeyFre
Zen-coding is a great toolkit for html and css workflow, and it has been renamed and moved to emmet for a while. It seems some update in it. Could you take a little time to update your script with that?
+1
Posted: Wed Jan 02, 2013 5:44 pm
by F. Phoenix
KDJ, I finished translation of your FindFiles.js, but has 2 moments, which modified:
Need about +10px for better translation of "Don't search in larger than:" label
" B " for "bytes" in status bar was untranslatable
F. Phoenix
Thank you for the translation.
And can you use a shorter alternative of "Не искать в файлах крупнее:"?
Eg: "Не искать в больших, чем:" or "Не искать в крупнее, чем:".
Similarly as: "Не искать в бинарных".
Posted: Thu Jan 03, 2013 11:14 am
by DV
KDJ wrote:And can you use a shorter alternative of "Не искать в файлах крупнее:"?
"Не искать в файлах >"
Posted: Thu Jan 03, 2013 11:41 pm
by F. Phoenix
KDJ, in this case I prefere "Не искать в больших, чем:", but don't see the problem to increase it. And what about add bytes mark after input field? For something like this: screenshot.
DV, вот там из-за отстутствия этой "Б", по моему, как раз и есть основной недостаток интуитивности. Тем более, что поле ввода текстовое, а не NumericUpDown. А с ней вполне неплохо бы воспринималось и "Не искать в больших, чем:", и твое "Не искать в файлах >"; а так этот символ еще, к примеру, в виде стрелки частенько юзается.
Posted: Fri Jan 04, 2013 7:49 am
by Lenchik
А настолько ли большая проблема делать эти окошки и шрифты не пиксельных размеров, а растягивающимися под размеры шрифтов пользователя? Вот я увеличил шрифты в системе. Opera и utorrent на это отреагировали отлично - всё растянулось и всё читабельно. А Акельпад неоднозначно среагировал - в меню шрифт изменился и менюшки подвинулись, но статусная строка под ширину надписей не исправилась и кое-что съедается, в настройках и заголовках вкладок mdi шрифт не сменился (и, соответственно, смотрится мелко на фоне остальных программ). Плагины и скрипты так и остались на прописанных в них шрифтах и размерах. Могут ли разработчики учитывать то, что пользоатель может хотеть все смотерть большим шрифтом или не тем, который за него впишет разработчик?
Posted: Fri Jan 04, 2013 9:56 am
by DV
Lenchik wrote:Могут ли разработчики учитывать то, что пользоатель может хотеть все смотерть большим шрифтом или не тем, который за него впишет разработчик?
Вообще - да. Просто дело в том, что реализация этого дела средствами Win API сделана, выражаясь словами одного из наших политиков, "немножко по-дебильному". Часто просто неохота возиться со всеми этими контекстами устройств, шрифтами и прочим отстоем ради пересчёта размеров.