|
Check out CxImage on Code project, you will find that very usefull.
The World is getting smaller and so are the people.
|
|
|
|
|
Thanks for the reply.but the code given there is in c++,whereas im working in Win32.Plz tell me if u find any thing code or reference which converts the files ...(Win32)..
|
|
|
|
|
What do you mean you are working in Win32. You must be using some kind of compiler C, C++, VB to use the Win32 API's.
|
|
|
|
|
I think CxImage is not dependent on MFC, so you can use those classes without any prob.but need to check on that wheather it uses MFC or not. Doing image manupulation in pure C is a heavy task, i dont even want to think about that.
The World is getting smaller and so are the people.
|
|
|
|
|
CxImage can be running on Linux. So, I guess it is MFC independent.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
I have an object od CBitmap.
I have to get text dynamically and display in Bitmap..
So guys any idea how to Write a text in a Bitmap ....
String is CString type and not another bmp
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
Construct a DC from the CPaintDC, and use DrawText of gdi function to draw on the screen...
Cheers
Regards.
The World is getting smaller and so are the people.
|
|
|
|
|
The simple way:
Load the bitmap into a CBitmap. Get it's dimensions and construct a target-compatible, memory-based DC. As an example, create a DC based on the device context of the window you wish to display the bitmap in.
Then select the CBitmap into the memory-based DC, use the TextOut function to write a string of text to it. Now you can use the BitBlt function to copy bits from the in-memory DC (containing the bitmap and the text) to the window display DC (most apparently blank).
See the MSDN for CDC:CreateCompatibleDC for an example, which loads a bitmap from a resource file, then spanks it to a window. The idea behind everything is that when you "select" a bitmap to a DC, the DC will represent the drawing surface of this bitmap.
For a more in-depth explanation and tutorials, see Chris Becke's tutorial Bitmap Basics - A GDI tutorial[^]
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Antti Keskinen wrote:
create a DC based on the device context of the window you wish to display the bitmap in.
Actually that bmp is not fixed on a particular window..
Basically its a dragImage.It moves along with the mouse pointer...
So will ur solution work for this case?
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
You mean that you drag the image around with the mouse, much like in a rectangle-cut method used in many paint applications ?
I've gotta hand it out, though, I can't help you on that one without doing some extensive research first. Perhaps someone else can help you out.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
hi friends!
I am very much willing to make chat software that can allow the people to chat within a lan. i also want to add the sound and web cam part to it(but at a later stage). just like another yahoo messenger but for a lan.
i have read a lot abt TCP\IP. and am not able to decide frm where to start.
if somebody can help me out in this context i'll be very gr8ful.
might be that we can work together to achieve something new.
pls mail me at : deepeshdhakad@rediff.com
Deepesh Dhakad
Indian Institute of Information Technology,Allahabad
India
|
|
|
|
|
http://ring.csi.ad.jp/archives/pc/forest/i/ipmsg/
For writing a chat system you need to have a chat server and client.
I guess you wount be allowed to install your chat server on the server,
instead you can use UDP based chat programs like ipmsg,
download the ipmsg src you will find most of ur needs for writing a chat client on the lan,
but it does not have webcam and sound features in it.
regards,
Prakash.
The World is getting smaller and so are the people.
|
|
|
|
|
|
.
modified on Tuesday, August 9, 2011 4:47 AM
modified 1-Dec-11 1:45am.
|
|
|
|
|
I dont know about putting image ont he button face, but i guess its not all that difficult if you handle the onpaint event of the button or ondrawitem.
for ur second question, you need to rearrange the item size on the dialog box dynamically , so you need to find the resolution of the screen. You can find out using the win32 api GetSystemMetrics()
cheers
Prakash.
The World is getting smaller and so are the people.
|
|
|
|
|
Actually I have the screen resolution and have calculated the size to which I have to change the button dimensions. Now I am searching for the right API to change the size of the button and also a way to change the size of a bitmap image.
|
|
|
|
|
You can use SetWindowPos to change the size of the button.
And Drawing the image, well you have to strech the image according to the button size , you can do that by using bitblt of gdi.
The World is getting smaller and so are the people.
|
|
|
|
|
Is there any way in VC++, which dumps a folder with contents into a target path (like CopyFile method)
Thanks in advance
Warm Regards,
KKR
|
|
|
|
|
Check out SHFileOperation win32 api, windows explorer does almost everything using this api.
regards,
prakash.
The World is getting smaller and so are the people.
|
|
|
|
|
Thanks Prakash
Its intresting and I will go through it.
Warm Regards,
KKR
|
|
|
|
|
Is it possible to send windows events from one application to another?
To be more specific I want one application to make the other application believe that the user just clicked its "ok" or "cancel" button eventhough the mouse didn't move at all.
The problem is that the two applications can't communicate with each other via any IPC etc. Can we make use of windows hooks here? If so how?
Any ideas or comments would be greatly appreciated.
Thanks
Regards,
Zahid
|
|
|
|
|
Try using DDE or register a custom event with unique ID,
then broadcast the message from one application to all the windows.
only your other application will then process it.
regards,
Prakash.
The World is getting smaller and so are the people.
|
|
|
|
|
Generally, in a dialog-based application, the Ok button has an ID IDOK attached to it. CDialog class has a default handler for a click of this button.
If the application in question has this handler implemented or overwritten, you can simulate the clicks of the default Ok and Cancel buttons by sending a WM_COMMAND message. The default identifiers, which MFC recognizes, are IDOK and IDCANCEL. See WM_COMMAND reference for details.
The other method (MFC style) would be to access the dialog window through a HWDN and FromHandle method of CDialog. Then use UpdateData and PostQuitMessage member methods to terminate the dialog window, or alternatively call the default OnOK handler, which does the same things.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
I liked your idea very much but the problem is that I want it work for other buttons on the Dialog as well that I don't know the ID for. Infact I don't have access to the source code of the target application whose buttons I want to press. So I can't write any handlers in there.
Secondly I tried simulating a mouse click by doing
mouse_event(MOUSEEVENTF_LEFTDOWN, 50, 50, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 50, 50, 0, 0);
which kind of works but sends messages to the self application and not the target one (since the x,y coordinates are relative to the current window).
Back to the send WM_COMMAND message you talked about? What kind of message do I need to send inorder to simulate a mouse click. Since I don't know what the names of the Messages the target application handles in its code I probably can't send it Button_Click messages, so it has to be mouse_click and also how do I determine the 1st hWnd argument....right now I am doing a broadcast? Thanks.
Regards,
Zahid
|
|
|
|
|
According to the Platform SDK Reference, when a button is clicked, it will send a BN_CLICKED notification to it's parent. This notification is packed to a WM_COMMAND message.
In order to simulate a mouse click, you must send WM_LBUTTONDOWN or WM_RBUTTONDOWN, depending which mouse button you'd like to simulate. These messages carry with them position information in a POINT structure. The structure's coordinates are relative to the target window's upper-left corner.
However, the mouse message must be sent to the button window, which then sends a BN_CLICKED message to it's parent. If you do not have access the source code at all, then one option is to create an enumeration function to enumerate through all the child windows of a dialog.
Buttons are, in fact, standard windows with a class name of "Button", if they are default buttons. When doing the enumeration, you can compare the class name of the window and it's caption to determine the correct button. Say, a button which reads 'Click me', would have a class name of "Button" and a window text of "Click me".
The enumeration could be implemented by using a while-loop in accordance with a GetNextWindow function call. Here's a half-pseudo code on how to implement it:
CWnd* pChildWnd = dlgPointer->GetTopWindow();<DIV>
while (true)
{
TCHAR buffer[40];
CString strCaption = "";<DIV>
::GetClassName(pChildWnd->m_hWnd, (LPTSTR) &buffer[0], 39)
pChildWnd->GetWindowText(strCaption);<DIV>
if ( strstr(buffer, "Button") && strCaption.Find("Click me") != -1 )
{
break;
}<DIV>
pChildWnd = pChildWnd->GetNextWindow();<DIV>
if ( pChildWnd == NULL )
break;<DIV>
}
After obtaining the CWnd pointer of the desired button window, use CWnd::SendMessage to post a WM_LBUTTONDOWN message to the button. It will then respond by posting the BN_CLICKED message to it's parent.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|