Page 2 of 2

Posted: Wed Nov 30, 2005 4:44 am
by dagcrack
josku_x wrote:
GeoTrail wrote:Works fine now ;)
Pretty funny, can use the draw mouse thing to scare people, you can say it's a virus or something :lol: And they must pay to get help removing it :twisted:
That's funny! I laughed for that about 10 minutes :lol: :D ...

dagcrack wrote: :? :? :? What's the deal with this? Get codearchiv:
well, dagcrack, maybe there is similar code to do that in the codearchiv, but that doesn't count! This counts here, because I needed a half-hour to do this, it was hard first to do the DesktopOutput procedure, and after it was completed I tried very much to do things right, because I was afraid something could happen to my PC. After I saw it kills my CPU, I wanted to stop working on it, but when it was just to use Delay(5), then the show began :) ... Also, while I was experimenting the Win32 API, I found the InvalidateRect_() procedure which refreshes the determined area.. So what I mean is, that I made much work to do this.

Code: Select all

PS: Updated code! Check the first code snippet in my first post. lol.
To me it's a rip-off, you cant say anything to change my mind by now.
But since its a small snippet, I really dont care, mainly because I didnt write the original one.

But just seeing how many people steals other's code (even if its public domain and blablabla) and claims that they made it, pisses me off. Not saying that of you, even if I think so.

Posted: Wed Nov 30, 2005 4:40 pm
by josku_x
Firstly, I want to say this topic is going very much off-topic..

Secondly, dagcrack, I don't want to know what do you think of my snippet, and even if here are people who steal code (for example you :lol: ), I didn't steal this code from the CodeArchiv!

But hey, why do we then steal others code?

For example, nowadays people write some "code" like: "1+1=2".. Why did Albert Einstein not tell us to not steal his "code"?!

Here is another example of Einstein, E=mc^2, why do we use that nowadays? Huh?

Just one thing: BUzz oFF! :x

Oh, yes, your nickname on this forum is dagcrack, search that in google, you get thousands of results!

Posted: Wed Nov 30, 2005 5:08 pm
by thefool
found a post by him on another site:
http://forums.cgsociety.org/showthread.php?t=164091

hoho
I will say it again, we already have 2 publishers on the line. We already HAVE them, so all what you say is simply untrue. 10,000 copies? We will sell much more.
quote from that page. Seems to be one of those dagcrack works with. selling more than 10 000 copies of a game with such a childish name? "Action Bird" :lol:

the dangerous bird!! uh be scared

Posted: Wed Nov 30, 2005 5:11 pm
by josku_x
Well, I found him in many websites, including blitzcoder...

Anyway, I don't like it that my topic goes off-topic...
Is there anything concerning you with my code? I mean does it work well? Any problems?


:arrow: Seems to be I'm good 8)

Posted: Wed Nov 30, 2005 5:14 pm
by thefool
Image

What proffessional artwork is that? I thought you were better... Even i can make prettier things than that!!

Jokin :) though i probably would be able to do this, even using the senseflare engine


@joskux for going on track again, your code works fine here!

Posted: Mon Dec 05, 2005 5:12 pm
by gpetersz
I don't care about this childish argument, sorry for that, I would like to learn, from anybody who is willing to help.
(hey guys, it is NOT Windows Vista to be worth arguing over who made it first...)

Okay. Somebody might describe me how this code works and why.

My problems:

1.
How on earth should one know that the point will go to the Desktop?
Why? Allocatememory() help says:

"Allocates a contiguous memory area according to the specified size (in bytes). If the needed memory is available, *MemoryID will get the start address of the memory area, else it be 0.

Note: All the allocated memory areas are automatically freed when the programs ends. "

What has it got to do with Desktop????
In the DesktopOutput() procedure you only poke into this memory area. And it is returned as a buffer(????). Why a red dot is put on the desktop?

2.
So this DektopOutput() is used in StartDrawing()
How on earth did this come into your mind? I read the help again and found:
WindowOutput() : Graphics will be rendered directly on the Window
ScreenOutput() : Graphics will be rendered directly on the Screen (for games)
SpriteOutput() : Graphics will be rendered directly on the Sprite (for games)
ImageOutput() : Graphics will be rendered directly on the Image data (see CreateImage())
PrinterOutput() : Graphics will be rendered directly on the Printer
TextureOutput() : Graphics will be rendered directly on the Texture

The help tells nothing about other buffers to use (And how come Desktop into the picture? Why not any other memory chunk?)

3.
How on earth can these Windows functions be called from such easily from PureBasic? Like (InvalidateRect_). Does this _ underscore means that it is not a PureBasic command? But how does Purebasic know from which library should it call the functions.

Besides win32hlp says this:

BOOL InvalidateRect(
HWND hWnd, // handle of window with changed update region
CONST RECT *lpRect, // address of rectangle coordinates
BOOL bErase // erase-background flag
);

We pass 0, 0, 0. Does it mean the desktop somehow? But the second parameter should be a pointer.

Guys. I am totally confused. These things are absolutely undocumented and I don't really understand how and why they work.

Could anybody help me out?

Thanks!

Posted: Mon Dec 05, 2005 5:37 pm
by josku_x
Whoa! you have many questions.
Well here are the answers to your questions:
1.
How on earth should one know that the point will go to the Desktop?
Why? Allocatememory() help says:

"Allocates a contiguous memory area according to the specified size (in bytes). If the needed memory is available, *MemoryID will get the start address of the memory area, else it be 0.

Note: All the allocated memory areas are automatically freed when the programs ends. "

What has it got to do with Desktop????
In the DesktopOutput() procedure you only poke into this memory area. And it is returned as a buffer(????). Why a red dot is put on the desktop?
Well, as I was bored and there was nothing to do, I started to think to make something very unuseful and drawing to the desktop is something like that... Well, how did I know to use AllocateMemory()? It was so that when I tried to draw in a memory area (Yes, sounds crazy), the return was nothing, so I tried many times, but as I started to use big sizes like AllocateMemory(800), then I could see something, but it didn't draw to my whole desktop, so I thought that my screensize is what I need to use to get it working, and I have a 1024*768 screen here so 1024 passed succesfully. And it needs to be poked as long because the return is too big for a byte, string etc... and if it would not be poked, then it won't do anything, just eat memory...

On to the next question:
2.
So this DektopOutput() is used in StartDrawing()
How on earth did this come into your mind? I read the help again and found:
WindowOutput() : Graphics will be rendered directly on the Window
ScreenOutput() : Graphics will be rendered directly on the Screen (for games)
SpriteOutput() : Graphics will be rendered directly on the Sprite (for games)
ImageOutput() : Graphics will be rendered directly on the Image data (see CreateImage())
PrinterOutput() : Graphics will be rendered directly on the Printer
TextureOutput() : Graphics will be rendered directly on the Texture

The help tells nothing about other buffers to use (And how come Desktop into the picture? Why not any other memory chunk?)
As I said, I was bored and just tried to do something, and when I wanted to draw to the desktop, I found out there wasn't a DesktopOutput() procedure. Also, If I want to use another chunk, it maybe wouldn't draw to the desktop, and that is the bug.

now to the next question:
3.
How on earth can these Windows functions be called from such easily from PureBasic? Like (InvalidateRect_). Does this _ underscore means that it is not a PureBasic command? But how does Purebasic know from which library should it call the functions.

Besides win32hlp says this:

BOOL InvalidateRect(
HWND hWnd, // handle of window with changed update region
CONST RECT *lpRect, // address of rectangle coordinates
BOOL bErase // erase-background flag
);

We pass 0, 0, 0. Does it mean the desktop somehow? But the second parameter should be a pointer.
Yes, the underscore means it is not a PureBasic function, so it is a Basic function (maybe Visual Basic, not sure)
And InvalidateRect_() well, if hWnd is set to 0 and there is no window, it will update the desktop, and if the RECT is set to 0, then the area is the whole desktop. and the last parameter is a flag, and I didn't need any special flags, so I set it to 0.

I hope your answers are now fully answered and that you understand how everything works.

EDIT:
But how does Purebasic know from which library should it call the functions.
Why do you think you are using PureBasic? :lol:
Just joking, if you make for example your own Basic language, you have to declare all headers you need for the compiled projects of the users.

So look this:
http://msdn.microsoft.com/library/defau ... w_7ano.asp

Scroll down the page until "Requirements". You'll see it is needed to include Windows.h (header) and the library User32.lib, and it seems Fred has included and declared these in PB, if he wouldn't we couldn't use the functions with underscore...

Posted: Mon Dec 05, 2005 5:44 pm
by Fred
The underscore means it's not a PureBasic function but an API function (ie: Windows API function on Windows, Linux on linux and so on). About the DesktopOutput(), it just simulate an output to the desktop by providing the correct 'Device Context (DC)' to the 2DDrawing library which use generic functions to do the drawing.

Posted: Mon Dec 05, 2005 5:45 pm
by josku_x
Fred wrote:The underscore means it's not a PureBasic function but an API function (ie: Windows API function on Windows, Linux on linux and so on). About the DesktopOutput(), it just simulate an output to the desktop by providing the correct 'Device Context (DC)' to the 2DDrawing library which use generic functions to do the drawing.
I couldn't explain it so easy :lol:
But I did say it correctly, right?

Posted: Mon Dec 05, 2005 6:53 pm
by gpetersz
Thanks josku and Thanks Fred!

So if I get it right, you were just doodling around creatively? :D
Oh my! Maybe I am on a wrong path with my practice, I always take the helpfile and read. ;)

Thanks for the info!

I suspected what Fred said that there is some undocumented feature with Startdrawing. :)

Thanks for the useful API calling description! I was after something like I'd open the correct DLL from the system32 folder and start calling like that, but seemingly I don't need to do that!

Thanks guys again!

Posted: Mon Dec 05, 2005 8:17 pm
by josku_x
no problem,.. hey! I know an artist as he was a boy, he doodled around and now everybody knows him with the name: Josku_X :wink:

Ok ok, but if you need help, it is good to look the helpfile through and read about winapi controls, but if you have no clue, this board helps you the most!


But it is good to practice, because, for example me, I am just a beginner and can make some good programs, but I never practice, I always just doodle aorund :D

Posted: Mon Dec 05, 2005 8:34 pm
by gpetersz
Actually, with undocumented things the help file won't have at all.
I was sure that I could not draw to the desktop and it was OK for me, since it wasn't written in the help. You found a way (by trying illogical things ;)), and that's nice!

Fred had the answer for this undocumented topic. :)

Posted: Mon Dec 05, 2005 9:02 pm
by josku_x
But I had the creativiness :D

Posted: Mon Dec 05, 2005 9:53 pm
by gpetersz
That's true! :D

Re: Draw to the desktop =D

Posted: Mon Nov 29, 2010 10:20 pm
by J. Baker
It seems the code no longer works. Can you no longer draw to memory with StartDrawing()?