Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MFC (http://www.go4expert.com/forums/mfc/)
-   -   Sending info when clicking a mouse button to notepad (http://www.go4expert.com/forums/sending-info-clicking-mouse-button-t13301/)

Andres 27Aug2008 00:00

Sending info when clicking a mouse button to notepad
 
Can someone please help me with this code... I am trying to send info to notepad when I click a mouse button.

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static HANDLE hFile = INVALID_HANDLE_VALUE;

switch(msg)
{
case WM_CREATE:
hFile = CreateFile(...);
return 0;

case WM_DESTROY:
CloseHandle(hFile);
PostQuitMessage(0);
return 0;

case WM_LBUTTONDOWN:
WriteFile(...);
return 0;

case WM_RBUTTONDOWN:
WriteFile(...);
return 0;

default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
}

oogabooga 27Aug2008 01:38

Re: Sending info when clicking a mouse button to notepad
 
Are you really trying to send the data to "notepad"?
Or are you trying to write the data to a text file that could subsequently be read in notepad?

shabbir 27Aug2008 09:21

Re: Sending info when clicking a mouse button to notepad
 
Moved to MFC/Win32 forum for better responses.

Andres 27Aug2008 20:32

Re: Sending info when clicking a mouse button to notepad
 
Yes you are right, I am trying to write data to a text file that could subsequently be read in notepad.

oogabooga 29Aug2008 01:18

Re: Sending info when clicking a mouse button to notepad
 
Then you need to look up those functions on MSDN.
CreateFile
WriteFile
They're a little complicated, but just remember that you mostly want the defaults.


All times are GMT +5.5. The time now is 10:49.