|
Thanks for your Reply
As Prasad suggestion it was illegal format,
str.Format("%s",*wp);
Runtime Error.
As mandanani suggestion ,Iagree
CString str1=”hai”;
To:
CString str1=_T(”hai”); its correct
But my programme was Socket Programme so I want to send the OnReceiving Character through WPARAM.
Ireceive the data in TCHAR and converted in to *CString and pass through the WPARAM
CString str1=”hai”;
CString* str2;
Str2=new CString (str1);
PostThreadMessage(WM_USER + 100,(WPARAM)_T(str2),0); /** this is wrong***/
Regards
shakumar
shakumar
|
|
|
|
|
shakumar_22 wrote: PostThreadMessage(WM_USER + 100,(WPARAM)_T(str2),0); /** this is wrong***/
PostThreadMessage(WM_USER + 100,(WPARAM)str2,0) That will pass the "raw" pointer to the message handler for WM_USER+100 . Be sure to delete that pointer when you are done with it.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> 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! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Didn't I answer this yesterday?
As I said then - you are allocating a string on the stack. When you leave the function, it is destroyed. Some time later, your posted message is dealt with, the wp now points to junk.
In the first case, you are posting an address of a string built into the data segment of your program, so it will still be valid later.
Iain.
|
|
|
|
|
How to find out the privilege given to a user(admin/limited access..)through coding?
Thanks
-- modified at 6:53 Tuesday 31st July, 2007
|
|
|
|
|
Users from windows or from your application?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Users from windows or from your application? A bit more info would be good
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Your question is a bit too vague. What permissions are you referring to?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I would guess he's talking about windows ....
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
for the windows system(xp and above)
|
|
|
|
|
I want my application to detect whether it runs on a cluster or not. How can i do this using Cluster API ?
BEST REGARDS
|
|
|
|
|
If I compile the code as a UNICODE built , which compilation would it be UTF-8
, UTF-16 or some other .
I mean to say what support it would be UTF-8 or UTF-16.
and If nothing what can be done to make it utf-8 if I am using wcstombs ,_wcslen functions ?
Using MultiByteToWideChar is the solution ?
|
|
|
|
|
Internal a LPCWSTR/CStringW is in UTF-16 LE, a CString also when you compile in UNICODE.
Converting UTF-16 LE to UTF-8 you should use WideCharToMultiByte( CP_UTF8, 0, stringw, BYTE* );
When you want a Unicode file, you should first write an encoding tag.
|
|
|
|
|
I'm using Visual studio 6.0 and MFC.
I add a menu resource to my application and define all required names.
Menu produces its IDs automatically (e.g. ID_HELP_ABOUT) I use class wizard to add a handler for the command message. Every things OK. But when I revisit my menu and decide to add another handler for another item, a few days later, I see all those IDs turned to numbers (e.g. 32792) I then have to find the ID and retype it to be able to use the class wizard to add a handler.
I know how to add a handler manually, but it's a pain in my ...;P
Is there any way to return all IDs back? (I hope it's not deleting .clw file, it's even more pain to reassign all those classes, etc.)
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
Actually in your "resources.h" you should have a relation of IDs and assigned int values. But it is the first time I hear about what you are saying. Maybe is there an option somewhere where you choose about seeing IDs in number or in name, but not sure about
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Hamed Mosavi wrote: ...a few days later, I see all those IDs turned to numbers (e.g. 32792)
At this point, what does the project's resource.h file look like?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Nothing especial, except some resources have similar IDs
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
Same here with VC.NET 2003:
The resources in the resource-editor and %PROJECT%.rc -file are the (correct) numbers, whereas the resource.h file has the (correct) ID-to-number table.
Annoying, but I could live with it. But as you mention it...
Failure is not an option - it's built right in.
|
|
|
|
|
If you use another "standard" IDs or Windows constants like windows styles (WS_MAXIMIZE) or attributes for some classes (PS_SOLID) and so on... are they ok? or have been transformed in their equivalent numbers too?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Sorry, I misunderstood what you mentioned.
Yes they are ok. I mean other resources like those I use for dialogs will be shown OK in "Resource view".
Everything OK, but menus.
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
Then, Sorry... but i dont understand what happens. All or none, but not some :S
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Nelek wrote: All or none, but not some
I'm sorry, Englilsh is not my native language. I don't understand this sentence.
Anyway, the problem remained; IDs of my menus turn to numbers, and just menus have this behavior.
Thank you for your effort
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
I made a programm that compare two txt files. If they are different then a=1 otherwise a=0.
Here is the first txt file:
T18 DB2 CCI00002 <br />
C03CLI NYNR48400000 01100000002 00<br />
C03RES NYNR48400000 00500000015 00
Here is the seconde one:
T18 DB2 CCI00009 <br />
C03CLI NYNR48400000 01100000002 00<br />
C03RES NYNR48400000 00500000015 00
They are diferent only because of the bold underlined character.
But the value return is 0.
The programme used is:
int a=0;<br />
char c;<br />
char t;<br />
fstream file1;<br />
file1.open("file1.txt",ios::in);<br />
fstream file2<br />
file2.open("file2.txt",ios::in);<br />
while (i<114) {<br />
file1>>c;<br />
i=i+1;<br />
file2>>t;<br />
if (c!=t) <br />
{a=1;}<br />
}
it´s i<114 because i don´t want to compare the whole text file.
Does anyone have an idea of the reason why the returned value is 0 even if the files are different?
|
|
|
|
|
have you tried debugging and going trhough step by step? Take a look on the contents of every char in every loop of the while. You will maybe have a surprise
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
ok i will try that way, thank you!
|
|
|
|
|
Why use an int if you plainly want a bool ?
why increment i in the middle, which makes the code harder to read ?
have you tried stepping through the code to see what values are being read into c and t ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|