flat assembler
Message board for the users of flat assembler.
Index
> Windows > MAKEINTRESOURCE |
Author |
|
AsmGuru62 18 Aug 2013, 13:37
Just pass the ID of a resource as a DWORD.
Sometimes (very rare) resources are named by actual text. In such case you must pass the string where MAKEINTRESOURCE needed. P.S. If you look into .H file you will see something like this: Code: #define MAKEINTRESOURCE(i) (LPTSTR) ((DWORD) ((WORD) (i))) |
|||
18 Aug 2013, 13:37 |
|
yoshimitsu 18 Aug 2013, 18:50
you can't allocate memory at an address below 10000h, means the high-word-address-part of such resource name-strings you pass to the winapi are always nonzero.
so, there's the case the high-word is nonzero, which means you're passing the resource name as a string and the other case being the high-word is zero, which results in the winapi function using the low-word as an resource ID. as in asm parameters are simply dwords and you do not have to do type converts simply pass either an ID or a string. |
|||
18 Aug 2013, 18:50 |
|
HaHaAnonymous 18 Aug 2013, 18:56
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 20:13; edited 1 time in total |
|||
18 Aug 2013, 18:56 |
|
machinecoder 19 Aug 2013, 07:05
AsmGuru62 wrote: Just pass the ID of a resource as a DWORD. So do you mean this... Code: hIcon = LoadImage( g_hInst, MAKEINTRESOURCE(IDI_MAIN_ICON), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0); Becomes this Code: hIcon = LoadImage( g_hInst, IDI_MAIN_ICON, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0); Please help, as I want to put icons on the status bar and every example is in poo-bum 'C++' ! C++ is just a poor mans assembler language, real programmers code in X86 |
|||
19 Aug 2013, 07:05 |
|
AsmGuru62 19 Aug 2013, 17:46
Yes, just remove that macro and do not use it - this macro is just a type cast.
Please take a look here: http://msdn.microsoft.com/en-us/library/windows/desktop/aa381018(v=vs.85).aspx Notice how the name of a resource can be: "Unique name or a 16-bit unsigned integer value identifying the resource." There are also two examples of ICON resources: Code: desk1 ICON "desk.ico" 11 ICON "custom.ico" Notice how 1st icon is NAMED "desk1" and the 2nd has an ID as an integer value 11. So, if your icons are NAMED by a string - you must pass a string instead of MAKEINTRESOURCE() and if it is a value - then pass an integer value: Code: ResIcon1 db 'desk1',0 ResIcon2 dd 11 HIcon1 dd 0 HIcon2 dd 0 ... invoke GetModuleHandleA, 0 mov esi, eax invoke LoadIconA, esi, ResIcon1 mov [HIcon1], eax invoke LoadIconA, esi, [ResIcon2] mov [HIcon2], eax |
|||
19 Aug 2013, 17:46 |
|
xDOBORAx 03 Sep 2013, 20:37
machinecoder wrote:
youre so wrong, real men use punched cards isnt keyboard and monitor for feeble ? _________________ |
|||
03 Sep 2013, 20:37 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.