The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: six_L on June 21, 2007, 01:09:31 AM

Title: MAKEINTRESOURCE
Post by: six_L on June 21, 2007, 01:09:31 AM
QuoteMAKEINTRESOURCE

This macro converts an integer value to a resource type compatible with Windows resource-management functions. This macro is used in place of a string containing the name of the resource.

LPTSTR MAKEINTRESOURCE(
  WORD wInteger;
);

Parameters

wInteger
    Specifies the integer value to be converted.

Return Values

The return value is the specified value in the low-order word and zero in the high-order word.
Remarks

The return value should be passed only to the Microsoft® Win32® resource-management functions, as the lpType parameter.

The MAKEINTRESOURCE macro is defined as follows.

#define MAKEINTRESOURCE(i)  (LPTSTR) ((DWORD) ((WORD) (i)))
how do translate the macros into asm?
Title: Re: MAKEINTRESOURCE
Post by: u on June 21, 2007, 01:59:05 AM
In the end, it's all a DWORD  :bdg
That C++ definition is just to trick the C++ compiler.
The OS will recognize if the passed parameter is an ID or a string simply by checking if the value is >65535. In the OS, it's basically forbidden to have memory, allocated in the first virtual 64kB (and quite a bit more). So, any pointer will be >>65535.
Title: Re: MAKEINTRESOURCE
Post by: six_L on June 21, 2007, 02:47:32 AM
thanks you.
Title: Re: MAKEINTRESOURCE
Post by: bomz on May 02, 2011, 04:43:44 AM
and how convert IDI_ICONATERISK to MAKEINTRESOURCE(IDI_ICONASTERISK)  ?

STRING db 4 dup (?)

mov dword ptr [STRING+3], IDI_ICONASTERISK

How Use here resourses from system32\shell32.dll?
Quote
ImageFile      db 'my.bmp',0


      invoke CreatePopupMenu
      mov hPopupMenu,eax
      invoke LoadImage,0,addr ImageFile,IMAGE_BITMAP,120,120,LR_LOADFROMFILE
      mov bytesWrite, eax
      invoke AppendMenu,hPopupMenu,MF_BITMAP,IDM_EXIT,bytesWrite