Click here to Skip to main content
15,915,636 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: the debug problem in VC++ Pin
Saurabh.Garg30-Mar-08 1:59
Saurabh.Garg30-Mar-08 1:59 
GeneralRe: the debug problem in VC++ Pin
David Crow30-Mar-08 2:54
David Crow30-Mar-08 2:54 
GeneralRe: the debug problem in VC++ Pin
Hamid_RT7-Apr-08 2:29
Hamid_RT7-Apr-08 2:29 
GeneralCustom C++ Runtime Pin
Richard Andrew x6429-Mar-08 14:24
professionalRichard Andrew x6429-Mar-08 14:24 
GeneralRe: Custom C++ Runtime Pin
Mark Salsbery29-Mar-08 14:28
Mark Salsbery29-Mar-08 14:28 
GeneralRe: Custom C++ Runtime Pin
Randor 29-Mar-08 19:25
professional Randor 29-Mar-08 19:25 
GeneralRe: Custom C++ Runtime Pin
Hamid_RT7-Apr-08 2:30
Hamid_RT7-Apr-08 2:30 
GeneralRegisterWindowClass and resources from a DLL Pin
Moak29-Mar-08 13:19
Moak29-Mar-08 13:19 
Hi,

I recently moved application resources (dialogs and strings) into a resource only DLL and came across a problem that I don't fully understand... thanks for some help.

As soon as I created my main dialog from the loaded DLL it failed and the debug output showed something like: >>> If this dialog has OLE controls: AfxEnableControlContainer has not been called yet. I traced it back to an owner draw control in the dialog, when I removed this control all worked fine. So I played around a bit with my owner draw control. It is derived from CWnd and tries to register a window class, here is the code:

WNDCLASS wndcls;
HINSTANCE hInst = AfxGetInstanceHandle();
if(!(::GetClassInfo(hInst, MY_CONST_CLASSNAME, &wndcls)))
{
	wndcls.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;
	wndcls.lpfnWndProc = ::DefWindowProc;
	wndcls.cbClsExtra = wndcls.cbWndExtra = 0;
	wndcls.hInstance = hInst;
	wndcls.hIcon = NULL;
	wndcls.hCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW);
	wndcls.hbrBackground = NULL;
	wndcls.lpszMenuName = NULL;
	wndcls.lpszClassName = MY_CONST_CLASSNAME;
	AfxRegisterClass(&wndcls)
}


After I replaced AfxGetInstanceHandle() with AfxGetResourceHandle() it works. This was just try and error, am I doing it right? Because MSDN says hInstance = "Handle to the instance that contains the window procedure for the class". Confused | :confused:

/Moak
GeneralRe: RegisterWindowClass and resources from a DLL Pin
Mark Salsbery29-Mar-08 14:57
Mark Salsbery29-Mar-08 14:57 
GeneralRe: RegisterWindowClass and resources from a DLL Pin
Moak29-Mar-08 15:20
Moak29-Mar-08 15:20 
GeneralRe: RegisterWindowClass and resources from a DLL Pin
Mark Salsbery29-Mar-08 16:01
Mark Salsbery29-Mar-08 16:01 
GeneralRe: RegisterWindowClass and resources from a DLL Pin
Moak30-Mar-08 0:02
Moak30-Mar-08 0:02 
GeneralRe: RegisterWindowClass and resources from a DLL Pin
Moak29-Mar-08 15:47
Moak29-Mar-08 15:47 
GeneralRe: RegisterWindowClass and resources from a DLL Pin
Randor 29-Mar-08 19:21
professional Randor 29-Mar-08 19:21 
GeneralRe: RegisterWindowClass and resources from a DLL Pin
Moak30-Mar-08 0:07
Moak30-Mar-08 0:07 
GeneralRe: RegisterWindowClass and resources from a DLL Pin
Mark Salsbery30-Mar-08 6:51
Mark Salsbery30-Mar-08 6:51 
GeneralRe: RegisterWindowClass and resources from a DLL Pin
Randor 30-Mar-08 11:09
professional Randor 30-Mar-08 11:09 
GeneralRe: RegisterWindowClass and resources from a DLL Pin
Mark Salsbery30-Mar-08 11:23
Mark Salsbery30-Mar-08 11:23 
GeneralRe: RegisterWindowClass and resources from a DLL Pin
Randor 30-Mar-08 11:47
professional Randor 30-Mar-08 11:47 
GeneralRe: RegisterWindowClass and resources from a DLL Pin
Mark Salsbery30-Mar-08 11:56
Mark Salsbery30-Mar-08 11:56 
Questionprint .BMP file to printer ... how ? Pin
Member 435006729-Mar-08 11:38
Member 435006729-Mar-08 11:38 
AnswerRe: print .BMP file to printer ... how ? Pin
Member 435006729-Mar-08 14:02
Member 435006729-Mar-08 14:02 
GeneralRe: print .BMP file to printer ... how ? Pin
Mark Salsbery29-Mar-08 14:24
Mark Salsbery29-Mar-08 14:24 
AnswerRe: print .BMP file to printer ... how ? Pin
Hamid_RT7-Apr-08 2:29
Hamid_RT7-Apr-08 2:29 
QuestionUsing winsock, how can I tell if a system is listening for a connection on a port before I call connect? Pin
TragicComic29-Mar-08 10:39
TragicComic29-Mar-08 10:39 

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.