|
if you define _UNICODE you have to follow unicode. For CString to const char* error you could have used some macro for typecasting. no need to go for WCHAR. There are many other ways to e.g. password.GetBuffer(Password.GetLength()); which will return yoi char *.
|
|
|
|
|
oh i wasn't aware of this.I already started changing stuff and error seems to be never ending. Hmm i got a backup of project though... So i guess i need to start it again.
Well i have not define _UNICODE...and what could be solution you could think of in the problem i mentioned.
Can we still use unicode without defining _UNICODE. I guess we can cos few things are working when i changed to wchar_t and i have not defined _UNICODE anywhere...
Thanks
|
|
|
|
|
It's not compulsory to use Unicode, you can remove the /D UNICODE from the MSVC project settings, but it is generally a good idea to go Unicode these days.
The short answer to whether you are going to have to change all the code or not is YES and the sooner you do it the less painful it will be
One option is to change your strcpy s for tcscpy s etc so that the code will compile with and without UNICODE defined. This way you can do the transition more gradually and in the meanwhile non Unicode builds which mix TCHARs with chars will work, keep putting in the changes to TCHAR functions until the code also builds and works in UNICODE. TCHAR and tcs functions turn into wchar and wcs with UNICODE defined(remeber to define _UINICODE as well beacuse someone at Microsoft screwed up) and they turn back into ordinary char stuff in non Unicode builds. You'll need <tchar.h> included of course.
Welcome to the wonderful world of international software
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Hi,
Always uses TCHAR instead of char / wchat_t and the generic-text functions defined in Tchar.h.
This will maps appropriately if used _UNICODE or not.
|
|
|
|
|
someone would tell me how to check a socketport is open(active) or not?
if it is active I want to close it,otherwise I would skip this work.
GoodLuck!
|
|
|
|
|
Hey,
try this link
http://msdn2.microsoft.com/en-us/library/wxzt95kb(VS.80).aspx
and this
http://www.codeproject.com/internet/SocketFileTransfer.asp
|
|
|
|
|
Did you mean if I want to get such target I would have to using CSocketFile?
But I did no need to using such class.I only want to indicate the socket is active or not,if so,I would close it.
|
|
|
|
|
kcynic wrote: I only want to indicate the socket is active or not,if so,I would close it.
Is there any harm in closing an already closed socket? If so, then maybe you could use getsockname() or getsockopt() , and check for WSAENOTSOCK .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Oh,I see what did you mean. That is to say,I can close a socket no matter it is opened or not.
Thanks
|
|
|
|
|
kcynic wrote: ...I can close a socket no matter it is opened or not.
I *think* you can. I don't work with sockets so you'll need to test it to be sure.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
There must be some nice simple function i can use to get the full directory location of where i am running my program from. Lets say my program is "me.exe" from "C:\WINDOWS\stuff\me.exe", then i want to get "C:\WINDOWS\stuff" or "C:\WINDOWS\stuff\" .
My search failed so thats why im asking here, thanks
edit: im in visual studio with a MFC dialog based application
edit2: maybe i should add i want to find the full directory from the program itself, so it knows where its running from...
//Johannes
|
|
|
|
|
Do you need to GetModuleFileNameEx ?
|
|
|
|
|
Is there something less hightech and more simple?
Like none of the DWORD and all the other stuff
(i edited my question abit)
//Johannes
|
|
|
|
|
|
Im using the code:
TCHAR szPath[MAX_PATH];
GetModuleFileName(NULL,szPath,MAX_PATH);
AfxMessageBox(szPath);
however the messagebox show the full path and the executable name, i just want the full dir,
thanks
//Johannes
|
|
|
|
|
if i use that in combination with
PathRemoveFileSpec(szPath);
it works
thanks WhiteSky!
//Johannes
|
|
|
|
|
I glad your problem solved.
|
|
|
|
|
Are you kidding?
C++ too technical for ya? There's always VB...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Dear Friend,
Sometimes when I try to select file from the desktop in release mode, application closing without message. In debug mode there is error message saying "Unhandled exception at 0x7d64159e in Project1.exe: 0xC0000005: Access violation reading location 0x02f24b20." In call stack window, there is shell32.dll!7d64159e().
If I uninstall Adobe reader it is not happening.
Is there any way to fix it without uninstalling Adobe reader?
Best Regards,
Suman
|
|
|
|
|
How do you call CFileDialog ?
|
|
|
|
|
Here is code:
<br />
char szFilters[] = "CSV Files (*.csv)|*.csv|";<br />
CFileDialog dlg(TRUE, "CSV", "*.csv",<br />
OFN_FILEMUSTEXIST| OFN_HIDEREADONLY, szFilters, this);<br />
if(dlg.DoModal()== IDOK)<br />
{<br />
CString strPath = dlg.GetPathName();<br />
}<br />
The code is inside a function of class derived from CMDIFrameWnd.
Best Regards,
Suman
|
|
|
|
|
Your code doesnt seem has any problem whats your compiler?
|
|
|
|
|
WhiteSky wrote: Your code doesnt seem has any problem whats your compiler?
Visual Studio .Net 2003 (VC++ 7.1)
Best Regards,
Suman
|
|
|
|
|
rp_suman wrote: If I uninstall Adobe reader it is not happening.
There is some problem with the pdfshell.dll file. The moment you move your cursor over a file( or a pdf file not sure ) the file dialog disappears.
Unregister this dll using regsvr32(There is no use in doing this, since this could happen anywhere). Also if you use "new" for creating <code>CFileDialog this won't happen. This recently happened in one of our projects.
If you use VC debugger to see what all dll's are being loaded then you will see that the moment this dll is loaded the file dialog crashes. It's a shell extension dll for pdf files.
|
|
|
|
|
Thanks for great help from everybody.
I will try "new" for creating file dialog.
Best Regards,
Suman
|
|
|
|