Karl
Tue Jul 01 15:32:11 CDT 2008
krazymike wrote:
> Thanks. That's a lot of help. You know it's people like you who make
> it nearly impossible to get any help. Trying to make people look bad
> and yourself good only serves to expose you as the jerk you clearly
> are.
Bite me. I've been here far too long to care how I look to random newbs. And,
fwiw, it's almost certain that a majority of regulars here would agree it's people
like you who make it nearly impossible for, well, people like you to get any help
here. If you can't describe the problem, give it up.
> "Doesn't work" = hSearch gets value of -1 no matter what I do.
What's Err.LastDllError report?
> Prepending the \\?\ doesn't change anything.
There are *fundamental* differences in calling A/W functions from VB. As I stated,
you need to have a grasp on how pointers are passed to external libraries.
> What I was told that my
> code that works with the FindFirstFileA/FindNextFileA would work by
> switching to the W implementation of these functions. I'm finding
> that this is not the case.
Wrong. That is the case. But it's like switching to diesel to improve your milage.
There's "a bit more to it" than just that.
> I read somewhere that you need to pass the parameters to the W
> implementations as UTF-16 strings, but I have yet to have any luck
> with that either. The UTF-16 converter I found was returning null
> strings. I tried using MultiByteToWideChar to generate a UTF-8, but I
> don't think that's really doing much. The handler still receives the
> -1 value.
VB stores all strings as Unicode internally. How you pass them to external
libraries will determine what they recieve. That's *why* I asked you how you were
doing that. In particular, for your declares (function and structure) and the
actual call. If you can't provide those, we're just pounding sand here. <-- last
time I'm nice about that.
> I know this has to be possible, but perhaps not from VBA?
Of course it is.
> If I can get this working in vb6, that'd do fine, too.
From this perspective, they are functionally identical languages.
> I'm just restricted
> from using .Net in my department. Not my choice, just the way
> "business" decisions are made sometimes.
It's a good decision. Trust me. :-)
Btw, I'm curious why you entirely ignored my initial suggestion. Given your
description of the actual problem, it still seems to me like you're working far
harder than needed to find a solution to a problem you don't really have.
--
.NET: It's About Trust!
http://vfred.mvps.org
> On Jul 1, 1:20 pm, "Karl E. Peterson" <k...@mvps.org> wrote:
>> krazymike wrote:
>> > Ok, back to the original topic.
>>
>> > I used FindFirstFileA and FindNextFileA and was able to access a path
>> > of 306 characters. Now, I need to cover the UNICODE characters which
>> > may be in the file names. We get stuff from macs and linux machines
>> > from time to time. As far as I understand, I should be able to change
>> > the A to a W to use the unicode version.
>>
>> Right.
>>
>> > That doesn't work.
>>
>> Huh? You're a *developer* and you post a *user* error report?
>>
>> > prepended the "\\?\" to the path, and had no luck. I'm wondering if I
>> > need some language packs installed to use unicode at all.
>>
>> > Any thoughts?
>>
>> Yeah. But I'll spare you most of them.
>>
>> You need to understand Unimess, first. The way VB mangles the Unicode strings it
>> stores internally, when passing them externally, and vice-versa. To get Unicode
>> in/out of VB, you need to work directly with pointers. How are you declaring the
>> API(s) and their related structures? How are you filling the structures? How are
>> you reading what's returned?
>>
>> "Doesn't work" doesn't even begin to provide the requisite clues.
>> --
>> .NET: It's About Trust!
>>
http://vfred.mvps.org