Ok now everything updates smoothly and stays where its supposed to, but now i have another problem. I have created a simple function that bitblts my titlebar, my main form and my buttons. I have put this function in the WM_PAINT and the bitblt works fine and system resources aren't being used, but i also have another function in the WM_LBUTTONDOWN that checks the mouse coord, and if within a specified region will respond accordingly. Lets say that i have a button thats my rewind button, the mouse is clicked and its within the specified region for the rewind button my function in the WM_LBUTTONDOWN msg will call bitblt and blit the down image to the form... the problem is that the image does not show.... i was thinking its because of the WM_PAINT message that draws over the image before i can see it, so what i did was declare (bool Is_Btn_Down, then in my rewind function, i set (Is_Btn_Down = TRUE), then in my WM_PAINT function i check if (Is_Btn_Down = TRUE) or (FALSE), if it = TRUE then i bitblt the down button image and if its FALSE it should bitblt the UP button image. the problem is that the WM_PAINT message doesn't update the window unless it is moved offscreen, minimized or covered by another window. So i click my rewind button, it seems that nothing happens, but if i minimize the app and restore it, i see my down state rewind button, so this tells me that my functions are working properly but WM_PAINT isn't updating, how do i send a WM_PAINT message or something to my main window, I've tried UpdateWindow but it didn't work. is there something else..
Thanx for any input
AAG
This Business Is Binary. Your a 1 or a 0. Alive or Dead. (AntiTrust)
I guess you would find out this too, but the deal is simple, let WM_LBUTTONDOWN and WM_PAINT both call the function to blit up/down image
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.
BOOL RedrawWindow (HWNDhWnd, // handle of window
CONST RECT* lprcUpdate, // address of structure with update rectangle
HRGNhrgnUpdate, // handle of update region
UINTflags // array of redraw flags
);
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.
kedamn i have tried doing your solution right now, it even said so in my first post, i call bitblt on WM_LBUTTON down and also in WM_PAINT and the button still doesn't show, i'll try the other options and see what i come up with...
Thanx everyone for your input..
This Business Is Binary. Your a 1 or a 0. Alive or Dead. (AntiTrust)
ok i'm still having problems, i just took off the WM_PAINT message and clicked in the predefined area and it shows the down button state of the rewind button but when i release and handle the LBUTTONUP msg it doesn't show the i've tried all the redraw window and things like that and still nothing... i have posted the redrawwindow code i'm using, tell me if its right
Ah if you're using a memory dc then you have to blit the changes there as well, as the memory DC will overwrite it next time WM_PAINT is called
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.
Can you .zip and post you project so I can look at it? I have done what you are asking a ton of times (I have skined almost 1/2 the projects I have done. It's cooler that way) but its impossible for me to tell what you have going on from what you have said thus far.
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com
It is not messy at all believe me. Your code was real easy to read. Ok here is the deal, I am running out of time today but I will look at it first thing tomorrow. I can't seem to see why your not refreshing. But let me give you 3 pieces of advice.
1) Make a global var like POINT pt; then when you catch your mouse events use:
pt.x = LOWORD(lparam);
pt.x = HIWORD(lparam);
That way your pt.x and pt.y will be the correct placement on your window. If not it gets messed up on breaks and you dont have to calc it and stuff.
2) add:
BeginPaint(hwnd,&ps);
EndPaint(hwnd,&ps);
after:
case WM_PAINT:
{
Redraw_Skin();
Your WM_PAINT needs to complete the paint commands. This should speed things up.
3) Looks like you have a bunch of memory leaks. I would make a destory function that kills:
HBITMAP MAINBMP;
HDC hdcMemory, hdcWindow;
This should help your program. I will figure out your refresh problem tomorrow, unless someone beats me to it.
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com
ok added the global point struct, that works great hehe i have question about the begin and end paint, i already have them in the function thats in the WM_PAINT msg, so why would i need to put them in the WM_PAINT again ??
This Business Is Binary. Your a 1 or a 0. Alive or Dead. (AntiTrust)
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.
got another problem... whenever i click the rewind button, the images show properly and u can click it as fast as u want and it will always show to appropiate image, but sometimes the image flickers, not just the button image but the whole image.... i know its not supposed to do this... i'll will post my project in a few minutes so someone can take a look at it..
This Business Is Binary. Your a 1 or a 0. Alive or Dead. (AntiTrust)
Try making globals for your DCs and bitmaps. Then make a loader function to load everything in and a deloader to reverse it. That way you are not wasting CPU time everytime you go to paint the images. That should help.
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com
yea, thats what i thought when i was looking thru the case functions since wm destroy gets called last and wm close fires the wm destroy message i figured it would be better
This Business Is Binary. Your a 1 or a 0. Alive or Dead. (AntiTrust)
Yep. You mess around in Destroy and sometimes your program gets hozed. If it still flashes after this, post the new code and I will check it out for you again.
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com
the problem is now i get a really really wierd reaction. now after i execute my program, it loads fine but when i move the window to another location on my screen, the bitblt gets blitted to the desktop in the location that the program orginally started up at and my actual form goes blank... if click where the rewind button is supposed to be, nothing appears on the main form but in the image thats being blitted to the forms original location, the proper function happens! LOL do u know whats wrong ??
This Business Is Binary. Your a 1 or a 0. Alive or Dead. (AntiTrust)
ok i got it, i had put DeleteDC in the Draw_Skin Function for some reason, so i took it out and put it in the Unload_Bmp_Globals and now it works fine thanx for your help i really appreciate it
Laterz,
AAG
This Business Is Binary. Your a 1 or a 0. Alive or Dead. (AntiTrust)
ok got a new wierd problem. i have create a dialog resource box, set its window property to popup and its style to none... its callback is BOOL, what properties does this type of callback have... like for instance it doesn't seem to have a WM_SIZE.. i couldn't find anything in the SDK either can u give me some help on this... i tried register a new WndClassEx and create a new window and that worked fine and i got all the stretching and blt and resizing for the skinned form working perfect except for some strange reason in XP the forms would work fine but in 98 the main form would get mixed up with the resizable form, i think it deals with how XP and 98 handle memory operations or something but i don't see why it would be a problem if i was using totally different hwnds and HTBITMAPS and dc and dc memory objects as well, or it could have been the way i created the new window, perhaps they were running in the same process or something i don't know and got confused LOL or something...
This Business Is Binary. Your a 1 or a 0. Alive or Dead. (AntiTrust)
I am not 100% sure that they are using DD (Well technically its not even that DX8 and above anymore. But its to early for me to remember what its called right now) but thats what the rumor is. Its really not that hard when you use all the built in functions that DX provides. Infact it takes about half the code to do it in DD than BitBlt if you do it right.
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com