473,387 Members | 1,687 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

c++ and win 32 api

I would think that this would qualify as a FAQ around here, for which I do
not see a hyperlink. Anyways, one of the reasons I made a commitment to
learning C was that I wanted to be near windows but not anchored to it. An
expression like
#define WIN_32
is perfectly kosher c. I have said elsewhere that the double colon token
was the 42nd Parallel between c and c*. I have a good politician's
understanding of what separates ISO C and ISO C++ . How the heck does the
c++ crowd differentiate itself from windows? In particular, can you access
win 32 api "legally?" My guess is that the answer to this question is going
to be similar to the speed limit on I-94 in Wisconsin when you can only tune
in the Jesus station and the corporate country one. "To have the pedal to
the medal is strictly verboten, and the cops will occasionally inflict a
speed levy, but everyone who has to penetrate the cheese barrier does so."
fu
-------------
81 in 65 = $260
your welcomed, russ
Jun 19 '06 #1
13 2092
Your Uncle wrote:
= How the heck does the
c++ crowd differentiate itself from windows?
Simple. If the API in question is not in the Standard, then it's system
specific.

In particular, can you access
win 32 api "legally?"


By using the Windows API. It's just not on-topic in comp.lang.c++,
that's all.

Jun 19 '06 #2

"red floyd" <no*****@here.dude> wrote in message
news:Cu********************@newssvr29.news.prodigy .net...
Your Uncle wrote:
= How the heck does the c++ crowd differentiate itself from windows?


Simple. If the API in question is not in the Standard, then it's system
specific.

Is the set of API's in the standard non-empty? fu
Jun 19 '06 #3
Your Uncle wrote:
"red floyd" <no*****@here.dude> wrote in message
news:Cu********************@newssvr29.news.prodigy .net...
Your Uncle wrote:
= How the heck does the c++ crowd differentiate itself from windows?


Simple. If the API in question is not in the Standard, then it's system
specific.


Is the set of API's in the standard non-empty? fu

The subject appears to be operating system APIs. These are OT in any
pure language group and they invariably have their own groups.

C++ standard library (APIs) are defined in the C++ standard and by
inclusion, the C standard, so the set isn't empty.

--
Ian Collins.
Jun 19 '06 #4

"Ian Collins" <ia******@hotmail.com> wrote in message
news:4f*************@individual.net...
Your Uncle wrote:
"red floyd" <no*****@here.dude> wrote in message
news:Cu********************@newssvr29.news.prodigy .net...
Your Uncle wrote:

= How the heck does the c++ crowd differentiate itself from windows?

Simple. If the API in question is not in the Standard, then it's system
specific.


Is the set of API's in the standard non-empty? fu

The subject appears to be operating system APIs. These are OT in any
pure language group and they invariably have their own groups.

C++ standard library (APIs) are defined in the C++ standard and by
inclusion, the C standard, so the set isn't empty.

Non-empty sets in the standard IS the definition of topical. furunculus
Jun 19 '06 #5

"Your Uncle" <in*****@crippled.net> wrote in message
news:44**********************@news.usenetmonster.c om...

"red floyd" <no*****@here.dude> wrote in message
news:Cu********************@newssvr29.news.prodigy .net...
Your Uncle wrote:
= How the heck does the c++ crowd differentiate itself from windows?


Simple. If the API in question is not in the Standard, then it's system
specific.

Is the set of API's in the standard non-empty? fu


? I don't understand what you're trying to say here.
But in regards to your original question(s), when we speak of C++ in _this_
newsgroup, we're talking about the language itself, as defined by the
"Standard". The Standard does not include any third-party libraries, or
anything related to a specific compiler, platform, or related software.

The Windows API is a C library. (Actually, a set of C libraries, I think,
such as GDI and WinSDK, etc.) But you are free to write C++ programs which
interface with C libraries. It's perfectly "legal" to do so, and your code
is still valid "C++" (although it may no longer be portable). But it
becomes off-topic for this newsgroup when one begins to ask questions
_specific_ to that software (or any other third-party library, except
perhaps Boost).

So when you see someone say that someone else's posted example code "is not
C++" because it's full of Windows API stuff, what they mean is that the code
includes third-party stuff that we just don't discuss here. But we _will_
help with the code if it's just a C++ _language_issue, and not something
which requires knowledge of the API.

For example, if an API call is expecting a char* parameter, but we can see
you're passing a char instead, that's really a language issue, and we'll
help you by pointing out your error. (Provided of course that we can tell,
from either your code or comments, that a char* _is_ what the API is
expecting. We won't go looking that up ourselves.)

-Howard


Jun 19 '06 #6

Your Uncle wrote:
"Ian Collins" <ia******@hotmail.com> wrote in message
news:4f*************@individual.net...
Your Uncle wrote:
"red floyd" <no*****@here.dude> wrote in message
news:Cu********************@newssvr29.news.prodigy .net...

Your Uncle wrote:

>= How the heck does the c++ crowd differentiate itself from windows?

Simple. If the API in question is not in the Standard, then it's system
specific.

Is the set of API's in the standard non-empty? fu

The subject appears to be operating system APIs. These are OT in any
pure language group and they invariably have their own groups.

C++ standard library (APIs) are defined in the C++ standard and by
inclusion, the C standard, so the set isn't empty.

Non-empty sets in the standard IS the definition of topical. furunculus


The standard library does indeed have sets and they can be either empty
or non-empty, though not both at the same time.

Jun 19 '06 #7


Your Uncle wrote:
"Ian Collins" <ia******@hotmail.com> wrote in message
news:4f*************@individual.net...
Your Uncle wrote:
"red floyd" <no*****@here.dude> wrote in message
news:Cu********************@newssvr29.news.prodigy .net...

Your Uncle wrote:

>= How the heck does the c++ crowd differentiate itself from windows?

Simple. If the API in question is not in the Standard, then it's system
specific.

Is the set of API's in the standard non-empty? fu

The subject appears to be operating system APIs. These are OT in any
pure language group and they invariably have their own groups.

C++ standard library (APIs) are defined in the C++ standard and by
inclusion, the C standard, so the set isn't empty.

Non-empty sets in the standard IS the definition of topical. furunculus


just include windows.h and call the api functions the same way you would in C.
Some people prefer to do things like this:

::SetWindowText(...)

where the :: is a safety measure that tells the compiler to ignore any similar
function which may be defined in an inherited class... but it isn't a
requirement if you know none of your inherited classes override the windows api
functions you want to use.

David
Jun 19 '06 #8

"David Lindauer" <ca*****@bluegrass.net> wrote in message
news:44***************@bluegrass.net...


Your Uncle wrote:
"Ian Collins" <ia******@hotmail.com> wrote in message
news:4f*************@individual.net...
> Your Uncle wrote:
>> "red floyd" <no*****@here.dude> wrote in message
>> news:Cu********************@newssvr29.news.prodigy .net...
>>
>>>Your Uncle wrote:
>>>
>>>>= How the heck does the c++ crowd differentiate itself from windows?
>>>
>>>Simple. If the API in question is not in the Standard, then it's
>>>system
>>>specific.
>>
>> Is the set of API's in the standard non-empty? fu
>>
> The subject appears to be operating system APIs. These are OT in any
> pure language group and they invariably have their own groups.
>
> C++ standard library (APIs) are defined in the C++ standard and by
> inclusion, the C standard, so the set isn't empty.

Non-empty sets in the standard IS the definition of topical. furunculus


just include windows.h and call the api functions the same way you would
in C.
Some people prefer to do things like this:

::SetWindowText(...)

where the :: is a safety measure that tells the compiler to ignore any
similar
function which may be defined in an inherited class... but it isn't a
requirement if you know none of your inherited classes override the
windows api
functions you want to use.

That, unlike the previous reply to which I can reply categorically, went
past me at 100 mph. I've been in the thankless underworld of c long enough
that I feel I need to apply for refugee status. Please indulge me with a
continued explanation. fu
Jun 20 '06 #9


Your Uncle wrote:
"David Lindauer" <ca*****@bluegrass.net> wrote in message
news:44***************@bluegrass.net...


Your Uncle wrote:
"Ian Collins" <ia******@hotmail.com> wrote in message
news:4f*************@individual.net...
> Your Uncle wrote:
>> "red floyd" <no*****@here.dude> wrote in message
>> news:Cu********************@newssvr29.news.prodigy .net...
>>
>>>Your Uncle wrote:
>>>
>>>>= How the heck does the c++ crowd differentiate itself from windows?
>>>
>>>Simple. If the API in question is not in the Standard, then it's
>>>system
>>>specific.
>>
>> Is the set of API's in the standard non-empty? fu
>>
> The subject appears to be operating system APIs. These are OT in any
> pure language group and they invariably have their own groups.
>
> C++ standard library (APIs) are defined in the C++ standard and by
> inclusion, the C standard, so the set isn't empty.
Non-empty sets in the standard IS the definition of topical. furunculus


just include windows.h and call the api functions the same way you would
in C.
Some people prefer to do things like this:

::SetWindowText(...)

where the :: is a safety measure that tells the compiler to ignore any
similar
function which may be defined in an inherited class... but it isn't a
requirement if you know none of your inherited classes override the
windows api
functions you want to use.

That, unlike the previous reply to which I can reply categorically, went
past me at 100 mph. I've been in the thankless underworld of c long enough
that I feel I need to apply for refugee status. Please indulge me with a
continued explanation. fu


the :: scope operator is used to clarify the location of an identifier, e.g.:

mystruct::myclassmember

or

mynamespace::myidentififier

That way, you can get to identifiers which aren't strictly in scope.

I'm not sure what the strict definition of what happens when there is nothing
on the left hand side of the ::, but basically it will get you to a scope
outside the current namespace/class scope. This is by definition in the C++
language...

on to the off-topic part: it so happens that windows headers and windows
compilers are arranged so that the identifiers in the header file will show up
in this scope outside the current namespace/class scope (assuming you haven't
included the headers inside another namespace).

Now some object-oriented windowing systems will name classes and/or member
functions similarly to what the underlying OS call is named... for example a
Window object may have a function called SetWindowText. So for example if you
inherit from this Window object, then try to call SetWindowText from a member
function you are writing, you may intend to use the windows API but end up
calling the member function instead. That has obvious ramifications... to
avoid such ambiguity, some people like to qualify all os calls with the ::
operator when they do intend to do an OS call.

David

Jun 20 '06 #10
David Lindauer wrote:
the :: scope operator is used to clarify the location of an identifier,
e.g.:

mystruct::myclassmember

or

mynamespace::myidentififier

That way, you can get to identifiers which aren't strictly in scope.

I'm not sure what the strict definition of what happens when there is
nothing on the left hand side of the ::,
The name is searched in the global namespace.
but basically it will get you to a scope outside the current
namespace/class scope.
.... unless you are in the global namespace.

Now some object-oriented windowing systems will name classes and/or member
functions similarly to what the underlying OS call is named... for example
a Window object may have a function called SetWindowText.


AFAIK, you might run into trouble when using names defined in the Win32 API
for your own functions in some namespace or class, because the Win32 API is
using a lot of #define hackery, so the function name might actually be a
macro that is replaced with another name silently.

Jun 20 '06 #11

"Rolf Magnus" <ra******@t-online.de> wrote in message
news:e7*************@news.t-online.com...
David Lindauer wrote:
the :: scope operator is used to clarify the location of an identifier,
e.g.:

mystruct::myclassmember

or

mynamespace::myidentififier

That way, you can get to identifiers which aren't strictly in scope.

I'm not sure what the strict definition of what happens when there is
nothing on the left hand side of the ::,


The name is searched in the global namespace.
but basically it will get you to a scope outside the current
namespace/class scope.


... unless you are in the global namespace.

Now some object-oriented windowing systems will name classes and/or
member
functions similarly to what the underlying OS call is named... for
example
a Window object may have a function called SetWindowText.


AFAIK, you might run into trouble when using names defined in the Win32
API
for your own functions in some namespace or class, because the Win32 API
is
using a lot of #define hackery, so the function name might actually be a
macro that is replaced with another name silently.

Thank you for the replies. A source snippet might help:

/////////////////////////////////////////////////////////////////////////////
// The one and only CTja31App object

CTja31App theApp;

/////////////////////////////////////////////////////////////////////////////
// CTja31App initialization

BOOL CTja31App::InitInstance(){ ; }
/* end source */
I believe this is kosher c++ . How does one find a context to talk about
this stuff without the whole message map? fu
Jun 20 '06 #12

Rolf Magnus wrote:
AFAIK, you might run into trouble when using names defined in the Win32 API
for your own functions in some namespace or class, because the Win32 API is
using a lot of #define hackery, so the function name might actually be a
macro that is replaced with another name silently.


min and max are defined as macros. This means many of the standard
functions get bashed by the preproc. You often have to undef min and
max after including a win32 api header.

Jun 20 '06 #13
Noah Roberts wrote:
Rolf Magnus wrote:
AFAIK, you might run into trouble when using names defined in the Win32 API
for your own functions in some namespace or class, because the Win32 API is
using a lot of #define hackery, so the function name might actually be a
macro that is replaced with another name silently.


min and max are defined as macros. This means many of the standard
functions get bashed by the preproc. You often have to undef min and
max after including a win32 api header.


We're OT, but if you define NOMINMAX before including windows.h, you
don't get the evil macros.
Jun 20 '06 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL)...
2
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues...
3
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which...
0
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. ...
1
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the...
4
by: Albert Ahtenberg | last post by:
Hello, I have two questions. 1. When the user presses the back button and returns to a form he filled the form is reseted. How do I leave there the values he inserted? 2. When the...
1
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url ...
2
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value...
3
by: Sandwick | last post by:
I am trying to change the size of a drawing so they are all 3x3. the script below is what i was trying to use to cut it in half ... I get errors. I can display the normal picture but not the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.