|
"To obtain the items being activated, the receiving application should use the LVM_GETSELECTEDCOUNT message to receive the number of items that are selected and then send the LVM_GETNEXTITEM message with LVNI_SELECTED until all of the items have been retrieved "
How did you use LVM_GETSELECTEDCOUNT, LVM_GETNEXTITEM, and LVNI_SELECTED? Can you give an sample code to solve the problem mentioned?
|
|
|
|
|
Hi all,
I want to get text on a Edit Control in MFC application. On MSDN I found that it is possible by using
GetDlgItemText(Edit_Control_ID)
But I'm confusing how to assign or used on the application. Give a feedback to me.
Thanks.
I appreciate your help all the time...
|
|
|
|
|
Will this helpful ?
CString strStaticText;<br />
GetDlgItem(IDC_EDIT1)->GetWindowText(strStaticText);
Regards,
Paresh.
|
|
|
|
|
Thanks. But I got this error
'CWnd::GetDlgItemTextA' : no overloaded function takes 1 arguments
left of '->GetWindowTextA' must point to class/struct/union
But on the explanation I don't found that more than one argument is passing.
I appreciate your help all the time...
|
|
|
|
|
I prefer to make me a control-variable to access the control in addition to the data variable. Like this:
CNamingDlg.h:
CEdit c_Name;
CString m_Name;
.
.
.
CNamingDlg.cpp:
void CNamingDlg::DoDataExchange( CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control( pDX, IDC_NAME, c_Name);
DDX_Text(pDX, IDC_NAME, m_Name);
}
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Hmm, thanks.
Can you tell me what is the difference, or the advantage using a control-variable rather than member function. Actually using a member function, just within few lines I can done it.
Please explain it.
Eranga
I appreciate your help all the time...
|
|
|
|
|
I got my wisdom from Joseph M. Newcomer (*the* one great Joseph M. Newcomer!) from his Page[^].
Basically, you can substtute
CButton * button = (CButton *)GetDlgItem(IDC_BUTTON);
if(button->GetCheck( ) == BST_CHECKED) ... by
if(c_Button.GetCheck( ) == BST_CHECKED) ... The amount of saved lines sum up with more complicated dialogs.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
That is interesting. I think it can be real helpful to me read that page, lots of resources there. Actually those things are really new for me. I'm switch from Java to C++(console and MFC) because of my project. Lots of things to learn. Sometimes I'm really mess with stuff. But I like to learn.
Thanks
Eranga
I appreciate your help all the time...
|
|
|
|
|
simple,
CString str;
GetDlgItemText(IDC_EDIT1,str);
now, what ever text is typed in edit 1 will be gathered at str.
hope your problem is solved.
|
|
|
|
|
Wow, it works. That mean I have to use two arguments with it.
Thanks.
At the same time I'll try to write that string to a text file. Done it as follows.
<br />
char tempBufferOne[256] ;<br />
<br />
GetDlgItemText(IDC_S_WRITE, readString) ;<br />
AfxMessageBox(readString) ;<br />
openFile.Write(readString, 256) ;<br />
Here I comes with mess. It writes the text to the text file. What happened is after writing text to the file, if it is not fill the buffer size, print some annoying characters. How can I avoid it.
I appreciate your help all the time...
|
|
|
|
|
Use like this.
openFile.Write(readString, readstring.GetLength()) ;
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
chandu004 wrote: Use like this.
openFile.Write(readString, readstring.GetLength()) ;
Thanks. I need an advice from you pal. I know you are a genius on C++. How did you find such point in shot period. Is there any better way to use MSDN. I'm not trivialize your knowledge sir.
chandu004 wrote: Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
Sure, I'll do it right after I get what I want from you guys
I appreciate your help all the time...
|
|
|
|
|
Eranga Thennakoon wrote: How did you find such point in shot period.
your questions resemble my doubts, past four years ago.
but then, i was not aware of codeproject.
so i learnt them on my own.
and regarding msdn,
Eranga Thennakoon wrote: Is there any better way to use MSDN.
i donot use msdn most frequently, because, iam a poor student and i dont learn from books or tutorials.
and i have least patience to search the required topics in msdn or internet.
most of the times, i request my colleagues tofind answer and learn from them.
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
chandu004 wrote: your questions resemble my doubts, past four years ago.
but then, i was not aware of codeproject.
so i learnt them on my own.
That's true pal. Coding...and...Coding... gives much confidants in future. Self learning I always appreciate. Others help would more than that.
chandu004 wrote: i donot use msdn most frequently, because, iam a poor student and i dont learn from books or tutorials.
and i have least patience to search the required topics in msdn or internet.
most of the times, i request my colleagues tofind answer and learn from them.
Me too pal. I ask about MSDN because here in my University all the facilities are available. So I use them. It's not bad, I suppose. Actually I refer Indian books, that mean low price editions, I can't spend much. You know that I don't have even a computer as well. Up to now I learn on my University PCs. Nothing worry. One day I'm surly use my own PC
I appreciate your help all the time...
|
|
|
|
|
I want to ask this on same time.
I try to do it in other way round, send a text string to a edit control(text box). Is there any such member function like,
GetDlgItemText(Edit_Control_ID)
to send some text. Go through MSDN, but no luck. May be there is an alternative way.
Eranga
I appreciate your help all the time...
|
|
|
|
|
WOW,
I found it too. Just use SetDlgItemText() member function. Pass two arguments, control ID and string to print.
Eranga
I appreciate your help all the time...
|
|
|
|
|
congrats
:->
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
SetDlgItemText();
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
You say that I've missing ; or anything else.
Eranga
I appreciate your help all the time...
|
|
|
|
|
Hi everyone...
This program enable me to get RGB from desktop but how can i modify it to get the RGB from a bmp image instead?
with regards....
_____________________________________________________________________________
#include <stdio.h>
#include <windows.h>
#define GetRValue(rgb) ((BYTE)(rgb))
#define GetGValue(rgb) ((BYTE)(((WORD)(rgb)) >> 8))
#define GetBValue(rgb) ((BYTE)((rgb)>>16))
void Example_GetPixel(HDC hdc)
int main(int argc, char **argv)
{
int crColor;
POINT ptCursor;
HDC hdcDesktop = GetDC(HWND_DESKTOP);
while(!(GetAsyncKeyState(VK_ESCAPE) & 0x8000)){
GetCursorPos(&ptCursor);
crColor = GetPixel(hdcDesktop, ptCursor.x, ptCursor.y);
printf("%02X %02X %02X\r", GetRValue(crColor), GetGValue(crColor), GetBValue(crColor));
Sleep(100);
}
ReleaseDC(HWND_DESKTOP, hdcDesktop);
return 0;
}
|
|
|
|
|
It will be a gigantic change!!!
Anyway trying LoadImage might be a solution.
- NS -
|
|
|
|
|
purplee85 wrote: This program enable me to get RGB from desktop but how can i modify it to get the RGB from a bmp image instead?
Here is a function that does this...
COLORREF GetPixelValueFromBitmap( const int x, const int y, CBitmap& bmp )
{
CDC dcDesktop;
dcDesktop.Attach( ::GetDC( GetDesktopWindow() ));
CDC dc;
dc.CreateCompatibleDC( &dcDesktop );
const int nRestorePoint = dc.SaveDC();
dc.SelectObject( &bmp );
const COLORREF clr = dc.GetPixel( x, y );
dc.RestoreDC( nRestorePoint );
return clr;
}
Nibu thomas
MVP For VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http:\\nibuthomas.wordpress.com
|
|
|
|
|
Hello
I had developed a windows service at my office PC having Win2000 installed. I brought the same code back to my home PC which has WinXP installed on it. Now when I tried to run the windows service, I got the following error:
Error Code :1153
Symbol :ERROR_RMODE_APP
Description : The specified program was written for an earlier version of Windows.
Which means the service developed on Win2000 PC cannot run on WinXP PC. But logically should this error come up? Is the .exe generated by VC++ IDE also dependent on the PC on which the application has been developed?
Will the reverse case also give me an error? Say if I develop the application on WinXP and try to run it on Win2000?
Thanx.
|
|
|
|
|
vipin_nvk wrote: Is the .exe generated by VC++ IDE also dependent on the PC on which the application has been developed?
This is the key point and the answer is, it can be, in at least the following ways.
1. Installed SDK. The code you develop on your Win2K PC will be diferent depending on what version of Visual C++ and what version of and SDKs are installed. These will effectively change your source. You can update these to versions capable of build XP apps if they are not already.
2. Test platform. The code you build on the Win2K PC may work there against the Win32 API verion available there but that does not automatically gaurentee it will work against XP. Remember that every Win32 application loads up Dlls that are part of Windows from the machines where it's installed and then makes hundreds of calls into these Dlls. If one function is missing, or perhaps behaves differently then things can go wrong.
Two points to note in your specific case.
1. The reason for the failure may not actually be the Win2K vs XP differences it could possibly be just the general difference between the two machines although with the error you're getting this is unlikely.
2. The requirements and environment for Services in particular are very Windows version specific. It may be that your Win2K developed service does not do all the things or meet all the timings required by an XP Service. MS tightens things up in security for example with each release.
With all that in mind in the end it could be as simple as which value of the _WIN32_WINNT you've compiled with. Unless you set this to at least 0x0501 I wouldn't expect the service to start on XP.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
I Am Using MFC Application.
How Can I Get The Handler Of Click Event From My Desktop?? I Want To Get The Message Of The Mouse Event In My Window Procedure Method.
Plz Reply If U Get Some Solution..
Thanks
|
|
|
|