[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference hydra::axp-developer

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

3366.0. "Ingenieurburo Riemer - Point 23530" by RDGENG::ASAP () Thu Mar 20 1997 09:16

    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.RTitleUserPersonal
Name
DateLines
3366.1faxed answerRDGENG::HAGUEFri Mar 21 1997 04:4430
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.