http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shellexecute.asp
this means we should not only use the GetUnicode to get a unicode string
from Tcl, but also change the ShellExecute call.. I've worked a lot with
those type of functions (ANSI/UNICODE) so I know how it works... :
you have two functions, the first one is ShellExecuteA and is the ANSI
version of ShellExecute, and you have a second function ShellExecuteW
which is the unicode version (W = Wide char). The ShellExecute function
doesn't exist, it's a macro in this form :
#ifdef UNICODE
#define ShellExecute ShellExecuteW
#else
#define ShellExecute ShellExecuteA
#endif
Since almost all compilations are done using ANSI and not UNICODE (unless
you manually change that in the project settings), then you end up with
the ANSI version.
The solution would be to use this instead :
ShellExecuteW ( NULL, L"open", file, arguments, NULL, SW_SHOWNORMAL);
As well as changing the GetStringFromObj into GetUnicode calls...
btw, the L"open".. the 'L' was introduced to tell the compiler that this
constant string should be compiled into a unicode string, since it's the
compiler that will create it, it doesn't kow it's unicode and will default
to 8bit per char, the 'L' says to use 16bits per char, so it's not a
typo...
now, all we should do has been explained. Also, we should add att the end
something like this (pseudocode this time) :
int ret = (int) ShellExecuteW ...
if (ret > 32) return TCL_OK;
switch (ret) {
case ERROR_FILE_NOT_FOUND :
Tcl_AppendResult (interp, "The specified file was not found");
break;
case ERROR_PATH_NOT_FOUND :
Tcl_AppendResult (interp, "The specified path was not found");
break;
case ERROR_BAD_FORMAT :
Tcl_AppendResult (interp, "The .exe file is invalid (non-Microsoft
Win32
.exe or error in .exe image)");
break;
etc...
}
return TCL_ERROR;
Just get the error list from the msdn link I gave at the top of this
email....
I can do it if you want, but I have no compiler... so if someone could do
it and compile instead of me doing it, not compiling, and not testing...
that would be great! What else do you need ? :P
KKRT
On Fri, 23 Jun 2006 07:24:24 -0400, Sander Hoentjen <[EMAIL PROTECTED]>
wrote:
> On Fri, 2006-06-23 at 04:14 -0400, Youness Alaoui wrote:
>
>> - special characters in Windows logon username prevent from opening
>> browser to hotlog.htm
>>
> the bug is in WinLoadFile in file winutils.cpp
> First let me tell you again i don't know C programming, and also I don't
> know how to compile on windows.. But here is a suggestion, feel free to
> shoot me down if i say something stupid..
> Now we have:
> ShellExecute(NULL,"open", file, arguments, NULL, SW_SHOWNORMAL);
>
>
> return TCL_OK;
>
> So whatever ShellExecute is doing, TCL_OK is returned. I suggest that
> the return value of ShellExecute is checked, and it it is an error value
> then return TCL_ERROR (and of course first Tcl_AppendResult). That way
> in the future it is easier to spot an error.
>
> Furthermore about the error:
> // Get the first argument string (file)
> file=Tcl_GetStringFromObj(objv[1], NULL);
> replace that by:
> // Get the first argument string (file)
> file=Tcl_GetUnicode(objv[1]);
>
> Maybe that way it will work, but as I said I don't have a clue on how to
> compile on windows..
>
> Hope this helps,
>
> Sander
>
>
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Amsn-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/amsn-devel
--
KaKaRoTo
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Amsn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amsn-devel