|
You are great man!
It works fine,if I just override OnNotify function without
adding any code in it.
If you know the reason why it does not work if OnNotify
was not overridden,let me also know that.
Thank you so much.
|
|
|
|
|
poda123 wrote: I just override OnNotify
u didn't write any code inside it?
nave
|
|
|
|
|
Yes, I did not write any code in OnNotify().But it works.
Also I cannot write the code of TTN_NEEDTEXT message handler's code
in OnNotify() function because the parameters has to be given by the OS
<br />
BOOL CWFPDlg::ShowMyToolTips(UINT id, NMHDR* pNMHDR, LRESULT* pResult)<br />
{<br />
}<br />
|
|
|
|
|
u can d like this.
BOOL CWFPDlg::ShowMyToolTips(UINT id, NMHDR* pNMHDR, LRESULT* pResult)
{
if( pNMHDR->code == TTN_NEEDTEXT)
{
// u r code...
}
}
any way now it working na..
where r u from?
nave
|
|
|
|
|
You suggested me to write the ShowMyToolTips() function code in
OnNotify() function.
Since the parameters such as NMDHR* has to be given by OS,I cannot write it
in overridden OnNotify() function.
ShowMyToolTips() function is the Message Handler for the Message TTN_NEEDTEXT.
So again why should I check like
if( pNMHDR->code == TTN_NEEDTEXT)
{
// u r code...
}
Thanks for your reply.
I am from Chennai,India.
|
|
|
|
|
Hello all
I compile my application in unicode. I make all settings related to unicode, but error occure as
static_cast' : cannot convert from 'class CString' to 'const char *const '
so plz send me solution of this if anybody know.
Thanks
Atool
Atool
|
|
|
|
|
it cant convert but u can use CString GetBuffer
never say die
|
|
|
|
|
void foo(const char*);
CString str = _T("hello");
foo((LPCTSTR)str);
|
|
|
|
|
I think that arose because of, when using UNICODE, the operator LPCTSTR ( ) const casts to const WCHAR * instead of const char * .
So all that you can do is
const WCHAR * pWChar = (LPCTSTR)yourString;
If you need a char pointer then you have to convert the wide-char string to the ANSI one, perhaps calling WideCharToMultiByte API (see MSDN for reference) on the obtained wchar pointer.
hope that helps.
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.
|
|
|
|
|
'static_cast' : cannot convert from 'CString' to 'wchar_t *'.Toxcct is right as i didnot see that the querier wants to convert to const char*:->
never say die
|
|
|
|
|
Actually I wrote 'const wchar_t * '
The code below
CString str("foo");
const wchar_t * pWStr = (LPCTSTR) str;
works fine. But then you have to convert the string if your final target is to obtain a const char * pointer.
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.
|
|
|
|
|
CPallini wrote: const wchar_t * pWStr = (LPCTSTR) str;
this is faulty, because you convert a string of TCHARs into a string of wchar_t.
change into this :
const wchar_t * pWStr = T2WC((LPCTSTR) str);
|
|
|
|
|
toxcct wrote: this is faulty, because you convert a string of TCHARs into a string of wchar_t.
not if you have _UNICODE defined.
(and if you haven't defined it, the compiler will complain about...)
By the way T2WC does not exists on my system (Visual Studio 6) can you tell me, please, how is it defined (I'm curious about...)?
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.
|
|
|
|
|
Pallini, looks like you are missing the closing </font> tag in your name.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
Thank you very much.
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.
|
|
|
|
|
No problem.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
>> not if you have _UNICODE defined.
then, it's worse, because if unicode is not defined, CString is still contained of TCHAR, which equates to char, not wchar_t.
you should never make assertions such like UNICODE exists or not. if you use TCHARs, then use them for all. otherwise, use (LPCWSTR) instead
|
|
|
|
|
toxcct wrote: then, it's worse, because if unicode is not defined, CString is still contained of TCHAR, which equates to char, not wchar_t.
And the compiler will camplain about. The world will not end.
toxcct wrote: you should never make assertions such like UNICODE exists or not. if you use TCHARs, then use them for all. otherwise, use (LPCWSTR) instead
I can't agree with this...But, I think, it's a matter of taste.
Again, Can you please tell me about T2WC ?
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.
|
|
|
|
|
Are we supposed to guess what your code looks like that is causing this error?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello all,
I have list box IDC_FILE_LIST and a add and remove (IDC_REMOVE) button.
After adding some items in the list box, I want to remove an item which is selected by the user on clicking on remove button.
For that I have used this code and its not working item selected by the user is not getting deleted can please tell me what is the error in the below code.
BOOL CALLBACK DlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_REMOVE:
{
HWND hList = GetDlgItem(hwnd, IDC_FILE_LIST);
int count = SendMessage(hList, LB_GETCOUNT, 0, 0);
SendMessage(hwnd,(UINT) LB_DELETESTRING,count,lParam);
}
break;
-----------
----------------------
Tanking you,
Suresh HC.
|
|
|
|
|
Hi,
To get selected item you should use LB_GETCURSEL (LB_GETCOUNT returns number of items). Besides if you want to use LB_DELETESTRING you need first retrieve what text is at selected item - LB_GETTEXT.
-----------
Mila
|
|
|
|
|
Thank you very much Mila for your response. Your comments helped me a lot.
|
|
|
|
|
The problem arises in the code below:
Suresh H wrote: int count = SendMessage(hList, LB_GETCOUNT, 0, 0);
SendMessage(hwnd,(UINT) LB_DELETESTRING,count,lParam);
you are asking for the number of list items instead of the item currently selected. Moreover the lParam in the LB_DELETESTRING should be zero.
Try this:
int curSel = SendMessage(hList, LB_GETCURSEL, 0, 0);
SendMessage(hwnd, (UINT) LB_DELETESTRING, curSel, (LPARAM)0);
hope that helps
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.
|
|
|
|
|
Thank you very much sir the solution is working.
int CurSel = SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST), LB_GETCURSEL, 0, 0);
SendMessage(GetDlgItem(hwnd, IDC_FILE_LIST), LB_DELETESTRING, CurSel, 0);
|
|
|
|
|