|
What about them? Did I maybe misunderstand your problem?
The code I supplied creates a CRichEditCtrl without any borders at all. I tested it on my end. Was that not what you wanted?
|
|
|
|
|
Look there http://msdn.microsoft.com/en-us/library/bb787873(VS.85).aspx
I guess that your form style like win98. To turn on XP or later versions style, include this code:
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\""
#endif
|
|
|
|
|
I'm not using MS-stuff. Do you know if there's a win32 equivalent?
Thanks, Rozis
|
|
|
|
|
Hi sir
I have some strings which i am reading from database.
I want to comapare the strings with the given character and sort it Alphapatecially
For example if the given character input is "s".it should compare with the
given strings and get the result only with "s".
For example the strings are aa,bb,cc,ss,sss,sss
It should compare and get ss,sss,sss.
Any easy way or any help appreciated
Thanks
Raj
|
|
|
|
|
You have two possibilities: When extracting from the database ignore all strings that do not match the prefix character. Alternatively when sorting filter out all strings that do not match before sending to the sort function.
It's time for a new signature.
|
|
|
|
|
Dear You should handle by database query with using "where" and assending statment .
|
|
|
|
|
If you only want the strings for one purpose then it's probably more efficient to lean on your RDBMS and let it do the filter and sort for you. If, on the other hand, you want the strings for a variety of groovy purposes then you can filter them on the client side using a couple of algorithms from the C++ standard library:
#include <algorithm>
#include <string>
#include <vector>
#include <iterator>
#include <iostream>
std::vector<std::string> create_test_data()
{
std::vector<std::string> strings;
strings.push_back( "aa" );
strings.push_back( "bb" );
strings.push_back( "cc" );
strings.push_back( "ss" );
strings.push_back( "sss" );
strings.push_back( "sss" );
std::random_shuffle( strings.begin(), strings.end() );
return strings;
}
void print( const std::vector<std::string> &data, std::ostream & to )
{
std::copy( strings.begin(), strings.end(), std::ostream_iterator<std::string>( to, "\n" ) ) << std::endl;
}
int main()
try
{
std::vector<std::string> strings( create_test_data() );
print( strings, std::cout );
strings.erase(
std::remove_if(
strings.begin(),
strings.end(),
[]( const std::string &str ){ return str.front() != 's'; } ),
strings.end() );
std::sort( strings.begin(), strings.end() );
print( strings, std::cout );
}
catch( std::exception &e )
{
std::cout << "Something went wrong: " << e.what() << std::endl;
}
catch( ... )
{
std::cout << "Something went wrong, no idea what!" << std::endl;
}
The two important lines are:
strings.erase(
std::remove_if(
strings.begin(),
strings.end(),
[]( const std::string &str ){ return str.front() != 's'; } ),
strings.end() );
std::sort( strings.begin(), strings.end() );
as they're the lines that filter and sort the strings.
The first one removes any string that doesn't start with an 's' character. I've used a lambda to do the comparison - if you're not using a very up to date compiler you might have to replace that with a function object. Holler if you need some help. As remove_if has some funky behaviour (it can't resize the range it's filtering) you have to resize the vector - which is what erase is doing. Have a look at "Effective STL" by Scott Myers for a good treatment of why this happens.
The second line just sorts the remaining strings into alphabetical order.
Hope this helps, please scream if you need more help with this and don't decide SQL is the way to go!
Cheers,
Ash
Edited to play around with formatting a bit...
modified on Saturday, June 26, 2010 10:11 AM
|
|
|
|
|
raju_shiva wrote: I want to comapare the strings with the given character and sort it Alphapatecially
Wasn't sorting working here?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi!
When I execute my program, my application window opens and closes in a sudden. Then a window called
Data Execution prevention window opens. If click that window it has the following data:
Problem signature:
Problem Event Name: BEX
Application Name: CricCEGUI.exe
Application Version: 0.0.0.0
Application Timestamp: 4c259f04
Fault Module Name: StackHash_4930
Fault Module Version: 0.0.0.0
Fault Module Timestamp: 00000000
Exception Offset: 01079340
Exception Code: c0000005
Exception Data: 00000008
OS Version: 6.0.6002.2.2.0.256.1
Locale ID: 1033
Additional Information 1: 4930
Additional Information 2: b5c2ee444cce2fcc0c63bdde408d8084
Additional Information 3: b9dd
Additional Information 4: c9f8be406ff0c0f9c077c4f309046cec
What does this mean? How do I run my application without crash?
|
|
|
|
|
|
Its look like you are corrupting one of the buffer. Please have a review of your code.
|
|
|
|
|
Does anyone have a reliable implementation of IsTextUnicode()?
I'm tired of dealing with it. All I can find on the internet are people complaining about it, but so far no better alternative.
|
|
|
|
|
Man, that's shocking! I came here to ask the very same question. Please let me know if you find something useful (I'll do the same).
Workout progress:
Current arm size: 14.4in
Desired arm size: 18in
Next Target: 15.4in by Dec 2010
Current training method: HIT
|
|
|
|
|
It's not shocking to me, it's pathetic and annoying. This situation has existed for many years, and MS continues to ship this crappy API.
|
|
|
|
|
Rajesh R Subramanian wrote: Workout progress:
Current arm size: 14.4in
Desired arm size: 18in
Next Target: 15.4in by Dec 2010
Thats Incredible
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
The documentation for IsTextUnicode() states:
Determines if a buffer is likely to contain a form of Unicode text.
Which is to say, it can only test for the likelihood by sampling various bytes within the buffer. Since there is no byte or word pattern which absolutely guarantees that a buffer is Unicode there is no way that such a function can guarantee to recognise it.
It's time for a new signature.
|
|
|
|
|
And I've asked them several times why they have that crappy API and they say it could help instead of nothing.
But the problem is - it NEVER worked, so why have it?!
Workout progress:
Current arm size: 14.4in
Desired arm size: 18in
Next Target: 15.4in by Dec 2010
Current training method: HIT
|
|
|
|
|
You are right, I just tried it and what do you know - it doesn't work.
See other answer below.
It's time for a new signature.
modified on Saturday, June 26, 2010 9:32 AM
|
|
|
|
|
Nothing seems to work.
The output of the code below is always Text is ASCII
#define UNICODE
#define _UNICODE
#include <windows.h>
#include <tchar.h>
#include <wchar.h>
#include <stdio.h>
int main()
{
char *asciimessage = "This is an ASCII string.";
wchar_t *unicodemessage = L"This is a Wide Unicode string.";
TCHAR *automessage = TEXT("This message can be either ASCII or UNICODE!");
if(IsTextUnicode(unicodemessage,80,NULL))
printf("Text is Unicode\n");
else
printf("Text is ASCII\n");
if(IsTextUnicode(asciimessage,80,NULL))
printf("Text is Unicode\n");
else
printf("Text is ASCII\n");
return 0;
}
|
|
|
|
|
Your parameters are incorrect. You have specified 80 for the buffer length in both your calls, but neither of your strings are 80 bytes long, so the tests will be inspecting some random data beyond the end of the strings.
See also my response below.
It's time for a new signature.
|
|
|
|
|
This code works:
char ascii[] = "The rain in Spain";
WCHAR ucode[] = L"The rain in Spain";
wcout << "Testing the ASCII string" << endl;
if (IsTextUnicode(ascii, sizeof ascii, NULL))
wcout << "It is Unicode" << endl;
else
wcout << "It is NOT Unicode" << endl;
wcout << "Testing the Unicode string" << endl;
if (IsTextUnicode(ucode, sizeof ucode, NULL))
wcout << "It is Unicode" << endl;
else
wcout << "It is NOT Unicode" << endl;
The issue seems to be that the buffer length must be correct, and parameter 3 should be NULL to ensure all possible tests are tried.
It's time for a new signature.
|
|
|
|
|
Thanks Richard.
I ran your code and it works.
Output:
Testing the ASCII string
It is NOT Unicode
Testing the Unicode string
It is Unicode
Press any key to continue
Complete code listing
#define UNICODE
#define _UNICODE
#include <windows.h>
#include <tchar.h>
#include <wchar.h>
#include <stdio.h>
#include <iostream.h>
int main()
{
char ascii[] = "The rain in Spain";
WCHAR ucode[] = L"The rain in Spain";
cout << "Testing the ASCII string" << endl;
if (IsTextUnicode(ascii, sizeof ascii, NULL))
cout << "It is Unicode" << endl;
else
cout << "It is NOT Unicode" << endl;
cout << "Testing the Unicode string" << endl;
if (IsTextUnicode(ucode, sizeof ucode, NULL))
cout << "It is Unicode" << endl;
else
cout << "It is NOT Unicode" << endl;
return 0;
}
|
|
|
|
|
I wish it were as simple as that. Try this:
LPCWSTR str = L"कमल";
BOOL b = false;
b = IsTextUnicode(str, _tcslen(str), NULL);
if(b)
AfxMessageBox(L"Text is Unicode!");
else
AfxMessageBox(L"Boo!");
I've worked extensively with Asian languages and I've never had this API to work reiably. I know the documentation kinda confesses it, but there has been no development on this at all!
Richard MacCutchan wrote: char ascii[] = "The rain in Spain";
Richard MacCutchan wrote: if (IsTextUnicode(ascii, sizeof ascii, NULL))
Also, your example is flawed because you're wrongly passing the size of the pointer instead of passing the size of the buffer itself in bytes.
Workout progress:
Current arm size: 14.4in
Desired arm size: 18in
Next Target: 15.4in by Dec 2010
Current training method: HIT
|
|
|
|
|
Rajesh R Subramanian wrote: Also, your example is flawed because you're wrongly passing the size of the pointer instead of passing the size of the buffer itself in bytes.
No. Last time I checked:
char ascii[] = "The rain in Spain";
sizeof ascii == ::strlen(ascii) + 1
|
|
|
|
|
Yes, yes, apologies. See my reply to Richard.
Workout progress:
Current arm size: 14.4in
Desired arm size: 18in
Next Target: 15.4in by Dec 2010
Current training method: HIT
|
|
|
|