|
thank you sir for the reply.
Sir i am trying to take a bitmap image suppose A,B,C,D these are 4 alpha. used in image with different colors.
Now my task is to whenever we put the mouse on the alpha. i would like to get the pixels coordinates.
So can you help how should or what should be done in my project part.
i can send you the detail if you want of the program.
Your Sincerely
Kaushal kishore Sharma
|
|
|
|
|
Which part(s) of the task are giving you trouble?
Can you post an example of code that's not working?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thank you sir.
I am searching for net for few days about this part when i create a CColorDlg class the VC++ gets hangs.
Firstly sir i want to know that am i going in right direction for finding pixel coordinates aur not?
then sir i tried out CColordlg for it it gets hangs.
So sir i you have any code where i can include it in my project part i will be very thankful to you.
Your Sincerely
Kaushal Kishore Sharma
|
|
|
|
|
kaushal kishore sharma wrote: i want to know that am i going in right direction for finding pixel coordinates aur not?
I have no idea what you've done.
No need to call me sir
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thank you mark.
can you send me your email id iacan send my code and then you might be able to understood my problem
your sincerely
kaushal kishore sharma
|
|
|
|
|
kaushal kishore sharma wrote: can you send me your email id iacan send my code...
Narrow your code down to a handful of relevant statements. E-mailing someone in bulk is just asking to be ignored.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Take care of the stride?
For example,
the bimap is 8 bit per pixel, and 10*10 in size.
It is not neccesarry that every line contains 8*10 bits.
You might use stride to locate the pixel in the bitmap data.
MSDN:
GDI+ BitmapData
Stride INT Offset, in bytes, between consecutive scan lines of the bitmap. If the stride is positive, the bitmap is top-down. If the stride is negative, the bitmap is bottom-up.
system
|
|
|
|
|
Hi There.
I need some technical help regarding one of the article i.e., "SendKeys in C++".
http://www.codeproject.com/KB/cpp/sendkeys_cpp_Article.aspx
This article is one of the best articles I have ever came across. At this point of moment, Can anyone please tell me how can I read the text written on the active window?
I mean this application can write text on active window, Can you please help me out in reading the same text?
In case you need any further info, then please let me know.
Thanks and Regards.
Pankaj
|
|
|
|
|
char *strBuffer;
int numCharsToRead;
HWND activeWnd;
activeWnd = GetActiveWindow();
numCharsToRead = GetWindowTextLength(activeWnd);
strBuffer = (char) malloc(numCharsToRead+1);
memset(strBuffer, 0, numCharsToRead+1);
GetWindowText(activeWnd, strBuffer, numCharsToRead);
|
|
|
|
|
Yikes...
OK - generally, that will only take the caption if the target window is not an edit control. For a complex view (e.g. CFormView-based views), you will have to descend into the child controls to get at the text-based ones. Using Notepad as an example, you will likely only get Notepad's caption.
You should mention that the above code will not work correctly in a Unicode build and is not TCHAR safe. Also, you do not handle deallocation of the buffer. You can skip the memset(...) by using calloc(...) , but this is not necessary because you allocate enough space for the terminating NUL to be put in.
Might want to use new instead because this is likely a C++ target. (When you get older, you appreciate consistency more and more...)
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Guilty as charged.
Don't know what on earth I was thinking.
Also, strBuffer = (char) malloc(numCharsToRead+1); isn't going to compile anywhere. strBuffer = (char*) malloc(numCharsToRead+1) would be more appropriate, though for reasons mentioned by James, this entire method is still really poor.
|
|
|
|
|
You are right buddy.
I only get the Caption but not the actual text.
Just FYI, my view is a complex (e.g. CFormView-based views). Any pointers, I mean, How can I read data that is being displayed in the same?
A code snippet will be helpful.
Thanks.PanB
|
|
|
|
|
Just an add-on, when I tried to write some text on this window by getting its handle, its actually setting its caption...
|
|
|
|
|
Here's some non MFC code that will grab the window text from a window's children.
http://www.savefile.com/files/1782897[^]
It can look at it's own children or you can enter the (full) title-bar text of
a program and it will look at that app's child windows.
Hope it's more useful and less horrific than my last 'effort'
|
|
|
|
|
Hi there.
Even that article does not fulfilled my requirement.
But anyway buddy, Thanks a TON for your effort and time.
Regards
PanB
|
|
|
|
|
If you can easily determine the type of a given view object, or if your app only has one view-based class, you can get a pointer to the active view and cast it to the actual type of the CFormView -based class.
Your class can expose either the text of its children or their HWND s, either one can be used to get the text of the controls. You can even have it present a struct -type that contains all of the HWND s, allowing you easy access to all of the controls.
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Thanks for your reply James.
Just an add-on info. I am trying to hook an existing application with this new piece of code. So, I do not know what type of view is it, but I am sure its not something that's being derived from CEdit.
As I said before, if I try to set any text in the control, its Caption gets filled with that text.
In case you need any further info., please let me know.
Thanks
PanB
|
|
|
|
|
I created a Smart Device MFC SDI application in VS2005. I've got some files with names like this: MyApp.cpp, MyAppDoc.cpp, MyAppView.cpp, MainFrm.cpp. There are classes in these files. In MyApp.cpp there is a class called CMyAppApp. In MyAppView.cpp there is a class called CMyAppView. In MainFrm.cpp there is a class called CMainFrame. How do I call public methods in CMyAppView and CMainFrame from CMyAppApp? How do I get hold of instances of the classes so I can access the methods? I don't want to use "new" on CMainFrame. This would create a new form. I want to get hold of the handle to the existing form and view (CMainFrame and CMyAppView). I can't find any good pointers in afxwin.h.
|
|
|
|
|
lagu2653 wrote: How do I get hold of instances of the classes so I can access the methods?
There are no instances of classes (objects) until you create them.
You can't access non-static methods of a class without an object.
lagu2653 wrote: I don't want to use "new" on CMainFrame. This would create a new form. I want to get hold of the handle to the existing form and view (CMainFrame and CMyAppView).
Where do these existing windows come from if you don't create them?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Oops, I misread your post
lagu2653 wrote: How do I get hold of instances of the classes so I can access the methods? I don't want to use "new" on CMainFrame. This would create a new form. I want to get hold of the handle
MFC has functions to to get at those instances like, AfxGetMainWnd() or something
Then the CFrameWnd[^] class has functions to get Views like GetActiveView()
led mike
|
|
|
|
|
OOOPS, bits are flowing more slowly from Italy...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
led mike wrote: Oops, I misread your post
me too apparently!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
If I understand you correctly then you've already wizard-generated code creating such windows. You may to call AfxGetMainWnd to get a pointer to the frame window (possibly you need to cast it) and the call its GetActiveView (and, again, cast it).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
Recently I reinstalled visual c++ 2008 Express edition and ever since then, when I open a project, all the source files within the project no longer automatically restore themselves to their previous state. This question isn't very clear so lets pretend I had the files main.cpp, d3d.cpp, and d3d.h open when I last closed my project. When I open this project again, none of the source files will open with it. I have to manually open all the source files (which can be quite tedious for large projects). Previous to reinstalling, the files main.cpp, d3d.cpp, and d3d.h would all automatically restore themselves in this particular example.
I've searched through the options menu but couldn't find a setting for it
|
|
|
|