|
CodingLover wrote: if(szMyBuffer != L"")
As Joe said, this isn't the buffer itself. You cannot check using the == operator.
If you are using std::string or CString, you could. That too I'd prefer checking their lengths. For buffers you could use CRT routines :
MSDN[^]
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
if (*szMyBuffer)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi all,
i have an ascii value in unsigned char* buffer, i want to convert it in Hex.
please tell me how can i convert it in hex.
and i also want to convert hex values in decimal .
so please tell me how can i do this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
If you are using CString , then you haven't read my previous reply to you, a few days ago: printf tutorial for you[^]
If you are not using MFC, still still MUST read the printf tutorial and you can use _stprintf[^]
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
thanks
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
If you actually wanted to be thankful, I'll be glad if you can please read the tutorials that you're asked to.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
What I'm trying to do is create a dialog resource, assign some buttons and edit boxes on it and attach it to a CDockablePane object so that I can dock the dialog. How can I do this?
|
|
|
|
|
eight wrote: How can I do this?
Which part exactly?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I've done this recently
In the OnCreate of your derived CDockablePane class, create a dialog with this as the parent of the dialog.
something like :
int YouDerivedClass::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;
m_YourDialog.Create(IDD_SOMETHING, this);
}
Do forget to set the style of your dialog to childand no border
This signature was proudly tested on animals.
|
|
|
|
|
Here are the steps that I took.
1. I've created a new MFC SDI project (DialogDockableTester ), with Visual Studio style, maximized, and with ribbons.
2. I've created a dialog, IDD_TEMPDLG . Border = None, Style = Child.
3. Added class CTempDlg : public CDialog to use IDD_TEMPDLG
4. Added class CMyDockablePane : public CDockablePane
5. Added an object of CTempDlg, m_TempDlg in CDialogDockableTesterView
6. Overridden CMyDockablePane::OnCreate(LPCREATESTRUCT lpCreateStruct) with this
int CMyDockablePane::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;
m_TempDlg.Create(IDD_TEMPDLG, this);
return 0;
}
7. Added an object of CMyDockablePane, m_MyDockablePane in CMainFrame
8. Added this line in CMainFrame::OnCreate
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
:
:
if (!m_MyDockablePane.Create(_T("MyDockablePane"), this, CRect(0, 0, 200, 200), TRUE, 100, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_BOTTOM | CBRS_FLOAT_MULTI))
{
return FALSE;
}
m_MyDockablePane.EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_MyDockablePane);
return 0;
}
Still can't get it to work. Am I missin something?
|
|
|
|
|
I just retried with a simple project, and I had to set the dialog visiblity.
int MyPage::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;
BOOL bRet = myDialog.Create(IDD_DIALOG1, this);
ASSERT( bRet );
myDialog.ShowWindow(SW_SHOW);
return 0;
}
In my mainframe :
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)
return -1;
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
CMDITabInfo mdiTabParams;
mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE;
mdiTabParams.m_bActiveTabCloseButton = TRUE;
mdiTabParams.m_bTabIcons = FALSE;
mdiTabParams.m_bAutoColor = TRUE;
mdiTabParams.m_bDocumentMenu = TRUE;
EnableMDITabbedGroups(TRUE, mdiTabParams);
CString s2("Page");
if (!myPage.Create(s2, this, CRect(0, 0, 200, 200), TRUE, ID_OPERATION_PAGE, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT| CBRS_FLOAT_MULTI))
{
TRACE0("Failed to create objectPage\n");
return FALSE;
}
myPage.EnableDocking(CBRS_ALIGN_ANY);
DockPane(&myPage);
CDockingManager::SetDockingMode(DT_SMART);
EnableAutoHidePanes(CBRS_ALIGN_ANY);
This signature was proudly tested on animals.
|
|
|
|
|
When I add the line
myDialog.ShowWindow(SW_SHOW);
It works! Thanks Maximilien. 
|
|
|
|
|
hi,
i've followed your step to pu dialog in dockpane but i can't see the dialog, i don't know how to fix this problem
Here are the steps that I took.
1. I've created a new MFC MDI project (DialogDockableTester), with Visual Studio style, maximized, and with ribbons.
2. I've created a dialog, IDD_TEMPDLG. Border = None, Style = Child.
3. Added class CTempDlg : public CDialog to use IDD_TEMPDLG
4. Added class CMyDockablePane : public CDockablePane
5. Overridden CMyDockablePane::OnCreate(LPCREATESTRUCT lpCreateStruct) with this
int CMyDockablePane::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDockablePane::OnCreate(lpCreateStruct) == -1)
return -1;
BOOL bRet = m_TempoDlg.Create(IDD_TEMPDLG, this);
ASSERT( bRet );
m_TempoDlg.ShowWindow(SW_SHOW);
return 0;
}
6. Added an object of CMyDockablePane, m_MyDockablePane in CMainFrame
7. Added this line in CMainFrame::OnCreate
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
// ....
CString s2("Page");
if (!myPage.Create(s2, this, CRect(0, 0, 200, 200), TRUE, ID_OPERATION_PAGE, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT| CBRS_FLOAT_MULTI))
{
TRACE0("Failed to create objectPage\n");
return FALSE; // failed to create
}
myPage.EnableDocking(CBRS_ALIGN_ANY);
DockPane(&myPage);
CDockingManager::SetDockingMode(DT_SMART);
EnableAutoHidePanes(CBRS_ALIGN_ANY);
//...
}
in your steps you added an object of CTempDlg, m_TempDlg in CDialogDockableTesterView, and i don'nt know how to use m_TempDlg in CDialogDockableTesterView.cpp
Am I missin something?
|
|
|
|
|
I've recreated your project based on the given codes and it works. IDD_TEMPDLG is visible on the left side of the screen. An idea, CDockablePane state is automatically saved in the registry. If you're familiar with registry, you might want to delete "HKEY_CURRENT_USER > Software > Local App-Wizard Generated Applications > DialogDockableTester".
|
|
|
|
|
Hi,
what i have is a window split horizontally, and the dockpane is tranparent and on the down.
what can i do?
|
|
|
|
|
Hi there
I have a strange problem.
I call the send function to send some bytes from a TCP sockets.
The sends command blocks until the socket receives a packet from the other side.
MSDN mentions that send blocks only if there is no buffer space in TCP stack.
But I only send 100bytes (plus there is no other network traffic)
Any ideas
Thanx
|
|
|
|
|
|
try Rose, it's really pretty.
|
|
|
|
|
Just handle the WM_ERASEBKGND message.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
It's worked.
Thanks David.
|
|
|
|
|
I found this code a little confusing. Due to proprietary nature of the original source, I have to abstract this out.
What does const void return value mean? I can understand the intent of "const void*" return value, but "const void" seems to be just a typo?
Am I missing anything fancy with the construct here?
#include <stdio.h>
typedef const void (*hello)();
const void x()
{
printf("x() is called\n");
}
int main()
{
hello test=x;
test();
}
|
|
|
|
|
I don't believe you're missing anything - it does seem odd.
In fact, gcc raises a warning on a function returning const void:
a.c:2: warning: function definition has qualified void return type
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hm... which gcc are you using? Mine doesn't even complain about it.
~
$ cat x.c
#include <stdio.h>
typedef const void (*hello)();
const void x()
{
printf("x() is called\n");
}
int main()
{
hello test=x;
test();
}
~
$ gcc x.c
~
$ ./a.exe
x() is called
~
$ gcc --ver
Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs
Configured with: /usr/build/package/orig/test.respin/gcc-3.4.4-3/configure --ver
bose --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libe
xecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-langu
ages=c,ada,c++,d,f77,pascal,java,objc --enable-nls --without-included-gettext --
enable-version-specific-runtime-libs --without-x --enable-libgcj --disable-java-
awt --with-system-zlib --enable-interpreter --disable-libgcj-debug --enable-thre
ads=posix --enable-java-gc=boehm --disable-win32-registry --enable-sjlj-exceptio
ns --enable-hash-synchronization --enable-libstdcxx-debug
Thread model: posix
gcc version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
|
|
|
|
|
i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5490)
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
crewchill wrote: I found this code a little confusing.
Yes. Working with legacy code I often find confusing items or constructs. My initial reaction is, like yours:
crewchill wrote: Am I missing anything fancy with the construct here?
Then later it becomes apparent that the author was just stupid.
On the bright side, tomorrow is FRIDAY! ![Jig | [Dance]](https://codeproject.global.ssl.fastly.net/script/Forums/Images/jig.gif)
|
|
|
|