Click here to Skip to main content
15,888,968 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Can't use 'User-defined-Message' in APP class of dialog-based MFC application. Why? Pin
Cool_Dev10-Aug-10 19:57
Cool_Dev10-Aug-10 19:57 
GeneralRe: Can't use 'User-defined-Message' in APP class of dialog-based MFC application. Why? [modified] Pin
JongchanAhn10-Aug-10 21:43
JongchanAhn10-Aug-10 21:43 
GeneralRe: Can't use 'User-defined-Message' in APP class of dialog-based MFC application. Why? Pin
Cool_Dev11-Aug-10 0:57
Cool_Dev11-Aug-10 0:57 
AnswerRe: Can't use 'User-defined-Message' in APP class of dialog-based MFC application. Why? Pin
dilara semerci10-Aug-10 20:32
dilara semerci10-Aug-10 20:32 
QuestionHot key conflict with input in Game Pin
wikywin10-Aug-10 17:10
wikywin10-Aug-10 17:10 
AnswerRe: Hot key conflict with input in Game Pin
Cool_Dev10-Aug-10 20:22
Cool_Dev10-Aug-10 20:22 
GeneralRe: Hot key conflict with input in Game Pin
wikywin10-Aug-10 21:51
wikywin10-Aug-10 21:51 
QuestionUnicode text in messagebox from utf-8 file - VC 6.0 Pin
Jayapal Chandran10-Aug-10 11:11
Jayapal Chandran10-Aug-10 11:11 
Hi,
I am trying to display unicode text read from a file.
I am using messagebox to display the text.
VC 6.0 does not store unicode text as it is so i want to try whether reading from a file works.
Here is the code.

#define UNICODE
#define _UNICODE
#include <windows.h>
#include <tchar.h>
#include <io.h>
#include <fcntl.h>
#include <stdio.h>

void pint(int);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
    LPSTR lpCmdLine, int nCmdShow)
{
	
	int f,len;	
	char str[100];
	TCHAR tstr[100];

	f = open("c:\\uni.txt",O_RDONLY|O_BINARY);
	len = read(f,str,50);
	close(f);
	str[len] = '\0';
	tstr[len] = 0;

	pint(len);
	MultiByteToWideChar(CP_ACP, 0, str, len, tstr, len);
	
    MessageBoxW(NULL, tstr, _T("Note"), MB_OK);

	
    return 0;
}

void pint(int src)
{
    char buff[512];
    TCHAR tbuff[512];
    int len;

    itoa(src,buff,10);
    len = strlen(buff);
    buff[len] = 0;
    tbuff[len] = 0;

    MultiByteToWideChar(CP_ACP, 0, buff, len, tbuff, 512);
    MessageBoxW(NULL,tbuff,_T("PINT"),MB_OK);
}


Project Options
/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"Debug/uni.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c 


Pre processor definition
WIN32,_DEBUG,_WINDOWS,_MBCS


The length of the text file in UFT-8 format is 18 bytes and when i echoed the size it said 18 bytes.
But the characters are junk with extended ascii charset.
The text in the file is தமிழ்
What am i missing.

I have been using devc++ but it had problems so i thought it should work in vc6.0 and if so then i can change my ide. Using .Net ... i will do that after some time but now i want to make it work in vc 6.0 or devc++...

In codeblocks it is working fine with GCC compiler.

http://vikku.info/

Today's Beautiful Moments are
Tomorrow's Beautiful Memories


AnswerRe: Unicode text in messagebox from utf-8 file - VC 6.0 Pin
Aescleal10-Aug-10 11:46
Aescleal10-Aug-10 11:46 
GeneralRe: Unicode text in messagebox from utf-8 file - VC 6.0 Pin
Jayapal Chandran10-Aug-10 12:21
Jayapal Chandran10-Aug-10 12:21 
GeneralRe: Unicode text in messagebox from utf-8 file - VC 6.0 Pin
Aescleal10-Aug-10 19:36
Aescleal10-Aug-10 19:36 
GeneralRe: Unicode text in messagebox from utf-8 file - VC 6.0 Pin
Jayapal Chandran12-Aug-10 9:03
Jayapal Chandran12-Aug-10 9:03 
GeneralRe: Unicode text in messagebox from utf-8 file - VC 6.0 Pin
Jayapal Chandran7-Oct-10 0:53
Jayapal Chandran7-Oct-10 0:53 
QuestionWriteFile() API failed and GetLastError return 0x05 value. Pin
Member 390315410-Aug-10 4:54
Member 390315410-Aug-10 4:54 
AnswerRe: WriteFile() API failed and GetLastError return 0x05 value. Pin
Richard Andrew x6410-Aug-10 11:24
professionalRichard Andrew x6410-Aug-10 11:24 
AnswerRe: WriteFile() API failed and GetLastError return 0x05 value. Pin
Luc Pattyn10-Aug-10 11:46
sitebuilderLuc Pattyn10-Aug-10 11:46 
QuestionHELP: pair-value search & replace Pin
andwan010-Aug-10 4:24
andwan010-Aug-10 4:24 
AnswerRe: HELP: pair-value search & replace Pin
Moak10-Aug-10 12:55
Moak10-Aug-10 12:55 
AnswerRe: HELP: pair-value search & replace Pin
CPallini10-Aug-10 20:55
mveCPallini10-Aug-10 20:55 
GeneralRe: HELP: pair-value search & replace Pin
Moak10-Aug-10 23:10
Moak10-Aug-10 23:10 
GeneralRe: HELP: pair-value search & replace Pin
CPallini10-Aug-10 23:18
mveCPallini10-Aug-10 23:18 
QuestionHow to Get CMenu Rect? [modified] Pin
dancingfish10-Aug-10 3:17
dancingfish10-Aug-10 3:17 
AnswerRe: How to Get CMenu Rect? Pin
CPallini10-Aug-10 3:25
mveCPallini10-Aug-10 3:25 
GeneralRe: How to Get CMenu Rect? Pin
dancingfish10-Aug-10 3:30
dancingfish10-Aug-10 3:30 
QuestionRe: How to Get CMenu Rect? Pin
David Crow10-Aug-10 3:32
David Crow10-Aug-10 3:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.