|
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.
|
|
|
|
|
Thanks for detailed reply Antti. It worked!! I had to implement the whole thing in WIN32 API since the SendMessage took only 3 parameters in MFC and not the window pointer. Also I used WM_LBUTTONDOWN followed by WM_LBUTTONUP to simulate a mouse click.
Regards,
Zahid
|
|
|
|
|
Sir i want to creat a Vc++ system wide hook dll.{{Whatever hook articles available on the internet are intended for advanced developers who know thing or 2 in vc++.}}But students like me who are new to vc++ find it difficult to grasp some ideas.
I want a basic level explanation from some experts who really wants to teach those things to their students.
The hooks i am intended to create is Wh_Getmessage and i have to call that dll from vb6
Say my objective of this hook is say if i a user type A then i have to change to B for any application running.
I am a stranger to vc++ so i need help in how to create this {{system wide}} wh_getmessge hook
1.In vc++ in new what dll i have to chose ]
a.MFC appwizard Dll
b.WIn32 Dynamic link library
What is the difference between these 2 dlls.?
2.What is an header file and what are the things we have to declare here and why we have to declare??
3.How functions in vc++ dll should be declared inorder to call those functions from vb.?
4.Say i am calling SetHook funciton from vb which is in dll then hook is set.
MsgFilterHook = SetWindowsHookEx( WH_GETMESSAGE,(HOOKPROC)MsgFilterFunc, dll_hInstance, threadID );
I am having the hookhandle in MsgFilterHook which i can use to unhook this hook.
Threadid = 0 to create a system wide hook
MsgFilterFunc is my callback function
My doubt is once hook is set , will the system automatically call my callback filter function for any application which process getmessage
Say i have notepad and i am typing A and in my call back function i will get a wm_char = A.NOw if i change to another application say wordpad and type B
then will it be possible to get the wm_char=B message in my callback function.Please Explain me how does this work.
5.Say n no of editor applications are running and i want to disable the character T from going to any application and i have to make T into H how to do this in my callbackfunciton.Issue in this question is how am going to get these hook work for any application which is running.??
Issues
1.How to start creating a dll in vc++6
2.Header file decleration ideas.
3.Export functions declerations.
4.Explanations of how these hook work on a systemwide basis(i understood how dll maps the memory of other applications but wanted codings point of view like what are the parameters come to callback function each time a new application is actvated.)
5.What is #pragma and shared data segment ?How variables should be decalred in the hook dll and how it should be accessed??Please explain at a lower level how this things are implemented why is the need?
Thanks in advance.
|
|
|
|