Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 740
  • Last Modified:

How to get an instance handle?

Does anyone know that how to get the instance handle inside a dll using win32? Please help!
0
softyan
Asked:
softyan
  • 4
  • 4
1 Solution
 
rwilson032697Commented:
Use GetModuleHandle.

Cheers,

Raymond.
0
 
softyanAuthor Commented:
Can i use the function like this in the dll?
DialogBox(GetModuleHandle(),"IDD_DIALOG",hwnd,(DLGPROC)CustDlg);
0
 
rwilson032697Commented:
If this would work in a .EXE I see no reasong why it should not in a DLL.
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
softyanAuthor Commented:
I have tried out in and EXE and it worked but not in a dll. Could you pls tell me that how to display a dialog box inside a dll?
0
 
rwilson032697Commented:
Remember that the instance identifies the executable where the dialog box resource resides. Does it reside in the DLL or in the EXE?

hwnd should also be the appropriate window handle from your application.

The API help does not say that this cannot be done.

Raymond

0
 
softyanAuthor Commented:
When i compile my dll, i compile with the dialog box resource, does this means that the dialog box resource reside in the dll?
The hwnd is the handle of the application which calling this dll. It this the right way?
0
 
rwilson032697Commented:
You can check this by opening the DLL as resources in Studio.

It sounds as though you are doing things right to display the dialog - I can't really offer any other suggestions at the moment.

Raymond.
0
 
softyanAuthor Commented:
I still cannot find out the way to display a dialog box resource from a dll. Anyway this is your point.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improved Protection from Phishing Attacks

WatchGuard DNSWatch reduces malware infections by detecting and blocking malicious DNS requests, improving your ability to protect employees from phishing attacks. Learn more about our newest service included in Total Security Suite today!

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now