Click here to Skip to main content
15,913,944 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: A ridiculous beginners question Pin
Terry O'Nolley22-Sep-03 18:15
Terry O'Nolley22-Sep-03 18:15 
GeneralRe: A ridiculous beginners question Pin
Rick York22-Sep-03 18:26
mveRick York22-Sep-03 18:26 
GeneralRe: A ridiculous beginners question Pin
Alvaro Mendez23-Sep-03 4:22
Alvaro Mendez23-Sep-03 4:22 
GeneralRe: A ridiculous beginners question Pin
Rick York24-Sep-03 14:09
mveRick York24-Sep-03 14:09 
GeneralRe: A ridiculous beginners question Pin
John M. Drescher22-Sep-03 18:02
John M. Drescher22-Sep-03 18:02 
GeneralRe: A ridiculous beginners question Pin
Terry O'Nolley22-Sep-03 18:20
Terry O'Nolley22-Sep-03 18:20 
GeneralRe: A ridiculous beginners question Pin
John M. Drescher22-Sep-03 18:30
John M. Drescher22-Sep-03 18:30 
GeneralCallbacks Pin
halblonious22-Sep-03 16:50
halblonious22-Sep-03 16:50 
In a function, I create a font chooer dialog for my user, for which I'm trying to add a callback function, like so:

//create the pointer
LPCFHOOKPROC FontHook;

//create the font chooser dialog
CFontDialog dlg(&LogFont,CF_ENABLEHOOK|CF_EFFECTS|CF_BOTH|CF_NOVECTORFONTS|CF_NOSCRIPTSEL|CF_INITTOLOGFONTSTRUCT,NULL,NULL);

//tell it to hook to the function
dlg.m_cf.lpfnHook = FontHook;

//display the font dialog
if(dlg.DoModal() == IDOK)
{
//blah blah
}


Then, elsewhere in the view I added the actual callback function, like so:

UINT CALLBACK FontHook(HWND hdlg,UINT uiMsg,WPARAM wParam,LPARAM lParam)
{
//blah blah
return TRUE;
}

It compiles fine, but when I try to use the font dialog is gives me an application error:

"The instruction at '0xcccccccc' referenced memory at '0xcccccccc'. The memory could not be 'read'."

It desplays this three times, before quitting out. I figured out it's on the .DoModal line where it's having the issue, I think. It gives me this error when debugging:

"Unhandled exception in Application.exe: 0xC0000005: Access violation."

Can anyone please tell me what I'm doing wrong or forgetting to do?


halblonious
GeneralRe: Callbacks Pin
Phil Speller22-Sep-03 22:14
Phil Speller22-Sep-03 22:14 
GeneralRe: Callbacks Pin
halblonious23-Sep-03 11:35
halblonious23-Sep-03 11:35 
GeneralRe: Callbacks Pin
Member 42425922-Sep-03 22:14
Member 42425922-Sep-03 22:14 
GeneralRe: Callbacks Pin
halblonious23-Sep-03 11:37
halblonious23-Sep-03 11:37 
GeneralRe: Callbacks Pin
David Crow23-Sep-03 3:07
David Crow23-Sep-03 3:07 
GeneralRe: Callbacks Pin
halblonious23-Sep-03 11:36
halblonious23-Sep-03 11:36 
Questionhow i can get the WM_POWERBROADCAST Pin
vancuver22-Sep-03 16:44
vancuver22-Sep-03 16:44 
AnswerRe: how i can get the WM_POWERBROADCAST Pin
Mike Dimmick23-Sep-03 1:01
Mike Dimmick23-Sep-03 1:01 
GeneralDevice Manager source code Pin
Member 40481322-Sep-03 16:32
Member 40481322-Sep-03 16:32 
GeneralRe: Device Manager source code Pin
Alexander M.,27-Sep-03 7:42
Alexander M.,27-Sep-03 7:42 
GeneralCIPAddressCtrl Pin
esepich22-Sep-03 16:21
esepich22-Sep-03 16:21 
GeneralRe: CIPAddressCtrl Pin
David Crow23-Sep-03 3:16
David Crow23-Sep-03 3:16 
QuestionHow to get a Copying Files Dialog in Drag and Drop Pin
Matt Bauer22-Sep-03 15:31
Matt Bauer22-Sep-03 15:31 
AnswerRe: How to get a Copying Files Dialog in Drag and Drop Pin
David Crow23-Sep-03 3:18
David Crow23-Sep-03 3:18 
GeneralRe: How to get a Copying Files Dialog in Drag and Drop Pin
Matt Bauer23-Sep-03 12:33
Matt Bauer23-Sep-03 12:33 
GeneralRe: How to get a Copying Files Dialog in Drag and Drop Pin
David Crow24-Sep-03 2:33
David Crow24-Sep-03 2:33 
QuestionWinAPI call for CPU/memory usage? Pin
gautamcode22-Sep-03 15:27
gautamcode22-Sep-03 15:27 

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.