Page 1 of 1

Editing images via a dll, errors

Posted: Fri Apr 26, 2024 11:09 am
by es_91
I wanted to open an image in my main .exe, call the function of a dll giving it the image number (#image) and edit it there. The edited new image is created in the dll code, filled with pixels and stored into a structure. The structure now contains the #image number.

Back in the .exe main, after calling the function, the #image number is 0 and i can not find out what happened in the dll code for i can not debug it the same time i run the main .exe

What is the best way to process? Copying the code into the main file and run it there? Can i debug a dll ?? logging ??

I am using createImage () inside the dll to get an #image number and hand it back to the main program. There it is 0. :?:

Wanted to edit some image content, maybe i try editing the original #image instead.

Re: Editing images via a dll, errors

Posted: Fri Apr 26, 2024 11:12 am
by AZJIO
1. Dbgview.exe
Submit the data and Dbgview will show it.

Code: Select all

OutputDebugString_("test")
2. OnError
3. Before creating a dll, you need to test the code as an exe

Re: Editing images via a dll, errors

Posted: Fri Apr 26, 2024 11:36 am
by HeX0R
#Images created in main, are not valid inside a DLL!
You can even create two individual images with #Image = 0 inside a DLL and inside Main.
You have to work with ImageID()s

Re: Editing images via a dll, errors

Posted: Fri Apr 26, 2024 3:22 pm
by es_91
According to this, HeX0R, a dll would have to load every image content from either the clipboard or the file system when both exe and dll use it.

ImageIDs can not be used inside startDrawing ( imageOutput ( ) ). The memory should be readable but no image command can be used 'cause #images are not global.

Re: Editing images via a dll, errors

Posted: Fri Apr 26, 2024 3:33 pm
by DarkDragon
es_91 wrote: Fri Apr 26, 2024 3:22 pm According to this, HeX0R, a dll would have to load every image content from either the clipboard or the file system when both exe and dll use it.

ImageIDs can not be used inside startDrawing ( imageOutput ( ) ). The memory should be readable but no image command can be used 'cause #images are not global.
A DLL can be written in many languages, how are you supposed to work with PB images in other languages? You can't. So what you typically do is pass the image data towards the dll, see DrawingBuffer for example. You don't need to go through the hard drive.

Pass the image data pointer, width, height, pitch, bpp and channels to the function inside and work in memory.

Re: Editing images via a dll, errors

Posted: Fri Apr 26, 2024 3:37 pm
by HeX0R
I think EncodeImage() might also work (untested), then pass the Buffer to the DLL and recatch it.