Hi,
have also tried to convert the ambigous #define MAKEINTRESOURCEW(i) (LPWSTR)((ULONG_PTR)((WORD)(i))) in C++ into C# but with no luck.
So I compiled a C++ program using MAKEINTRESOURCE and traced it to see what TYPE is really passed to UpdateResource(..) or similar resource accessing functions. What I hav efound that it actaully passes the interger value (Resource ID). For example if you have a Resource with "MY_RES_ID" with ID 129
the compiled code actaully just passes the 129 as a WORD data.
So in C# while doing DllImport, I just chaged the Data Type for the Resource Id parameter which uses MAKEINTRESOURCE.
Here is what I did with UpdateResource
[DllImport("kernel32.dll")]
static extern bool UpdateResource(IntPtr hUpdate, string lpType, int lpName, ushort wLanguage, IntPtr lpData, uint cbData);
Notice the Third param which has been chaged from String to int. And It works!!! Now you will just pass (using my example as mentioned above) 129 instead of MY_RES_ID, or directly MY_RES_ID if it is defined somewhere to reprent 129.
----
Rezaul Kabir
shuvro@yahoo.com