|
I set the loop with ::PeekMessage into the main_function, but no effect
How do you mean "create a new window to add a message loop" to create a simple CDialog-derived window ?
In this case the dialog has a new Handle and the MFC Application sends the messages to the process/main-thread, so the messages don't travel to the dialog, or?
All this work to transmit two int's to another process
I think i will write the int-values as text and the Console reads the values, that's very stupid,
but works
|
|
|
|
|
I think its hard to get the messages of a console window. I am not sure but i think you can try hooking( SetWindowsHookEx() ).
|
|
|
|
|
Try here[^]; this section of Code Project deals with inter-process communication. There are easier ways to pass data between processes than the Windows message mechanism, especially when both of the apps aren't windowed applications.
Software Zen: delete this;
|
|
|
|
|
|
convert cstring to const unsigned short *
How can i achieve this??
|
|
|
|
|
This is a really bad idea. A CString is an object representing a memory area in the PC. You can interpret to a pointer BUT it should be temporary. => (LPCSTR).
(const unsigned short *)(LPCSTR)
But there is no unsigned short !!!!
RTFM
Greetings from Germany
|
|
|
|
|
VARIANT v;
First case:
v.bstrVal = SysAllocString(sz);
//where sz is a OLECHAR FAR*
Second case:
v.bstrVal =sz.AllocSysString();
//where sz is a CString
Second case solved my problem
|
|
|
|
|
The right decription is often half of the solution of the problem!!!
For these String conversion are some API function and macros available. Its better to use them.
I dont need them often so I dont remember gut I guess like OLE2CHAR( )
Greetings from Germany
|
|
|
|
|
yashveer wrote: v.bstrVal =sz.AllocSysString();
dont forget to free it using the SysFreeString().
|
|
|
|
|
ya i m actually using
SysFreeString()
I wouldnt have known about all this. I was searching for a way to convert text to csv.... i found something on msdn online
http://support.microsoft.com/kb/179706/
Instead of fixed string given in the code:
FillSafeArray(L"John", 0, 0, &saRet);
I wanted to use the following:
FillSafeArray(str, 0, 0, &saRet);
where str is CString
and hence....all this
|
|
|
|
|
Use the MultiByteToWideChar() function.
Other option is to define the _UNICODE in the project setting preprocessor definitions, so that the CString will be keeping wide characters internally and hence no conversion is requirent
|
|
|
|
|
You can use MultiByteToWideChar may be somethng like this
CString str;
wchar_t* wch
MultiByteToWideChar(CP_ACP,0,str,strlen(str),wch,strlen(str),NULL,NULL)
Don't forget to allocate memory to this wchar variable
then typecast this wchar to unsigned short*
FillSafeArray((unsigned short*)wch ,....)
I think this will help u out !!!
|
|
|
|
|
typecast it to const unsigned short* .....
FillSafeArray((const unsigned short*).....
|
|
|
|
|
hi all
can anybody tell me is whats the difference between UTF-8 and multibyte.
and from where i can find more information on the same?
Thanx in advance.
|
|
|
|
|
Google for "UTF-8 multibyte" and you will get many hits. Try Wikipedia first.
|
|
|
|
|
UTF-8 is a Unicode encoding scheme.
Multibyte is a common name for a number of legacy encodings that typically store strings in char arrays (in C) as opposed to wchar_t arrays.
|
|
|
|
|
Nemanja Trifunovic wrote: Multibyte is a common name for a number of legacy encodings that typically store strings in char arrays
Thus in the sense of your definition UTF-8 is a multibyte-format.
UTF-16 (not that someone in his right mind would use that) isn't.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
jhwurmbach wrote: UTF-8 is a multibyte-format.
It is in a sense that is usually stored in char arrays and is a variable length encoding, but as I said the term "multibyte" is usually used for various legacy ASCII extensions such as SHIFT_JIS. UTF-8 is really a Unicode encoding.
jhwurmbach wrote: UTF-16 (not that someone in his right mind would use that) isn't.
You probably mean UTF-32.
|
|
|
|
|
Nemanja Trifunovic wrote: jhwurmbach wrote:
UTF-16 (not that someone in his right mind would use that) isn't.
You probably mean UTF-32.
I meant UTF-8 in the original meaning. According to the link[^]given in the posting below, UTF-16 is fixed 16-bit (and seems to be what the Windows-designers had in mind when they added the UNICODE-Functions taking wchar_t)
It seem as if standard bodies have tampered with UTF-16.
UTF-8 uses bytes, but it leaves the fixed relationship one code number <-> one character (which UTF-16) reatined.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
jhwurmbach wrote: According to the link[^]given in the posting below, UTF-16 is fixed 16-bit
Don't know about the link, but UTF-16 is definitelly not fixed 16-bit per character. There are surrogate pairs[^] that cover the space above 16 bits.
On the other hand, with UTF-32, each code point is encoded with a 32-bit number, and it is the only fix-length Unicode encoding schema.
|
|
|
|
|
|
Hi
I want to Read the JPEG file in the CFile or CStdioFile format.
I used to Write and read ".doc",".xt" file format by
CStdioFile file1;
file1.m_pStream=fopen("d:/newfile1.doc","a+");
file1.WriteString(L"hai");
file1.Close();
now i want to Read and Write the JPEG formated file.Some of them said read file in Binary format, but i dont know how to read in binary format.
Give your suggestion to Read and Writeing of jpeg file format
regards
shakumar
shakumar
|
|
|
|
|
I think you must read stream fundamentals.
fstream fs;
fs.open("file.txt",ios::bin); // not sure about bin or binary.
Search in C++ books, msdn does not have good documentation about streams.
|| ART OF LIVING ||
|
|
|
|
|
Please refer here[^].
Regards,
Paresh.
|
|
|
|
|
shakumar_22 wrote: file1.m_pStream=fopen("d:/newfile1.doc","a+");
Why use this? there is an open function for CStdioFile and CFile.
file1.Open("d:/newfile1.doc",CFile::modeRead|CFile::modeWrite);
There are some other flags also for opening.
you can use the same for opening JPEG files. But what you gonne do by reading row JPEG data?
|
|
|
|