ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Distinguish between Windows Xp and Windows Vista (https://www.excelbanter.com/excel-programming/429416-distinguish-between-windows-xp-windows-vista.html)

ARbitOUR[_17_]

Distinguish between Windows Xp and Windows Vista
 

Damn!!!! This forum has been SOOO helpful in the past...I'll be sure to
donate to this site when I make it big..LOL

Anyways, I desperately need code that will determine the operating
system that is used by the end-user. I don't need the version number
returned as a value but purely an indication of which operating system
is in use - especially whether it is Windows XP or Windows Vista (the
service pack is irrelevant).

For interests' sake, the reason I need to distinguish between the two /
various operating systems is that I use SendKeys to navigate the menus
of MS Paint and the menu layouts of MS Paint for XP is not exactly the
same as that of MS Paint shipped with Vista. Obviously I will be using
IF statements to indicate the procedure to follow dependant on the
Operating system in use... Any help? Anyone? ? THX IN ADVANCE!


--
ARbitOUR
------------------------------------------------------------------------
ARbitOUR's Profile: http://www.thecodecage.com/forumz/member.php?userid=254
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=103713


Peter T

Distinguish between Windows Xp and Windows Vista
 
MsgBox Application.OperatingSystem

For more info about the system

http://support.microsoft.com/?kbid=152601

Sendkeys does not work in Vista !

Regards,
Peter T



"ARbitOUR" wrote in message
...

Damn!!!! This forum has been SOOO helpful in the past...I'll be sure to
donate to this site when I make it big..LOL

Anyways, I desperately need code that will determine the operating
system that is used by the end-user. I don't need the version number
returned as a value but purely an indication of which operating system
is in use - especially whether it is Windows XP or Windows Vista (the
service pack is irrelevant).

For interests' sake, the reason I need to distinguish between the two /
various operating systems is that I use SendKeys to navigate the menus
of MS Paint and the menu layouts of MS Paint for XP is not exactly the
same as that of MS Paint shipped with Vista. Obviously I will be using
IF statements to indicate the procedure to follow dependant on the
Operating system in use... Any help? Anyone? ? THX IN ADVANCE!


--
ARbitOUR
------------------------------------------------------------------------
ARbitOUR's Profile:
http://www.thecodecage.com/forumz/member.php?userid=254
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=103713




Peter T

Distinguish between Windows Xp and Windows Vista
 
MsgBox Application.OperatingSystem

For more info about the system

http://support.microsoft.com/?kbid=152601

Sendkeys does not work in Vista !

Regards,
Peter T



"ARbitOUR" wrote in message
...

Damn!!!! This forum has been SOOO helpful in the past...I'll be sure to
donate to this site when I make it big..LOL

Anyways, I desperately need code that will determine the operating
system that is used by the end-user. I don't need the version number
returned as a value but purely an indication of which operating system
is in use - especially whether it is Windows XP or Windows Vista (the
service pack is irrelevant).

For interests' sake, the reason I need to distinguish between the two /
various operating systems is that I use SendKeys to navigate the menus
of MS Paint and the menu layouts of MS Paint for XP is not exactly the
same as that of MS Paint shipped with Vista. Obviously I will be using
IF statements to indicate the procedure to follow dependant on the
Operating system in use... Any help? Anyone? ? THX IN ADVANCE!


--
ARbitOUR
------------------------------------------------------------------------
ARbitOUR's Profile:
http://www.thecodecage.com/forumz/member.php?userid=254
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=103713




ARbitOUR[_18_]

Distinguish between Windows Xp and Windows Vista
 

MsgBox Application.OperatingSystem

For more info about the system

'Getting Windows Status Information from Windows API'
(http://support.microsoft.com/?kbid=152601)

Sendkeys does not work in Vista !

Regards,
Peter T


Thx for the reply Peter!
:)

Regarding Sendkeys: If it doesn't work in Vista, why does it work on my
copy of Vista?

Just wondering....


--
ARbitOUR
------------------------------------------------------------------------
ARbitOUR's Profile: http://www.thecodecage.com/forumz/member.php?userid=254
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=103713


Peter T

Distinguish between Windows Xp and Windows Vista
 

"ARbitOUR" wrote in message
...

MsgBox Application.OperatingSystem

For more info about the system

'Getting Windows Status Information from Windows API'
(http://support.microsoft.com/?kbid=152601)

Sendkeys does not work in Vista !

Regards,
Peter T


Thx for the reply Peter!
:)

Regarding Sendkeys: If it doesn't work in Vista, why does it work on my
copy of Vista?

Just wondering....


--
ARbitOUR



How curious, SendKeys now seems to be working in my Vista too. It definitely
didn't work before in uncompiled VBA as a Standard User, though it did work
in compiled VB6 (but not in the IDE) and IIRC also with VBA with the UAC off
as administrator.

I can only assume some recent Vista update is why it now appears to work.
However best not assume it will work for all, a quick search will give you
hundreds of pages on the topic, with complaints about SendKeys not working
in Vista and loads of API driven alternative solutions.

Regards,
Peter T



Simon Lloyd[_1238_]

Distinguish between Windows Xp and Windows Vista
 

There were many fixes in the latest updates of Vista, and sendkeys was
probably included, just like Excel 2007 doesn't support FileSearch there
is soon to be a fix in the latest service pack to bring that back :)Peter T;461596 Wrote:
"ARbitOUR" wrote in message
...

MsgBox Application.OperatingSystem

For more info about the system

'Getting Windows Status Information from Windows API'
('Getting Windows Status Information from Windows API'

(http://support.microsoft.com/?kbid=152601))

Sendkeys does not work in Vista !

Regards,
Peter T


Thx for the reply Peter!
:)

Regarding Sendkeys: If it doesn't work in Vista, why does it work on

my
copy of Vista?

Just wondering....


--
ARbitOUR



How curious, SendKeys now seems to be working in my Vista too. It
definitely
didn't work before in uncompiled VBA as a Standard User, though it did
work
in compiled VB6 (but not in the IDE) and IIRC also with VBA with the
UAC off
as administrator.

I can only assume some recent Vista update is why it now appears to
work.
However best not assume it will work for all, a quick search will give
you
hundreds of pages on the topic, with complaints about SendKeys not
working
in Vista and loads of API driven alternative solutions.

Regards,
Peter T



--
Simon Lloyd

Regards,
Simon Lloyd
'Microsoft Office Help' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=103713


ARbitOUR[_20_]

Distinguish between Windows Xp and Windows Vista
 

How curious, SendKeys now seems to be working in my Vista too. It
definitely
didn't work before in uncompiled VBA as a Standard User, though it did
work
in compiled VB6 (but not in the IDE) and IIRC also with VBA with the
UAC off
as administrator.

I can only assume some recent Vista update is why it now appears to
work.
However best not assume it will work for all, a quick search will give
you
hundreds of pages on the topic, with complaints about SendKeys not
working
in Vista and loads of API driven alternative solutions.

Regards,
Peter T


True, sendkeys does have it's fair share of problems. However whether
it works or not for the end user doesn't matter that much to me. I only
used sendkeys in a value added macro for the end user that runs an
'e-mail prep' routine copying ranges to MS paint ans saves it as a bmp
with pre-defined file name for ease of location - it's simply a small
part of the whole workbook. Initialy my main concern with send keys was
primarily the numlock handling that varied between XP and Vista (i.e.
checking the state of numlock before running the process, then toggling
it back to it's original state after the process is complete.

Furtunately not many of the end-users will be running it on Vista (my
PC at work runs XP and so does most of the other end-user's PC's).

Either way, thx for the feedback Peter

:)


--
ARbitOUR
------------------------------------------------------------------------
ARbitOUR's Profile: http://www.thecodecage.com/forumz/member.php?userid=254
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=103713


Peter T

Distinguish between Windows Xp and Windows Vista
 
just like Excel 2007 doesn't support FileSearch there
is soon to be a fix in the latest service pack to bring that back


Really? Could you point to the source where that is confirmed, thanks.

Regards,
Peter T

"Simon Lloyd" wrote in message
...

There were many fixes in the latest updates of Vista, and sendkeys was
probably included, just like Excel 2007 doesn't support FileSearch there
is soon to be a fix in the latest service pack to bring that back :)Peter
T;461596 Wrote:
"ARbitOUR" wrote in message
...

MsgBox Application.OperatingSystem

For more info about the system

'Getting Windows Status Information from Windows API'
('Getting Windows Status Information from Windows API'

(http://support.microsoft.com/?kbid=152601))

Sendkeys does not work in Vista !

Regards,
Peter T

Thx for the reply Peter!
:)

Regarding Sendkeys: If it doesn't work in Vista, why does it work on

my
copy of Vista?

Just wondering....


--
ARbitOUR



How curious, SendKeys now seems to be working in my Vista too. It
definitely
didn't work before in uncompiled VBA as a Standard User, though it did
work
in compiled VB6 (but not in the IDE) and IIRC also with VBA with the
UAC off
as administrator.

I can only assume some recent Vista update is why it now appears to
work.
However best not assume it will work for all, a quick search will give
you
hundreds of pages on the topic, with complaints about SendKeys not
working
in Vista and loads of API driven alternative solutions.

Regards,
Peter T



--
Simon Lloyd

Regards,
Simon Lloyd
'Microsoft Office Help' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile:
http://www.thecodecage.com/forumz/member.php?userid=1
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=103713




Peter T

Distinguish between Windows Xp and Windows Vista
 
Not sure I quite follow but if the objective is to save a copy of part of a
worksheet as a BMP neither SendKeys nor use of a third party app such as
MSPaint are required.

Regards,
Peter T



"ARbitOUR" wrote in message
...

How curious, SendKeys now seems to be working in my Vista too. It
definitely
didn't work before in uncompiled VBA as a Standard User, though it did
work
in compiled VB6 (but not in the IDE) and IIRC also with VBA with the
UAC off
as administrator.

I can only assume some recent Vista update is why it now appears to
work.
However best not assume it will work for all, a quick search will give
you
hundreds of pages on the topic, with complaints about SendKeys not
working
in Vista and loads of API driven alternative solutions.

Regards,
Peter T


True, sendkeys does have it's fair share of problems. However whether
it works or not for the end user doesn't matter that much to me. I only
used sendkeys in a value added macro for the end user that runs an
'e-mail prep' routine copying ranges to MS paint ans saves it as a bmp
with pre-defined file name for ease of location - it's simply a small
part of the whole workbook. Initialy my main concern with send keys was
primarily the numlock handling that varied between XP and Vista (i.e.
checking the state of numlock before running the process, then toggling
it back to it's original state after the process is complete.

Furtunately not many of the end-users will be running it on Vista (my
PC at work runs XP and so does most of the other end-user's PC's).

Either way, thx for the feedback Peter

:)


--
ARbitOUR
------------------------------------------------------------------------
ARbitOUR's Profile:
http://www.thecodecage.com/forumz/member.php?userid=254
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=103713




ARbitOUR[_23_]

Distinguish between Windows Xp and Windows Vista
 

Peter T;462328 Wrote:
Not sure I quite follow but if the objective is to save a copy of part
of a
worksheet as a BMP neither SendKeys nor use of a third party app such
as
MSPaint are required.

Regards,
Peter T


If you imply copying the required range to a chart / graph then
exporting it as an image file...I've already tried that and yes it does
work...

...However, unfortunately there tends to be some colour degradation
when the resulting image is printed (so much so that certain text /
values on the quotation becomes illegible...not only when printing, but
also on the digital file itself).

So the chart/graph method doesn't help me much.

If there is a third way, I'd love to know how...

:)


--
ARbitOUR
------------------------------------------------------------------------
ARbitOUR's Profile: http://www.thecodecage.com/forumz/member.php?userid=254
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=103713


Peter T

Distinguish between Windows Xp and Windows Vista
 
I think I know why your chart Export is not coming out clear for you but can
be made fine. But there's a better way -

Get hold of Stephen Bullen's PastePicture.zip (from memory in downloads or
excel files)
http://www.oaltd.co.uk

Drag the module modPastePicture into your project. This provides the APIs
and wrapper functions required to get the image off the clipboard and save
to file. Adapt something like the following to your needs -

Sub TestRangeToBMP()
Dim lPicType As Long
Dim vFile As Variant
Dim oPic As IPictureDisp

lPicType = xlBitmap ' xlPicture for metafile or *.emf

vFile = Application.DefaultFilePath & "\TestRangeToBMP.bmp"
' or say
' vFile = Application.GetSaveAsFilename(etc

Range("a1:k20").Copy

Set oPic = PastePicture(lPicType)

SavePicture oPic, vFile
Application.CutCopyMode = False

End Sub


Normally you would want to use the CopyPicture function to give the choice
of working with a BMP or a metafile (emf). However CopyPicture is buggy in
Excel2007 unless you know exactly what you are doing (ie which formats work
with which object types - don't rely on Help or intellisense which are
wrong). The simple Copy function puts both bmp & metafile image formats on
the clipboard from range, shape and chartarea objects in 2007 (but in
earlier versions, if shape object only a metafile).

Finally, if you are concerned with quality you may find the metafile works
much better for you. Depends on what you want to do, in particular it scales
much better. Also smaller file size.

Regards,
Peter T



"ARbitOUR" wrote in message
...

Peter T;462328 Wrote:
Not sure I quite follow but if the objective is to save a copy of part
of a
worksheet as a BMP neither SendKeys nor use of a third party app such
as
MSPaint are required.

Regards,
Peter T


If you imply copying the required range to a chart / graph then
exporting it as an image file...I've already tried that and yes it does
work...

..However, unfortunately there tends to be some colour degradation
when the resulting image is printed (so much so that certain text /
values on the quotation becomes illegible...not only when printing, but
also on the digital file itself).

So the chart/graph method doesn't help me much.

If there is a third way, I'd love to know how...

:)


--
ARbitOUR
------------------------------------------------------------------------
ARbitOUR's Profile:
http://www.thecodecage.com/forumz/member.php?userid=254
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=103713





All times are GMT +1. The time now is 05:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com