|
Do you have more information? What protocol do you use on your socket? HTTP, FTP, in-house?
If the protocol you use specifies in its header the number of incoming bytes, make sure you don't miscalculate.
Michel
If I am wrong or said something stupid, I apologize in advance
|
|
|
|
|
I want to record sound with callback function.
I call waveInOpen, waveInPrepareHeader, waveInAddBuffer etc. successfully.
And I can get WIM_OPEN and WIM_CLOSE message in the callback function.
BUT I CAN'T get WIM_DATA message! Why???
BTW: I can get MM_WIM_DATA message when I use threads instead of callback
function, and I can get WOM_DONE message when using callback function waveOutProc.
|
|
|
|
|
Hey!
I found the answer.
I forget to call waveInStart.
|
|
|
|
|
As title.
I'm amumu, and you?
|
|
|
|
|
iS it possible to get the system's image list and use that to a tree control so that it the images in the tree control of Windows Explorer is the same as with the images of the tree control my application??
|
|
|
|
|
How do i capture the whole viewport size of a CScrollView to a bitmap?...
I'm making a paint program and i want to save the whole drawing including the hidden part of the bitmap.... (the part which is not scrolled)...
I tried Bitbliting the ScreenDC into memDC which has a bitmap attached to it
but it only captured the visible part.. worst it also captured the Scrollbars...
|
|
|
|
|
Hi,
I am using AfxMessageBox() API in my application.Sometimes the message box doesn't come up and when I debugged and saw found that the return value is 0 which means that there is no enough memory to display the message box.What do I do to solve this problem?
Thank You.
Yamuna.E.
Yamuna.E.
|
|
|
|
|
Buy more RAM ?
I've NEVER had AfxMessageBox fail, what makes you think it's memory related ? When does it happen ?
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Even for me this is the first time AfxMessageBox fails.
MSDN tells that AfxMessageBox on failure returns 0 and that it is due to no enough memory.
I forgot to mention the scenario.
This messagebox I call from within a thread function(via CreateThread) which takes as its parameter the string to be displayed and I am sure there is no problem with string passing.This I made sure by hard-coding the string just to check whether it works fine with hard-coded string value.But even in that case I got the same problem.
But now I tried using MessageBox API instead of AfxMessageBox.Its working fine.But couldn't get the reason behind the problem.
Thank You.
Yamuna.E.
Yamuna.E.
|
|
|
|
|
It's certainly an odd problem. In the future, TRACE or OutputDebugString will allow you to check a variable value in Debug mode without having to bring up a dialog.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Fine Thank You.
Yamuna.E.
Yamuna.E.
|
|
|
|
|
Hi all!
I want to do next: user clicks the button, and Web Browser replaces by richedit control (in a dialog). TROUBLE: after hiding of web browser, its window handle become not valid. Here's a code:
void CCalendarDlg::OnViewEditSwitch()
{
CString strBtnText;
m_btnEditView.GetWindowText(strBtnText);
if(strBtnText == EDIT_BUTTON_TEXT)
{
m_btnEditView.SetWindowText(VIEW_BUTTON_TEXT);
m_Browser.ShowWindow(SW_HIDE);
m_wndRichEdit.ShowWindow(SW_SHOW);
}
else
{
m_btnEditView.SetWindowText(EDIT_BUTTON_TEXT);
m_wndRichEdit.ShowWindow(SW_HIDE);
m_Browser.ShowWindow(SW_SHOW);
}
}
ERROR:
Debug assertion failed here:
BOOL CWnd::ShowWindow(int nCmdShow)
{
ASSERT(::IsWindow(m_hWnd));
if (m_pCtrlSite == NULL)
return ::ShowWindow(m_hWnd, nCmdShow);
else
return m_pCtrlSite->ShowWindow(nCmdShow);
}
Help, please!
|
|
|
|
|
I solve the problem so:
void CCalendarDlg::OnViewEditSwitch()
{
CString strBtnText;
m_btnEditView.GetWindowText(strBtnText);
if(strBtnText == EDIT_BUTTON_TEXT)
{
m_btnEditView.SetWindowText(VIEW_BUTTON_TEXT);
//m_Browser.ShowWindow(SW_HIDE);
m_Browser.SetWindowPos(this, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOZORDER);
m_wndRichEdit.ShowWindow(SW_SHOW);
}
else
{
CRect rc;
m_wndRichEdit.GetWindowRect(&rc);
::MapWindowPoints(HWND_DESKTOP, *this, (LPPOINT) &rc, 2);
m_btnEditView.SetWindowText(EDIT_BUTTON_TEXT);
m_wndRichEdit.ShowWindow(SW_HIDE);
m_Browser.SetWindowPos(this, 0, 0, rc.Width() , rc.Height(),
SWP_NOMOVE | SWP_NOZORDER);
//m_Browser.ShowWindow(SW_SHOW);
}
}
But I'm interested in problem description... Why handle became invalid?
|
|
|
|
|
Is there anyway to test the DLL generated when creating a method which is to be called via CeRapiInvoke()?? I tried to a a LoadLibrary on it and don't get a handle back.
|
|
|
|
|
what are you trying to do exactily ?
Are you trying to use RAPI, if so you should be linking your software to 'rapi.lib' and include 'rapi.h', these come with the Handheld PC SDK. RAPI is no COM complient.
Regards
Ray
"Je Suis Mort De Rire"
|
|
|
|
|
Well....I'm already using RAPI and it works fine with a PDA. What I was asking was if there is a way to debug DLLs designed to be used in conjuction with CeRapiInvoke(). I could create another DLL project and simply reuse the call but I'm trying to debug the x86 DLL generated by eVC.
Paul
|
|
|
|
|
ive tried both of these, and it still aint working
//WideCharToMultiByte(0,0,_ip_name,wcslen(_ip_name)+1,tempbuf_ip,256,0,0);
MultiByteToWideChar(CP_ACP, 0, tempbuf_ip, -1, (WCHAR*)_ip_name,256);
this is my code.
char *tempbuf_ip;
WCHAR _ip_name[256];
GetDlgItemText(hwnd, IDC_IP, tempbuf_ip, 256);
//WideCharToMultiByte(0,0,_ip_name,wcslen(_ip_name)+1,tempbuf_ip,256,0,0);
//MultiByteToWideChar(CP_ACP, 0, tempbuf_ip, -1, (WCHAR*)_ip_name,256);
and then _ip_name points to:
if( FAILED( hr = CreateHostAddress( _ip_name ) ) )
{
//blah
}
CreateHostAddress points to a WCHAR*;
HRESULT CreateHostAddress(WCHAR* pwszHost)
-Thanks for any help
|
|
|
|
|
You are trying to convert to BSTR. #include <comutil> ( from memory, or comdef, maybe ? ) and cast to _bstr_t.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Well first off, there isn't any memory behind the tempbuf_ip pointer. Try defining tempbuf_ip as char tempbuf_ip [256].
After that,
MultiByteToWideChar(CP_ACP, 0, tempbuf_ip, -1, _ip_name,256);
should work just fine.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
I usually do this:
#include <atlconv.h>
USES_CONVERSION;
CString data;
m_dataBox.GetWindowText(data);
BSTR bstr = ::SysAllocString (A2W(data));
/moliate
|
|
|
|
|
moliate wrote:
BSTR bstr = A2W(data);
This line is bogus. When you will try to free the memory from the BSTR, your program is likely to crash.
The fact is that a BSTR has its 4 preceding bytes (the bytes before the actual string) specifying the length of the string. So a function expecting a BSTR will likely make your program crash. I suggest to replace with:
BSTR bstr = A2BSTR(data);
and don't forget to ::SysFreeString(bstr) !!
Michel
If I am wrong or said something stupid, I apologize in advance
|
|
|
|
|
You are absolutly right. I had forgotten the ::SysAllocString in the sample.
/moliate
|
|
|
|
|
Thanks for all the help guys, got it to work just fine now
I used _bstr_t.
|
|
|
|
|
ive tried both of these, and it still aint working
//WideCharToMultiByte(0,0,_ip_name,wcslen(_ip_name)+1,tempbuf_ip,256,0,0);
MultiByteToWideChar(CP_ACP, 0, tempbuf_ip, -1, (WCHAR*)_ip_name,256);
this is my code.
char *tempbuf_ip;
WCHAR _ip_name[256];
GetDlgItemText(hwnd, IDC_IP, tempbuf_ip, 256);
//WideCharToMultiByte(0,0,_ip_name,wcslen(_ip_name)+1,tempbuf_ip,256,0,0);
//MultiByteToWideChar(CP_ACP, 0, tempbuf_ip, -1, (WCHAR*)_ip_name,256);
and then _ip_name points to:
if( FAILED( hr = CreateHostAddress( _ip_name ) ) )
{
//blah
}
CreateHostAddress points to a WCHAR*;
HRESULT CreateHostAddress(WCHAR* pwszHost)
-Thanks for any help
|
|
|
|
|
I suggest:
WCHAR *_ip_name = A2W(tempbuf_ip);
The beauty of this, you don't need to deallocate memory, since A2W uses _alloca.
Anonymous wrote:
char *tempbuf_ip;
WCHAR _ip_name[256];
GetDlgItemText(hwnd, IDC_IP, tempbuf_ip, 256);
This last line of the snippet above is likely to make your program crash since GetDlgItemText expects that tempbuf_ip points to a valid block of memory, which is not the case, unless you took off some code statements from your example.
Michel
If I am wrong or said something stupid, I apologize in advance
|
|
|
|
|