From: Mike S on
On 6/14/2010 3:31 PM, Karl E. Peterson wrote:
> After serious thinking Mike S wrote :
>> On 6/14/2010 12:54 PM, Karl E. Peterson wrote:
>>> Mike S wrote on 6/13/2010 :
>>>> On 6/13/2010 7:08 PM, Viper900 wrote:
>>>>>> If you don't have wordpad, or if you want to let Windows use the
>>>>>> associated program you might consider using this approach, I'm not
>>>>>> sure
>>>>>> how it would work on a 64-bit OS though:
>>>>>>
>>>>>> How To Use ShellExecute to Launch Associated File (32-bit)
>>>>>> http://support.microsoft.com/kb/170918
>>>>>>
>>>>>> FindExecutable: Find Exe Associated with a Registered Extension
>>>>>> http://vbnet.mvps.org/index.html?code/system/findexecutable.htm
>>>>>
>>>>> Thank you Mike S, your link solved the problem
>>>>
>>>> Did you have a chance to test it on any 64-bit OS?
>>>
>>> What's the concern on x64?
>>
>> The MS site support.microsoft.com/kb/170918 lists it as 32-bit:
>> How To Use ShellExecute to Launch Associated File (32-bit)
>> I was wondering how a 64-bit OS would handle it. Will it work, or will
>> it create an error?
>
> Works here. There may be another 64-bit option, for 64-bit processes to
> call, but that's pretty irrelevent for Classic VB apps. :-)


Thanks, that's good to know. I was wondering if there would be a lot of
adjustments for 64-bit OS's running old VB6 programs.

From: Karl E. Peterson on
Mike S has brought this to us :
> On 6/14/2010 3:31 PM, Karl E. Peterson wrote:
>> After serious thinking Mike S wrote :
>>> On 6/14/2010 12:54 PM, Karl E. Peterson wrote:
>>>> Mike S wrote on 6/13/2010 :
>>>>> On 6/13/2010 7:08 PM, Viper900 wrote:
>>>>>>> If you don't have wordpad, or if you want to let Windows use the
>>>>>>> associated program you might consider using this approach, I'm not
>>>>>>> sure
>>>>>>> how it would work on a 64-bit OS though:
>>>>>>>
>>>>>>> How To Use ShellExecute to Launch Associated File (32-bit)
>>>>>>> http://support.microsoft.com/kb/170918
>>>>>>>
>>>>>>> FindExecutable: Find Exe Associated with a Registered Extension
>>>>>>> http://vbnet.mvps.org/index.html?code/system/findexecutable.htm
>>>>>>
>>>>>> Thank you Mike S, your link solved the problem
>>>>>
>>>>> Did you have a chance to test it on any 64-bit OS?
>>>>
>>>> What's the concern on x64?
>>>
>>> The MS site support.microsoft.com/kb/170918 lists it as 32-bit:
>>> How To Use ShellExecute to Launch Associated File (32-bit)
>>> I was wondering how a 64-bit OS would handle it. Will it work, or will
>>> it create an error?
>>
>> Works here. There may be another 64-bit option, for 64-bit processes to
>> call, but that's pretty irrelevent for Classic VB apps. :-)
>
> Thanks, that's good to know. I was wondering if there would be a lot of
> adjustments for 64-bit OS's running old VB6 programs.

There are a few, but thankfully most stuff at this level is pretty
forward compatible.

--
..NET: It's About Trust! http://vfred.mvps.org
Customer Hatred Knows No Bounds at MSFT
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Free usenet access at http://www.eternal-september.org


From: MikeD on


"Mike S" <mscir(a)yahoo.com> wrote in message
news:hv6ki0$dh2$1(a)news.eternal-september.org...
> On 6/14/2010 3:31 PM, Karl E. Peterson wrote:
>> Works here. There may be another 64-bit option, for 64-bit processes to
>> call, but that's pretty irrelevent for Classic VB apps. :-)
>
>
> Thanks, that's good to know. I was wondering if there would be a lot of
> adjustments for 64-bit OS's running old VB6 programs.
>

As Karl said, there are a couple of gotchas to look out for, but if your app
is properly written to begin with, it should run just fine under 64 bit
Windows without any special code. By "properly written", I mean things like
not hard-coding paths or making other assumptions about Windows in general.
For example, most 32 bit programs will be installed in "Program Files
(x86)", so don't assume it's just "Program Files". Always use the API to
get special folder path names. Windows knows that your program is 32 bit
and when the path is different for a 32 bit app and a 64 bit app, the API
function will provide you the correct one. This goes for your installer too.
Files that should be installed in the system folder should be installed to
"SysWOW64", NOT to "System32". Any decent installer should just be able to
handle this. However, if the installer has 64 bit support, be sure you do
NOT use that for your 32 bit VB6 app.

About the only area where I've found special code *may* be necessary is the
Registry. Normally, 32 bit apps can only access a "special" section of the
Registry for 32 bit apps. Windows redirects API calls from 32 bit apps to
this section, so again, there's usually nothing special you need to do.
However, you could find that you need to read a setting that's in a 64 bit
hive of the Registry. There's a special flag you can use to cause your 32
bit app to read 64 bit hives; likewise, there's a flag for 64 bit apps to
read 32 bit hives. I remember I had to do this once. Can't remember
exactly what setting it was that I needed to get from the Registry though.
These 2 flags are:

Const KEY_WOW64_64KEY As Long = &H100& '32 bit app to
access 64 bit hive
Const KEY_WOW64_32KEY As Long = &H200& '64 bit app to
access 32 bit hive

One or the other of these can be specified when you open the key. For
example:

lRet = RegOpenKeyEx(hMainKey, KeyName, 0&, KEY_WRITE Or KEY_WOW64_64KEY,
hKey)

(In VB6, you will never need to use KEY_WOW64_32KEY).

--
Mike


From: C. Kevin Provance on

"MikeD" <nobody(a)nowhere.edu> wrote in message
news:uLT$J3IDLHA.4400(a)TK2MSFTNGP05.phx.gbl...
: As Karl said, there are a couple of gotchas to look out for, but if your
app
: is properly written to begin with, it should run just fine under 64 bit
: Windows without any special code. By "properly written", I mean things
like
: not hard-coding paths or making other assumptions about Windows in
general.
: For example, most 32 bit programs will be installed in "Program Files
: (x86)", so don't assume it's just "Program Files". Always use the API to
: get special folder path names. Windows knows that your program is 32 bit
: and when the path is different for a 32 bit app and a 64 bit app, the API
: function will provide you the correct one. This goes for your installer
too.
: Files that should be installed in the system folder should be installed to
: "SysWOW64", NOT to "System32". Any decent installer should just be able to
: handle this. However, if the installer has 64 bit support, be sure you do
: NOT use that for your 32 bit VB6 app.
:
: About the only area where I've found special code *may* be necessary is
the
: Registry. Normally, 32 bit apps can only access a "special" section of the
: Registry for 32 bit apps. Windows redirects API calls from 32 bit apps to
: this section, so again, there's usually nothing special you need to do.
: However, you could find that you need to read a setting that's in a 64 bit
: hive of the Registry. There's a special flag you can use to cause your 32
: bit app to read 64 bit hives; likewise, there's a flag for 64 bit apps to
: read 32 bit hives. I remember I had to do this once. Can't remember
: exactly what setting it was that I needed to get from the Registry though.
: These 2 flags are:
:
: Const KEY_WOW64_64KEY As Long = &H100& '32 bit app to
: access 64 bit hive
: Const KEY_WOW64_32KEY As Long = &H200& '64 bit app to
: access 32 bit hive
:
: One or the other of these can be specified when you open the key. For
: example:
:
: lRet = RegOpenKeyEx(hMainKey, KeyName, 0&, KEY_WRITE Or KEY_WOW64_64KEY,
: hKey)
:
: (In VB6, you will never need to use KEY_WOW64_32KEY).

This is the kind of thing that would make a great example ::nudges Karl::

--
Customer Hatred Knows No Bounds at MSFT
Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc

Bawwk! Paulie want a dingleball, bawwk!

From: Mike S on
On 6/15/2010 6:22 AM, MikeD wrote:
>
>
> "Mike S" <mscir(a)yahoo.com> wrote in message
> news:hv6ki0$dh2$1(a)news.eternal-september.org...
>> On 6/14/2010 3:31 PM, Karl E. Peterson wrote:
>>> Works here. There may be another 64-bit option, for 64-bit processes to
>>> call, but that's pretty irrelevent for Classic VB apps. :-)
>>
>>
>> Thanks, that's good to know. I was wondering if there would be a lot
>> of adjustments for 64-bit OS's running old VB6 programs.
>>
>
> As Karl said, there are a couple of gotchas to look out for, but if your
> app is properly written to begin with, it should run just fine under 64
> bit Windows without any special code. By "properly written", I mean
> things like not hard-coding paths or making other assumptions about
> Windows in general. For example, most 32 bit programs will be installed
> in "Program Files (x86)", so don't assume it's just "Program Files".
> Always use the API to get special folder path names. Windows knows that
> your program is 32 bit and when the path is different for a 32 bit app
> and a 64 bit app, the API function will provide you the correct one.
> This goes for your installer too. Files that should be installed in the
> system folder should be installed to "SysWOW64", NOT to "System32". Any
> decent installer should just be able to handle this. However, if the
> installer has 64 bit support, be sure you do NOT use that for your 32
> bit VB6 app.
>
> About the only area where I've found special code *may* be necessary is
> the Registry. Normally, 32 bit apps can only access a "special" section
> of the Registry for 32 bit apps. Windows redirects API calls from 32 bit
> apps to this section, so again, there's usually nothing special you need
> to do. However, you could find that you need to read a setting that's in
> a 64 bit hive of the Registry. There's a special flag you can use to
> cause your 32 bit app to read 64 bit hives; likewise, there's a flag for
> 64 bit apps to read 32 bit hives. I remember I had to do this once.
> Can't remember exactly what setting it was that I needed to get from the
> Registry though. These 2 flags are:
>
> Const KEY_WOW64_64KEY As Long = &H100& '32 bit app to access 64 bit hive
> Const KEY_WOW64_32KEY As Long = &H200& '64 bit app to access 32 bit hive
>
> One or the other of these can be specified when you open the key. For
> example:
>
> lRet = RegOpenKeyEx(hMainKey, KeyName, 0&, KEY_WRITE Or KEY_WOW64_64KEY,
> hKey)
>
> (In VB6, you will never need to use KEY_WOW64_32KEY).

Thanks for the details, I'll keep this post against any future problems.