|
HI,
I have delevoped a Client Server multithreaded application using CSocket, I am getting Socket Notification Sink error.
Wht iy is ? How can remove this ?
Thanks
Regards.
|
|
|
|
|
look Here[^]
"A winner is not one who never fails...but the one who never quits"
|
|
|
|
|
How does I use .jar lib in visual C++
|
|
|
|
|
Why do you really want to use the java library in C++?
AFAIK , You will need to host the JVM for that ..
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
You can run jar file if and only if you are hosted JVM. But you can open, view, read and modify the Jar file from VC++ since Jar file has the same file format as ZIP file.
http://www.artpol-software.com/index_zip.html
Here is library which can be used for accessing zip archives.
Benoy Bose
|
|
|
|
|
You might want to have a look at Java Native Interface, JNI, found here: JNI
-- modified at 9:22 Monday 3rd July, 2006
fogot to add the link
|
|
|
|
|
I am a beginner. I am trying to display the HWND when i use certain Win32 functions such as GetForegroundWindow() for debugging purposes. When i use MessageBox or OutputDebugString such as below...
m_foreHwnd1 = GetForegroundWindow();
MessageBox(NULL, (LPCSTR)m_foreHwnd1, "INFO", MB_OK);
OutputDebugString("ForeHwnd1: ");
OutputDebugString((LPCSTR)m_foreHwnd1);
OutputDebugString("\n");
... I get errors like the following:
First-chance exception at 0x77e26673 in SendFocusWin.exe: 0xC0000005: Access violation reading location 0x00090548.
Unhandled exception at 0x77e26673 in SendFocusWin.exe: 0xC0000005: Access violation reading location 0x00090548.
Can i display the HWND so i can see what the heck is going on in my code? What is the How To?
|
|
|
|
|
First thing you need to learn is that you do not cast things without knowing exactly what you are doing as you can shoot yourself in the foot, like what you have done here.
m_foreHwnd1 = GetForegroundWindow();
CString szMessage;
szMessage.Format(_T("ForeHwnd1: 0x%08X\r\n"), m_foreHwnd1);
OutputDebugString(szMessage);
|
|
|
|
|
Did you try Format function of CString
else try this
CString strHwnd;
strHwnd.Format(_T("Handle is: %d\n"), m_foreHwnd1);
OutputDebugString(strHwnd);
"Dream bigger...Do bigger...Expect smaller"
aji
|
|
|
|
|
GetForegroundWindow() API will return handle to active window with which user is interacting, so in debugging mode you constantly switch between your app and debug window. so its difficult to know window handle.
Not sure what are you trying to do, but try this to display window handle in output window.
CString str;<br />
str.Format("%x",m_foreHwnd1);<br />
OutputDebugString(str);
Hope this helps
|
|
|
|
|
If u r able to solve ur problem with our answers then please tel it so that we get some confidence
"Dream bigger...Do bigger...Expect smaller"
aji
|
|
|
|
|
I think i posted on the wrong forum. I now see that there is a forum that supports STL questions, which i think would help come up with a ANSI version of the solution you folks provided. Sorry. But thanks for the excellent response!
|
|
|
|
|
HI PLZ TELL ME HOW TO CREATE SPLIT WINDOW IN MFC(SDI)
I CREATE IT BUT IT DOES NOT WORK
I ALREADY PUT MY QUESTION BUT NOBODY SOLVE MY PROBLEM
PLZ SOLVE BY GIVING EXAMPLE
Ashish Dogra
MCA
Noida
|
|
|
|
|
If you really want to split a window and know how it is done a simple way is to Create a new MFC Application and in the fourth or Fifth step(I don't remember exactly) you can choose for Window Explorer view instead of MFC View.
In this way you will be able to see a window split in two parts just like the explorer.
If you want to see the code open the mainframe.cpp file and there you can study
OnCreateClient function
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
thanks sir
but i want to split it into four or more panes and also add scroll bars for each window.
plz tell me sir
Ashish Dogra
MCA
Noida
|
|
|
|
|
You just have to get with that in the same manner as in my previous post.Just pass the number of partitions you create to CreateStatic and that number of classes that are derived from CView will help.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
try this:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)<br />
{<br />
BOOL res = m_splilter.CreateStatic(this,2,1);<br />
m_splilter.CreateView(0,0,RUNTIME_CLASS(CsplView),CSize(0, 200), pContext);<br />
m_splilter.CreateView(1,0,RUNTIME_CLASS(COtherView),CSize(200, 200), pContext);<br />
return TRUE;<br />
}
Where CsplView is a default view class generated by Wizard
and COtherView is class derived from Cview.
Hope these help.
|
|
|
|
|
Can we subclass scrollbar of an listbox or combobox into a custom one?
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
Dear All,
I have a MDI application and I'm currently trying to programmatically change the active view.
So in sort I have a combo box on my toolbar which list the views currently open.
When I select a different view in this combobox I want that view to come into focus. Basically it should do exactly the same as selecting the view from the 'Window' main menu option.
I have tried sending the WM_MDIACTIVATE message to the main frame but this doesn't seem to work.
Any suggestions would be gratefully received.
Many thanks
Tom
|
|
|
|
|
I would suggest you the MDIActivate member of CMDIFrameWnd class.
I hope it works.
|
|
|
|
|
Hi
Thanks for the suggestion of using MDIActivate, unfortunately this doesn't seem to do trick when I call the following:
pMainFrm->MDIActivate((CWnd*)pView);
Where pView is a pointer to the view I want to activate and bring to the front of all other view windows.
I was wondering if I should be casting here and whether I had used the function correctly.
Thanks
Tom
|
|
|
|
|
I suppose the parameter of MDIActivate should be a frame window (CMDIChildWnd ) which contains your view.
Try this:
CWnd * p = pView->GetParent();
ASSERT_KINDOF(CMDIChildWnd, p);
pMainFrm->MDIActivate(p);
|
|
|
|
|
I wrote the following procedure to activate views programatically. It's a bit specialised, but I hope it might give you some useful clues. The bit underneath the comment "//There is already a View displaying this parent..." activates the view pointed to by pView.
CKernelView* CMainFrame::ActivateView(CModel* pParentModel)
{
CKernelView *pView, *pActiveView;
CWnd* pBar;
CMDIFrameWnd *pFrame;
CMDIChildWnd *pChild;
pBar = GetDlgItem(IDD_NAVIGATOR_BAR);
pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;
pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();
pActiveView = (CKernelView*)pChild->GetActiveView();
if (pActiveView->m_pParentModel == pParentModel)
pView = pActiveView;
else if (pParentModel->m_pShadow != NULL)
{
pView = pParentModel->m_pShadow->m_pView;
pFrame = (CMDIFrameWnd*)pView->GetParentFrame();
pFrame->ActivateFrame(SW_RESTORE);
}
else if (pBar->IsDlgButtonChecked(IDC_TRACK_NEW))
pView = pParentModel->OpenView(m_pDocViewed, pParentModel->m_PlantFlag);
else
{
pView = pActiveView;
pView->ChangeModel(pParentModel);
}
return pView;
}
Best Regards
Cliff
-- modified at 17:36 Monday 3rd July, 2006
|
|
|
|
|
Hi guys i got stuk in a problem........
i want to read the unicode file with C/C++......
thnx in advance
here is the piece of code
FILE* fp = NULL;
wchar_t* buf = (wchar_t*)malloc(sizeof(wchar_t) * 200);
wchar_t* retbuf = NULL;
if ((fp = fopen("d:/GRCasual.txt", "r")) == NULL) // opens the file
{
return 0;
}
while(!feof(fp))
{
/*fseek(fp,sizeof(char),SEEK_CUR); */
retbuf = fgetws(buf, 200, fp);
}
if( fp )
fclose(fp);
return 0;
Best Rgards
Rocky
|
|
|
|
|
I shall assume you are trying to read a UTF16LE (with BOM) file and I shall also assume you are compiling with UNICODE defined.
FILE* fp = NULL;
wchar_t buf[201];
wchar_t bom;
if ((fp = fopen("c:\\GRCasual.txt", "r")) == NULL)
{
return 0;
}
size_t read = fread(&bom, sizeof(bom), 1, fp);
if(bom == 0xFEFF)
{
while(!feof(fp))
{
read = fread(buf, sizeof(buf[0]), (sizeof(buf) / sizeof(buf[0])) - 1, fp);
buf[read] = '\0';
MessageBox(NULL, buf, L"Text", MB_OK);
}
}
if( fp )
fclose(fp);
return 0;
But i think it would be better to use this instead. If you use the C functions like fopen you can't open files with unicode filenames...
http://www.codeproject.com/file/stdiofileex.asp[^]
|
|
|
|