|
How can i do a search in a DC? I need to determine if there's a certain set of pixels (another, much smaller DC) present in a big DC. How can i do this? I already did some searching on this site and on MSDN but i can't come up with anything usefull.
Thanks.
|
|
|
|
|
There is only one way: brute force
In an MFC implementation, you would use a CDC object and the GetPixel SDK function. The function returns the color of a pixel in the specified point.
You would need to run through the bigger DC in pieces of the smaller DC, comparing each pixel against other.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi All,
I transparentize a window by SetWindowRgn, but I can't control it's alpha.
How to control it? Like SetLayeredWindowAttributes under Win2K.
I want to transparentize a window captured by WindowFromPoint
Thanks.
Xiaobin
|
|
|
|
|
Not doable.
The layered windows are only available in Win 2000/XP and later. You could attempt to creating a window, then making it's whole client area from an image that supports transparency, and paint the background of the window with a NULL brush. This, however, would require you to constantly erase and repaint the background.
Using this method with a WindowFromPoint would require you to subclass the target window, take a screenshot of it's DC, create an image from this DC that supports transparency, then set the background brush to NULL for the window, and repaint it completely with the transparent image.
In conclusion: impossible, get an OS version that supports layered windows or forget the idea
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi Antti,
Thanks.
I get the address from SetLayeredWindowAttributes from "User32.dll" and set it to a function pointer. If the pointer is NULL, I set the IsW2K false.
I choose the transparent function in this way, am I right?
And, when I move a window transparentized in your method, it seems can't retain transparency. What shall I do?Hook the WM_PAINT message?Or...?
I wrote a program can make window captured transparency under Win2K, but I want it suport Win9x. I found it difficult. -.-;;
|
|
|
|
|
Well, like I mentioned, you can make a program that adds a transparency effect to a window under Win2k. That much is simple. If you want your program to not crash in Win9X, you need to check for the availability of SetLayeredWindowAttributes in User32.dll.
The method I described requires that you subclass the window, get it's class style and variables, then register a new window class with NULL brush and set this class as the window's class. Naturally you need some way to preserve the original window class so you can return it when your program exits.
When a window has NULL background brush, it's background gets painted with the desktop image currently underneath the window when the background is refreshed. You can force a window to redraw itself by issuing a RedrawWindow method call. Of course, you would need to order the window to refresh itself always when it is moved.
This isn't a very working method to force other process' windows go transparent, because you would then constantly need to handle WM_PAINT messages to capture the DC of the window to a transparent image, process it, and re-paint the window with the new image. This adds a big amount of overhead and will certainly slow the program's execution.
Transparency is just not supported on Windows 95/98. You can add transparency for Windows 2000/XP programs and make sure your program works correctly on 95/98 by fetching the address of SetLayeredWindowAttributes and testing the result for NULL. But you can't make transparency effects similar to what the layering can offer on Windows 95/98.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi Antti Keskinen,
Thanks a lot.
Xiaobin
|
|
|
|
|
It's impossible.hahahahahah.....
windows98 is rubbish.Bless u.
|
|
|
|
|
Try to paint the window with a brush having a brush style BS_HOLLOW
use log brush for this.
|
|
|
|
|
Hi,
Details:
created Win32 console application
includes - process.h windows.h, etc
using _beginthread
Problem:
the following error occurs
error C2065: '_beginthread' : undeclared identifier
How do I link with one of the multithreaded C run-time libraries
& which one should I use?
Caoimh
|
|
|
|
|
You'll need pass /MT to the command line.
In VS.NET:
Right-click on your Project in the Solution Explorer and click on Properties, C/C++ -> Code Generation.
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
Thank You. Works perfectly as you would expect
Caoimh
|
|
|
|
|
Check CreateThread
and link with kernel32.lib
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
CreateThread should largely be avoided on the desktop, because it doesn't allow the C/C++ run-time libraries to set themselves up for the new thread correctly. Better to use _beginthreadex and one of the the multi-threaded CRT versions.
Note that the single-threaded versions of the CRT aren't thread-safe anyway; you can do your program a fair amount of damage if you try to use the single-threaded version from multiple threads.
On Windows CE devices, use CreateThread , because the system entry points and the C run-time are all in coredll.dll - the system is C run-time aware. You can't use _beginthread or _beginthreadex anyway, because they're not there.
|
|
|
|
|
hi,
i have a dialog based application in which i am loading images and editing it..for this i need the undo and the redo functions ... any idea how do i go about it.
Any help is warmly welcomed.
Thanking you.
Satadru.
|
|
|
|
|
|
|
While both of your replies contained the right text, the underlying links were wrong. Did you try them out?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
One way that I've seen it done is to keep a list of each changed document. In other words, each time the document is changed, a copy is kept in a list. When an undo is requested, the latest document in the list is "copied" over the current document, and the view is notified to do a redraw. This is very simplistic but I think you get the general idea.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
step 1. firstly identify the type of operations for which you like to have undo facility.
step 2. create a CUndo class and add to it all the necessary variables for each type of opeations.
step 3. create a vector of CUndo pointers .
step 4 .save all the CUndo object pointers in this particular vector.
always save the previous state of the image when the user performs certain action.
for example if the image is changed from state1 to state2 then create an undo object storing all necessary information of state1 and add to vector.
if the user clicks undo menu then again create an undo object of state 2. then read the last object in the vector, refresh the image with the information retrieved from vector, delete this state1 undo object from the vector, and add the state 2 undo object information.
|
|
|
|
|
hi people if anyone has implemented Davide Pizzolato's CxImage class to load images of different formats ...kindly reply to me ...
Thanking you
Satadru
|
|
|
|
|
is it worth answering this?
I would be very confused without having CxImage
I use it for Win32 (api) applications and it works well.
Goodbye and thanks for the fish!
|
|
|
|
|
I'm unable to call the Win32 pai GetAncestor in a VC++ project.
While other win32 API's like GetPaernt dont have any problem.
The error that comes is:
G:\VC++ progs\venom\venom.cpp(89) : error C2039: 'GetAncestor' : is not a member of '`global namespace''
G:\VC++ progs\venom\venom.cpp(89) : error C2065: 'GetAncestor' : undeclared identifier
I call it as :
GetAncestor(hwnd,1);//GA_PARENT = 1
-Vladimir India
|
|
|
|
|
Try to include Winuser.h
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hi!
Including winuser.h has got no effect. I still am not able to compile it!
I tried it on both win2000 and win98,...
Can you please try calling it and see...
Thanks!
-Vladimir India
|
|
|
|