Click here to Skip to main content
15,906,567 members
Home / Discussions / COM
   

COM

 
GeneralRe: CoUninitialize causes access violation Pin
geo_m14-Nov-03 8:00
geo_m14-Nov-03 8:00 
GeneralRe: CoUninitialize causes access violation Pin
yitzhak12-Nov-03 23:09
yitzhak12-Nov-03 23:09 
GeneralRe: CoUninitialize causes access violation Pin
Prakash Nadar14-Nov-03 3:09
Prakash Nadar14-Nov-03 3:09 
QuestionCCW viable for ADO.NET access? Pin
DavidQR11-Nov-03 22:59
DavidQR11-Nov-03 22:59 
AnswerRe: CCW viable for ADO.NET access? Pin
Nick Parker17-Nov-03 17:24
protectorNick Parker17-Nov-03 17:24 
AnswerRe: CCW viable for ADO.NET access? Pin
Nick Parker17-Nov-03 17:25
protectorNick Parker17-Nov-03 17:25 
GeneralhWnd in COM Question. Pin
Matt Gates11-Nov-03 15:24
Matt Gates11-Nov-03 15:24 
GeneralRe: hWnd in COM Question. Pin
Heath Stewart11-Nov-03 19:25
protectorHeath Stewart11-Nov-03 19:25 
The cool thing about COM is that you don't have to worry about implementation (i.e., VC++ vs. VB vs. et al.). The bad thing about COM is that you don't have to worry about implementation!

The important thing is to get an HWND through a COM-friendly manner. Your CNormalDlg needs a parent HWND (or application frame HWND). You can either design your class so that you pass that wndParent to its constructor or something (to associate the parent HWND; this is a fairly common practice). Or, in the spirit of .NET, you can QI the container for various OLE-defined or user-defined (you and / or your team) interface, like IOleWindow (common for ActiveX UI components). It has a method GetWindow that returns (via a retval) the HWND. How you QI the parent is another store, but usually has to do with implementing IOBjectWithSite or something similar (the container should QI for this and call SetSite to pass its IUnknown interface that you would hold on to in order to QI it later, for IOleWindow or something). Of course, the container has to implement / support these interfaces. COM is all about contracts, and the "terms" of those contracts is up to the containers and components - you don't get all the functionality for free!

So, either of these methods (either passing the parent HWND or QI'ing for an interface to get the parent HWND) are pretty common. I used a similar QI when I wrote an IE BHO that QI'd the site for the IWebBrowser2 interface then call get_HWND to get its HWND. I then used that as the parent HWND when displaying dialogs and what-not.

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: hWnd in COM Question. Pin
Matt Gates12-Nov-03 1:39
Matt Gates12-Nov-03 1:39 
GeneralRe: hWnd in COM Question. Pin
Heath Stewart12-Nov-03 3:05
protectorHeath Stewart12-Nov-03 3:05 
GeneralRe: hWnd in COM Question. Pin
Matt Gates12-Nov-03 14:06
Matt Gates12-Nov-03 14:06 
GeneralCAxDialogImpl Pin
Abhishek Srivastava12-Nov-03 17:19
Abhishek Srivastava12-Nov-03 17:19 
GeneralRe: CAxDialogImpl Pin
Matt Gates13-Nov-03 13:25
Matt Gates13-Nov-03 13:25 
GeneralRe: CAxDialogImpl Pin
dharani13-Nov-03 17:12
dharani13-Nov-03 17:12 
GeneralRe: CAxDialogImpl Pin
Abhishek Srivastava13-Nov-03 17:29
Abhishek Srivastava13-Nov-03 17:29 
GeneralRe: CAxDialogImpl Pin
dharani13-Nov-03 17:54
dharani13-Nov-03 17:54 
GeneralRe: CAxDialogImpl Pin
Abhishek Srivastava13-Nov-03 18:36
Abhishek Srivastava13-Nov-03 18:36 
GeneralRe: CAxDialogImpl Pin
dharani13-Nov-03 19:04
dharani13-Nov-03 19:04 
GeneralRe: CAxDialogImpl Pin
Tomaz Rotovnik21-Nov-03 2:42
Tomaz Rotovnik21-Nov-03 2:42 
GeneralRe: hWnd in COM Question. Pin
Heath Stewart13-Nov-03 2:54
protectorHeath Stewart13-Nov-03 2:54 
GeneralRe: hWnd in COM Question. Pin
Prakash Nadar14-Nov-03 3:12
Prakash Nadar14-Nov-03 3:12 
GeneralRe: hWnd in COM Question. Pin
Anonymous17-Nov-03 22:07
Anonymous17-Nov-03 22:07 
GeneralDTE.LaunchWizard() Pin
RockHard PartyNipples11-Nov-03 8:25
RockHard PartyNipples11-Nov-03 8:25 
GeneralIIS mime Type Pin
fenil jacob10-Nov-03 23:38
fenil jacob10-Nov-03 23:38 
GeneralRe: IIS mime Type Pin
Vi211-Nov-03 19:21
Vi211-Nov-03 19:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.