Re: Command-line arguments on start up.
- From: "Paul G. Tobey [eMVP]" <ptobey no spam AT no instrument no spam DOT com>
- Date: Tue, 17 Jan 2006 15:02:33 -0700
In general, yes. Since, when WinMain exits the program is over, it's OK in
this case, too. You might find that the pointer is invalid in some contexts
(it might be bad in other threads or something), but generally it should be
fine.
Paul T.
"elena" <elena@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7EB599DC-B2E2-4BFF-B358-A26DE358B4DC@xxxxxxxxxxxxxxxx
> Hi, Paul,
> No problem in the code above, it works great.
> My question is: Is it ok to assign one pionter to another?
>
> Thank you,
> elena
>
> "Paul G. Tobey [eMVP]" wrote:
>
>> lpCmdLine is the command line, in Unicode, of course. Is there a
>> problem?
>> You haven't asked any questions...
>>
>> Paul T.
>>
>> "elena" <elena@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:EB5E3FDC-AE8C-42F0-BA39-B249BA2D67DE@xxxxxxxxxxxxxxxx
>> > Hi, All
>> >
>> > I am not sure that this is the right way to receive to access
>> > command-line
>> > arguments when the App. starts up. The argument is string, which will
>> > be
>> > used
>> > as
>> > file name later in the program
>> >
>> > Please, advice
>> >
>> > LPTSTR m_lpCmdLine;
>> >
>> > int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
>> > LPTSTR lpCmdLine, int nCmdShow)
>> > {
>> > MSG msg;
>> > HACCEL hAccelTable;
>> > m_lpCmdLine = lpCmdLine; // actually i assign pointer to
>> > pointer ???
>> >
>> > if ( !InitInstance( hInstance, nCmdShow))
>> > {
>> > return FALSE;
>> > }
>> >
>> > hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_IMAGERSAMPLE);
>> >
>> > while (GetMessage(&msg, NULL, 0, 0))
>> > {
>> > if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
>> > {
>> > TranslateMessage(&msg);
>> > DispatchMessage(&msg);
>> > }
>> > }
>> > return msg.wParam;
>> > }
>>
>>
>>
.
- Follow-Ups:
- Re: Command-line arguments on start up.
- From: elena
- Re: Command-line arguments on start up.
- References:
- Re: Command-line arguments on start up.
- From: Paul G. Tobey [eMVP]
- Re: Command-line arguments on start up.
- Prev by Date: Re: Doubt to Write a WCHAR at Binary File
- Next by Date: Re: help I need an assembler
- Previous by thread: Re: Command-line arguments on start up.
- Next by thread: Re: Command-line arguments on start up.
- Index(es):
Relevant Pages
|
Loading