Click here to Skip to main content
16,007,809 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: 'sqrt' : undeclared identifier Pin
Christian Graus15-Dec-02 14:51
protectorChristian Graus15-Dec-02 14:51 
GeneralRe: 'sqrt' : undeclared identifier Pin
rbc15-Dec-02 15:33
rbc15-Dec-02 15:33 
GeneralRe: 'sqrt' : undeclared identifier Pin
Christian Graus15-Dec-02 15:42
protectorChristian Graus15-Dec-02 15:42 
GeneralRe: 'sqrt' : undeclared identifier Pin
Nick Parker15-Dec-02 16:18
protectorNick Parker15-Dec-02 16:18 
GeneralRe: 'sqrt' : undeclared identifier Pin
rbc17-Dec-02 17:11
rbc17-Dec-02 17:11 
Generalsetting the behavior of the context popup menu Pin
trustno115-Dec-02 11:04
trustno115-Dec-02 11:04 
GeneralRe: setting the behavior of the context popup menu Pin
Joseph Dempsey15-Dec-02 11:42
Joseph Dempsey15-Dec-02 11:42 
GeneralGetMailslotInfo returns incorrect lpMessageCount Pin
mwilliamson15-Dec-02 10:48
mwilliamson15-Dec-02 10:48 
I've got a program that uses mail slots. My problem is that when I send a mail message to the local machine the message is recieved twice. I have narrowed this down to my sending code by changing it to send to the microsoft messenger service. The messeneger service recieves the message twice too. However, it I use net send to send the message it is only recieved once. I think net send uses the NetMessageBufferSend function, but I should still only recieve once. If I send to a remote machine with the same code, it is only recieved once. I have tested it on two machines and both have the problem. My code to send is as follows:

{
int nResult;
HANDLE pHandle;
DWORD dwBytesSent;
CString strMailslotName;

strMailslotName = _T("\\\\");
strMailslotName += m_sComputerName;
strMailslotName += _T("\\mailslot\\messngr");

pHandle = CreateFile( strMailslotName, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
if( pHandle == INVALID_HANDLE_VALUE )
{
AfxMessageBox("Error accessing mail slot \"" + strMailslotName + "\"");
CloseHandle( pHandle );
return;
}
else
{
nResult = WriteFile( pHandle, strMsgText, ( DWORD )strMsgText.GetLength(), &dwBytesSent, NULL );
if( nResult == 0 || ( DWORD )strMsgText.GetLength() != dwBytesSent )
{
CString Error;
LPVOID lpMsgBuf;

if (!::FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0,
NULL ))
{
AfxMessageBox("An unknown error occured.");
}
else
{
Error = "Error writing to mailslot: ";
Error += (LPCTSTR)lpMsgBuf;
AfxMessageBox(Error);
}
LocalFree( lpMsgBuf );
}
}
CloseHandle( pHandle );
}

Any ideas whats wrong with this? I don't see how it could be sending two messages. m_sComputerName is the local computer's name.

Thanks for you help!
GeneralRe: GetMailslotInfo returns incorrect lpMessageCount Pin
Joel Lucsy16-Dec-02 5:19
Joel Lucsy16-Dec-02 5:19 
QuestionHow do I set the Height and Length of a View? Pin
Anonymous15-Dec-02 10:13
Anonymous15-Dec-02 10:13 
AnswerRe: How do I set the Height and Length of a View? Pin
Anonymous15-Dec-02 10:17
Anonymous15-Dec-02 10:17 
Questionprocess and network path? Pin
imran_rafique15-Dec-02 10:03
imran_rafique15-Dec-02 10:03 
AnswerRe: process and network path? Pin
Philip Patrick15-Dec-02 10:17
professionalPhilip Patrick15-Dec-02 10:17 
GeneralCreating HTML out of a formatted text message Pin
trimtrom15-Dec-02 9:41
trimtrom15-Dec-02 9:41 
GeneralRe: Creating HTML out of a formatted text message Pin
nde_plume15-Dec-02 10:11
nde_plume15-Dec-02 10:11 
GeneralRe: Creating HTML out of a formatted text message Pin
trimtrom16-Dec-02 8:13
trimtrom16-Dec-02 8:13 
GeneralRe: Creating HTML out of a formatted text message Pin
nde_plume17-Dec-02 9:34
nde_plume17-Dec-02 9:34 
Generalc++ to hex Pin
Anonymous15-Dec-02 9:09
Anonymous15-Dec-02 9:09 
GeneralRe: c++ to hex Pin
Chris Losinger15-Dec-02 9:29
professionalChris Losinger15-Dec-02 9:29 
GeneralRe: c++ to hex Pin
Philip Patrick15-Dec-02 10:13
professionalPhilip Patrick15-Dec-02 10:13 
GeneralRe: c++ to hex Pin
Kannan Kalyanaraman15-Dec-02 17:50
Kannan Kalyanaraman15-Dec-02 17:50 
GeneralRe: c++ to hex Pin
Philip Patrick15-Dec-02 10:14
professionalPhilip Patrick15-Dec-02 10:14 
GeneralRe: c++ to hex Pin
User 665815-Dec-02 12:01
User 665815-Dec-02 12:01 
GeneralATL/WTL Windows and fonts Pin
Jörgen Sigvardsson15-Dec-02 7:58
Jörgen Sigvardsson15-Dec-02 7:58 
GeneralRe: ATL/WTL Windows and fonts Pin
Jörgen Sigvardsson15-Dec-02 8:09
Jörgen Sigvardsson15-Dec-02 8:09 

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.