Click here to Skip to main content
15,914,013 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: converting TCHAR to LPVOID Pin
David Crow24-May-04 8:39
David Crow24-May-04 8:39 
GeneralRe: converting TCHAR to LPVOID Pin
pnpfriend24-May-04 9:05
pnpfriend24-May-04 9:05 
GeneralRe: converting TCHAR to LPVOID Pin
David Crow24-May-04 9:49
David Crow24-May-04 9:49 
GeneralRe: converting TCHAR to LPVOID Pin
pnpfriend24-May-04 10:49
pnpfriend24-May-04 10:49 
GeneralRe: converting TCHAR to LPVOID Pin
David Crow24-May-04 10:52
David Crow24-May-04 10:52 
GeneralRe: converting TCHAR to LPVOID Pin
pnpfriend24-May-04 9:19
pnpfriend24-May-04 9:19 
GeneralRe: converting TCHAR to LPVOID Pin
Michael Dunn24-May-04 11:04
sitebuilderMichael Dunn24-May-04 11:04 
GeneralRe: converting TCHAR to LPVOID Pin
pnpfriend25-May-04 7:59
pnpfriend25-May-04 7:59 
Thank you all for your advises..
I had changed wcscpy() to _tcscpy() to send the message from app1 to app2,
app2 seems like only got the first character of the message from app1 but as Davide Crow suggested, I wrote a function that checked every single character of the message and found out that message char was store in every other index in the array. for example, H0E0L0L0O
<br />
void App2::GetReqStr(TCHAR* str, DWORD bufSize)<br />
{<br />
	TCHAR temp[BUFSIZE];<br />
	int j=0;<br />
	for (int i=0;i<bufSize;i++)<br />
	{<br />
		if(str[i] != 0)<br />
		{<br />
			temp[j]=str[i];<br />
			j++;<br />
		}<br />
	}<br />
	_tcscpy(str,temp);<br />
	str[j]=NULL;<br />
}<br />


So App2 gets the message what app1 sent, but the problem is that app1 is not getting the same message what App2 sent back.

for example, App2 gets message "Hello" from app1 and app2 send "YES" to app1 back. however, using the following same methods, ReadFile() and WriteFile(), and app1 got junk messages from app2. Why is that??? it is driving me crazy. I cant' find the errors.. why I dont' get the same message that is sent by app2???????? Cry | :((


<br />
CString msg = "HELLO";  //example string, could be other than "HELLO"<br />
<br />
TCHAR chBuf[BUFSIZE];<br />
_tcscpy(chBuf,msg);<br />
fSuccess = ReadFile( hPipe, chBuf,BUFSIZE,&cbRead, NULL);  //to read the message<br />
<br />
fSuccess = WriteFile( hPipe,chBuf,_tcslen(chBuf)*sizeof(TCHAR*),&cbWritten,NULL);  // to write the message<br />
<br />

GeneralRe: converting TCHAR to LPVOID Pin
Blake Miller25-May-04 15:11
Blake Miller25-May-04 15:11 
GeneralSetWindowsHookEx, SC_SCREENSAVE and mouse moves Pin
caykahve24-May-04 6:01
caykahve24-May-04 6:01 
GeneralRe: SetWindowsHookEx, SC_SCREENSAVE and mouse moves Pin
jmkhael24-May-04 6:19
jmkhael24-May-04 6:19 
GeneralRe: SetWindowsHookEx, SC_SCREENSAVE and mouse moves Pin
caykahve24-May-04 21:32
caykahve24-May-04 21:32 
GeneralRe: SetWindowsHookEx, SC_SCREENSAVE and mouse moves Pin
jmkhael24-May-04 22:41
jmkhael24-May-04 22:41 
GeneralProblem adding ActiveX to an MFC DLL Pin
Aviv Halperin24-May-04 5:58
Aviv Halperin24-May-04 5:58 
GeneralRe: Problem adding ActiveX to an MFC DLL Pin
igor196024-May-04 8:36
igor196024-May-04 8:36 
GeneralExcel 97 Automation Pin
act_x24-May-04 4:35
act_x24-May-04 4:35 
GeneralHTMLDocument and scripts Pin
Aggtaa24-May-04 4:11
Aggtaa24-May-04 4:11 
GeneralQuestions about Unicode Pin
Xiangyang Liu 刘向阳24-May-04 2:58
Xiangyang Liu 刘向阳24-May-04 2:58 
GeneralRe: Questions about Unicode Pin
Ravi Bhavnani24-May-04 4:21
professionalRavi Bhavnani24-May-04 4:21 
GeneralRe: Questions about Unicode Pin
Xiangyang Liu 刘向阳24-May-04 4:31
Xiangyang Liu 刘向阳24-May-04 4:31 
GeneralRe: Questions about Unicode Pin
wb24-May-04 4:59
wb24-May-04 4:59 
GeneralRe: Questions about Unicode Pin
Xiangyang Liu 刘向阳25-May-04 1:20
Xiangyang Liu 刘向阳25-May-04 1:20 
GeneralRe: Questions about Unicode Pin
Ravi Bhavnani24-May-04 9:04
professionalRavi Bhavnani24-May-04 9:04 
GeneralRe: Questions about Unicode Pin
Xiangyang Liu 刘向阳25-May-04 1:19
Xiangyang Liu 刘向阳25-May-04 1:19 
GeneralRe: Questions about Unicode Pin
Ravi Bhavnani25-May-04 1:21
professionalRavi Bhavnani25-May-04 1:21 

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.