Re: Windows API in VC++
From: Victor Bazarov (v.Abazarov_at_comAcast.net)
Date: 10/08/04
- Next message: ChrisP: "File Handling in 'C'"
- Previous message: Alfred: "Re: Windows API in VC++"
- In reply to: Alfred: "Re: Windows API in VC++"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 7 Oct 2004 22:16:24 -0400
"Alfred" <anonymous@discussions.microsoft.com> wrote...
>I have look at the code reference, and this is my code:
>
> HWND hWnd ;
> int Rtval = ShellExecute(hWnd, "Open", "notepad.exe", NULL, NULL, 0);
>
> I always get error during compile:
> error C2440: 'initializing' : cannot convert from 'struct HINSTANCE__ *'
> to 'int'
>
> can anyone help me this? i'm new in this...
(a) You must pass a _real_ window as the first argument. You cannot
pass an uninitialised variable. 'ShellExecute' will use it to create
error message boxes. You could try to pass NULL there, but don't
quote me on that.
(b) 'ShellExecute' returns HINSTANCE, not an int. The return value
needs to be assigned to an HINSTANCE variable.
HINSTANCE hInst = ShellExecute(hSomeRealWindow, ...
Get a good book and don't substitute serious study with reading the
reference and posting to a newsgroup.
Victor
- Next message: ChrisP: "File Handling in 'C'"
- Previous message: Alfred: "Re: Windows API in VC++"
- In reply to: Alfred: "Re: Windows API in VC++"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|