Newsgroup: it.comp.programmare.win32
Titolo: [C++ builder] Applicazioni console ed esecuzione

Salve,
avrei 2 domande da porvi:
1) In che modo posso scrivere semplici applicazioni console?
2) Con quale comando posso passare istruzioni alla shell di windows (tipo la 
funzione system) in modo da far aprire la console e vedere il risultato di 
comandi come dir, tasklist, etc...?
Grazie 

 comandi come dir, tasklist, etc...?
Manda in esecuzione "cmd.exe" sotto Win2000/XP, "
command.com
" sotto
win98 e famiglia. (oddio: era mica command.exe? non ho sottomano win98
per controllare...)
Puoi passargli i comandi da eseguire sulla riga di comando che usi per
lanciarli.

 lanciarli.
Si ma come mando in esecuzione cmd.exe da un programma scritto in C++ 
builder? 

builder? 
Usando ShellExecute() (o ShellExecuteEx()).
Puoi passare a cmd.exe il parametro /C seguito dal comando specifico
da eseguire.

 da eseguire.
Devo includere qualche header? Perché il compilatore non trova tali 
funzioni. 

funzioni. 
shellapi.h
(Ma guardare l'help no eh? :-)

"Andrea Laforgia" <a.laf...@andrealaforgia.it.invalid> ha scritto nel 
messaggio news:alatn3956umi2amb5...@4ax.com...

Dall'help sia nella scheda "Indice" che in quella "Trova" non esce niente 
scrivendo ShellExecute o Shell Execute.
Grazie 

Dopo aver fatto un po di tentativi e aver cercato in rete ho trovato 
un'esempio di uso di tale api e l'ho adattata al mio caso:
ShellExecute(NULL, NULL, "cmd.exe", NULL, NULL, 1);
Questa istruzioni apre una shell, ma se provo:
ShellExecute(NULL, NULL, "cmd.exe /C dir", NULL, NULL, 1);
Non appare nessuna shell.
Devo usare anche gli altri parametri in qualche modo?

scrivendo ShellExecute o Shell Execute.
E' una funzione appartenente all'API di Windows, quindi devi cercare
non nell'indice primario ma nel Windows SDK.
In ogni caso, anche su MSDN trovi documentazione adeguata.

 In ogni caso, anche su MSDN trovi documentazione adeguata.
Si ho cercato anche li poi ma l'esempio che ho trovato su un vecchio post mi 
e' stato più utile, tuttavia non riesco a far partire nessun programma se 
non la sola shell. Ho scritto tutto nell'altro post.
Ciao 

anything illegal in the matter
    beyond that. I do not think it a criminal offence if it goes no
    further than the adoption of a child and the payment of money to
    its parents for the privilege.'"
Later, when His Excellency was calling the attention of Acting
Attorney General Russell to a somewhat similar case, he states, in
reference to this above-described case:
    "Mr. Phillipo, before whom the papers were laid, did not seem
    disposed to enforce the rights of the father, on the ground that
    he had sold the child. I did not agree with Mr. Phillipo's view of
    the law."
CHAPTER 8.
JUSTICE FROM THE SUPREME BENCH.
On October 6th, 1879, Sir John Smale, the Hon. Chief Justice for Hong
Kong, passed judgment in three cases on prisoners convicted of various
degrees of crime connected with the enticing, detaining, buying and
selling of children. Governor Hennessy, in reporting the remarks made
by the Chief Justice on that occasion to the Secretary of State for
the Colonies, pronounced it "an able and elaborate judgment on the
existence of slavery at Hong Kong."
Said Sir John Smale:
    "Various causes have occasioned delay in passing sentence, of
    which I will only refer to one: The gravity of the fact that these
    and other cases have recently brought so prominently to the notice
    of the Court that two specific classes of slavery exist in this
    Colony to a very great extent, viz., so-called domestic slavery,
    and slavery for the purposes of prostitution. The three cases now
    awaiting the sentence of the Court are specially provided for by
    Ordinances of 1865 and 1872, prohibiting kidnaping and illegally
    detaining men, women, and children; and no difficulty ever arose
    in my mind as to the crimes of which these prisoners are severally
    convicted, or as to the sentences due to such crimes; and there is
    no question as to crime

the reason
that the slaves are not present with which to do it. Women have
freedom and cannot be openly bought and sold even in marriage; women
have self-reliance and self-respect in a Christian country; they have
a clean, decent religion; women who worship the true God have His
protecting arm to defend themselves, and through them other women
who do not personally worship God share in the benefits. If free,
independent women of God were as scarce in America as in Hong Kong the
same moral conditions would prevail here, without regard to climate,
for, _if women could be bought and sold and reduced by force to
prostitution, there are libertines enough, and they have propensities
strong enough to enter at once upon the business, even in America_.
That which has elevated women above this slave condition is the
development of a self-respect and dignity born of the Christian faith.
But let us take warning. If the women of America have not the decent
self-respect to refuse to tolerate the Oriental slave-prostitute in
this country, the ba

one of selling,
the other of buying a child for the purposes of prostitution. His
Lordship, the Chief Justice, said:
    "I will call upon the prisoners at another time. This is a case
    of far larger proportions than the guilt or innocence of the two
    prisoners at the bar. I take shame to myself that the appalling
    extent of kidnaping, buying and selling slaves for what I may
    call ordinary servile purposes, and the buying and selling young
    females for worse than ordinary slavery, has not presented itself
    before to me in the light it ought. It seems to me that it has
    been recognized and accepted as an ordinary out-turn of Chinese
    habits, and thus that until special attention has been excited it
    has escaped public notice. But recently the abomination has forced
    itself on my notice. In some cases convictions have been had; in
    two notable instances, although I called for prosecution, the
    criminals escaped. They were Chinese in respectable positions,
    and I was given to understand that buying children by respectable
    Chinamen as servants was according to Chinese customs, and that to
    attempt to put it down would be to arouse the prejudices of the
    Chinese. The practice is on the increase. It is in this port,
    and in this Colony especially, that the so-called Chinese custom
    prev

that matter of "liberty of the subject"
only too well, and take advantage of the habeas corpus act at every
turn to capture a slave who is trying to escape their clutches.
These words of Governor Smith should be borne in mind and brought to
attention every time our law officers in California put brothel girls
through the farce of asking them if they are desirous of liberty, and
when they say no, proclaim triumphantly to the world that "there isn't
a slave girl in Chinatown." These officers deceive others by these
falsehoods, but they know too well the conditions to be themselves
deceived.
When certain Chinese girls appeared before a committee appointed to
investigate conditions at San Francisco, the members of the committee
were put under promise not to divulge their names or stories, as
"their lives would not be safe for five years to come," if the
brothel-keepers and their former owners knew that they had informed
against them. It is a little difficult to describe the various secret
societies of Chinatown in full, but for practical purposes and as
relates to the welfare of Chinese women, it may be said that the
secret society, or tong, is a sort of mutual benefit society and has
generally a very commendable sort of name; but it exists to divide the
profits of the trade in women, among other villainies. When anyone
gives any evidence against such a society, or informs a rescue worker
where a girl will be found who desires her liberty, then some one from
the tong that has a special interest in the profits of that girl's
slavery, deposits a sum

as they affect the moral status of the Colony, in order
    that some remedy may be applied to them.... I am informed that His
    Excellency the Governor has been unable to obtain the opinion of
    the Attorney-General on the points raised." ...
It is impossible not to feel that this neglect on the part of someone
at Hong Kong to forward the Chief Justice's letters until the first of
these was a year old (for they were actually sent in August, 1881),
was a designed obstruction of his endeavors to set himself in the
correct light, and to enlighten the Christian public of Great Britain
as to the abuses existing at Hong Kong.
In this letter expressing regret at the delay of his letters, he
speaks of convictions of eight more cases of kidnaping, and "almost
unprecedented brutal assaults on bought children." "Considering the
special waste of life in brothel life, and the general want of new
importations to keep up the bondage class of 20,000 in this Colony,
the cases of kidnaping detected cannot be one-half of one per cent of
the children and women kidnaped."
    "Two cases of brutal treatment of young girls by purchasers, their
    pocket-mothers, one little girl having had her leg broken by
    beating her, and the other having been shockingly and indecently
    burnt,--both probably weakened for life,--illustrate the cruel
    passions which ownership in human beings engenders here, as it
    ever has done elsewhere. In a case now before the magistrate, the
    evidence tends to show that a girl thirteen years old was
    bought by a brothel-keeper for $200, and forced, by beating and
    ill-treatment, into that course of life in a brothel licensed by
    law. Subject to such surveillance as these houses are by law, it
    seems to me such slavery is easy of suppression."
At this time the official career of Sir John Smale a

a family, handed over to him his
little daughter, aged six years; that the little girl was to become
his daughter and to be brought up by him, he paying $23 to the
parents. He accused the father of trying to extort money from him, and
appealed for "protection" from "impending calamities." Later, further
facts came out, showing that the father of the child had borrowed $5
three years before from Leung A-Tsit, which, with interest at ten
cents per month for every dollar, now amounted to $23. The September
before, his creditor came and demanded payment, and when the father
told him he had no money, and found it very difficult to provide
for his family, Leung A-Tsit said: "Very well, you can give me your
daughter instead, and when she is grown up I will find her a husband."
It was finally agreed that he should have the little girl for $25,
viz., the $23 already owing, and $2 to the mother as "tea-money." The
$2 were paid and he took the child away. The mother said: "I was very
sorry about it and cried." (But mothers have little to say as to the
disposal of the children they bear in the Orient). The Governor, Sir
John Pope Hennessy, took a deep interest in this ca