|
Your program MUST be compiled as either unicode OR ascii, you cannot change this at runtime. If you are reading files, you must convert the file to either unicode or ascii to match your program. Read my previous post, I gave you the two functions which do the converting.
|
|
|
|
|
If i choose UNICODE build it will not support by window 95 then????
|
|
|
|
|
asdtry wrote: If i choose UNICODE build it will not support by window 95 then????
From the MSDN-text for MultiByteToWideChar():
Requirements
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Winnls.h; include Windows.h.
Library: Use Kernel32.lib.
You will need to read in the MSDN anyway.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Not unless you use the "Layer for Unicode" api. This is just a dll you link against and ship with your program.
The best option is to do an ANSI build and convert the UNICODE files you are reading. Be warned though, not all UNICODE can be converted to ANSI, you might find it better to use a multibyte encoding like UTF8 and convert everything ( ANSI and UNICODE ) to this.
|
|
|
|
|
Hi,
I need to add MFC controls dynamically.
Can any one show me any article about it ?
Thanks.
Nice things do nice works
|
|
|
|
|
CWnd::Create()
Can you explain what "dynamically" means for you?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
And also see CreateWindow
|
|
|
|
|
Sakthiu wrote: I need to add MFC controls dynamically.
Can any one show me any article about it ?
what control you want to generate dynamically
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
Im making a game, there are lots of objects, all made from the same struct, so to tell the difference, i put 'char* ID;' into the struct, and set it to something like "Player" when the Player object is created.
In the debug version, when i get to a point where i have to check its the player, i use:
if(Current->ID == "Player")
And it would return true.
In the release version, it comes back false. So, what do i need to do to make the strings match in the release version?
|
|
|
|
|
Using strings is a bit slow, why not have an enum of object types. Also ID is a bad name as it suggests an identifier not a type
You are compairing pointers not the contents of memory at that location. Im not sure why it works in debug
use the strcmp() function and remember it returns 0 if they are the same
if(strcmp(Current->ID, "Player") == 0)
System.IO.Path.IsPathRooted() does not behave as I would expect
|
|
|
|
|
Hm, i get what your saying about ID, perhaps i'll change it.
Thanks though.
Im still getting used to C++, been doing C# where comparing strings is easy.
|
|
|
|
|
The Undefeated wrote: Im still getting used to C++, been doing C# where comparing strings is easy.
It would have been easy here too, if you had used string classes (like std::string or MFCs CString ).
They have an overloaded compasison-operator doing things the "intuitivly right" way.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
The Undefeated wrote:
if(Current->ID == "Player")
from where ID is coming.. and is "Player" is hardcoded...
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
Well im just using strcmp() now, but ID was set elsewhere, like this:
Main->ID = "Player", and yes, its hardcoded.
The if statement is in a Function, which is given the pointer to a struct, in this case 'Main'
|
|
|
|
|
Hi all. I have gotten a nesting error from VC and i dont know what i need to do to get what i need done and fix this problem.
The error
[code]
fatal error C1061: compiler limit : blocks nested too deeply
[/code]
What im doing is making a bunch of pre-programmed options. So i have a lot of if/else statements. Something like 30-40 or more. If there is a way to make it more simple i'd like to know. Something like using one main command to call on different functions. Thanx in advance!
|
|
|
|
|
Without seeing your code or knowing more precisely what you are doing, all I can say is
WOW! >128 levels of nesting! (I had to look it up - never heard of that error )
|
|
|
|
|
From MSDN :The code includes blocks that are nested to a level greater than the compiler limit (128 :-O levels of nesting). Simplify block nesting in the code. :wtf: What a pity !!
Can you use switch or something else ?!!
Can you separate into some functions ?
|
|
|
|
|
I'd be interested in seeing your code but I get the distinct impression that it could be scary.
Steve
|
|
|
|
|
Can anybody explain why only the last UpdateData() works in this code. All the lines seem to appear at once.
CString f;<br />
f = L"Checking database.";<br />
this->m_StatusText = f;<br />
this->UpdateData(FALSE);<br />
Sleep(500);<br />
f += L"Opening database.";<br />
this->m_StatusText = f;<br />
this->UpdateData(FALSE);<br />
Sleep(500);<br />
f += L"Loading data";<br />
this->m_StatusText = f;<br />
this->UpdateData(FALSE);
|
|
|
|
|
Makakuin wrote: Can anybody explain why only the last UpdateData() works in this code.
The bigger question is why are you using it in the first place?
Makakuin wrote: //m_StatusText is a CEditCtrl with value variable CString
Impossible. It's either one or the other. Change m_StatusText to be a CEdit member variable and use SetWindowText() instead.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Sorry - that was just an experiment, and I found out, acciddentally, that only the last UpdateData() worked in this code....
|
|
|
|
|
This code has just the same effect. I`ve placed a button and a editctrl on dialog for testing purposes and aded the above code in OnButton1 , but the text appears all at once after a 1500 miliseconds pause...
CString f;<br />
f = L"Checking database. ";<br />
this->c_StatusText.SetWindowTextW(f);<br />
Sleep(500);<br />
f += L"Opening database. ";<br />
this->c_StatusText.SetWindowTextW(f);<br />
Sleep(500);<br />
f += L"Loading data.";<br />
this->c_StatusText.SetWindowTextW(f);<br />
Sleep(500);
|
|
|
|
|
How about giving the control a chance to refreshredraw...
CString f;
f = L"Checking database. ";
this->c_StatusText.SetWindowTextW(f);
this->c_StatusText.UpdateWindow();
Sleep(500);
f += L"Opening database. ";
this->c_StatusText.SetWindowTextW(f);
this->c_StatusText.UpdateWindow();
Sleep(500);
f += L"Loading data.";
this->c_StatusText.SetWindowTextW(f);
this->c_StatusText.UpdateWindow();
Sleep(500);
|
|
|
|
|
Yes! This works! Don`t know how I forgot about this function...
Thanx!
|
|
|
|
|
Perhaps this link[^] will make you look differently on UpdateData() .
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|