|
Hiya how do I check the contents of the recv function in window sockets??
I want to check the contents of the string, char by char.
This is my code so far:
int ret;
CString text;
for( int nReceivedBytes = 0;nReceivedBytes < 255; )
{
ret = recv( sock_Accept,text,255, 0 );
if( ret > 0 )
{
nReceivedBytes += ret;
}
}
Thanks,
grahamoj.
|
|
|
|
|
What do you mean check the contents of the string? Given that your code stores the incoming data into variable text, one solution is to check the CString object via [] operator.
Kuphryn
|
|
|
|
|
Hey all,
I want to get a list of exported DLL functions from a DLL (like Dependency Walker does) - along with each function's entry point.
How do I do that?
Thanks!
|
|
|
|
|
I may be wrong, but isn't the code for the Dependency Walker part of the examples shipped with Visual Studio?
Regards,
Alvaro
There are no stupid questions, but there are a lot of inquisitive idiots. -- despair.com
|
|
|
|
|
As far as I know - no...
I also looked for it on MSDN and couldn't find it.
Any other ideas? :-/
|
|
|
|
|
find some articles about the PE file format(it's the file format of exe and dll ... files).
i found a very nice tutorial at http://spiff.tripnet.se/~iczelion/tutorials.html
have a look at these tutorials, then u just have to code
have fun
|
|
|
|
|
Hey all,
I want to get a list of exported DLL functions from a DLL (like Dependency Walker does) - along with each function's entry point.
How do I do that?
Thanks!
|
|
|
|
|
Hello there
I would like to be able to open files from the left frames (I use Windows Explorer's TreeView style and a RichEditView app)
How could people open files from the tree when they double-click it?
Or how could I create a permanent (not included in each new window) tree control that could be used to open files faster?
|
|
|
|
|
Your question has more to do with design than technique. One solution is add a double mouseclick handler for the tree control. Open the file if applicable.
Kuphryn
|
|
|
|
|
Use a dialog bar for the tree (there are many examples around here), and the sole CRichEditView as an MDI child view.
Regards,
BB
|
|
|
|
|
It crashes in afxwin2,. saying for the postmessage that(IsWindow) isnt true.
Here is my code:
void CTrio::OnClose()
{
<code>
m_pParentWnd->PostMessage(UDM_PHOTO_CLOSED,WPARAM(this),0);
}
CDialog::OnClose();
DestroyWindow();
}
If I add the commented out if., it never goes into it to post.
AFXWIN_INLINE BOOL CWnd::PostMessage(UINT message, WPARAM wParam, LPARAM lParam)
{ ASSERT(::IsWindow(m_hWnd)); return ::PostMessage(m_hWnd, message, wParam, lParam); }
#
Appreciate your help,
ns
|
|
|
|
|
You have your "if (IsWindow" line commented out.
Regards.
Alvaro
There are no stupid questions, but there are a lot of inquisitive idiots. -- despair.com
|
|
|
|
|
I know....but if I put the if in, the messgae NEVER gets posted!! I need to post it!
Appreciate your help,
ns
yet I've posted to the parent successfully with the same pointer elsewhere.....
|
|
|
|
|
Is your parent window still around at this point? If so, use the debugger to check that the value of your member variable is still valid. Perhaps it's getting changed somewhere.
Also, if your parent is going away before the dialog box, and that's OK with you, you may consider moving the code in your message handler to the dialog's class. Another option is to write code in the parent window to close the dialog box before going away.
Regards,
Alvaro
There are no stupid questions, but there are a lot of inquisitive idiots. -- despair.com
|
|
|
|
|
My parent is not going away at all!!!! not before and not after! I'll check the debugger. Thanks.
Appreciate your help,
ns
|
|
|
|
|
This is bizaare, but I had so many classes where I used the parentWnd that in this one I didnt even retrieve it from the CReate() function where it came in as a 'this'. Fine. I see my carelessness that the debugger promptly showed me (thanks A M )
BUT my code compiled with this m_pPArentWnd variable being used but never declared anywhere in the class!!!! I checked several times but I do NOT have an m_pParentWnd defined in this class!!!
Appreciate your help,
ns
|
|
|
|
|
m_pParentWnd is a protected member of the CDialog class. Any class derived from CDialog will have access to this member variable.
See file AfxWin.h line 2639.
HTH
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Thanks!!! I was really puzzled, and when I looked inb MSDN under CWNd there was no such member. Guess I should have searched for it in the MFC folder....
Appreciate your help,
ns
|
|
|
|
|
ns,
I recommend you get acquainted with the F12 key. It takes you to where things are defined. If you had put the cursor on the variable and pressed F12, it would have taken you straight to where it's defined inside the CWnd source code!
All that's required is for you to add "Browse Info" to the project, which it will prompt you to do the first time you press F12. It's a really handy shortcut -- it's also part of the "right-click" menu.
Regards,
Alvaro
There are no stupid questions, but there are a lot of inquisitive idiots. -- despair.com
|
|
|
|
|
I didnt know about F12! Many thanks!
Appreciate your help,
ns
|
|
|
|
|
Hi guys,
I have a dialog with a slider control. I can use ON_WM_HSCROLL() and the OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) function to catch my slider. But what can I do if a have more than one slider?
I think that the fourth parameter "CScrollBar* pScrollBar" is supposed to be used to identify witch slider has been used. But i dont know how to used it?
help me please.
Regards
Everything's beautiful if you look at it long enough...
|
|
|
|
|
MemLeak wrote:
think that the fourth parameter "CScrollBar* pScrollBar" is supposed to be used to identify witch slider has been used. But i dont know how to used it?
in your OnHScroll, compare that pScrollBar to the address of your slider:
if ((CWnd*)pScrollBar == &m_mySlider) {...}
or
if ((CWnd*)pScrollBar == GetDlgItem(IDC_MY_SLIDER)) {...}
-c
When history comes, it always takes you by surprise.
|
|
|
|
|
Thanks!!
That's what I was looking for.
Everything's beautiful if you look at it long enough...
|
|
|
|
|
Hi everyone,
First thanks for all of your help. It helps improve my knowledge everyday. Now for my next attempted trick I've created a dll which has a bunch of dialogs meant to pop up when called by an external app.
one of these dialogs requires the use of InitCommonControlsEx() becuase it uses the Progress control. I have initialized everything, and when the function is called it goes through the initialization process fine, but the dialog box NEVER gets displayed. I have no idea why. Here's my init code:
INITCOMMONCONTROLSEX InitCtrls;
// Initialize the common controls
InitCtrls.dwSize = sizeof(INITCOMMONCONTROLSEX);
InitCtrls.dwICC = ICC_PROGRESS_CLASS;
InitCommonControlsEx(&InitCtrls);
hTemp =CreateDialog(hDllHInstance,
MAKEINTRESOURCE(IDD_WORKING),
hWnd,
IuxWorkingDialogBoxWndProc);
if (hTemp == NULL)
error = GetLastError();
And the initialization in the WndProc (clipped from the rest of the function):
HWND m_hProgress;
switch( msg ) {
case WM_INITDIALOG:
m_hProgress = GetDlgItem(hDlg, IDC_PROGRESS);
SendMessage(m_hProgress, PBM_SETRANGE, 0, MAKELPARAM(0, m_progressRange));
SendMessage(m_hProgress, PBM_SETSTEP, 1, 0);
m_progressCounter = 0; // reset the progress counter
return 1;
break;
Any suggestions? Thanks in advanced.
|
|
|
|
|
Stupid me. I knew it was something dumb. I forgot to set the dialog to a popup. It was set to child. Doh!
Thanks anyways!
|
|
|
|