|
I am working with a 3D viewer. When files from folders in Japanese characters are opened, the path contains some "?????" instead of Japanese characters. How can I convert this to multibyte.
I cant build my project in Unicode also. Please help
C:\Test\インド&新規ビジネス\新規ビジネス\ was the actual path
But I get the path like this inside code...
C:\Test\???&??????\??????\
|
|
|
|
|
You can convert your characters using the WideCharToMultiByte() [^] function. However, it would probably be better to convert your application to Unicode.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi All,
I want implement MFC Docking Framework[^]
in my existing mfc application
i have take same trial but it gives me assertion like
before execution of my project.
in output window a text appears
Like,
"Performing registration"
and after that came below assertion
File: c:\program files\microsoft visual studio.net 2003\vc7\atlmfc\include\atlbase.h
Line: 2619
Expression: _pAtlModule == 0
|
|
|
|
|
Hi, i'm getting strange memory leaks on basic functions such as:
fopen_s, localtime_s, wprintf, or _wfopen. What could possibly be wrong with the code / memory management?
I'm using Visual Leak Detector 2.2.
Memory leak report:
http://pastebin.com/j4ubmgD6[^]
void logger::calibrateFile(){
time_t t = time(0);
struct tm now;
errno_t err = localtime_s(&now, &t );
if (err)
{
printf("Invalid argument to localtime_s (logger).");
exit(1);
}
char st[ 10 ];
_itoa_s(now.tm_year + 1900, st, 10);
string fname = (string)st;
fname += '-';
_itoa_s(now.tm_mon + 1, st, 10);
fname += (string)st;
fname += '-';
_itoa_s(now.tm_mday, st, 10);
fname += st;
fname += ".txt";
string _logFile = this->logDir + fname;
if (this->logFile.compare(_logFile) != 0){
if (this->flog.is_open())
this->flog.close();
this->logFile = _logFile;
if (this->fileExists(this->logFile.c_str())) this->fresh = false;
this->flog.open(this->logFile.c_str(), fstream::out | fstream::app);
if (!this->flog.fail()){
printf("IP.logFile = %s\n", this->logFile.c_str());
}else
printf("IP.logFile = failed (%s)!\n", this->logFile.c_str());
}
}
Detected leak example:
---------- Block 528 at 0x0236DC58: 228 bytes ----------
Leak Hash: 0x2583A208 Count: 1
Call Stack:
f:\dd\vctools\crt_bld\self_x86\crt\src\realloc.c (85): test.exe!_realloc_base + 0x17 bytes
f:\dd\vctools\crt_bld\self_x86\crt\src\dbgheap.c (832): test.exe!realloc_help + 0x10 bytes
f:\dd\vctools\crt_bld\self_x86\crt\src\dbgheap.c (1040): test.exe!_realloc_dbg + 0x1B bytes
f:\dd\vctools\crt_bld\self_x86\crt\src\dbgheap.c (1107): test.exe!_recalloc_dbg + 0x19 bytes
f:\dd\vctools\crt_bld\self_x86\crt\src\setenv.c (250): test.exe!__crtsetenv + 0x39 bytes
f:\dd\vctools\crt_bld\self_x86\crt\src\wtombenv.c (72): test.exe!__wtomb_environ + 0xB bytes
f:\dd\vctools\crt_bld\self_x86\crt\src\getenv.c (131): test.exe!_getenv_helper_nolock + 0x5 bytes
f:\dd\vctools\crt_bld\self_x86\crt\src\tzset.c (165): test.exe!_tzset_nolock + 0xA bytes
f:\dd\vctools\crt_bld\self_x86\crt\src\tzset.c (95): test.exe!__tzset
f:\dd\vctools\crt_bld\self_x86\crt\src\loctim64.c (82): test.exe!_localtime64_s
c:\program files (x86)\microsoft visual studio 10.0\vc\include\time.inl (121): test.exe!localtime_s + 0xD bytes
c:\users\zzz\zzz\code\c++ projects\test\parser\logger.cpp (40): test.exe!logger::calibrateFile + 0xD bytes
c:\users\zzz\zzz\code\c++ projects\test\parser\parser.cpp (11): test.exe!Parser::Parser
c:\users\zzz\zzz\code\c++ projects\test\test\test.cpp (27): test.exe!wmain + 0x26 bytes
f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c (278): test.exe!__tmainCRTStartup + 0x19 bytes
f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c (189): test.exe!wmainCRTStartup
0x760F339A (File and line number not available): kernel32.dll!BaseThreadInitThunk + 0x12 bytes
0x772F9ED2 (File and line number not available): ntdll.dll!RtlInitializeExceptionChain + 0x63 bytes
0x772F9EA5 (File and line number not available): ntdll.dll!RtlInitializeExceptionChain + 0x36 bytes
Data:
50 D7 36 02 00 00 00 00 A0 41 20 00 FA 00 00 00 P.6..... .A......
C0 00 00 00 02 00 00 00 95 02 00 00 FD FD FD FD ........ ........
30 D0 36 02 78 B9 36 02 E0 B9 36 02 18 96 36 02 0.6.x.6. ..6...6.
E0 70 36 02 B0 71 36 02 28 72 36 02 C8 95 36 02 .p6..q6. (r6...6.
20 C8 36 02 80 C8 36 02 58 71 36 02 F8 C8 36 02 ..6...6. Xq6...6.
48 C9 36 02 B8 C9 36 02 08 CA 36 02 20 6B 36 02 H.6...6. ..6..k6.
88 6B 36 02 E0 6B 36 02 38 6C 36 02 88 6C 36 02 .k6..k6. 8l6..l6.
08 6D 36 02 60 6D 36 02 C0 6D 36 02 48 6E 36 02 .m6.`m6. .m6.Hn6.
98 72 36 02 28 67 36 02 80 67 36 02 80 66 36 02 .r6.(g6. .g6..f6.
90 68 36 02 E0 67 36 02 A8 69 36 02 20 6A 36 02 .h6..g6. .i6..j6.
F0 68 36 02 78 6A 36 02 B8 D1 36 02 F0 D0 36 02 .h6.xj6. ..6...6.
40 D1 36 02 00 D3 36 02 98 96 36 02 28 D2 36 02 @.6...6. ..6.(.6.
90 D2 36 02 50 D4 36 02 A0 D4 36 02 68 D3 36 02 ..6.P.6. ..6.h.6.
E8 D5 36 02 E8 D3 36 02 70 D7 36 02 00 00 00 00 ..6...6. p.6.....
FD FD FD FD ........ ........
#include <string>
#include <fstream>
#include <iostream>
#include <stdio.h>
#include <ctime>
#include <direct.h>
#define GetCurrentDir _getcwd
class logger
{
private:
ofstream flog;
bool fresh;
string logDir;
string logFile;
bool fileExists(const char* fname);
void directWrite(char* logline);
public:
void calibrateFile();
}
modified 7-Nov-11 3:32am.
|
|
|
|
|
The information being reported here is merely showing memory being reallocated as a string is manipulated and its size increased. The actual tidy up of reallocated and deallocated blocks will happen elsewhere, when the string destructor is called. Remember that tools like this are only pointing you to areas of your code that could be potential problems, it is up to you to verify whether they are real problems or not.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Thanks for the tip 
|
|
|
|
|
Hi,
I want to use an unregistered tlb file. To achieve this I figured out that i will need to install the tlb file in WinSxS folder.
Now my problem is how do i create a manifest file with this tlb file. Mt.exe requires -dll option to be used if -tlb file is specified to it.
Can anyone please help me out
|
|
|
|
|
|
I have some third party code that has stopped working since I moved to VS2010.
A popup color picker now no longer pops up from it's source button. Ultimately, its CWnd::CreateEx call fails (technically the call to AfxCtxCreateWindowEx). GetLastError says 0x00000579 (Invalid menu handle). It doesn't have a menu.
The same code works in VS6.
Any suggestions?
My CREATESTRUCT in CWnd::CreateEx looks like this:
<edit -="" get="" the="" right="" one="" this="" time!="">
lpCreateParams 0x00000000 void *
hInstance 0x00400000 {unused=9460301 } HINSTANCE__ *
hMenu 0x00000000 {unused=??? } HMENU__ *
hwndParent 0x008a06be {unused=0 } HWND__ *
cy 294 int
cx 278 int
y 673 int
x 571 int
style -771751935 long
lpszName 0x00000000 <Bad Ptr> const char *
lpszClass 0x00168828 "Afx:00400000:800" const char *
dwExStyle 0 unsigned long
modified 24-Oct-11 17:58pm.
|
|
|
|
|
I see a menu handle in the above, but this may not be valid for some combinations of Window styles.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
You're right - I edited to put the right one in!
|
|
|
|
|
style -771751935
style 0xD2000001
and includes both WS_CHILD and WS_POPUP , which is an illegal combination according to the documentation[^].
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Thanks Richard - that is a good lead! In the meantime I found that the invalid menu handle message was coming from PreCreateWindow.
This is because:
C:\Program Files\Microsoft Visual Studio\VC98\MFC\SRC\WINCORE.CPP
BOOL CWnd::PreCreateWindow(CREATESTRUCT& cs)
{
if (cs.lpszClass == NULL)
{
VERIFY(AfxDeferRegisterClass(AFX_WND_REG));
ASSERT(cs.style & WS_CHILD);
cs.lpszClass = _afxWnd;
}
return TRUE;
}
but
C:\Program Files\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc\wincore.cpp
BOOL CWnd::PreCreateWindow(CREATESTRUCT& cs)
{
if (cs.lpszClass == NULL)
{
VERIFY(AfxDeferRegisterClass(AFX_WND_REG));
ASSERT(cs.style & WS_CHILD);
cs.lpszClass = _afxWnd;
}
if ((cs.hMenu == NULL) && (cs.style & WS_CHILD))
{
cs.hMenu = (HMENU)(UINT_PTR)this;
}
return TRUE;
}
|
|
|
|
|
Good catch, don't you just love MFC!
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
This turned out to be the problem, cheers!
[third party....grrr... mumble mumble]
|
|
|
|
|
Hi all, do you know how to add a ActiveX control to a WTL main frame? I searched quite a lot and it seems all samples are using a dialog inheriting CAxDialogImpl while I do not want to use dialogs. Is it possible to host ActiveX control directly from main frame (which inherits from CFrameWindowImpl)?
Thanks in advance.
Wei
|
|
|
|
|
If you don't want a dialog what about using a View derived from CWindowImpl to host the ActiveX control?
|
|
|
|
|
Come to think of it I seem to remember ATL or WTL has window templates designed to host ActiveX controls. I think there's an example on the net that designs and implements a 'Bullseye' ActiveX control.
|
|
|
|
|
Hello.
I'm porting a *nix C code to Windows using MingW.
Having trouble with syslog.h.
Is there any syslog.h analog in Windows so that I could include the headers like:
#ifdef WIN32
#include <windows header>
#else
#include <syslog.h>
#endif
?
Thank you.
|
|
|
|
|
Here[^] are some possible suggestions.
|
|
|
|
|
|
locale loc("chs");
mbstate_t mystate;
char origin[] = "追求追求";
wchar_t dest[9] = { 0 };
const char * pc;
wchar_t * pwc;
const codecvt<wchar_t,char,mbstate_t>& myfacet =
use_facet<codecvt<wchar_t,char,mbstate_t> >(loc);
codecvt<>.in() translates char into wchar_t characters, but the first letter of origin[] is always translated wrong,the remaining characters are fine.
could someone help me out?
|
|
|
|
|
Cold_Fearing_Bird wrote: char origin[] = "追求追求";
You are trying to set a unicode/wide string to ANSI buffer.
|
|
|
|
|
|
I have tried the line of code that you complain about, but it compiles successfully. Please try and be more clear about your problem.
|
|
|
|