Jump to content

Recommended Posts

Posted

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?

Posted

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.

Posted

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".

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...