|
jschell wrote: your "compelling one" isn't very.
I didn't say there was one.
jschell wrote: other macro compilers
I hadn't considered that, thanks.
jschell wrote: clever tricks increase the cost of code maintenance
Absolutely, and this is kinda to prove that point.
|
|
|
|
|
PIEBALDconsult wrote: I didn't say there was one.
I apologize. Your post is clear but somehow I managed to read something into it which wasn't there at all.
|
|
|
|
|
I have an application which work fine if it is setup inside the folder with English characters for example "myapplication" but if I does not run when I try to install it inside in a folder which has folder name like "выполнятЬ" however installation does not create problem.
The problem comes with flash player activeX. I have integrated swf inside a dialog. I calls it's function like below
try
{
_bstr_t response = flashDlg.flashPlayer->CallFunction (query);
}
catch(...)
{
logManager.Print(LL_INTERR, "Error while sending command to swf..");
return false;
}
First 3 times it calls the function without problem but after that it throws error I traps into catch. Any suggestion or guess what can be the problem.
modified on Saturday, January 22, 2011 6:56 AM
|
|
|
|
|
You need to use (preferably) Unicode otherwise multi-byte strings to support the extended character set.
This is in the General Project Options currently as Character Set = Not Set . Change this to Use Unicode Character Set
Then you will need to add the _T() macro around all of your strings like logManager.Print(LL_INTERR, _T("Error while sending command to swf.."));
|
|
|
|
|
I am already using that option "Use Unicode Character Set". The problem is uncertain this type of folder name works fine in my machine but does not work in other machines and my PM always says "Everything runs into your machine why it does not run in other machines"
One thing is sure that it is somehow related to language issue because it works fine in all machines if they have folder name in English.
Another strange thing is that swf loads without any problem. Initial function call goes fine but later on it does not work even though data as well as function name both are same.
|
|
|
|
|
If I am understanding this correctly, it installs ok into the folder, but wont run from it.
If that is correct:
The English language is in the ASCII character set. The Unicode and Multi-Byte character sets are just supersets of the ASCII character set.
Having the Unicode character set enabled is only half the story. You need to use the Unicode functions.
I am certain if you are using the Unicode functions, then it will work.
For functions like fopen are ASCII, you need to use it like FILE *pFile = _tfopen(_T("C:\\выполнятЬ"), _T("w")); . Also not that the source code file needs to be saved in Unicode format if you use non-english strings in it like that one. Visual Studio will prompt you if this needs to happen.
For the Win32 API functions, they will automatically change over to use the Unicode versions unless your function names finish with a capital A
If it aren't understanding it correctly, and it doesn't install into the folder, then try a different setup program.
|
|
|
|
|
Yes you got it right. It is installing perfectly but not running. However problem is not in writing files or opening file. It is between Flash ActiveX and my wrapper function who actually calls it.
Here is the implementation of CallFunction()
inline _bstr_t IShockwaveFlash::CallFunction ( _bstr_t request )
{
BSTR _result = 0;
HRESULT _hr = raw_CallFunction(request, &result);
if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
return _bstr_t(_result, false);
}
It FAILs and then goes for _com_issue_errorex
If my parameter are wrong then it should not work even if it was installed inside English folder. Function Parameters does not have non English chars.
|
|
|
|
|
Find the value of _hr when the it has failed.
You can do 1 of the following:
1. Put a breakpoint on the line if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
2. Print a message with TRACE("%u", _hr); to the "Output" window in Visual Studio if you are using MFC or ATL
3. printf("%u", _hr); if it is a console app
4. Show it in a MessageBox
Let me know what the code is, or see this page on MSDN[^] if you would like to have a shot at decoding the error yourself.
|
|
|
|
|
I added a break point there to check HRESULT value. It was E_FAIL.
|
|
|
|
|
Well, that's a great deal of help. A generic error code.
Perhaps checking the value of query may help, see if it isn't sending anything strange
Other than that, the best I can do then is suggest running ProcMon[^] and filter by your application and Filesystem activity to see if there is any errors when accessing the directory.
Other than that check the documentation.
|
|
|
|
|
Andrew Brock wrote: You need to use the Unicode functions.
I am certain if you are using the Unicode functions, then it will work.
I don't think either of these statements is true. The use of Unicode or ANSI inside a program is not dependent on the character set or language of the platform. If this were the case then I suspect thousands of programs would not run.
I must get a clever new signature for 2011.
|
|
|
|
|
At that stage (until he modified the question) I thought the problem was something along the lines of opening a file that lived inside a folder with a non-english name, then the program crashing as a result of reading from a file that isn't open.
Windows is Unicode. Most functions (in the Win32 API) that have an ASCII version convert the ASCII string to Unicode then call the Unicode version of the function.
Having said that, how do you specify a directory name (in Russian) that only exists within extended character sets (such as Unicode) with only ASCII. You can't.
The OP has since modified the question and has better defined his problem and the location of it, which now makes my answer irrelevant.
|
|
|
|
|
No problem, I just thought you were going off on a bit of a tangent. What you say here is correct, and obviously you cannot specify extended character file names in ASCII.
I must get a clever new signature for 2011.
|
|
|
|
|
You need to capture more information in your catch block, or use the debugger to trap it and see what is going on in the CallFunction() method; perhaps the parameter is incorrect.
I must get a clever new signature for 2011.
|
|
|
|
|
I was unsure what type of error it was throwing so I used ... in catch block. Debugger is not able to help here. By debugging, I have checked for the expiry of the flash object but it was alive so no problem there. Even parameters are also right.
|
|
|
|
|
I think Andrew has made some useful suggestions above. You need to display the actual error code in your catch block; in your case you are just printing a rather unhelpful message.
I must get a clever new signature for 2011.
|
|
|
|
|
This CallFunction is inside flash9c.tli file. Whenever I write any helpful statement there and compiles the code then it automatically reverts back. I am not able to put any statement there. I think this file generates automatically at compile time.
|
|
|
|
|
I have no experience of Flash, so I am unable to make any further suggestions.
I must get a clever new signature for 2011.
|
|
|
|
|
Hi everyone! I had the following lines of C++ code in my program
CFileDialog dialog(true);
CString strFileName=L"";
INT_PTR nResult = dialog.DoModal();
if(nResult == IDOK)
strFileName=dialog.GetFolderPath();
The problem is: When I execute the program on a PC running Windows XP, there always have an ugly exception which I don't know why it happened. But everything's fine when I copied it to another PC running Windows 7.
I'm desperate. Would you guy please tell me why?
anhld
|
|
|
|
|
The hWnd=0x00000000 is probably due to clean-up code.
As for the exception, could you tell us what it is. What code and/or message.
If you go to Debug>Exceptions and tick everything, it should break the debugger the moment the exception is thrown, so you can see what is causing it.
Once you have found the source, reset the exceptions filter (there should be a Reset All button in the dialog) otherwise they will annoy the heck out of you
|
|
|
|
|
|
MSDN[^] says:
The dialog box must have been created with the OFN_EXPLORER style; otherwise, the method will fail with an assertion.
You need to create the dialog like
CFileDialog dialog(true, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_EXPLORER);
|
|
|
|
|
Sorry! It doesn't work.
anhld
|
|
|
|
|
Perhaps i should have read the next line on that page[^].
"You can call this method only while the dialog box is being displayed. After the dialog box has been closed, this function will no longer work, and the method will fail with an assertion."
Not sure why it works on Windows 7, but you can instead use
strFileName = dialog.GetPathName();
strFileName = strFileName.Left(strFileName.ReverseFind(_T('\\')) + 1);
That is just example code, and you should add error checking into it to ensure there is a '\' character
|
|
|
|
|
Yeah! You're right! I should read MSDN carefully before asking this question. Anyway, thank you so much!
anhld
|
|
|
|