Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ COM
I am beginner with COM. Currently I am trying to write a COM server(*.EXE) to receive messages from other process. So, I plan to create a hidden dialog for my COM server.
 
I just created a ATL Dialog class using VS2010 and the "Add class wizzard".
 
class CMyDlg: 
	public CAxDialogImpl<CTestDialog>
 
After initialized
 
CMyDlg dlg;
dlg.DoModal();
 
It just hang on every thing.
 
Then I changed another method
 
CMyDlg dlg;
dlg.Create(NULL);
dlg.ShowWindow(SW_SHOW);
 
Nothing happened! Just an error code: 1813. That means The specified resource type cannot be found in the image file.
 
I can't understand why this happen?
The Dialog resource was created by the wizzard.
 
I searched from google and some forum for the whole 2 day, nothing was found.
 
Could you please give me some idea?
 
Thanks!
 

Gordon
Posted 15-Sep-12 10:15am
xchftt513
Comments
armagedescu at 17-Sep-12 9:56am
   
how can you call doModal on a hidden box?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

It might be a problem in Create method: you should use a template name, not a NULL statement. If you did not derived 'Create' virtual method, I suppose, the compiller will use standard CDialog template, not the inherited one.
  Permalink  
Comments
xchftt at 16-Sep-12 7:53am
   
THe create function parameter was hWnd. Because my application was a ALT service, no window existed.
skydger at 17-Sep-12 5:08am
   
Have you tried to create standard CDialog window?
Although it might be a problem. If there is no any window, you can try to attach your dialog to desktop:
CWnd wnd;
wnd.Attach( GetDesktopWindow() );
CDialog dlg;
dlg.Create( MAKEINTRESOURCE(IDC_MY_DIALOG), &wnd);
...
wnd.Detach();
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I ignored that my OS was Windows7. The services dialog, if successfully created, would work at Session 0. In this Session, no message can arrive from other session.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 325
1 Sergey Alexandrovich Kryukov 289
2 CPallini 275
3 DamithSL 260
4 Maciej Los 215
0 OriginalGriff 5,455
1 DamithSL 4,422
2 Maciej Los 3,860
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,010


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 18 Dec 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100