oldtimer Posted April 16, 2022 Share Posted April 16, 2022 I am having a problem trying to embed a small bitmap into an exe file. Here, I think, are the relevant code fragments When I run the script the bitmap shows up exactly as intended. After compiling- Using _Resource_SetToCtrlID the picture doesn't show up at all I switched to _Resource_GetAsBitmap then _Resource_SetBitmapToCtrlID, the bitmap shows up but is not "transparent" I've been struggling with this for hours, would very much appreciate someone telling me what I'm doing wrong. Link to comment Share on other sites More sharing options...
Solution Nine Posted April 16, 2022 Solution Share Posted April 16, 2022 Please use tags when you post code as described in the link. Maybe this : #AutoIt3Wrapper_Res_File_Add=Check.bmp, RT_BITMAP, BMP_1 #include <WinAPISys.au3> #include <WinAPIRes.au3> #include <StaticConstants.au3> #include <GUIConstants.au3> GUICreate("Test") Local $idPic = GUICtrlCreatePic("", 10, 10, 50, 50, -1, $WS_EX_TRANSPARENT) Local $hInstance = _WinAPI_GetModuleHandle(0) Local $hBitmap = _WinAPI_LoadImage($hInstance, "BMP_1", $IMAGE_BITMAP, 0, 0, 0) If Not $hBitmap Then Exit ConsoleWrite("ERROR" & @CRLF) GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
mikell Posted April 17, 2022 Share Posted April 17, 2022 17 hours ago, oldtimer said: embed a small bitmap into an exe file What about directly hard coding the bmp in the script ? one nice method here Link to comment Share on other sites More sharing options...
oldtimer Posted April 17, 2022 Author Share Posted April 17, 2022 On 4/16/2022 at 1:37 PM, Nine said: Please use tags when you post code as described in the link. Maybe this : #AutoIt3Wrapper_Res_File_Add=Check.bmp, RT_BITMAP, BMP_1 #include <WinAPISys.au3> #include <WinAPIRes.au3> #include <StaticConstants.au3> #include <GUIConstants.au3> GUICreate("Test") Local $idPic = GUICtrlCreatePic("", 10, 10, 50, 50, -1, $WS_EX_TRANSPARENT) Local $hInstance = _WinAPI_GetModuleHandle(0) Local $hBitmap = _WinAPI_LoadImage($hInstance, "BMP_1", $IMAGE_BITMAP, 0, 0, 0) If Not $hBitmap Then Exit ConsoleWrite("ERROR" & @CRLF) GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE That works perfectly. Thanks very, very much. Is that method documented somewhere that I should have been able to find? I had searched and searched trying to find something that would work. I apologize for not using tags in the code I posted. I won't make that mistake again. Link to comment Share on other sites More sharing options...
Nine Posted April 17, 2022 Share Posted April 17, 2022 36 minutes ago, oldtimer said: Is that method documented somewhere that I should have been able to find? I had searched and searched trying to find something that would work. I do not remember all the codes that I have created over time. With well over 1500 scripts, I use my search tool (see signature) to find what I want inside my scripts directory tree. As for where to find the documentation, MSDN is the best place to get the exact information you seek for. Glad I gave you a solution for your problem. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now