Page 2 of 3
Posted: Mon Nov 27, 2006 10:28 pm
by netmaestro
I'm a retard, it's the mask that's buggered up, and I know for sure that leaving the depth parameter off CreateImage is a mistake. Updated, could you try?
Posted: Mon Nov 27, 2006 10:30 pm
by srod
Works okay here.
This is weird!
Posted: Mon Nov 27, 2006 10:34 pm
by Sparkie
Still green

Posted: Mon Nov 27, 2006 10:35 pm
by netmaestro
OK, guaranteed to fix it:

Posted: Mon Nov 27, 2006 10:36 pm
by Trond
netmaestro wrote:I'm a retard, it's the mask that's buggered up, and I know for sure that leaving the depth parameter off CreateImage is a mistake. Updated, could you try?
No, I watched the mask in the library viewer and it's correct. It should probably be 1-bit instead of 24-bit, though? But I just discovered that PB has some problems with low-images (see bug forum).
Posted: Mon Nov 27, 2006 10:37 pm
by Trond
netmaestro wrote:OK, guaranteed to fix it:

That made a white rectangle.
Edit: It looks good when I change the background colour of the pipette image to black.
Posted: Mon Nov 27, 2006 10:56 pm
by netmaestro
[removed for relevance]
Posted: Mon Nov 27, 2006 11:00 pm
by Sparkie
Netmaestro, I think Trond and I have issues with our PC's. I'll be home in an hour and I can see what it looks like there.
Seeing as how my work PC and home PC are acting differently with various pieces of code, there must be a common denomenator for all of this.
edit...sorry Netmaestro...still green
Posted: Mon Nov 27, 2006 11:09 pm
by netmaestro
OK, a minor breakthrough at least. I found a laptop here that the green background shows on, so I can continually test potential solutions. I'll post when I've got it beat.
Posted: Mon Nov 27, 2006 11:52 pm
by netmaestro
Got it beat. Source is in the original post. The solution was to give the color bitmap a black background. Should work everywhere now.
Posted: Mon Nov 27, 2006 11:54 pm
by Sparkie
As I thought, it (the original code) works perfectly for me on my home PC.

Posted: Tue Nov 28, 2006 8:18 am
by netmaestro
It's OK now but I'd like to understand just what happened a bit better. The green background makes sense if Windows is XOR'ing the color bitmap and the transparent part of the mask. The transparent part of the mask is white and the transparent color of the bitmap was pink. White XOR'ed with pink results in green, which was showing. But then, why didn't it show on all computers instead of just a few? Is something different in newer video cards? Mine's new, and the laptop it showed green on is two years old. At any rate, with a black background for the color bitmap, white XOR'ed with black leaves nothing, so that really should be safe everywhere. If anyone understands a bit more than I do about what's going on (which doesn't take much!) I'd appreciate a tip or two.
Posted: Tue Nov 28, 2006 10:19 am
by Shardik
Tranquil wrote:
Unfortunately I dont have this icon on my harddisc. But you can surely extract it from Paint with some Icontools.
srod wrote:
The following 'icon extractor' only locates 6 icons embedded within mspaint.exe
This code example demonstrates how to use the cursor resource from MSPaint.Exe (tested with WinNT SP6 and WinXP Pro SP2):
Code: Select all
CursorID.S = "#1204"
CursorLib.S = "MSPaint.Exe"
CursorLibHandle.L = LoadLibrary_(CursorLib)
If CursorLibHandle = 0
MessageRequester("Error", CursorLib + " couldn't be loaded!", #MB_ICONERROR)
End
EndIf
CursorHandle = LoadImage_(CursorLibHandle, @CursorID, #IMAGE_CURSOR, 0, 0, #LR_DEFAULTCOLOR)
If CursorHandle = 0
MessageRequester("Error", "Cursor " + CursorID + " couldn't be loaded from " + CursorLib, #MB_ICONERROR)
End
EndIf
CreateImage(0, 100,100)
StartDrawing(ImageOutput(0))
Box(0,0,100,100,#White)
StopDrawing()
OpenWindow(0,0,0,400,300,"Pipette Demo",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
CreateGadgetList(WindowID(0))
ImageGadget(0,120,80,0,0,ImageID(0),#PB_Image_Border)
SetClassLong_(GadgetID(0), #GCL_HCURSOR, CursorHandle)
Repeat
ev=WaitWindowEvent()
Until ev=#PB_Event_CloseWindow
DestroyIcon_(CursorHandle)
End
Posted: Tue Nov 28, 2006 10:24 am
by netmaestro
Very nice, thanks for posting. Where did you get the value "#1204" and how do I look through an executable to find what's in there?
Posted: Tue Nov 28, 2006 11:03 am
by Shardik
netmaestro,
I used ResourceHacker (
http://www.angusj.com/resourcehacker) to list all resources from MSPaint.Exe. When using resource hacker to open MSPaint.Exe you have to open the tree view node "Cursor Group" and take a look at the different cursor nodes. When opening node 1204 and clicking on 1031 you will see the pipette cursor on the right side. So you have to use #1204 to load the pipette cursor resource.
If you want some examples for simple resource handling take a look at the code of GPI:
http://www.purebasic.fr/english/viewtop ... 58&start=4