|
tasleem143 wrote:
but right at start when i call the wsastartup() i cannot start up.
Doesn't make sense!?
Don't try it, just do it!
|
|
|
|
|
yes i make sense
when u start netowrk programming u had to start the newtork socket or initialize the network socket through the wsastartup() funcion.
hope u will be satisfied.
ddd
|
|
|
|
|
This works for me in VC++6:
Header:
class Network : public CAsyncSocket
{
// Attributes
public:
CAsyncSocket Socket;
// Operations
public:
Network();
virtual ~Network();
// Overrides
public:
int Update(IN unsigned char * data, IN int datalength,OUT unsigned char * result, OUT int * resultlength);
// Implementation
protected:
WSADATA wsaData;
};
Implementation:
Network::Network()
{
int err;
char text[64];
if (AfxSocketInit(&wsaData)){
Socket.Create(0, SOCK_DGRAM );
if (!Socket.Connect("192.168.1.77",666)){
err = Socket.GetLastError();
wsprintf(text,"Connect Error %x",err);
MessageBox(NULL,text,"Network",MB_OK);
}
}
}
int Network::Update(IN unsigned char * data, IN int datalength,OUT unsigned char * result, OUT int * resultlength)
{
if (!datalength) return -1;
return Socket.Send(data, datalength);
}
|
|
|
|
|
can i not use the socket api instead the casyncsocket. bcos i dont know much about the Casynch functions whether they work on the blocking or the nonblocking mode.
ddd
|
|
|
|
|
The CAsyncSocket is the MFC version of the 'classic' API.You can use it blocking or non-blocking. Depends if you give it the events it should notify. MSDN has some good info on it.
Wim
|
|
|
|
|
anybody help me
i have read the main header of Shape File successfully.right now i m reading record header og each record contained in that file the problem i m facing is that record header contain1)Record Number 2)Content length
Record Number must begin with zero but i have retrieved 10
what can i do now.
|
|
|
|
|
What does the file look like and how are you reading it?
|
|
|
|
|
thnx david.
actually i have read the FileHeader of Shape file after header of shape file the RecordHeader of each record i have to read.
structure of file is like
__________
FileHeader
____________________________
RecordHeader |RecordContent
____________________________
RecordHeader |RecordContent
_____________________________
.
.
.
Recordheader contain the Record number and Content length.
each have type Int
|
|
|
|
|
|
I am using the following code to create a bi-dimensional list :
typedef CList<CString, CString&> MYTYPE;<br />
CList<MYTYPE, MYTYPE&> myList;
But I get this :
Error C2582: 'operator =' function is unavailable in 'class'
What I'm doing wrong ?
Regards,
Cosmin Unguru
|
|
|
|
|
the CList 'class', dont have an overloaded = operator.
You have to implement your own operator
Hmm...
|
|
|
|
|
May I use IsClipboardFormatAvailable function to check CF_OWNERDISPLAY ?
if (IsClipboardFormatAvailable(CF_TEXT) || IsClipboardFormatAvailable(CF_OEMTEXT))
{
HANDLE hClipboardData = GetClipboardData(CF_TEXT);
// char* pchData = (char*)GlobalLock(hClipboardData);
LPTSTR pchData = (LPTSTR)GlobalLock(hClipboardData);
CString strFromClipboard = pchData;
//TextOut(hdc,10,10,strFromClipboard,strFromClipboard.GetLength());
dc->TextOut(0,0,strFromClipboard);
}
else if(IsClipboardFormatAvailable(CF_BITMAP))
{
HBITMAP hClibBmp = (HBITMAP)GetClipboardData(CF_BITMAP);
HDC hMemDC = CreateCompatibleDC(hdc);
HBITMAP hOldBmp = (HBITMAP)SelectObject(hMemDC,hClibBmp);
BITMAP bm;
GetObject(hClibBmp,sizeof(BITMAP),(LPSTR)&bm);
BitBlt(hdc,0,0,bm.bmWidth,bm.bmHeight,hMemDC,0,0,SRCCOPY);
SelectObject(hMemDC,hOldBmp);
DeleteDC(hMemDC);
ReleaseDC(dc);
}
else if (IsClipboardFormatAvailable(CF_OWNERDISPLAY))
{
HWND hClipboardOwner;
HGLOBAL hglobal;
hClipboardOwner = GetClipboardOwner()->GetSafeHwnd();
hglobal = GlobalAlloc(GMEM_MOVEABLE,sizeof(PAINTSTRUCT));
LPPAINTSTRUCT lpps;
lpps = (LPPAINTSTRUCT)GlobalLock(hglobal);
CopyMemory(lpps, &dc->m_ps, sizeof(PAINTSTRUCT));
GlobalUnlock(hglobal);
hdc = dc->Detach();
::SendMessage(hClipboardOwner,WM_PAINTCLIPBOARD, (WPARAM) m_hWnd, (LPARAM) hglobal);
dc->Attach(hdc);
}
Thanks in advance
|
|
|
|
|
Hi, I'd like to try out Visual Assist since Visual C++ 6.0's "syntax highlighing" (yeah right) sucks to put it directly. The problem is I'm running Windows 98 and Visual Assist X (the one I saw in the showcase) doesn't run on it, the Whole Tomato website also won't let me download a previous version. Does anybody still have either a Visual Assist 6 or 4.1 trial installer?
|
|
|
|
|
You can ask there product department for that
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Thanks, I'll try that
|
|
|
|
|
1) VC6 "syntax highlighting" is now over 10 years old.
2) Before VC6, highlighting may not have existed (so do not knock it).
3) I started out programming in monocrome (damn), it required that you knew what you were doing without visual clues (imagine that!).
4) I was (origanaly) amazed that a friend of mine went to work for a national communications company and there editor, for there propietary language, did not include a stytax hihlighting edidtor. They had to program in monochorm.
Unless you can write a better IDE with syntax highlitng you have no room to speak (I've written two of them).
Visual Assist is a prime example of how well they wrote the origanal, because the could easely (ralativaly) tye it in.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
can my application know if computer is connect to the internet very fast?
if yes, how?
I hope the detection is very fast, i.e. in 500 ms - slow detection is very easy.
thx
includeh10
|
|
|
|
|
|
Make A Worker thread that CHECK for internet every 100 ms, that the fastest way to detect any net connection
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Try:
IsDestinationReachable()
InetIsOffline()
InternetGetConnectedState()
InternetCheckConnection()
RasEnumConnections()
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi all
i want to send a BSTR data to a method of an interface of a com class . i recieved the BSTR from a method of another interface of the same com server ,but it generates a fatal error and terminates the program . is there any task to do before sending BSTR to the method , a conversion or something like that?
thank you .
|
|
|
|
|
What Type or Error are you getting and could you show your INTERFACE declaration.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Might be because of incorrect usage of BSTRs. Wherever possible, I'd suggest using CComBSTR or _bstr_t instead of raw BSTRs, as it is tough to keep track of them.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
thank you for your reply
HRESULT ISysR::GetP(BSTR * Blob1) .here the Blob1 is the output parameter .Inline HRESULT ICTParam::SetB(_bstr_t Blob2) and here the Blob2 is the input parameter . i want to send the Blob1 for the SetB method .but it shows the window "send error report " .
|
|
|
|
|
Where exactly does it bomb? I presume your code will be looking like this
HRESULT ISysR::GetP(BSTR *Blob1)
{
SetB(_bstr_t(*Blob1));
}
First, if Blob1 is an out parameter, it means that there would be no memory allocated (SysAllocString memory) to it, so calling any BSTR methods on Blob1 will blow up. The code calling GetP will probably be like
BSTR val;
GetP(&val);
It's GetP's job to allocate memory for the BSTR and return it back. What does you SetP method look like?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|