|
Suresh H wrote: since in the combo box I have values from 0,1,2,3,4,5 and so on …
so as I get the Index number value will be the same as the CB content.
Seems very strange logic.
But, use CB_GETLBTEXT message, as it will not be the case always.
|
|
|
|
|
Yes Prasad I will make use of it.
|
|
|
|
|
For CB_GETLBTEXT, MSDn says:
lParam
Pointer to the buffer that receives the string. The buffer must have sufficient space for the string and a terminating null character.
With your 100 TCHARS you might or might not be ok.
MSDN gives the solution in the next sentence:
You can send a CB_GETLBTEXTLEN message prior to the CB_GETLBTEXT message to retrieve the length, in TCHARs, of the string.
So, the code-snippet would better be:
int nIndx =::SendMessage(hCombo,CB_GETCURSEL,0,0);
const LRESULT nSize = ::SendMessage(hCombo, CB_GETLBTEXTLEN, (WPARAM)nIndx, 0);
TCHAR buff[nSize+1];
::SendMessage(h,CB_GETLBTEXT,(WPARAM)nIndx,(LPARAM)buff);
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
jhwurmbach wrote: lParam
Pointer to the buffer that receives the string. The buffer must have sufficient space for the string and a terminating null character.
With your 100 TCHARS you might or might not be ok.
True, It is just a quick fix.
jhwurmbach wrote: TCHAR buff[nSize+1];::SendMessage(h,CB_GETLBTEXT,(WPARAM)nIndx,(LPARAM)buff);//buff will contain text returned
Again, small correction here, need to allocate memory on heap.
TCHAR *buff = new TCHAR[nIndx+1];
::SendMessage(hCombo,CB_GETLBTEXT,(WPARAM)0,(LPARAM)buff);
|
|
|
|
|
prasad_som wrote: Again, small correction here,
In the end it doesn't pay to cut short on testing...
Thanks!
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Hi
All
I am doing multilingual applicaton in VC++, in this application i want marathi menu in my applicatin. I don't want to change menu font from control panel because by setting this all menu in win XP will be in marathi. so Can i set menu font to marahti by any code. please send me solution if anybody have.
Thanks
Atul Mahajan
Atul
|
|
|
|
|
Use a string table if you are using VS2003 or above. Load Unicode strings during runtime if you are using VS6. What have you tried? Where exactly are you stuck? Are you hard-coding menu captions currently?
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
I am using VC++ 6.0 for this apllication. I tried by using following steps
I open .rc file in MSWord
then change font strings to marathi
save this file
rebuild application and run it.
but font of menu not change, i read this steps on some site on internet so i follow this step , but not get desired result.so please guide me
Thanks in Advance
Atul
Atul
|
|
|
|
|
M. Atul wrote: I open .rc file in MSWord
then change font strings to marathi
save this file
rebuild application and run it.
VS6 is does not understand unicode. How did you even compile it with unicode characters? VS Editor must have given you an error that the resource file is corrupted and so can't be loaded. If not, then you did not save it with unicode characters which essentially means you did not make a change. All you have to do is, store your strings in an external file and load it dynamically. Ever heard of resource dlls? I suggest you read more on localization.
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
abichaz wrote: 16 bin
what does this mean ?
|
|
|
|
|
Hello Experts
I have a file but it is unicode support.
I want read the byte as character.Then
what type of buffer i have to take. (may be byte or not)
and what will be the variable the hold the character.(may be char or not)
manu
|
|
|
|
|
Define the buffer to store the unicode characters as wchar_t type.
Come online at:-
jubinc@skype
|
|
|
|
|
Hai,
Iam Using a Method named GetInputText in my class but was showing following error..
error C2511: 'GetInputText' : overloaded member function 'void (const struct FI_Text *,unsigned
short,unsigned long)' not found in dblink.
So i made it as comment line but not in header file because its refered by other files in my
class.But even then it showing the linker error i dont know how to rectify that???
error LNK2001: unresolved external symbol "public: virtual void __cdecl
dblink::GetInputText(struct FI_Text const *,unsigned short,unsigned short)"
(?GetInputText@ClientHarness@@UAAXPBUFI_Text@@GG@Z)
Please can anyone tell how to rectify it...
Thanks & Regards
Harshadha
|
|
|
|
|
harshadha wrote: error LNK2001: unresolved external symbol "public: virtual void __cdecl
dblink::GetInputText(struct FI_Text const *,unsigned short,unsigned short)"
(?GetInputText@ClientHarness@@UAAXPBUFI_Text@@GG@Z)
GetInputText is used somewhere in your application, but linker is not able to find its definition to link with.
Is this function defined ?
|
|
|
|
|
hai,
I Defined it in the header file of the dblink.h class.If i try to comment it and perform my compilation iam getting error like:
Dblink:overloaded member function
so i left it without commenting it..Even then getting error
Harshadha
|
|
|
|
|
harshadha wrote: error C2511: 'GetInputText' : overloaded member function 'void (const struct FI_Text *,unsigned
short,unsigned long)' not found in dblink.
This means your implemented version of this function differs in terms of type of parameters or in the order which they are passed. Make sure the parameter (here const struct FI_TEXT *, unsigned short, unsigned long in this case) is the same in the function definition also.
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
My error got rectified..Thanks a lot.....
Harshadha
|
|
|
|
|
Is it possible to receive a message in a worker thread. If yes, could anyone please tell me how?
Thank you,
AJ
|
|
|
|
|
In MFC worker threads don't have a message queue. You would need to use a GUI thread. I'd look at implementing a simple message queue yourself. An STL queue and a critical section should do the trick.
|
|
|
|
|
|
A situation where you want to send a message to a worker thread is very rare and in my opinion suspect. Usually you would handle such situation by signalling an event which the worker thread is waiting on, or polling a volatile declared flag.
Perhaps there is a more suitable solution for your problem.
What problem are you trying to solve by the use of a worker thread and why do you want to send messages to it?
It might be a little of topic, but it could be worth reading this[^] excellent article regarding multithreading.
--
Roger
-- modified at 4:18 Wednesday 17th January, 2007
Posted the wrong link. My apologies.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|
|
Roger Stoltz wrote: polling a volatile declared flag
Having a worker thread polling is not generally a good idea, but waiting on an event, on the other hand...
I inherited some code that polled, and because the person writing it was using a sleep inside the loop, they thought it would be OK. The thread was eating around 30% of the available CPU time while it waited, until I changed it to use an event, whereupon it "magically" dropped.
Steve S
Developer for hire
|
|
|
|
|
Steve S wrote: Having a worker thread polling is not generally a good idea, but waiting on an event, on the other hand...
What I meant, which unfortunately was not very clear, was a special case for a worker thread that doesn't wait for anything. It has a specific task that consumes 100% of the thread time slices and the thread would terminate when the task has completed. If you need to cancel the task prematurely I think it would be suitable by polling (or rather checking) a flag. But of course, there's always the possibility for calling ::WaitForSingleObject() with the timeout value set to zero, but that feels like overkill.
I was hoping for the OP to post again allowing me to pick up the "thread".
Steve S wrote: I inherited some code that polled, and because the person writing it was using a sleep inside the loop, they thought it would be OK. The thread was eating around 30% of the available CPU time while it waited, until I changed it to use an event, whereupon it "magically" dropped.
::Sleep() is one of the features that are so heavily abused and misused that I lack the words for it.
Every time anyone is trying to fix a threading issue by the use of ::Sleep() the code is almost certain to be wrong and even the design could be assumed to be erroneous.
If you haven't read Joe Newcomer's article about multithreading, which I included a link to in my previous post, have a go on it. It summarizes the common pitfalls quite clearly.
But, if I'm not mistaking, I think you already know...
Have a good one Steve
--
Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|
|
CMyListCtrl derives from CListCtrl, when someone using CMyListCtrl, he may change it's styles using SetWindowLong or ModifyStyle,I can overwrite ModifyStyle, but for SetWindowLong, I have nothing to do!
thanks
|
|
|
|
|
eat_union wrote: I can overwrite ModifyStyle, but for SetWindowLong, I have nothing to do!
Try these events...
WM_STYLECHANGED , WM_STYLECHANGING .
|
|
|
|