Click here to Skip to main content
15,897,334 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralMFC closing a dialog Pin
tordyvel23-Jan-05 11:29
tordyvel23-Jan-05 11:29 
GeneralRe: MFC closing a dialog Pin
Ravi Bhavnani23-Jan-05 11:54
professionalRavi Bhavnani23-Jan-05 11:54 
GeneralRe: MFC closing a dialog Pin
toxcct23-Jan-05 22:18
toxcct23-Jan-05 22:18 
Questionwhat is the "external definition model" of VC++ ?? Pin
Tomas joy23-Jan-05 9:36
Tomas joy23-Jan-05 9:36 
AnswerRe: what is the "external definition model" of VC++ ?? Pin
David Crow24-Jan-05 7:21
David Crow24-Jan-05 7:21 
QuestionAnybody with DDK experience here? Pin
s.connery23-Jan-05 8:07
s.connery23-Jan-05 8:07 
Generalsearch engine Pin
jinshi23-Jan-05 5:40
jinshi23-Jan-05 5:40 
QuestionDLL PostMessage() --> how to evaluate in another application? Pin
nne-vitamin23-Jan-05 5:20
nne-vitamin23-Jan-05 5:20 
Hi!

I posted here once more to hope that somebody can help me.

I included in my application a DLL which waits for key press. I realized the questioning (hook) of key press in the DLL. So, when I start my application the

DLL will be started too. The DLL works well. But conditioned that the DLL can register the key press without focusing to my application, I do not know how to

set the focus automatically to my application when the DLL registers a special key press as like as 'F9'.

Here is the code snippet in the DLL I tried to realize:

#pragma data_seg .....

HWND    g_hWndServer    = NULL;  // window to my application

#pragma data_seg()
#pragma comment(linker, ....


//
//...
//

LRESULT CALLBACK KeyboardTracker( int code, WPARAM wParam, LPARAM lParam )
{
        if (code==HC_ACTION) 
        {
                
                if ( wParam == VK_F9 )
                {      
                        PostMessage(g_hWndServer, VK_F9, 0, 0);                 
                } 
                
                
        }
        return ::CallNextHookEx(g_hHkKeyboard, code, wParam, lParam);
}


// Function to start the hook
//
__declspec(dllexport) BOOL TrackerInit(HWND hWnd)
{
        if ( g_hHkKeyboard == NULL ) 
        {
                g_hHkKeyboard = SetWindowsHookEx( WH_KEYBOARD, KeyboardTracker, g_hInstance, 0 );
        }
        
        
        
        _ASSERT(g_hHkKeyboard);
        
        
        if ( !g_hHkKeyboard )
        {
                return FALSE;
        }
        else /* hook success */
        {
                g_hWndServer = hWnd;
                return TRUE; 
        }
}


//
//...
//


In my application I call the DLL by calling the Dll-function in the event 'OnInitDialog':

// My application which use the DLL

BOOL CMyApplicationDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	
	SetIcon(m_hIcon, TRUE);			
	SetIcon(m_hIcon, FALSE);

        
        HWND hWnd = NULL; <<<<<<<======== // how can I hand over the main dialog of my appliction here???????
        TrackerInit(hWnd); // call the DLL-function to start key hook


	return TRUE;  
}


How can my application valuate the information of the PostMessage of the DLL????
Is that way upon correct or not?
Where can I place this code to my application?

In hope that anyone know what I mean: Thank you in advance!
AnswerRe: DLL PostMessage() --&gt; how to evaluate in another application? Pin
PJ Arends23-Jan-05 10:05
professionalPJ Arends23-Jan-05 10:05 
GeneralWhen is download complete Pin
tony777777723-Jan-05 4:52
tony777777723-Jan-05 4:52 
GeneralCRecordset and ATL COM Pin
xcavin23-Jan-05 3:36
xcavin23-Jan-05 3:36 
GeneralBlinking CStatic Control Pin
A_Fa23-Jan-05 2:51
A_Fa23-Jan-05 2:51 
GeneralRe: Blinking CStatic Control Pin
rbid23-Jan-05 3:58
rbid23-Jan-05 3:58 
GeneralTopics in MFC Programming Pin
phijophlip23-Jan-05 2:45
phijophlip23-Jan-05 2:45 
GeneralRe: Topics in MFC Programming Pin
Maximilien23-Jan-05 9:14
Maximilien23-Jan-05 9:14 
GeneralFatal error LNK1103: debugging information corrupt; recompile module Pin
Behzad Ebrahimi23-Jan-05 2:10
Behzad Ebrahimi23-Jan-05 2:10 
GeneralRe: Fatal error LNK1103: debugging information corrupt; recompile module Pin
Ryan Binns23-Jan-05 17:49
Ryan Binns23-Jan-05 17:49 
GeneralRe: Fatal error LNK1103: debugging information corrupt; recompile module Pin
Behzad Ebrahimi24-Jan-05 1:31
Behzad Ebrahimi24-Jan-05 1:31 
QuestionHow to dump NT hashes from local machine? Pin
sfirouza23-Jan-05 1:25
sfirouza23-Jan-05 1:25 
GeneralProblem in calling lapack in Matlab MEX program Pin
tttyip22-Jan-05 23:29
tttyip22-Jan-05 23:29 
GeneralOnHotKey Problem!!! Pin
FreewareFire22-Jan-05 21:56
FreewareFire22-Jan-05 21:56 
GeneralDebug mode in COM ... Pin
omkar joshi22-Jan-05 21:41
omkar joshi22-Jan-05 21:41 
GeneralRe: Debug mode in COM ... Pin
Tim Deveaux23-Jan-05 3:18
Tim Deveaux23-Jan-05 3:18 
Generalencryption...pls help! Pin
mytz22-Jan-05 19:19
mytz22-Jan-05 19:19 
GeneralCrypto++ help Pin
Neville Franks22-Jan-05 16:51
Neville Franks22-Jan-05 16:51 

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.