|
Thank you. That helped.
caykahve
|
|
|
|
|
See the "Extras" section of this article.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
is that David Crow leaning sidewise ? .. you are like a BOSS so try Bolding it or just leave it like David Crow. it luks great.
He is like a one-legged man in a bum kicking competition. -Novjot Sidhu
--[v]--
|
|
|
|
|
Hi all,
I have a .c file in my project and I want to convert it to the assebly file that is .asm file. Do anybody how can i do this in VC 6.0
Thanks in advance.
Ritu Kwatra
|
|
|
|
|
Ritu Kwatra wrote: I have a .c file in my project and I want to convert it to the assebly file that is .asm file. Do anybody how can i do this in VC 6.0
Start Debugging in Debug MODE with Disassembly button enabled
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
-- modified at 3:47 Monday 17th October, 2005
|
|
|
|
|
In VC, Open Project->Project Settings->[Tab C/C++]
on that Tab, in Listing file type, choose Assembly with source code. This outputs the desired .asm file.
Hope this helps
~RaGE();
|
|
|
|
|
Hi all,
I have a .c file in my project and I want to convert it to the assebly file that is .asm file. Do anybody how can i do this in VC 6.0
Thanks in advance.
Ritu Kwatra
|
|
|
|
|
How can I check for the version of Windows during installation of my application in a setup program using Launch Conditions Editor in the Setup Project of Visual Studio? What condition I should use and how?
Secondly, if my software is meant only for Win NT, 2000 and XP, can I safely afford to exclude InstMsiA.exe bootstrapper file in my setup files?
Thanks.
|
|
|
|
|
I am doing profiling on a program.When i am doing "function timing" and
"Function coverage" the result are properly present in the profile window and i can copy all the result into a file.But when i do "line profiling" all the result from the begining are not seen in the profile window.Can i save the result directly into a file(say notepad/wordpad) while the line profiling is going on.
|
|
|
|
|
Can I use the Setup Project provided with Visual Studio .NET for preparing Installation for my VC++ project?
Thanks
|
|
|
|
|
when built my program in VC++ 6.0,I frequently receive a message box displaying "this file has been modified out of the source editor , do you want to reload it?" , and after this, I find that the file is indeed changed and in turn some errors occured, how can this happen?
afterwards, I find a clue for this error: the file being modified each time is the same file named "DetailedDesign.h". and the file is changed typically when I make a call to "rebuild all".
so I tried setting the file "read only",and when I call "rebuild all", one error occured, following are all of the generated informations:
Deleting intermediate files and output files for project 'DetailedDesign - Win32 Debug'.
Error: Could not delete file "E:\my project
\DetailedDesign\DetailedDesign.h" : access denied。
--------------------Configuration: DetailedDesign - Win32 Debug--------------------
Creating Type Library...
Microsoft (R) MIDL Compiler Version 5.01.0164
Copyright (c) Microsoft Corp 1991-1997. All rights reserved.
Processing E:\my project\DetailedDesign\DetailedDesign.idl
DetailedDesign.idl
Processing D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\oaidl.idl
oaidl.idl
Processing D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\objidl.idl
objidl.idl
Processing D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\unknwn.idl
unknwn.idl
Processing D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\wtypes.idl
wtypes.idl
Processing D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\ocidl.idl
ocidl.idl
Processing D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\oleidl.idl
oleidl.idl
Processing D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\servprov.idl
servprov.idl
Processing D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\urlmon.idl
urlmon.idl
Processing D:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\msxml.idl
msxml.idl
midl : error MIDL2212 : error while writing to file .\.\DetailedDesign.h
Error executing midl.exe.
DetailedDesign.dll - 1 error(s), 0 warning(s)
thank you very much ,any info is appreciated!
I am trying to love c++
|
|
|
|
|
What have you chosen as output directory for your Debug session ? Is it E:\my project\DetailedDesign\ ?
Where is this file located in your Source Browser ?
Is this file somehow auto-generated ?
~RaGE();
|
|
|
|
|
all of my source files including the "DetailedDesign.h" are in the dirctory "E:\my project\DetailedDesign\", and the Debug output directory is " E:\my project\DetailedDesign\Debug" as default
-------------------
I am trying to love c++
|
|
|
|
|
Can any one help me to find data encoding of received buffer with WSARecv() command.
Weather data send by client is in UNICODE or in ASCII format
E.g.:
WSARecv (AcceptSocket, &DataBuf, 1, &RecvBytes, &Flags, &AcceptOverlapped, NULL)
DataBuf.buff is in ASCII or in UNICODE
Regads,
Madhu S. Kapoor
Madhu S. Kapoor
|
|
|
|
|
Madhu Sudan Kapoor wrote: WSARecv (AcceptSocket, &DataBuf, 1, &RecvBytes, &Flags, &AcceptOverlapped, NULL)
Is upto you in which form you want to recv data
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Let me confess that I am fresher in network programming can any one help me???
I made very simple server using IOCP but my server is unable to receive all the message. Here is code for my server
#include "stdafx.h"
//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include "winsock2.h"
#include "fstream"
#include "conio.h"
#include "stdio.h"
#pragma comment(lib,"ws2_32.lib")
/*--- MACRO Defination --*/
#define SERVER_PORT htons(8888)
#define DATA_BUFSIZE 4096
#define OP_READ 0
#define OP_WRITE 1
#define OP_ACCEPT 2
/* OverlapPlus Data Used to store Ovelap info and other information need to user*/
typedef struct _OVERLAPPEDPLUS
{
OVERLAPPED Overlapped;
SOCKET sServer,sClient;
int nOperationCode;
WSABUF wbuf;
DWORD dwBytes,dwFlags;
SOCKADDR_STORAGE ClientAddr;
int nClientNumber;
}OVERLAPPEDPLUS, * LP_OVERLAP_PLUS;
void Initialize();
DWORD WINAPI ServerWorkerThread(LPVOID lpParam);
FILE *stream;
void appendLog(TCHAR* strMessage)
{
stream = _wfopen( _T("c:\\iServer.log"), _T("a") );
fputws(_T("\n"),stream);
fputws(strMessage,stream);
fclose( stream );
}
int main()
{
WSADATA wsd;
SYSTEM_INFO SystemInfo;
SOCKADDR_IN InternetAddr;
SOCKET sListen;
HANDLE hIocp;
int nClientInc = 1;
/* Initialize Winsock2 */
Initialize();
/*--- Create an I/O completion port ---*/
hIocp = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, (ULONG_PTR)0, 0);
if(NULL == hIocp)
{
printf("Error in initialization of Completion Port! Press any to exit...");
return -1;
}
/* Determine how many processors are on the system, For thead optimization */
GetSystemInfo(&SystemInfo);
/*--- Create worker threads based on the number of processors available on the system ---*/
for(int nProcessor = 0; nProcessor < (int) SystemInfo.dwNumberOfProcessors; nProcessor++)
{
HANDLE ThreadHandle;
ThreadHandle = CreateThread(NULL, 0,ServerWorkerThread, hIocp,0, NULL);
//CloseHandle(ThreadHandle); // Why We close thread Handle ?????
}
/*--- Create a listening socket --- */
sListen = WSASocket(AF_INET, SOCK_STREAM, 0, NULL, 0,WSA_FLAG_OVERLAPPED);
/*--- Fill TCP Header Info for bind a socket ---*/
InternetAddr.sin_family = AF_INET;
InternetAddr.sin_addr.s_addr = htonl(INADDR_ANY);
InternetAddr.sin_port = SERVER_PORT;
/*-- Bind the socket with port --*/
bind(sListen, (PSOCKADDR) &InternetAddr, sizeof(InternetAddr));
/*--- Prepare socket for listening mode and Start the Server ---*/
listen(sListen, 5);
printf("Server Started in listen mode ....");
while(TRUE)
{
int ret;
char strBuffer[DATA_BUFSIZE];
ULONG_PTR *PerHandleKey;
OVERLAPPED *Overlap;
OVERLAPPEDPLUS *OverlapPlus,*olpClientOverlappedPlusData;
DWORD dwBytesXfered;
SOCKET sClient;
SOCKADDR_IN saRemote;
int nRemoteLen;
/*-- Accept connections and assign to the completion port--*/
nRemoteLen = sizeof(saRemote);
sClient = WSAAccept(sListen, (SOCKADDR *)&saRemote,&nRemoteLen,0 , 0);
printf("New Client! Socket number %d connected\n", sClient);
/* Allocate memory to olpClientOverlappedPlusData */
olpClientOverlappedPlusData = (LP_OVERLAP_PLUS)GlobalAlloc(GPTR, sizeof(OVERLAPPEDPLUS));
if(NULL == olpClientOverlappedPlusData)
{
printf("Error in initialization Memory! Press any to exit...");
return -1;
}
/*-- Fill OverlapPlusData -- */
olpClientOverlappedPlusData->sClient = sClient;
olpClientOverlappedPlusData->nClientNumber = nClientInc++;
olpClientOverlappedPlusData->nOperationCode = OP_READ;
olpClientOverlappedPlusData->wbuf.buf = strBuffer;
olpClientOverlappedPlusData->wbuf.len = DATA_BUFSIZE;
memcpy(&olpClientOverlappedPlusData->ClientAddr, &saRemote, nRemoteLen);
// Associate the accepted socket with the completion port
if(NULL == CreateIoCompletionPort((HANDLE)sClient, hIocp,(ULONG_PTR)0,0) )
{
printf("Error in initialization of Completion Port for server! Press any to exit...");
return -1;
}
/*-- Make Ready to Recive Data From given Port -- */
ret = WSARecv(sClient,&olpClientOverlappedPlusData->wbuf,1,&olpClientOverlappedPlusData->dwBytes,&olpClientOverlappedPlusData->dwFlags,&olpClientOverlappedPlusData->Overlapped, NULL);
}
return 0;
}
DWORD WINAPI ServerWorkerThread(LPVOID CompletionPortID)
{
/*-- Notify Starting of server -- */
printf("\nHello Server Started, I am in worker thread! \n");
HANDLE hIocp = (HANDLE) CompletionPortID;
ULONG_PTR *PerHandleKey;
OVERLAPPED *Overlap;
OVERLAPPEDPLUS *OverlapPlus,*newolp;
DWORD dwBytesXfered;
int ret;
char *strData ;
while (1)
{
ret = GetQueuedCompletionStatus(hIocp,&dwBytesXfered,(PULONG_PTR)&PerHandleKey,&Overlap,INFINITE);
if (ret == 0){
continue;
}
OverlapPlus = CONTAINING_RECORD(Overlap, OVERLAPPEDPLUS, Overlapped);
/*--- Process Data According to Operation Code ---*/
switch (OverlapPlus->nOperationCode )
{
case OP_READ:
// Process the data read Repost the read if necessary, reusing the same receive buffer as before
memset(&OverlapPlus->Overlapped, 0, sizeof(OVERLAPPED));
ret = WSARecv(OverlapPlus->sClient,&OverlapPlus->wbuf,1,&OverlapPlus->dwBytes,&OverlapPlus->dwFlags,&OverlapPlus->Overlapped, NULL);
appendLog((TCHAR*) &OverlapPlus->wbuf.buf[0]);
ZeroMemory(&(OverlapPlus->Overlapped),sizeof(OVERLAPPED));// Why we reset memory ???
printf("\n\n****Inforamtion*****\n\nClient Socket:%d \n Bytes:%d \n Buff :%s \n Client No: %d\n FLAG :%d ",(int)OverlapPlus->sClient,OverlapPlus->dwBytes,OverlapPlus->wbuf.buf,OverlapPlus->nClientNumber,OverlapPlus->dwFlags);
if (ret == SOCKET_ERROR)
{
ret = WSAGetLastError();
if ( ret != WSA_IO_PENDING)
{
// What should i do in case of Error???
//printf("Error occur at WSARecv() : %d", ret);
//ExitThread(0);
break;
}
}
break;
case OP_WRITE:
// Process the data sent, etc.
break;//…
}
}
}
void Initialize()
{
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD( 1, 1 );
err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 )
{
printf("\n couldn't find a useable winsock.dll");
exit(1);
}
}
Madhu S. Kapoor
Madhu S. Kapoor
|
|
|
|
|
:->
Using VC++.NET2003
I have written serial routines (ported from Apollo) as follows:
but I am finding that with a serial loopback setup
the leading bit is reset on all chars (ie. transmit 0xff and receive only 0x7f)
I have a feeling its to do with binary vs text mode but I am unable to resolve.
Code:
CSerial::CSerial (LPCTSTR pszCommPort, LPCTSTR pszMode , char LineTerminator)
{
m_strCommsPort = pszCommPort;
m_strMode = pszMode;
m_LineTerminator = LineTerminator;
}
CSerial::~CSerial ()
{
ios_$close();
}
void CSerial::ios_$close(void)
{
if ( m_Port != INVALID_HANDLE_VALUE )
{
ios_$flush();
CloseHandle ( m_Port );
m_Port = INVALID_HANDLE_VALUE;
}
}
bool CSerial::ios_$open(void)
{
COMMTIMEOUTS lpCommTimeouts;
LPCOMMTIMEOUTS pPortTimeouts = &lpCommTimeouts;
m_Port = CreateFile( m_strCommsPort, GENERIC_READ |
GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
if ( m_Port == INVALID_HANDLE_VALUE )
{
char szBuffer[256];
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL,
GetLastError(), MAKELANGID(LANG_NEUTRAL,
SUBLANG_DEFAULT),szBuffer, sizeof szBuffer, NULL );
strcat ( szBuffer, " opening " );
strcat ( szBuffer, m_strCommsPort );
MessageBox(NULL, szBuffer, "CIMW", MB_OK);
return false;
}
DCB dcb;
dcb.DCBlength = sizeof DCB;
GetCommState(m_Port, &dcb );
BuildCommDCB(m_strMode, & dcb);
dcb.fBinary = true;
dcb.fOutxDsrFlow = 0;
dcb.fOutxCtsFlow = 0;
dcb.fOutX = 0;
dcb.fInX = 0;
dcb.fDtrControl = DTR_CONTROL_ENABLE;
dcb.fRtsControl = RTS_CONTROL_ENABLE;
// Maximum time between read chars.
lpCommTimeouts.ReadIntervalTimeout = MAXDWORD;
// Multiplier of characters.
lpCommTimeouts.ReadTotalTimeoutMultiplier = 0;
// Constant in milliseconds.
lpCommTimeouts.ReadTotalTimeoutConstant =0;
// Multiplier of characters.
lpCommTimeouts.WriteTotalTimeoutMultiplier = 100;
// Constant in milliseconds.
lpCommTimeouts.WriteTotalTimeoutConstant = 1000;
SetCommTimeouts(m_Port, pPortTimeouts);
SetCommState(m_Port, & dcb);
return true;
}
bool CSerial::ios_$put ( const unsigned char *pszPacket, int iLen)
{
int iPut = 0;
for (int x=0; x < iLen; x++ )
{
ios_$putchar ( pszPacket[x] );
iPut++;
if (iPut >= iLen)
{
return true;
}
}
return true;
}
bool CSerial::ios_$putchar(unsigned char cByte)
{
DWORD bytesWritten;
bool bWrite;
bWrite = (bool)WriteFile ( m_Port, (void *)&cByte, 1,
&bytesWritten, NULL );
return bWrite;
}
int CSerial::ios_$get(unsigned char *cByte)
{
int iError;
int iCode;
DWORD bytesRead;
LPDWORD pBytesRead = &bytesRead;
iCode = ReadFile ( m_Port, (unsigned char *)cbyte,
1,pBytesRead, NULL);
if (bytesRead == 0)
{
return 0;
iError = GetLastError();
}
else
{
*cByte = x;
}
return 1;
}
void CSerial::ios_$flush()
{
PurgeComm ( m_Port, PURGE_RXCLEAR );
}
Ian
|
|
|
|
|
I haven't looked closely at the rest of the code, but try adding
dcb.ByteSize = 8;
to the device control block configuration to make sure the UART isn't defaulting to 7 bit mode.
|
|
|
|
|
HI, I have found the error is not the software but the edgeport/4S USB serial port hardware I am using. I tested the software on a direct RS232 port and it worked correctly. I have since found that re-installing the edgport/4s 4 port unit and then re-instating RS422 has fixed the problem.
|
|
|
|
|
Hi all !!
I practise VC. When I code my program to create a file.
The first time when I click my button2 (create file) I receive a error "access pathdir to file is denied" but I can create file at the second click. I don't know why ??? Please,I need help !!
This's my code when click button2, I use MFC wizard (use dialogbase)
void CTestDlg::OnButton2()
{
// TODO: Add your control notification handler code here
char filename[100];
GetCurrentDirectory(100,filename);
strcat(filename,"\\RongVang.dat");
CFile f;
if(!f.Open(filename,CFile::modeReadWrite))
f.Open(filename,CFile::modeCreate);
f.SeekToEnd();
char s[100];
strcpy(s,"Test Create file");
f.Write(s,100);
}
-- modified at 22:36 Sunday 16th October, 2005
|
|
|
|
|
the filename return format is not like this"C:\\ adir"
it return format is "C:\adir"
it can't use as a parameter in F.Open Function .
d
|
|
|
|
|
Thank so much !!
But how can i slove it ....
Can you show me .....
I've just program...
|
|
|
|
|
Why do you open the file two times?
i think there you get the error.
if(!f.Open(filename,CFile::modeReadWrite))<br />
f.Open(filename,CFile::modeCreate);<br />
Try this:
if(!f.Open(filename,CFile::modeCreate | CFile::modeReadWrite))
|
|
|
|
|
if(!f.Open(filename,CFile::modeCreate | CFile::modeReadWrite)) f.Open(filename,CFile::modeCreate);
The first click it will create file.
I want at the second click, third,4,5,.... click in button2, it will append my file, not delete and create new file like above !!
Can you help me ... !!!!!!!!!!!!
|
|
|
|
|
CString filename = _T("C:\\RongVang.txt");<br />
CStdioFile f;<br />
if(!f.Open(filename,CFile::modeReadWrite))<br />
f.Open(filename,CFile::modeCreate|CFile::modeReadWrite);<br />
f.SeekToEnd();<br />
CString s = _T("Test Create file\n");<br />
f.WriteString(s);<br />
dont forget to close your file.
|
|
|
|
|