|
Hi,
I am writing an application, which required unicode conversion, but I am facing some problem with SLOVAK characters.
For example, I face the problem for character ď , whose value is ď
for conversion, I did the following:
string strNum = "271";
wchar_t lpszUcode[1];
lpszUcode[0] = atoi(strNum.c_str());
int nCodePage = 1252;
int iBuffLen = WideCharToMultiByte(nCodePage, NULL, lpszUcode, 1, NULL, 0, NULL, NULL);
char* buffer = new char[iBuffLen + 1];
WideCharToMultiByte(nCodePage, NULL, lpszUcode, 1, buffer, iBuffLen, NULL, NULL);
buffer[iBuffLen] = 0;
string strRes = buffer;
It returns with the value d rather than ď .
can somene pl. sugeeset the solution for this.
Regards
Tough Time Never last, but Tough People do.
|
|
|
|
|
Vineet Kumar wrote: int nCodePage = 1252;
Code page 1252 doesn't contain that character, so it translates to the nearest equivalent that is in hte code page - which is "d".
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi All,
I need some details about File and Directory choosers. my requirement is i need to display the folders with content(ie. Folder is "Sample" it has sam.txt) in particular directory. I should use drag & drop , delete and multiple selection(not folder only content) events. So which control is better for this? Tree control or List Box or anything else?
Please help me..............
Thanks & Regards,
Anitha
|
|
|
|
|
AnithaSubramani wrote: Very urgent.............................
AnithaSubramani wrote: So which control is better for this? Tree control or List Box or anything else?
Good coding.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
Please let me know how to use RegQueryValueExW() with sample ....im confused with unicode..
|
|
|
|
|
The MSDN page for RegQueryValueEx[^] has an example. Where is your problem?
Why is that you have to worry about Unicode or ANSI? Can't you just use generic text-mappings?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Still busy though, managing to take some time out to see what's going on at CP.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
see here[^]
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hi Forum
How can i call function in thread.Situation is application make backup of moveing files/folder.And path is came one by one.So i try to use Thread.But i stop here(threading).Create a thread i use this code
CWinThread *co= new CWinThread();
co->CreateThread();
But How can i pass Copy Funtion in thread.Copy function is Copy(source path,Destination path)
Plz help me
|
|
|
|
|
If the "Copy" function is a global function, then you could call it straight from within your thread. If it is a member function of a class, then construct a class object and pass it to the thread as a parameter when you create your thread.
Also, read up on thread synchronization.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Thanks for reply
Now study more about Thread and do something like this.
void ThreadProc(void *param)
{
Copy(Source,Destination);
}
{
void CTestDlg::PathCame(const CString & FilePath)
{
HANDLE handle;
handle = (HANDLE) _beginthread( ThreadProc,0,0);
WaitForSingleObject(handle,INFINITE);
}
But only one thread run at the time.When fist thread is working and second is come then first thread destroy.
Plz help me
|
|
|
|
|
First things first: If you use things like _beginthread (or even CreateThread) along with MFC, all bets are off.
You must use the MFC functions instead. Like - to begin a thread, use AfxBeginThread()[^].
Have a look at the remarks section of CWinThread[^].
Can you tell me what is that you are looking to build? I don't get it.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi,
im using UrlDownload to file....to download a file from server..it worked fine before...but now it"s not working the reason i guess may be we have changed settings in internet options..ie related to ActiveX..but even when i reset the settings it"s not able to download file......(If possible please suggest any other API which cannot be dependent on internet settings...)
URLDownloadToFile(NULL,"http://(servername)/(virtualdirectory name)/(filename) , (path to store downloaded file), 0, NULL)
Please help me regarding the same......
|
|
|
|
|
We use a class that's based on WinInet that does this. See if it helps. I'm going to post the code below.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
class DownloadUrl
{
public:
DownloadUrl(const string& url);
~DownloadUrl();
int Get(void* buffer, int count);
int PercentageRead();
private:
DWORD m_Length;
int m_BytesReadTotal;
typedef auto_ptr<CInternetSession> apCInternetSession;
typedef auto_ptr<CHttpConnection> apCHttpConnection;
typedef auto_ptr<CHttpFile> apCHttpFile;
apCInternetSession m_pInternetSession;
apCHttpConnection m_pServer;
apCHttpFile m_pFile;
};
DownloadUrl::DownloadUrl( const string& url )
{
CString server, object;
DWORD service_type;
INTERNET_PORT internet_port;
AfxParseURL(url.c_str(), service_type, server, object, internet_port);
if (server.IsEmpty() || object.IsEmpty())
throw exception("Could not parse URL");
m_pInternetSession = apCInternetSession(new CInternetSession("Microsoft Internet Explorer 5.0"));
m_pInternetSession->SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 15000);
m_pInternetSession->SetOption(INTERNET_OPTION_CONNECT_BACKOFF, 1000);
m_pInternetSession->SetOption(INTERNET_OPTION_CONNECT_RETRIES, 2);
m_pInternetSession->EnableStatusCallback(TRUE);
m_pServer = apCHttpConnection(m_pInternetSession->GetHttpConnection(server, internet_port));
if (m_pServer.get() == NULL)
throw exception("HTTP connection failed");
m_pFile = apCHttpFile(m_pServer->OpenRequest("GET", object, NULL));
if (m_pFile.get() == NULL)
throw exception("Request failed");
m_pFile->AddRequestHeaders("Accept: audio/x-aiff, audio/basic, audio/midi, audio/mpeg, audio/wav, image/jpeg, image/gif, image/jpg, image/png, image/mng, image/bmp, text/plain, text/html, text/htm\r\n");
m_pFile->AddRequestHeaders("User-Agent: GetWebFile/1.0\r\n", HTTP_ADDREQ_FLAG_ADD_IF_NEW);
m_pFile->SendRequest();
DWORD dwStatus;
m_pFile->QueryInfoStatusCode(dwStatus);
if (dwStatus != HTTP_STATUS_OK)
throw exception("URL was denied by server");
m_Length = 0;
m_pFile->QueryInfo(HTTP_QUERY_CONTENT_LENGTH, m_Length);
m_BytesReadTotal = 0;
}
DownloadUrl::~DownloadUrl()
{
}
int DownloadUrl::Get( void* buffer, int count )
{
UINT bytes_read = m_pFile->Read(buffer, count);
m_BytesReadTotal += bytes_read;
return bytes_read;
}
int DownloadUrl::PercentageRead()
{
if (!m_Length)
return 0;
double ratio = m_BytesReadTotal;
ratio /= m_Length;
ratio *= 100;
return (int) ratio;
}
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
try {
DownloadUrl download_url("http://example.com/content.html");
static const unsigned buffer_size = 64*1024;
char buffer[buffer_size+1];
ofstream tmpfile("c:\\file.html", ios::out | ios::binary);
while (int bytes_read = download_url.Get(buffer, buffer_size))
{
tmpfile.write(buffer, bytes_read);
}
}
catch (exception& ) {
}
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Thanks for ur support may i know how can use RegistryRegQueryValueExW with sample..as im a newbie and im struggling with this unicode can u suggest me any article on how to use Unicode in my applications.....
|
|
|
|
|
what does RegistryRegQueryValueEx have to do with downloading files?
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Ya...this is a different doubt...Please try to calrify...
|
|
|
|
|
???
I don't understand what you're saying.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
The doubt What im going to ask is not related to Filedownload it is related to Registry access ...ie
Please let me know how can iread a value from registry using RegQueryValueExW() with sample.... and please let me know how can i use unicode in my applications ..really im struggling with this unicode....
|
|
|
|
|
You should start a new thread for this question.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
hi all
I am developing a directshow application through mfc .I am getting the error
Error 1 error C2664: 'ATL::CStringT<basetype,stringtraits>::CStringT(const VARIANT &)' : cannot convert parameter 1 from 'WCHAR [128]' to 'const VARIANT &' d:\visual c++ programs\mfc\pplayer\player.cpp 102
in the function
CString GetFilterName(IBaseFilter* pBF)
{
ASSERT(pBF!=NULL);
FILTER_INFO fi;
memset(&fi,0,sizeof(fi));
if(pBF!=NULL)
{
VERIFY(SUCCEEDED(pBF->QueryFilterInfo(&fi)));
}
return fi.achName; //here I am getting the error
}
please help me why i m getting this error
|
|
|
|
|
I'm guessing that you're using ASCII strings. fi.achName is a wide string, so isn't compatible with ASCII strings. When you attempt to pass it back as a CString, the compiler needs to find a constructor that will create an ASCII CString from a wide string. It can't, because there isn't one.
You need to convert the wide-string to a TCHAR string. The easiest way is to #include <atlconv.h> and convert the string like this:
return CW2CT(fi.achName);
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|