|
Thank you very much, Mike!
I'll post a solution as soon as I figured it out. Maybe it will help others.
|
|
|
|
|
After mailing with Markus Kuhn, the author of www.cl.cam.ac.uk/~mgk25/, he told me the following solution (function 1), which I wrapped a little bit (function 2):
static int Latin1toUTF8(TCHAR *t, const TCHAR *s, int len)
{
const TCHAR *p = s;
TCHAR *q = t;
while (p < s + len) {
if ((*p & 0x80) == 0) {
*q++ = *p++;
} else {
*q++ = 0xC0 | ((*p >> 6) & 0x3);
*q++ = 0x80 | (*p & 0x3F);
p++;
}
}
return q - t;
}
void StringToUTF8( const CString& input, CByteArray& output )
{
output.RemoveAll();
if ( input.IsEmpty() )
return;
output.SetSize(input.GetLength()*6);
const int new_length = Latin1toUTF8( (TCHAR*)output.GetData(), input, input.GetLength() );
ASSERT(new_length<=output.GetLength());
output.SetSize(new_length);
}
Thanks to Markus!
|
|
|
|
|
Anyone know how I can allow the user to enter a string wider than the edit portion of the CComboBoxEx? I've tried LimitText which works if I set it to a low number like 5. However, if I set it to a high number like 1024 or even 50 it doesn't take. I saw the comment in the MSDN about having to set the style to CBS_AUTOHSCROLL and tried that but still haven't gotten any luck.
TIA,
Dave Saulnier
CADKEY Corporation
|
|
|
|
|
Has anyone else noticed new problems with VC++ 6 after moving from NT4 to W2K?
I got a new system with W2K and after installing VC++ 6 the IDE now has a few small but very annoying problems that I don't recall from the NT4 days. I haven't yet applied SP4 because of MS' terrible track record with service packs. I thought I'd wait a few months to see if there wer any problems. Anyway, the problems are:
1. Cut and paste of code doesn't always work. You can select the text then hit CTRL-C but the IDE WILL NOT paste it into the new location no matter how many times I try. Repeatedly re-selecting and re-copying doesn't do anything. However, if I change my copy selection just by one character it works just fine!
2. When trying to save a modified source file, which is part of a loaded project, the IDE will tell me that the file cannot be saved (I forget the exact error). But if I try again, almost immediately, the file saves just fine. It's like there are two threads working with the file but they don't have any cooperation.
3. The IDE will periodically crash when I hit F7 to rebuild. This was so rare under NT4 that I was really surprised when it began happening under W2K.
4. After doing a cut/copy or paste the IDE gets stuck in selection mode. That is, the last location of the carat becomes the start of a text selection and wherever you move the carat to becomes the end of the selection. No amount of ESC, CTRL-C or anything will get it out of this selection mode. I got really pissed and wiped my hands over the entire keyboard several times, like you would a piano keys, and the all went back to normal. That is now how I fix it. It sounds like I'm beating the sh*t out of my keyboard !!!
|
|
|
|
|
I experienced what you say at point 4, but just one time.
I remember that selecting other text saved me from that trouble.
Never experienced the other points, however, maybe point 2 but one or two times.
I can't say why...
Cheers,
Paolo.
|
|
|
|
|
Interesting, I though this was just me...
I am getting 1 very frequently, which is extremly annoying. I usually can't get pasting to work untill I have made a sucessfull paste outside of the IDE. I have absolutely no idea why this is.
I have never experienced 2 or 3, but 4 is also trur for me, though not just after attempting to copy.paste. Sometrimes the selection will just remain untill I reopen the source file.
I alos get another problem though, which is that the IDE VERY frequently stops responding for about 20 - 60 seconds, and then resumes. This is not during compile time, ubut while editing files. I have been told many approaches to solve this, but none have worked. Maybe it is because I have too many include directories set up, and VC++ uses a timer to update intellisense or something?...
Oh yeah, I am also using Windows 2000, the profesional edition, and didn't have these problems with NT4.
|
|
|
|
|
Opps, I have very bad spelling which is obvoius from my last reply.
Sorry.
|
|
|
|
|
I also encounter IDE pauses frequently but they are usually no longer than 2 or 3 seconds.
You didn't say what kind of system you had, buy my system is a 800 MHz P3 it may be fast enough to make the pause less noticible.
You are probably right about the delays being caused by intellisense. I thought about turning it off until it dawned on me how much I use it
|
|
|
|
|
I don't think my system has much to do with it, before the move to Windows 2000, I was using a dual P2 450 with 128 MB RAM (NT4 SP3), but now I have a dual PIII 650 machine, with 512 MB RAM.
I also can't live without intellisense, it would require learning a hell of a lot about MFC that I don't want to, and don't have the time to.
|
|
|
|
|
I have experienced (1), (2), and (4) on both NT4.0 SP 6.0a and Win2000 SP1. I have never experienced 3 on either operating system. I was really hoping that DevStudio SP4 would fix (1) because that is the problem I see most frequntly.
|
|
|
|
|
You said that you were hoping VCPP SP4 would fix the problem, did it?
|
|
|
|
|
Hi Everyone,
How do I get the dialog box of Open & Save to come up?? (like the ones you see when you want to open and save a document in Microsoft Words).
I tried using CFileDialog but I'm having trouble. I'm not sure if I'm putting the wrong things in the parameter or what. I also get this error message of "failed assertion".
If anyone have any codes on an example of how to get the dialog box to work, please let me know.
Thanks in Advance!
Steve
|
|
|
|
|
Hi Steve,
That should be pretty simple:
CString filename;
CFileDialog opendlg(TRUE, NULL, NULL, OFN_HIDEREADONLY,
_T("Text files|*.txt;*.doc|Images|*.bmp;*.gif||"));
if (opendlg.DoModal() == IDOK)
filename = opendlg.GetPathName()
This code works for a single selection dialog. At the end you have the complete name of the selected file in the filename variable.
This should help you getting started, but refer to MSDN for a complete explanation.
Cheers,
Paolo.
|
|
|
|
|
I am using GetDIBits()
function for a Win NT VC++ application
I need to use it for a Ce application but the function
GetDIBits()
is not available for CE.
So please suggest a replacement function
or an alternative approach
Thanks in advance
|
|
|
|
|
I found the article, "A DIBSection wrapper for Win32 and WinCE", at http://codeguru.earthweb.com/ce/DIBSectionCE.shtml
It may help with DIBs under Windows CE.
gl
Jonathan Craig
|
|
|
|
|
Where can I get a freeware memory-leak detection tool, like the (more advanced) Boundschecker?
|
|
|
|
|
Hi,
I've never heard about free tools like this...
BoundsChecker is a good staff and it worth spending money.
Regards,
Alex Gorev,
Dundas Software.
|
|
|
|
|
Or he could set out to write his own... not that I would recomend it...
|
|
|
|
|
If you are using MFC, MFC has built-in leak detection. It's not exhaustive, but it's free and already available.
Read up on CMemoryState and AfxEnableMemoryTracking() .
|
|
|
|
|
Hi,
I want to debug my application in release mode
,added debug info into the release,
which tool allow me to view more that just assembley when
running it on the client machine
dr. watson...?,windbg...?
what should i do .???
thanks
tomer
|
|
|
|
|
Did you remember to link with debug info, and also include the pdb file on the client (if that format was used)...
If so, and you wind up in a debugger, it should prompt you for the locations of the relevant source files and away you go...
|
|
|
|
|
|
Hi
I am in a project where i have
to capture a realtime network packet, analyse it and display it to the GUI.
I am using MFC for GUI.I have a special driver insatalled which captures the data
flowing on the network.I am able to trap , analyse and display the data,but i loose
packets as packets are comming at very fast rate. I am using two threads , one gives a
DeviceIO control to the driver to get the packet and writes to a buffer(This is in a while loop).
Another Thread reads from the buffer and displays it to a MFC dialog.
What i suspect is that,when the first thread in which i give DeviceIo Control is preemted ,
it loses packets(I mean to say that i need to give DeviceIo ctrl continuosly to get each and every
packet at the same time reader thread should consumes the written packet as soon as possible).
Both thread uses comman resource(Buffer where packets are stored).
I am not using UI Thread concept.I am creating thread by calling CreateThread API.
Can UI threads be used for concepts like this , if yes will they solve my problem
of losing packets.
Your responce will be very useful to me.
Thanks
Jan
|
|
|
|
|
Jan,
I had the same problem, we solved it by using a capture process and a analyze process and memory mapped files.
HTH,
Xcrypto
|
|
|
|
|
hi HTH
Can u please give some more details about how u used
memory mapped files.
Jan
|
|
|
|