荔园在线
荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀
[回到开始]
[上一篇][下一篇]
发信人: tang (独孤九剑), 信区: Program
标 题: MSVC-BEGINNERS Digest - 18 May 1998 to 19
发信站: BBS 荔园晨风站 (Wed May 20 23:05:52 1998), 转信
here are 10 messages totalling 515 lines in this issue.
Topics of the day:
1. Win32 App to create a few second pause. (6)
2. CStatic notifications
3. <No subject given> (3)
Hello
The Sleep function doesn't want a (char *) as a parameter. What you are
trying to do is to send a string at position 1000, in the parameter
array, to the sleep function. This is what you could do instead:
#include "stdio.h"
#include "stdlib.h"
main(int argc, char *argv[]) {
sleep(atoi(argv[1])*1000);
}
This will convert the first parameter on the command line to a number
and then multiply it with 1000.
HTH
/Anders W
> -----Original Message-----
> From: Wayne M. VanWeerthuizen [SMTP:WayneMV@LOCALACCESS.COM]
> Sent: den 19 maj 1998 03:12
> To: MSVC-BEGINNERS@MAELSTROM.STJOHNS.EDU
> Subject: [MSVC] Win32 App to create a few second pause.
>
> What headers files do I need to include to get this to compile?
>
> main( int argc, char *argv[ ], char *envp[ ] )
> {
> sleep(argv[1*1000]);
> return(0);
> }
>
>
> I created a minimal workspace by using
> New | Project | Win32 Application
>
> I want a minimal Windows application that exists for a specified
> number of seconds, then terminates. I don't want it to display any
> windows. It will be called by a another Windows application (that I
> didn't write and don't have the source code for), which would wait for
> it to finish. The delay is needed for me to work around a bug in this
> other program.
On Tue, 19 May 1998 09:46:05 +0200, Anders W録lin wrote:
>The Sleep function doesn't want a (char *) as a parameter. What you are
>trying to do is to send a string at position 1000, in the parameter
>array, to the sleep function. This is what you could do instead:
>
>#include "stdio.h"
>#include "stdlib.h"
>
>main(int argc, char *argv[]) {
> sleep(atoi(argv[1])*1000);
>}
Argh. That type mismatch was a bad oversite on my part.
Doesn't answer the question I was trying to ask, though.
I still get an error, C2065: 'Sleep' : undeclared identifier.
The documentation tells me about Sleep()
Windows NT Yes
Win95 Yes
Win32s Yes
Import Library kernel32.lib
Header File winbase.h
Unicode No
Platform Notes None
If I try to #include <winbase.h>, I get hundreds of errors.
And there doesn't seem to exist any kernal32.h or the like.
>> What headers files do I need to include to get this to compile?
>>
>> main( int argc, char *argv[ ], char *envp[ ] )
>> {
>> Sleep(argv[1*1000]);
>> return(0);
>> }
>>
>>
>> I created a minimal workspace by using
>> New | Project | Win32 Application
>>
>> I want a minimal Windows application that exists for a specified
>> number of seconds, then terminates. I don't want it to display any
>> windows. It will be called by a another Windows application (that I
>> didn't write and don't have the source code for), which would wait for
>> it to finish. The delay is needed for me to work around a bug in this
>> other program.
Have you tried to include "windows.h"?
/Anders W
> -----Original Message-----
> From: Wayne M. VanWeerthuizen [SMTP:WayneMV@LOCALACCESS.COM]
> Sent: den 19 maj 1998 10:22
> To: MSVC-BEGINNERS@MAELSTROM.STJOHNS.EDU
> Subject: Re: [MSVC] Win32 App to create a few second pause.
>
> On Tue, 19 May 1998 09:46:05 +0200, Anders W録lin wrote:
>
> >The Sleep function doesn't want a (char *) as a parameter. What you
> are
> >trying to do is to send a string at position 1000, in the parameter
> >array, to the sleep function. This is what you could do instead:
> >
> >#include "stdio.h"
> >#include "stdlib.h"
> >
> >main(int argc, char *argv[]) {
> > sleep(atoi(argv[1])*1000);
> >}
>
> Argh. That type mismatch was a bad oversite on my part.
>
> Doesn't answer the question I was trying to ask, though.
>
> I still get an error, C2065: 'Sleep' : undeclared identifier.
>
> The documentation tells me about Sleep()
>
> Windows NT Yes
> Win95 Yes
> Win32s Yes
> Import Library kernel32.lib
> Header File winbase.h
> Unicode No
> Platform Notes None
>
> If I try to #include <winbase.h>, I get hundreds of errors.
> And there doesn't seem to exist any kernal32.h or the like.
>
> >> What headers files do I need to include to get this to compile?
> >>
> >> main( int argc, char *argv[ ], char *envp[ ] )
> >> {
> >> Sleep(argv[1*1000]);
> >> return(0);
> >> }
> >>
> >>
> >> I created a minimal workspace by using
> >> New | Project | Win32 Application
> >>
> >> I want a minimal Windows application that exists for a specified
> >> number of seconds, then terminates. I don't want it to display an
y
> >> windows. It will be called by a another Windows application (that
> I
> >> didn't write and don't have the source code for), which would wait
> for
> >> it to finish. The delay is needed for me to work around a bug in
> this
> >> other program.
for a start, its not "sleep(int delay)" its "Sleep(int delay)"
and you'll need
<windows.h>
<winbase.h>
if your creating a console application, you can create a shortcut to it in
your "StartUp" menu and set the properties to minimise window on startup.
Environment Visual C++ 5.0/MFC 4.2 ; Windows 95 OSR2;
Hello..
Can any body tell me why I am not getting any notifications from a CStat
ic
control in a dialog box? The control has the properties, WS_CHILD, and
SS_NOTIFY set, but still I don't get no notifications. My ON_NOTIFY
function is as follows:
//mydlg.cpp
BEGIN_MESSAGE_MAP(CAutorunDlg, CDialog)
//{{AFX_MSG_MAP(CAutorunDlg)
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_NOTIFY(LVN_KEYDOWN, IDC_LIST1, OnKeydownList1)
//}}AFX_MSG_MAP
ON_NOTIFY( STN_CLICKED, IDC_MYSTATIC, OnExit ) // this is it
END_MESSAGE_MAP()
// never comes in this function.
void CAutorunDlg::OnExit( NMHDR * pNotifyStruct, LRESULT * pResult )
{
if(pNotifyStruct->code == NM_CLICK){
*pResult = 0;
EndDialog(IDCANCEL);
}
*pResult = 0;
}
// added the ON_NOTIFY func myself, class wizard was not adding it.
Also, i am not getting any messages against the Static control in
ClassWizard (lets say i have a list ctrl in a dlg, and i get the messages
for which we can add handlers e.g. LVN_KEYDOWN, etc. in class view.). Why
doesn't class view show the messages for CStatic ctrl?
Shahbaz.
--
There are these few times I feel lonely for you.
But I know this shade of blue will soon pass through!
I must be strong without you by my side!
I can see forever you are my light.
※ 来源:.BBS 荔园晨风站 bbs.szu.edu.cn.[FROM: 192.168.0.4]
[回到开始]
[上一篇][下一篇]
荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店