Click here to Skip to main content
15,894,343 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: A C PROGRAM to extract a bit or a group of bits from a Ethernet frame Pin
JackDingler2-Mar-12 7:51
JackDingler2-Mar-12 7:51 
QuestionCall Class Members from Interrupt Routine Pin
Andy20228-Feb-12 22:04
Andy20228-Feb-12 22:04 
AnswerRe: Call Class Members from Interrupt Routine Pin
Jochen Arndt28-Feb-12 22:34
professionalJochen Arndt28-Feb-12 22:34 
GeneralRe: Call Class Members from Interrupt Routine Pin
Andy20228-Feb-12 22:50
Andy20228-Feb-12 22:50 
GeneralRe: Call Class Members from Interrupt Routine Pin
Jochen Arndt28-Feb-12 23:05
professionalJochen Arndt28-Feb-12 23:05 
AnswerRe: Call Class Members from Interrupt Routine Pin
enhzflep28-Feb-12 23:34
enhzflep28-Feb-12 23:34 
GeneralRe: Call Class Members from Interrupt Routine Pin
CPallini29-Feb-12 0:18
mveCPallini29-Feb-12 0:18 
GeneralRe: Call Class Members from Interrupt Routine Pin
Andy20229-Feb-12 5:15
Andy20229-Feb-12 5:15 
Thanks for the information and direction. I got it working now.
My application was a MFC C++ Dialog based program using VS2008.

The most difficult part was getting the first parameter in the PostMessage() call.
This was the HWND hWnd of the main window. I used a global variable g_hMainHWND so that it was available in both the interrupt and main program.

Code as follows:-
C++
//In the header file
#define	Digital_Event		1
// Message for 1553 interrupts
	afx_msg LRESULT OnDigitalInterrupt(UINT wParam, LONG lParam);

// In the Main MFC file of the application
const UINT WM_INTERRUPT_DIGITAL = WM_APP + 1;
HWND	g_hMainHWND;

BEGIN_MESSAGE_MAP(CDigitalPnPDlg, CDialog)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	// Interrupt for Digital
	ON_MESSAGE(WM_INTERRUPT_DIGITAL, OnDigitalInterrupt)

// In the Dialog Init routine
	g_hMainHWND = this->GetSafeHwnd();

LRESULT CDigitalPnPDlg::OnDigitalInterrupt(UINT wParam, LONG lParam)
{
	/* This routine is called every 20 msec by the interrupt from the
		board. 	*/
	if(wParam == Digital_Event)
		manage_timers();
	return 0;
}


// In the interrupt routin
	/* Arrange for the processing of the 20 msec interrupt in the main application	*/
	PostMessage(g_hMainHWND, WM_INTERRUPT_DIGITAL, Digital_Event, NULL);


Note I was using the interrupt to provide a timer facility as the card was providing this every 20 msec.

Andy
GeneralRe: Call Class Members from Interrupt Routine Pin
enhzflep29-Feb-12 5:22
enhzflep29-Feb-12 5:22 
GeneralRe: Call Class Members from Interrupt Routine Pin
Erudite_Eric1-Mar-12 22:37
Erudite_Eric1-Mar-12 22:37 
GeneralRe: Call Class Members from Interrupt Routine Pin
enhzflep1-Mar-12 22:44
enhzflep1-Mar-12 22:44 
GeneralRe: Call Class Members from Interrupt Routine Pin
Erudite_Eric1-Mar-12 22:55
Erudite_Eric1-Mar-12 22:55 
GeneralRe: Call Class Members from Interrupt Routine Pin
Richard MacCutchan29-Feb-12 5:34
mveRichard MacCutchan29-Feb-12 5:34 
GeneralRe: Call Class Members from Interrupt Routine Pin
Jochen Arndt29-Feb-12 5:59
professionalJochen Arndt29-Feb-12 5:59 
GeneralRe: Call Class Members from Interrupt Routine Pin
Andy20229-Feb-12 6:10
Andy20229-Feb-12 6:10 
GeneralRe: Call Class Members from Interrupt Routine Pin
Erudite_Eric1-Mar-12 22:39
Erudite_Eric1-Mar-12 22:39 
GeneralRe: Call Class Members from Interrupt Routine Pin
Andy2022-Mar-12 0:15
Andy2022-Mar-12 0:15 
GeneralRe: Call Class Members from Interrupt Routine Pin
Erudite_Eric4-Mar-12 21:29
Erudite_Eric4-Mar-12 21:29 
GeneralRe: Call Class Members from Interrupt Routine Pin
Jochen Arndt29-Feb-12 6:00
professionalJochen Arndt29-Feb-12 6:00 
GeneralRe: Call Class Members from Interrupt Routine Pin
Erudite_Eric1-Mar-12 22:31
Erudite_Eric1-Mar-12 22:31 
GeneralRe: Call Class Members from Interrupt Routine Pin
enhzflep1-Mar-12 22:41
enhzflep1-Mar-12 22:41 
AnswerRe: Call Class Members from Interrupt Routine Pin
JackDingler2-Mar-12 7:41
JackDingler2-Mar-12 7:41 
Questionview object in dialog when can be used Pin
appollosputnik28-Feb-12 20:43
appollosputnik28-Feb-12 20:43 
AnswerRe: view object in dialog when can be used Pin
CPallini28-Feb-12 21:42
mveCPallini28-Feb-12 21:42 
GeneralRe: view object in dialog when can be used Pin
appollosputnik28-Feb-12 22:44
appollosputnik28-Feb-12 22:44 

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.