|
waldermort wrote: Problem is, I am not yet ready to process this message
I do not think I have understood what your problem exactely is. What is it that you do not want ?
~RaGE();
|
|
|
|
|
I couldn't understand why the EN_CHANGE message was being sent and processed before I had completed that particular function. I guess it was being sent from the control as a SendMessage instead of a Postmessage.
I was not ready to process it since after setting the control text I needed to set some flags and fill some buffers. This was causing my EN_CHANGE handler to process the wrong information.
I have managed to overcome it by setting a few flags and sending a custom message. I now have a fully working auto save/redo/undo/IME-compatible edit box. Guess in future I should never trust exactly when a windows message will be sent.
|
|
|
|
|
waldermort wrote: I have managed to overcome it by setting a few flags and sending a custom message. I now have a fully working auto save/redo/undo/IME-compatible edit box. Guess in future I should never trust exactly when a windows message will be sent.
Ok, glad you have sorted it out. Sorry we could not help earlier.
~RaGE();
|
|
|
|
|
Hello,
I have a project (VS2005) with a dialogBox containing a listBox filled with my drive letters.
I use that code to populate the listbox :
BOOL NewDlgProc_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)<br />
{_TCHAR path[MAX_PATH];<br />
int res;<br />
_tcscpy_s(path, MAX_PATH, _T("*.*"));<br />
res = DlgDirList(hwnd,(LPTSTR) path, IDL_DRIVE, 0, DDL_DRIVES);<br />
if (res == 0)<br />
{<br />
MessageBox(hwnd, _T("No drive available"), _T("Warning!"),MB_OK | MB_ICONINFORMATION);<br />
}<br />
return TRUE;<br />
}
I would like to get the text of the selected item so i wrote the folowing code :
<br />
void NewDlgProc_OnSeldrive(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)<br />
{<br />
LRESULT len=0;<br />
LRESULT index;<br />
index = SendDlgItemMessage(hwnd, IDL_DRIVE, LB_GETCURSEL, 0, 0);<br />
if (index != LB_ERR)<br />
{<br />
_TCHAR driveText[8];<br />
len = SendDlgItemMessage(hwnd, IDL_DRIVE, LB_GETTEXT, (WPARAM)index2, (LPARAM)driveText);<br />
if (gbr_len != LB_ERR)<br />
{<br />
...<br />
}<br />
}<br />
...<br />
}
When i try to debug this code i have in the listbox two items with the folowing text : [-c-] and [-d-].
When i select an item i got in driveText variable something like that :
driveText[0] = 0x0e1c <br />
driveText[1] = 0x0013<br />
driveText[2] = 0x005b '['<br />
driveText[3] = 0x002d '-'<br />
driveText[4] = 0x0064 'd'<br />
driveText[5] = 0x002d '-'<br />
driveText[6] = 0x005d ']'<br />
driveText[7] = 0<br />
I do not understand why i get the first two index. I should have get directly the text '[-d-]'.
Could someone help me ?
Best regards.
|
|
|
|
|
gbruyneel wrote: len = SendDlgItemMessage(hwnd, IDL_DRIVE, LB_GETTEXT, (WPARAM)index2, (LPARAM)driveText);
index2 is not defined.
gbruyneel wrote: if (gbr_len != LB_ERR)
gbr_len is not defined.
Other than that, your code snippet worked fine for me.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Oops I missed the final code :
void NewDlgProc_OnSeldrive(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)<br />
{<br />
LRESULT len=0;<br />
LRESULT index;<br />
index = SendDlgItemMessage(hwnd, IDL_DRIVE, LB_GETCURSEL, 0, 0);<br />
if (index != LB_ERR)<br />
{<br />
_TCHAR driveText[8];<br />
len = SendDlgItemMessage(hwnd, IDL_DRIVE, LB_GETTEXT, (WPARAM)index, (LPARAM)driveText);<br />
if (len != LB_ERR)<br />
{<br />
...<br />
}<br />
}<br />
...<br />
}<br />
What are your result is it the same as mine, i have tried to switch to MBCS and i have the same behaviour.
|
|
|
|
|
gbruyneel wrote: ...is it the same as mine,
No.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hope I understood your question you need to get text of Listbox
Like this
TCHAR path[MAX_PATH];
int res;
_tcscpy(path, "*.*");
res=::DlgDirList(m_hWnd, path, IDC_LIST2, IDC_STATIC2, DDL_DRIVES);
TCHAR driveText2[256];//[8]
driveText2[0]='\0';
::SendMessage(hwnd, LB_GETTEXT, 0, (LPARAM)driveText2);
|
|
|
|
|
how to return string array from a method?
CString myclass::getStr()
{
CString strarr[]={"JAYARAJ","bala"}
return strarr;
}
i get error ..
how to do it...?
JAYARAJ
|
|
|
|
|
J5121982 wrote: CString strarr[]={"JAYARAJ","bala"}
What are you trying to do here? strarr is not an array like you might think. If you need an array of CString objects, use CStringArray . Otherwise, you'll need something like:
char *strarr[] = {"JAYARAJ", "bala"};
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Your function returns _one_ CString, not an array.
CStringArray myclass::getStr()
{
CStringArray csa;
csa.Add("str1");
csa.Add("str2");
return csa;
}
~RaGE();
-- modified at 8:55 Thursday 30th March, 2006 : Sorry David, you posted while I was writing.
|
|
|
|
|
i got this error
what to do?
error C2558: class 'CStringArray' : no copy constructor available
JAYARAJ
|
|
|
|
|
You cannot use the = operator on a CStringArray, you'll have to use the Copy function.
~RaGE();
|
|
|
|
|
You could use a vector of CStrings:
vector<CString> Doit()
{
CString s;
vector<CString> a;
s = "as";
a.push_back(s);
s = "ass";
a.push_back(s);
return a;
}
Now to use it:
CString s;
vector<CString> a;
a = Doit();
this is this.
|
|
|
|
|
khan++ wrote: s = "ass";//this one is for my boss.
Watch out! He might be reading Code Project...
|
|
|
|
|
Actually I have never seen him. And as far as I can tell, I am still anonymous.
this is this.
|
|
|
|
|
Birthday : Friday 16th December, 1977
Location : Pakistan
unless those informations are false, you're not really anonymous...
|
|
|
|
|
Heyyyyyy!
It was supposed to be confidential.
this is this.
|
|
|
|
|
sorry, i did not see any red bold stamp saying...
[CONFIDENTIAL]
[DO NOT OPEN]
...so, i read it...
|
|
|
|
|
Well, it was implicit...
Ok, very funny.
Gotta go now.
this is this.
|
|
|
|
|
J5121982 wrote: CString myclass::getStr()
{
CString strarr[]={"JAYARAJ","bala"}
return strarr;
}
i get error ..
how to do it...?
Of course u have type conflict. It look like you wrote
int myclass::getInt()
{
int arr[]={1,1}
return arr;
}
May be this helps:
CString[] myclass::getStr()
{
CString strarr[]={"JAYARAJ","bala"}
return strarr;
}
It should work, if no then try this
CString *myclass::getStr()
{
CString strarr[]={"JAYARAJ","bala"}
return (CString *)strarr;
}
BTW strarr seems to have local scope. So what you want to return is unclear.
If I understand what you try to do, it better to declare it in class itself:
class myclass{
...
public:
CString strarr[]={"JAYARAJ","bala"}
....
}
or specify static class storage
CString[] myclass::getStr()
{
static CString strarr[]={"JAYARAJ","bala"}
return strarr;
}
-- modified at 2:42 Friday 31st March, 2006
-- modified at 2:48 Friday 31st March, 2006
|
|
|
|
|
hi to all.
but special hello to Nibu Thomas.
i'm using my own browser(which is made in MFC C++) to load the webapplication. now what i have to do i have to make Login Page in XML.
and using the XML check the Authorization of the user and post the Data on the Redirected Page.
is it possible with MFC C++ using XML.
please help me.
Aavesh
|
|
|
|
|
|
Hi all,
Suppose i call terminate process that resides in the traybar.
the problem is the icon of it stays there. i need to make something like invalidate for the traybar.
is there a simple win32 api function? or do i need to find the window of the traybar then call it up on invalidate?
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi there!
I'm getting nuts over
that stuff, but I can't find anything about that problem.
I just want to connect my handheld stuff (symbol scanner with Windows CE .NET 4.2) to an oracle database. That's all.
But I can't find anything about that theme on the web, except that most of the standards are not working. (ODBC, DAO, ADO...)
Is it that complicated to connect CE to a database or am I just stupid?
Any (really any) help is apreciated!
Olli!
Olli
"Ooooooh, they have the internet on computers now!" Homer Simpson
+ = NULL :=>
|
|
|
|