Sign in to follow this  
Followers 0
oMBRa

kernel function : FindResource

5 posts in this topic

here is my code:

#Include <WinAPI.au3>
#include <Constants.au3>
Global Const $RT_GROUP_ICON = 14

$Path = @WindowsDir&'\notepad.exe'
$Hlib = _WinAPI_LoadLibraryEx($Path, $LOAD_LIBRARY_AS_DATAFILE)
$Resource = DllCall('kernel32.dll', 'hwnd', 'FindResource', 'ptr', $Hlib, 'str', 1, 'str', $RT_GROUP_ICON)
MsgBox(0, '', _WinAPI_GetLastErrorMessage())

what's wrong with it?

Share this post


Link to post
Share on other sites



here is my code:

#Include <WinAPI.au3>
#include <Constants.au3>
Global Const $RT_GROUP_ICON = 14

$Path = @WindowsDir&'\notepad.exe'
$Hlib = _WinAPI_LoadLibraryEx($Path, $LOAD_LIBRARY_AS_DATAFILE)
$Resource = DllCall('kernel32.dll', 'hwnd', 'FindResource', 'ptr', $Hlib, 'str', 1, 'str', $RT_GROUP_ICON)
MsgBox(0, '', _WinAPI_GetLastErrorMessage())

what's wrong with it?

$Resource = DllCall('kernel32.dll', 'ptr', 'FindResource', 'ptr', $Hlib, 'int', 2, 'long', $RT_GROUP_ICON)

In addition, ICON\1 does not exist in NOTEPAD.EXE.

Share this post


Link to post
Share on other sites

I have tried your code and I got error 127 with _winapi_getlasterror

Share this post


Link to post
Share on other sites

I have tried your code and I got error 127 with _winapi_getlasterror

$Resource = DllCall('kernel32.dll', 'ptr', 'FindResource', 'ptr', $Hlib, 'int', 2, 'long', $RT_GROUP_ICON)
MsgBox(0, '', $Resource[0])

It works correctly. If you want to get rid of the errors, then replace "FindResource" to "FindResourceA".

Share this post


Link to post
Share on other sites

yes now it works correctly... thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0