|
Is this in an MFC app (yes, I know you're using an MFC class CSocket)? Is it a console/service
application or a GUI application?
|
|
|
|
|
its a GUI based application
|
|
|
|
|
I would start by stepping into your CClientSocket::Attatch() function in the debugger
and you'll see what line the exception occurs on. Put a breakpoint on this line
pSocketForClient->Attatch(hSocket); // Problem is here
and use F11 key to step into the Attatch() function. There' s probably a pointer issue of
some kind. If you post the code for Attatch() maybe I can help a little
Mark
|
|
|
|
|
Hi Mark
I dint override the Attatch() member function of CAsyncSocket class.
I stepped in to the framework code of MFC.
i'm giving the details, where it is going wrong.
File : MAP_PP.CPP
Function : void* CMapPtrToPtr::GetValueAt(void* key) const
Line: 179
Code: if (m_pHashTable == NULL)
return NULL;
because of the abov code, some runtime error is occuring.
Pls suggest me, where it may go wrong?
ramana.
|
|
|
|
|
Do you have something like this in your app class' InitInstance() ?
if (!AfxSocketInit())
{
::SetCursor(::LoadCursor(0, IDC_ARROW));
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return FALSE;
}
|
|
|
|
|
ya. i have the code in InitInstance() method of APP class
if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return FALSE;
}
|
|
|
|
|
hmmm should work.
The only thing I can think of at this point is that your thread that you pass the socket to
needs to have a message loop because the CSocket/CAsyncSocket classes use a window for socket
messages. I'm not sure if this is related to the exception you are getting though
When you stepped into the Attach function, how far did it get? Specifically, how far into the
CAsyncSocket::AttachHandle() did it go? Did the CreateEx() for the window succeed?
We'll figure this out
|
|
|
|
|
I'm using VC7.1. And I want to disable the default behaviour of the Ecs key for a print preview view.
Can Anybody help me? Thanks in advance.
Max
|
|
|
|
|
I have added an OnKeyDown() message handler for the CPreviewView derived class in the project, but it has no chance to be invoked.
|
|
|
|
|
Hi,
Maybe I had run across the similar problem like yours,i mean,the one OnKeyDown() can't get called.
I think probably it's because the view to which your OnKeyDown() belongs doesn't have the input focus,so it seems you should let the view owns the input focus in someway.
Hope it could be of some help,good luck!
|
|
|
|
|
Thanks, graceleee.
But I cannot figure out how to get my view have the input focus.
|
|
|
|
|
Can a game controller be used with VC++? I haven't done anything on this, but was wondering if a controller could be used as an input device in a regular VC++ application in place of a mouse. Since there are more buttons on a controller than a mouse, can they be detected in a program? Does anyone recommend any particular controller if I wanted to work with this? Any references on this? Thanks.
|
|
|
|
|
It's detected by DirectX. Install DX and you can use it.
Christian Graus - C++ MVP
|
|
|
|
|
In my server application,I use Memory pool to malloc
memory in heap and use stack variable whenever possible,
During test,we found no memory leak from the report of memory
pool. However I did find one strange problem which puzzles me
for a long time:
the physical memory which server applications uses varies too
much, when the program starts it is 12MB,however in 5 minutes
maybe it goes to 50MB or so,Then at some time it drop 35MB suddenly
to 15M.
I use Microsoft WMPPlayer Active control ,it did have some
effects on the problem above,but even I remove it ,the problem also
not solved ,only the peak memory use would be brought down to 40MB.
I am wondering if the physical memory page problem ,or any thing
related to the Microsoft Win2000 professional system's memory management.
I try to find some information on Internet ,but none is helpful.So
I beg for any suggestions or sharing experience here .Thank you in advance.
|
|
|
|
|
How do you tell how much is being used ?
Christian Graus - C++ MVP
|
|
|
|
|
I get the memory my application used from the Windows "Task Manager",
which has "Memory usage","Peak Memory Usage" column and etc
|
|
|
|
|
TM simply tells you the amount of your application's address space that is in use. This is quite different from the amount of that address space your program is actually using.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
How can a user-mode client achieve direct access to kernel streaming(KS) filter in video capture? I know there is a sample from microsoft using KS in audio rendering and capture. Is KS feasible in video capture? Any suggesion and samples will be appreciated. Thanks in advance.
|
|
|
|
|
Hi,this is my first post here.I have a problem troubling me for days.
How to popup a menu after i strike a previously associated key,just like direct mouse click on the menu?
Say,in app-wizard created doc/view application,i associated 'File' menu with key 1 and 'View' with 2. I want to popup the File menu(all first level submenus under it 'popup') at the stroke of key 1 and View menu at key 2.
I tried handling WM_KEYDOWN message in view and in OnKeyDown() set the relevant menu item to MFS_HILITE(because i couldn't find other more suitable flags like MFS_POPUP or MFS_ACTIVATE etc).But it only hilite the File item itself instead of poppinp up submenus under it.Here is my code
<br />
void CMyView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)<br />
{<br />
if(nChar >= 0x31 && nChar <= 0x39) {
int nPosition = nChar - 0x30 -1;<br />
CMenu *pMenu = GetParentFarme()->GetMenu();<br />
MENUITEMINFO mii;<br />
ZeroMemory(&mii, sizeof(MENUITEMINFO));<br />
mii.cbSize = sizeof(MENUITEMINFO);<br />
mii.fMask = MIIM_STATE;<br />
mii.fState = MFS_HILITE;<br />
<br />
pMenu->SetMenuItemInfo(nPosition,&mii,1);<br />
GetParentFrame()->DrawMenuBar();<br />
}<br />
else {<br />
...<br />
}<br />
}<br />
I also tried the TrackPopupMenu(),but it doesn't seem the right direction.
I have seached web but couldn't get an answer like before i did.Could anyone help me out? Thanks a lot!
|
|
|
|
|
Hi all!
I have a problem of copying and pasting on my SDI application. My view is derived from CFormView. I created some edit controls,... on it but when i run my application, i can't use Ctrl+C or Ctrl+V to copy or paste . Who can help me
Thank in advance!
Rgs!
|
|
|
|
|
I am trying to write a simple application that is capable of zipping files. To do this I am using ‘LiteZip’.
I am writing with Visual C++ 2005.
The code which generates the error is:
#include "litezip.h"
HZIP hz;
ZipCreateFile(&hz,"FileName.zip",0);
The error message is:
error C2664: 'ZipCreateFileW' : cannot convert parameter 2 from 'const char [9]' to 'const WCHAR *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
From what I understand, I need to convert a CHAR to WCHAR.
This is done by…. ??
Regards
Pete
|
|
|
|
|
Since you have Unicode enabled, try:
HZIP hz;
ZipCreateFile(&hz,L"FileName.zip",0);
|
|
|
|
|
Mark...... you're a legend !!
All Ok now.
So what does the 'L' basically do ?
Cheers
Pete
|
|
|
|
|
Fritzables wrote: So what does the 'L' basically do ?
It makes the literal string's type wchar_t instead of char.
|
|
|
|
|
Oooops, now I get a:
LNK2028: unresolved token (0A00001B) "extern "C" unsigned long __stdcall ZipCreateFileW(void * *,wchar_t const *,char const *)" (?ZipCreateFileW@@$$J212YGKPAPAXPB_WPBD@Z) referenced in function "public: void __clrcall SystemInitialisation::ListUnmergedFiles(void)" (?ListUnmergedFiles@SystemInitialisation@@$$FQ$AAMXXZ)
|
|
|
|