Fails to convert process name to wxString

Eran Ifrah eran.ifrah at gmail.com
Fri Nov 2 14:29:49 PDT 2007


First let me open with the fact that I managed to find the bug and fix it.

Creating a minimal sample that can reproduce the problem was not helpful as
I expected, since the problem occurred there as well.
I did however used you advise, and went back to basics:
If all is Unicode (wx & my code) then the only function which I did not
check was the WinAPI function, and there lied the problem, let me explain:
In my code I loaded the functions by using LoadLibrary(), this code was
taken from a legacy code, reading this code, reveals a sad fact:  it used
LoadLibraryA ! so all my functions pointers (pfnFirstProcess,
pfnNextProcess) were using the ASCII version of the WinAPI.

Removing the LoadLibrary call and using the functions directly (and thus
letting the compiler do its #ifdef UNICODE thing and appending the 'W")
solved the problem.

Thanks for your useful tips.

Btw, I would like to contribute 2 function to wxWidgets, something like:
wxGetProcessList() - which returns an array of pairs of image name & process
ID (I can implement and test it on Linux/Windows) AND
wxGetProcessName(long pid) - which returns the process name by its PID
(returns the full path of the executable which created the process where
possible, unlike the former function which only return it name & ID)

I dont know if they will be accepted, since I don't have an access to Mac
machine (so I cant really implement it for Mac), or maybe they are not as
useful as I think they are, let me know what do you think.


Eran


On 11/2/07, Eran Ifrah <eran.ifrah at gmail.com> wrote:
>
> Ok, I will modify the minimal sample, to include my function and I will
> send it here.
>
> Thanks for your time (I will send it later today)
> Eran
>
>
> On 11/2/07, Vadim Zeitlin <vadim at wxwidgets.org> wrote:
> >
> > On Fri, 2 Nov 2007 11:09:22 +0200 Eran Ifrah <eran.ifrah at gmail.com>
> > wrote:
> >
> > EI> Passing pe.szExeFile directly yields the same the results as passing
> > EI> wxString.
> >
> > Ok, I'm lost so let's get back to the basics: can you please make a
> > (minimal) patch against the minimal sample to reproduce the problem?
> >
> > Thanks,
> > VZ
> >
> > --
> > TT-Solutions: wxWidgets consultancy and technical support
> >                http://www.tt-solutions.com/
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> > For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
> >
> >
>
>
> --
> Eran Ifrah
> eran.ifrah at gmail.com
>



-- =

Eran Ifrah
eran.ifrah at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wx-users/attachments/20071102/3cf=
0ba69/attachment.htm


More information about the wx-users mailing list