473,804 Members | 3,182 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Does c++ have an uniform class library?

JTL
I have learnt java before and now begin to learn c++

what puzzle me is that seem that different SDKs(c++builder , vs.net,
gcc..) has its own class library
we know that in java there are only one uniform class library
so that the codes I written in JBuilder can just copy to JCreator or
Eclipse
and they all run well

does c++ have such an uniform class library so that I could just learn
only one time
and then I can use it in c++builder or vs.net or gcc, just the same
codes
what's this uniform class library's name?

if they(c++builder , vs.net,gcc) use different librarys, what class
library do they use?
which library is most usefully or most common ?

Thank you very much in advance.

Dec 1 '06
38 2451
IR
kwikius wrote:
IR wrote:
>A window and it's contents exist and can be accessed/modified
independentl y of whether you are running the event loop or not
(does Send(Notify)Mes sage ring a bell?).

So there is really no need for that evil two-phase construction.

int main()
{
one_phase_windo w w;
}

Where exactly are you going to put your send_message in, before
the window runs, or after it quits?
Making a window visible / invisible has nothing to do with it's
construction. Closing a window doesn't necessarily destroy it.
Although it is a bad design IMHO, I often saw windows that could be
used for multiple tasks, some of these tasks not requiring the
window to be displayed on screen.

An example of such (bad) design would be a WYSIWYG "preview" window
that can be driven to print a document, without the need to display
the window itself. In such a case, the window and it's contents are
fully constructed and functional even though the window is not
displayed.
The point I'm trying to make is that objects that require two-phase
construction are not in a *useable* state as long as the second
phase has not been successful.
Displaying a window is an *optional* feature.

So you can construct it, use synchronous messages to simulate user
interaction and get the desired side effects (on MS Windows the
synchronous message API is Send(Notify)Mes sage, opposed to the
asynchronous PostMessage API which really needs an event loop), then
destroy it.

In such a case you never displayed the window, and you never entered
the event loop...
Cheers,
--
IR
Dec 6 '06 #21

IR wrote:
kwikius wrote:
IR wrote:
A window and it's contents exist and can be accessed/modified
independently of whether you are running the event loop or not
(does Send(Notify)Mes sage ring a bell?).

So there is really no need for that evil two-phase construction.
int main()
{
one_phase_windo w w;
}

Where exactly are you going to put your send_message in, before
the window runs, or after it quits?

Making a window visible / invisible has nothing to do with it's
construction. Closing a window doesn't necessarily destroy it.
OK just to clarify, what you are saying is that you need to have
connected to the display system by the time you exit the window ctor?

struct ApplicationWind ow{
system_window_c ookie cookie; // e.g HWND

ApplicationWind ow() : cookie(NULL)
{
cookie = get_system_wind ow(...);
if (!cookie) {
throw bad_window();
}
}
};

The problem is that for child windows AFAICS you are restricted to
(smart) pointers

struct ChildWindow{
ChildWindow(sys tem_window_cook ie parent); // child needs to have
parent cookie
};
struct ApplicationWind ow_w_child {

ChildWindow m_child; // cant do this
ApplicationWind ow_w_child() : m_child(???) {//* */}
};

Or am I missing something?

regards
Andy Little

Dec 6 '06 #22
Alf P. Steinbach wrote:
happy with it; I use it myself... You can find the source code at <url:
http://home.no.net/alfps/root/programs/ScreenSaverMana ger/download.html>.
Cute!. and useful. I will probably keep that :-)

BTW the precompiled help file as downloaded didnt seem to display any
content on my system, so I had to compile it locally.

So to get back to the subject, what you are saying is that you should
get the system window cookie for the window (e.g by cookie I mean the
HWND in windows) in the constructor of your window class?

<...>
One that at least from the discussion about it sounded very OK, using
templates and the standard library and strictly C++ RAII-oriented, was
discussed in a series of articles in some C++ magazine (not DDJ);
perhaps you'll find it by searching the net.
Do you mean win32GUI ?

regards
Andy Little

Dec 6 '06 #23

kwikius skrev:
Alf P. Steinbach wrote:
happy with it; I use it myself... You can find the source code at <url:
http://home.no.net/alfps/root/programs/ScreenSaverMana ger/download.html>.

Cute!. and useful. I will probably keep that :-)

BTW the precompiled help file as downloaded didnt seem to display any
content on my system, so I had to compile it locally.

So to get back to the subject, what you are saying is that you should
get the system window cookie for the window (e.g by cookie I mean the
HWND in windows) in the constructor of your window class?

<...>
One that at least from the discussion about it sounded very OK, using
templates and the standard library and strictly C++ RAII-oriented, was
discussed in a series of articles in some C++ magazine (not DDJ);
perhaps you'll find it by searching the net.

Do you mean win32GUI ?
win32gui is/was a very nice library for windows. Unfortunately it was
not maintained and when I downloaded it some month ago I could not get
it to work (I spend about two afternoons on this). A pity.
One thing I disliked about the library was the use of "magic" numbers -
Windows IDs. This and the use of the resource editor are ackward and
should be avoidable. But apart from that a potentially very nice
library.

/Peter
>
regards
Andy Little
Dec 6 '06 #24
JTL wrote:
it sounds interesting that Qt and wxWidgets can be used in windows and
linux
.... and have bindings from other languages.

Python: wxPython
Common Lisp: wxCL

Dec 6 '06 #25

Alf P. Steinbach wrote:
happy with it; I use it myself... You can find the source code at <url:
http://home.no.net/alfps/root/programs/ScreenSaverMana ger/download.html>.
Cute!. and useful. I will probably keep that :-)

BTW the precompiled help file as downloaded didnt seem to display any
content on my system, so I had to compile it locally.

So to get back to the subject, what you are saying is that you should
get the system window cookie for the window (e.g by cookie I mean the
HWND in windows) in the constructor of your window class?

<...>
One that at least from the discussion about it sounded very OK, using
templates and the standard library and strictly C++ RAII-oriented, was
discussed in a series of articles in some C++ magazine (not DDJ);
perhaps you'll find it by searching the net.
Do you mean win32GUI ?

regards
Andy Little

Dec 6 '06 #26
* kwikius:
Alf P. Steinbach wrote:
>happy with it; I use it myself... You can find the source code at <url:
http://home.no.net/alfps/root/programs/ScreenSaverMana ger/download.html>.

Cute!. and useful. I will probably keep that :-)

BTW the precompiled help file as downloaded didnt seem to display any
content on my system, so I had to compile it locally.

So to get back to the subject, what you are saying is that you should
get the system window cookie for the window (e.g by cookie I mean the
HWND in windows) in the constructor of your window class?
Yep.

I mean, have you tried extending a control in a typical GUI framework?

First that happens is that one discovers that this or that can't be done
/here/, because there's no API window yet, not there either, oh dang,
what's the actual /sequence/ of these calls? Not to mention that with
two-phase you get virtual calls down to a derived class' code before the
base class sub-object has been fully (logical level) initialized: bang
crash. And the frustrating thing is the knowledge that all this
[censored] is /unnecessary/, that it's just due to the framework
developers designing the framework for "C++ as better C", not for C++.

<...>
>One that at least from the discussion about it sounded very OK, using
templates and the standard library and strictly C++ RAII-oriented, was
discussed in a series of articles in some C++ magazine (not DDJ);
perhaps you'll find it by searching the net.

Do you mean win32GUI ?
*Checking the web page*

Yes.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Dec 6 '06 #27
kwikius wrote:
IR wrote:
>kwikius wrote:
>>IR wrote:

A window and it's contents exist and can be accessed/modified
independentl y of whether you are running the event loop or not
(does Send(Notify)Mes sage ring a bell?).

So there is really no need for that evil two-phase construction.
int main()
{
one_phase_windo w w;
}

Where exactly are you going to put your send_message in, before
the window runs, or after it quits?
Making a window visible / invisible has nothing to do with it's
construction . Closing a window doesn't necessarily destroy it.

OK just to clarify, what you are saying is that you need to have
connected to the display system by the time you exit the window ctor?

struct ApplicationWind ow{
system_window_c ookie cookie; // e.g HWND

ApplicationWind ow() : cookie(NULL)
{
cookie = get_system_wind ow(...);
if (!cookie) {
throw bad_window();
}
}
};
I think he means this sort of thing.

void show_dialog()
{
CSomeDialog dlg;

// YECCCH!!! TWO-PHASE INITIALIZATION HERE!!!!!
dlg.this_item = something;
dlg.that_item = something_else;
// etc...
rc = dlg.DoModal();
}

Dec 7 '06 #28
peter koch wrote:
kwikius skrev:
Alf P. Steinbach wrote:
happy with it; I use it myself... You can find the source code at <url:
http://home.no.net/alfps/root/programs/ScreenSaverMana ger/download.html>.
Cute!. and useful. I will probably keep that :-)

BTW the precompiled help file as downloaded didnt seem to display any
content on my system, so I had to compile it locally.

So to get back to the subject, what you are saying is that you should
get the system window cookie for the window (e.g by cookie I mean the
HWND in windows) in the constructor of your window class?

<...>
One that at least from the discussion about it sounded very OK, using
templates and the standard library and strictly C++ RAII-oriented, was
discussed in a series of articles in some C++ magazine (not DDJ);
perhaps you'll find it by searching the net.
Do you mean win32GUI ?

win32gui is/was a very nice library for windows. Unfortunately it was
not maintained and when I downloaded it some month ago I could not get
it to work (I spend about two afternoons on this). A pity.
One thing I disliked about the library was the use of "magic" numbers -
Windows IDs.
I agree about the us of magic numbers. My reference to the system
window cookie in my other posts in this thread was merely to illustrate
an implemntation detail. You should be able to get at the cookie to
hook into the native system, but I agree that it shouldnt be exposed
unnecesarily. Nevertheless the window cookie, or window handle is the
connection point to the system so I think its important to have it as
an, as far as possible opaque, but nevertheless visible Concept.

As far as child window id's go, it is usually possible to map them to a
cookie and so to a platform independent lightweight window type (
basically one that is owned by the system) , which nevertheless
provides "the usual operations", and it is possible to generate id's
automatically internally as required.

For menus my current scheme consists of treating them basically as a
directory tree structure accessed via paths. This works well for menus
as they naturally have unique names per branch. Internally the string
id is mapped to a string_handle so that as well as accessing via text
paths one can create a path consisting of a list of ids, which may
provide faster access. Here FWIW is what my current working test app
menu construction scheme looks like. It is somewhat reminiscent of the
one in Ultimate++ AFAICS:

my_custom_app_w indow1::my_cust om_app_window1( std::string const &
name_in)
: base_type(name_ in){

this->add_popup_me nu (".File");
this->add_menu_actio n(".File","Exit ",
&my_custom_app_ window1::exit_a ction);
this->add_popup_me nu (".number");
this->add_menu_actio n(".number","1" );
this->add_menu_actio n(".number","2" );
this->add_popup_me nu (".number","Oth er");
this->add_menu_actio n,".number.Othe r",
"Yep",&my_custo m_app_window1:: dummy_action);
this->add_popup_menu (".Help");
this->add_menu_actio n(".Help","Abou t",
&my_custom_app_ window1::about_ command);

}
(The leading dots are optional but seem to help legibility)
it will also work on arbitrary long paths of course, and the idea is
that you can enable, disable, grey out, get state and change the
callbacks , all via the paths as above. You can also get hold of child
nodes direct if you wish to work at one level.
This and the use of the resource editor are ackward and
should be avoidable.
Personally I dont like the GUI style widget editors much,for designing
controls. IMO It is usually superior and easier to maintain, to size a
modal dialog box, say, at runtime based on the size of the text, images
and so on, so that if these change or are of arbitrary size,constant
borders, spacing and so on are calculated automatically on the fly /
and or according to some 'look and feel' function, so I am trying to
make sure this is easy to achieve programmaticall y in the language
rather than via custom scripts. Overall this goes for any of the
'resource' stuff. I think by default it should not be necessary to need
resources and it should be possible to create everything
programmaticall y.

Having created Quan physical quantities library...

http://quan.sourceforge.net/quan_mat...tml/index.html

.... naturally I use Quan physical length units for dialog boxes. This
may not be everyones taste but once you know the size of a text
character in mm, or whatever your favourite unit is, I find it is
satisfying to provide spacings and so on in terms of millimeters or
inches or whatever rather than pixels, which gives you a constant look
independent of display hardware.

Dec 7 '06 #29

Alf P. Steinbach wrote:
* kwikius:
Alf P. Steinbach wrote:
happy with it; I use it myself... You can find the source code at <url:
http://home.no.net/alfps/root/programs/ScreenSaverMana ger/download.html>.
Cute!. and useful. I will probably keep that :-)

BTW the precompiled help file as downloaded didnt seem to display any
content on my system, so I had to compile it locally.

So to get back to the subject, what you are saying is that you should
get the system window cookie for the window (e.g by cookie I mean the
HWND in windows) in the constructor of your window class?

Yep.
OK. but the drawback of this AFAICS is that you can only have pointers
(e.g boost shared_ptr) to child windows as members of a winow class I
don't see a way around that.
Nevertheless I will try implementing the single phase construction
scheme. I did a quick test of it in my current test app and lo and
behold I got an exception from a child window that wanted its parent:-)
I mean, have you tried extending a control in a typical GUI framework?
Maybe I just got used to it. Seriously though, I have tried and often
got very frustrated in MFC . I much prefer the raw SDK in Windows.

regards
Andy Little

Dec 7 '06 #30

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

Similar topics

1
1706
by: Robert Oschler | last post by:
Is there a Javascript function, or library, that will take a URL and make it uniform/consistent? Something that will resolve all relative pathing and the current domain and protocol and return a uniform URL? Like the realpath() function in PHP? Thanks.
4
2211
by: Curious | last post by:
Hi, I am writing a class Distribution that inherits from Random class public class Distribution : System.Random { public int Uniform(int min, int max) { return this.Uniform(min, max); }
8
25490
by: kiranchahar | last post by:
Hey all, How do I generate random numbers with Uniform distribution Uniform(a,b) using C-programming? I want to generate uniform random numbers which have mean following Uniform(p,q) and also variance as Uniform(s,t)? any suggestion would be really appreciated. Thanks, Kay
55
6266
by: Zytan | last post by:
I see that static is more restricted in C# than in C++. It appears usable only on classes and methods, and data members, but cannot be created within a method itself. Surely this is possible in C# in some way? Or maybe no, because it is similar to a global variable (with its scope restricted) which C# is dead against? Zytan
4
2435
by: Alex Vinokur | last post by:
Here is some tuple (triple in this case) with uniform types (for instance, double): boost::tuple<double, double, doublet; Is there any way (in boost::tuple) to define such tuples something like uniform_tuple <3, doublet; ? Alex Vinokur
0
9577
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10569
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10325
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10315
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.