|
I can only offer what I see in the source files. Line 735 of afxwin2.inl looks like:
ASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd, CB_ADDSTRING, 0, (LPARAM)lpszString); Note there's only one assertion on that line.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
hi..
this piece of code is from vc++.net
MessageBox(0, "Please Check Row No:" + j ,"Validations",MB_OK);
When i try to concatenate some text string with an integer value(j), it compiles successfully. but the output is confusing.. for example..if the value of j is 5, then it trim 5 chars from the left in hat text string..
SO i tried it with concat function...like this..
MessageBox(0, String::Concat("Please Check Row No:" , (Datagrid1->get_Item(j,0))) ,"Validations",MB_OK);
This returns error
"error C2665: 'System::String::Concat' : none of the 9 overloads can convert parameter 2 from type 'System::Object __gc *'"
Can anyone solve my problem?
Salai
|
|
|
|
|
Use CString object:
<br />
CString str;<br />
str.Format("Please Check Row No: %d Validations",j);<br />
MessageBox(0,str,MB_OK);<br />
Matteo
|
|
|
|
|
Maetto..
Thanks for yr reply.. i tried this...
But it returns error "CString : Undeclared identifier."
i put this code in .cpp file...
should i have to include any header files here?
Salai
|
|
|
|
|
> CString str;
> str.Format("Please Check Row No: %d Validations",j);
> MessageBox(0,str,MB_OK);
> But it returns error "CString : Undeclared identifier."
char szBuf[200];
sprintf(szBuf, "Please Check Row No: %d Validations", j);
MessageBox(0, szBuf, MB_OK);
|
|
|
|
|
Never go heavyweight when lightweight works fine:
TCHAR caBuffer[ 64 + 1 ];<br />
<br />
_snprintf( caBuffer, 64, "Please Check Row No: %d Validations", j );<br />
caBuffer[ 64 ] = '\0';<br />
MessageBox( NULL, "Example", caBuffer, MB_OK );
Peace!
-=- James 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! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
CString is defined in "cstringt.h" (MFC) or "atlstr.h" (NON-MFC)
|
|
|
|
|
I am migrating my code from VC 6.0 to VC 7.1 and I have encoutered a problem:
The compiler says:-
e:\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\ShObjIdl.h(9569): error C2061: syntax error : identifier 'IXMLDOMDocument'
Any help on it ?
Regards,
|
|
|
|
|
I have the following pb:
I have an simple MFC app where I launch a function(INIT) that starts a thread(THREAD 1=wait for connection) that connects to a socket(CSocket).After the connection,I Detach and get the handle...now...my pb is this:
if I re-Attach the handle of the socket after the connection in the INIT function then when my server "dies"...I get the OnClose event on the CSocket object...but if I try to re-Attach the handle of the socket inside that Thread 1 or even in another Thread 2...I never receive that notification of the OnClose event
Anyone knows why, and the most important...does he have a solution for this pb ?
(I admin that I'm a begginer with MFC)
Of all the things I've lost, my mind I miss the most
|
|
|
|
|
Hi,
I have a binary string. I need to search certain characters.
I used to use "memstr" (obtain fist substring from string) on
Unix.
Is there anything similar to that available from MFC?
Thanks,
Kevin
|
|
|
|
|
If your are using CStrings, yes, CString::Find
~RaGE();
|
|
|
|
|
|
Use the CString to store the binary data
&
use Find (..) member fuction to find the charaters.
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
There is nothing exactly like memstr(...) in MFC or in the MS VC++ RTL. The closest things are strstr(...) and and functions like CString::Find(...) .
However, these might not work as you expect, because you said "binary string", and that usually means that NUL characters can be expected in other locations than the end of the string.
Other than taking an existing implementation and copying the source or writing your own implementation, a Q&D way would be to store the locations of all of the non-terminating NUL characters and convert them to some other character and then use a function like strstr(...) (with the strings modified as specified above).
After locating your substrings, you can convert them back by replacing the NUL s you replaced before.
Peace!
-=- James 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! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
As was mentioned before, strstr is the closest thing, but it is limited in that NULL characters terminate the buffers. So I have used this code:
#include <string.h>
char * _memmem(const char *mem, size_t mem_size, const char *sub, size_t sub_size)
{
char *ret = NULL;
char *ptr = const_cast<char *>(mem);
while (ptr && !ret)
{
ptr = reinterpret_cast<char *>(memchr(ptr, *sub, mem_size - (sub_size - 1) - (int)(ptr - mem)));
if (ptr)
{
if (!memcmp(ptr, sub, sub_size))
ret = ptr;
++ptr;
}
}
return ret;
} [edit]
cleaned up the code a little
[/edit]
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
-- modified at 18:12 Monday 21st November, 2005
|
|
|
|
|
Hi,
I have a dialog. I dynamically create some buttons in it.
The problem is with default button.
I always got the same click event (OK button) when I press 'Enter Key', regardless the button that has the focus.
What could be wrong?
Thank you.
- NS -
|
|
|
|
|
NS17 wrote: I always got the same click event (OK button) when I press 'Enter Key', regardless the button that has the focus.
That's the way dialog's are.
Pressing enter in a dialog will result in dialog being closed no matter where the focus is.
You have to override OnOk or try doing some additional scratching in PreTranslateMessage(MSG *pMsg).
PreTranslateMessage is more flexible. MSG structure has got lot's of information regarding a message to be processed.
<marquee direction="up" height="30" scrolldelay="1" step="1" scrollamount="1" hspace="0" vspace="0">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
use the CWnd::SetDefId() function to change the default button...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
It sounds like the dialog manager's idea of the default button has got out of sync with the control that has the focus. If using MFC or ATL, use the GotoDlgCtrl method instead of the SetFocus method to change the focus programmatically.
If you're not using either of these libraries, send your dialog a WM_NEXTDLGCTL message, setting wParam to the handle of the control that you want to get the focus, and lParam to TRUE.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I use VC++6.0 to create SDI project, my View base on CEditView class. I print out to view a string by GetActiveView()->SetWindowText(CString str), str = str + addstr. The cursor always on top of view. I want the cursor go to end of string str, or view scroll to bottom when I update str.
How to do that ? please help me.
thank !
|
|
|
|
|
Surely it isn't the most efficient way, but I use this and it works!
<br />
this->GetEditCtrl().SendMessage(WM_HSCROLL,SB_LEFT);<br />
this->GetEditCtrl().SendMessage(WM_VSCROLL,SB_BOTTOM);<br />
Matteo
-- modified at 6:56 Monday 21st November, 2005
|
|
|
|
|
I try your way:
this->SendMessage(WM_HSCROLL,SB_LEFT);
this->SendMessage(WM_VSCROLL,SB_BOTTOM);
and
GetActiveView()->SendMessage(WM_HSCROLL,SB_LEFT);
GetActiveView()->SendMessage(WM_VSCROLL,SB_BOTTOM);
but nothing change.
|
|
|
|
|
|
CmyView base on CEditView class, that not support funtion .SetSel() and .ReplaceSel()
|
|
|
|
|
You'll need to call GetEditCtrl() first.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|