Use
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
You wouldn't be able to properly reproduce it in Windows, but you could do it in your own programs by blitting a 32-bit image with alpha as the pointer.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You". -- Linus Torvalds
That's what I had also in mind. But it has to be a transparent Blt too. So, this could be a nice exercise for me using this new Alphablend API, combined with the familiar Blt operations.
ALphablendin effects in win2k are done with a certain api that is dependent on the system i think, the cursor is also pretty deep into the system since it's the last thing that moves when i crash. But the algoritm isn't that hard, split up all color components, multiply by alpha component for source and 1-alpha for target and add them up. On the cursor thing, a fullscreen app would be ideal but blitting outside wouldn't.
Use
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
Posts
1,457
If it's in Windows, you could hide the real cursor and use a small window with the effect in its position.
But in that case the alpha blending routine would have to be very fast... there's an API that automatically alpha-blends a window; by modifying the form's shape so it looks like a regular cursor and using that, you should get a different cursor
Hi kids, I'm back again in my thread.
I developed some code to simulate the a-blended (shaded ) mouse cursor.
See the attached ZIP, it also includes the source code.
Unfortunately, there's some flicker (guess the for-next loop 32x32 getpixel and setpixelv) but I did not had the time yet to solve this.
I also think that I should use another mask (a coloured one) for the shadow effect.
Why dont you just get a cursor makin proggie, and make your own cursor with a shadow? Their is a program called Microangelo, available on http://www.downloads.com/
It might not look as beutiful as muh lil win2k cursor, :P but it will look better then using vb to make a fake shadow.
The shading is Win2k specific, cant be done without it, unless you make a program that fakes it :P
I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
Posts
1,457
Ph34R: I'm sure he worked very hard on this, so you shouldn't make it look like a joke now.
All he has to do is make that effect appear in a shaped (notice the "P" in "shaPed", it's not a "D" ) form, and voila!
To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systemshere.
Jotaf's Theories!
"Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."
Thanks Jotaf98!
And Ph34R or something, my goal was to fake it, so I don't need this stupid MicroAngelo soft.
By the way, the flicker is almost gone by using a look-up table.
See the attached ZIP.
If you set the second argument, crKey, and put 'or LWA_COLORKEY' at the end, this will make whatever color crKey is completely invisible (i.e. if you set crKey to 0 which is black, all black parts of the form will be invisible). By invisible it means two things: not drawn on screen, and not able to be clicked on (if you click on an invisible bit, the focus goes through to the window underneath).
public declare function SetLayeredWindowAttributes lib "User32" (ByVal hWnd as Long, ByVal crKey as Long, ByVal bAlpha as Byte, ByVal dwFlags as Long) as Long
public declare function SetWindowLong lib "User32" (ByVal hWnd as Long, ByVal Index as Long, ByVal NewValue as Long) as Long
public const WS_EX_LAYERED = &H80000
public const LWA_COLORKEY = &H1
public const LWA_ALPHA = &H2
public const GWL_EXSTYLE = ? (Get from Api Text Viewer)
private sub Form_Load()
SetWindowLong hWnd, GWL_EXSTYLE, GetWindowLong(hWnd, GWL_EXSTYLE) or WS_EX_LAYERED
I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
Posts
1,457
Heh, cool! (Both of you )
Mad Compie, you should probably use the layering technique to allow us to use your cursor with other programs
To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systemshere.
Jotaf's Theories!
"Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."
I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
Posts
1,457
Heh, I think I saw a "in-line ASM for VB" demo at Planet Source Code
To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systemshere.
Jotaf's Theories!
"Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."
I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
Posts
1,457
Ok, then he could use just the old "shaped form" APIs
To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systemshere.
Jotaf's Theories!
"Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."
I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systemshere.
Jotaf's Theories!
"Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."
I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systemshere.
Jotaf's Theories!
"Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."
Some considerations:
* it's not really a cursor: clicks and mouse events should be programmed too (perhaps with WaitAsyncKeyState)
* i hide the system mouse cursor, but when you move the mouse fastly, it appears again for some ms
I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
Posts
1,457
Hey, that's easy to solve, just make it so that the pixel where the mouse pointer is a "hole" (with the shaped form functions). It only has to be the size of a pixel
To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systemshere.
Jotaf's Theories!
"Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."
I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
Posts
1,457
Oh, and that's a nice effect you have there
And the HideCursor API doesn't work well because it only works inside your form, and when the user moves it too quickly the form is not always there. And it will stop working after you do what I told you above
Try passing it 0 as the handle, or get the handle of the desktop... something like that
To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systemshere.
Jotaf's Theories!
"Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."
What a nice remark, Jotaf98!
That works, but then i can't use the ShowCursor API anymore and the form won't have the focus anymore. I think I'll have to use an empty cursor shape as the default cursor shape.
Also: when loading my app, I grap a copy of the desktop, but when the desktop changes (like some selection with the mouse), the memory DC does not change!
Any suggestions?
I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
Posts
1,457
The form doesn't need the focus to move! Aren't you using an API to get the mouse's position? If you take out that pixel and give ShowCursor the desktop's handle or 0, it should work and with no cursor flickering
Easy, just bitblt directly from the DC you just got from the desktop instead of using a copy
To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systemshere.
Jotaf's Theories!
"Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."
ShowCursor's parameter is not a hWnd or hDC!
Besides, I also lose a pixel (upper left corner) from my arrow if I use this method, I can't redraw a dot because it is not part of the form.
I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
Posts
1,457
With the right cursor, you won't have any problem with that pixel
Oh sorry, I thought that ShowCursor would take a handle and hide the cursor there How the hell does it find out it's that form's handle?
To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systemshere.
Jotaf's Theories!
"Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."
In the call back procedures that VB takes care of you it accesses it's hWnd of the thing that called it, quite complicated really (if you think about it too hard!) but a bit simple at the same time...
Anyways, you need to fix the problem in your cursor, how that it takes the DC but it doesnt refresh, so that I had a winzip open, it's titlebar was green. I clicked elsewhere and the titlebar turned gray (that's the colour scheme for my computer ) and when I put the mouse over it, the titlebar showed through green.
Ah, "Also: when loading my app, I grap a copy of the desktop, but when the desktop changes (like some selection with the mouse), the memory DC does not change! Any suggestions?"
I see you've already spotted this problem .
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
(Just a heads-up)
That's correct Sastraxi!
That's why I implemented only a single GetDC(0) to obtain the desktop once (=most simple way of programming). If it changes, the changes won't affect my cursor app.
So, anybody knows how to grab permanently only some segment of the desktop?
Or does there exists some API to control/create a real global user-defined cursor?
A consideration: the same effect should be acchieved when U drag a desktop icon (full coloured) around the desktop => also in Win98! ...
I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
Posts
1,457
Hum, you're right, if you grab the screen again you'll get the screen + your cursor
Maybe you could hide it, grab the screen and show it again. If you don't do it too often (every second should be enough) it won't flicker
To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systemshere.
Jotaf's Theories!
"Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."
I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systemshere.
Jotaf's Theories!
"Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."