| Title: | Alpha Developer Support | 
| Notice: | [email protected], 800-332-4786 | 
| Moderator: | HYDRA::SYSTEM | 
| Created: | Mon Jun 06 1994 | 
| Last Modified: | Fri Jun 06 1997 | 
| Last Successful Update: | Fri Jun 06 1997 | 
| Number of topics: | 3722 | 
| Total number of notes: | 11359 | 
    Company Name :  Ingenieurburo Riemer - Point 23530
    Contact Name :  Mr. Nelles
    Phone        :  0049 228 97985 0	
    Fax          :  0049 228 97985 55	
    Email        :  
    Date/Time in :  20-MAR-1997 14:16:21
    Entered by   :  Dave Hague
    SPE center   :  REO
    Category     :  Windows 3.11
    OS Version   :  3.11
    System H/W   :  4311 Intel		
    Brief Description of Problem:
    -----------------------------
They have written a function, and need HINSTANCE. 
HINSTANCE is not a parameter.
The function GetWindowWord (hwnd, GWW_HINSTANCE) gives HINSTANCE but one needs
the window handler of an existing window, but they are not able to do this
either.
So how does he get the HINSTANCE
| T.R | Title | User | Personal Name | Date | Lines | 
|---|---|---|---|---|---|
| 3366.1 | faxed answer | RDGENG::HAGUE | Fri Mar 21 1997 04:44 | 30 | |
| Mr. Nelles,
I know of hree methods to obtain and application instance handle:
 
1. The hInstance parameter to the WinMain procedure is the
   application's instance handle. The application can save this value
   in a global variable, making it available throughout the application.
 
2. The lParam parameter of the WM_CREATE message points to a
   CREATESTRUCT data structure, and the hInstance field of this
   structure is the application's instance handle. During the
   processing of the WM_CREATE message a window procedure can save
   this value in a static variable, as follows:
 
      hInst = ((LPCREATESTRUCT)lParam)->hInstance;
 
   This variable would then be available during all subsequent calls
   to the window procedure.
 
3. Given a window handle for one of its windows, an application can
   obtain its instance handle by calling the GetWindowWord function:
 
      GetWindowWord(hWnd, GWW_HINSTANCE)
 
Do any of these help.
regards,
Dave Hague
Software Partner Engineering.
    
 | |||||