|
CPallini wrote: I wonder if the above expression correctly addresses multibyte strings
Why wouldn't it?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: Why wouldn't it?
No more objections. You're right (maybe I found something [^] clearifying your point... )
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.
|
|
|
|
|
|
Basically, I want to convert a DWORD to a LPCSTR for use in an edit box, but I don't really know how to go about this. If I can do this with an API function, that would be recommended.
|
|
|
|
|
char buf[20];
sprintf(buf, "%u", myDWORD);
|
|
|
|
|
boost::lexical_cast[^], which basically is a convenience wrapper around std::stringstream or itoa if you fell like using plain old C.
Failure is not an option - it's built right in.
|
|
|
|
|
Do you mean:"I want to show the string representation of a DWORD content in a edit box?"
If the answer is yes Then:
DWORD dwValue = ...;
CHAR buffer[34];
ltoa(dwValue, buffer, 10);
SendMessage(hWndEdit, WM_SETTEXT, (WPARAM)0, (LPARAM) buffer)
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 exactly what I was looking for, thanks!
|
|
|
|
|
Hi,
i try to transfer a String from a DialogBox (a simple CString)to a SDIView.
There i want to print it out with (TextOut), but how can i manage the transfer ???
Please Help !!!
Many Thx
SE
|
|
|
|
|
Just after closing the dialog box, get the CString from the member of the Dialog where it is stored (or create a getter function) and put it on the screen.
Failure is not an option - it's built right in.
|
|
|
|
|
Sry I'm a little confused.
Did You have some lines of Code on how to do this and where in the code please ?
M*A*N*Y T*H*A*N*X
SE
|
|
|
|
|
From the following Dialog, I read m_Name and use it in my Program.
MyDlg.h
// MyDlg dialog
class MyDlg : public CDialog
{
DECLARE_DYNAMIC(MyDlg)
public:
MyDlg(CWnd* pParent = NULL); // standard constructor
virtual ~MyDlg();
// Dialog Data
enum { IDD = IDD_MY_DLG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
// Control of the Name Edit-Field
CEdit c_Name;
// The name string
CString m_Name;
};
----------------------------------------------------------------------------
Mydlg.cpp
// MyDlg.cpp : implementation file
//
#include "stdafx.h"
#include "MyDlg.h"
// MyDlg dialog
IMPLEMENT_DYNAMIC(MyDlg, CDialog)
MyDlg::MyDlg( CWnd* pParent /*=NULL*/)
: CDialog( MyDlg::IDD, pParent)
, m_Name( _T(""))
{
}
MyDlg::~MyDlg()
{
}
void MyDlg::DoDataExchange( CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control( pDX, IDC_NAME, c_Name);
DDX_Text(pDX, IDC_NAME, m_Name);
}
BEGIN_MESSAGE_MAP(MyDlg, CDialog)
END_MESSAGE_MAP()
Failure is not an option - it's built right in.
|
|
|
|
|
Hi jhwurmbach,
thx for your help !
But How do you use the strName in your Code ?
When you press ok on your Dlg...
regards
CB
|
|
|
|
|
Hi,
i solved it in this way:
void CSDI_DLG_DatenaustauschView::OnDialog()
{
CDC *pDC = new CDC;
pDC = GetDC ();
MyDlg.DoModal ();
pDC->TextOut(100,100,MyDlg.m_strEdit);
}
regards
CB
|
|
|
|
|
I have a dialog-based project.I don't know why when I press Enter the dialog would hide?
There is no button with IDOK as its ID;
Thanks
|
|
|
|
|
|
I would have a try.
Thanks
|
|
|
|
|
You must override OkOn for Enter and OnCancel fo Esc buttons.
|
|
|
|
|
hi in my program
i have to write some msgs in a mailslot in one computerand i ve to read them in another computer..
the code i'm using for writing is:
handle = CreateFile("\\\\park-testbench4\\mailslot\\sample1",
GENERIC_WRITE,
FILE_SHARE_READ,
0,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
0);
if (handle == INVALID_HANDLE_VALUE)
{
printf("error in creating mailslot");
}
err = WriteFile(handle, MyMessage, sizeof(MyMessage), &numWritten, 0);
if (!err)
{
printf("error in writing");
}
if (sizeof(MyMessage) != numWritten)
printf("WriteFile did not read the correct number of bytes!\n");
park-testbench4 is my computer name..its writing fine...
and i'm using the following code to read:
handle = CreateMailslot("\\\\park-testbench4\\mailslot\\sample1",
0,
MAILSLOT_WAIT_FOREVER,
NULL);
if (handle == INVALID_HANDLE_VALUE)
{
printf("error in creating mailslot :%d",GetLastError());
}
for (;;)
{
DWORD msgSize;
BOOL err;
err = GetMailslotInfo(handle, 0, &msgSize, 0, 0);
if (!err)
{
printf("GetMailslotInfo failed");
}
if (msgSize != (DWORD)MAILSLOT_NO_MESSAGE)
{
char * buffer;
buffer = (char*) malloc(100);
if (!buffer) printf("An error getting a memory block!");
else
{
DWORD numRead;
err = ReadFile(handle, buffer, msgSize, &numRead, 0);
if (!err)
printf("ReadFile error: %d", GetLastError());
else if (msgSize != numRead)
printf("ReadFile did not read the correct number of bytes!");
else
{
printf("%s",buffer);
}
GlobalFree(buffer);
}
}
Sleep(1000);
}
}
but error is coming as Error in creating mailslot ...
why i'm getting such error only during reading...
any help..
thanx n advance..
|
|
|
|
|
mirraa wrote: but error is coming as Error in creating mailslot ...
What is the actual error?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hi
in my program i want to change the font to courier new so that i can type in courier new font n my scintilla window...
anyone please help me out how to change the default font of scintillawnd window...
thanx in advance....
|
|
|
|
|
what is a "scintillawnd" ?
|
|
|
|
|
This perhaps.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all
I am running a piece of code and it asserts . Any ideas why so ? . I use VC++ 6.0 Dialog based application
char* one ="hello";
StrRev(one);
.....
.....
void StrRev(char *s)
{
for(char *end = s + (strlen(s) - 1); (end > s) ; --end, ++s)
{
char tmpChar = (*s);
(*s) = (*end); <---- it throws exception here ....why ?
(*end) = tmpChar;
}
}
redindian
|
|
|
|
|
Change
dharani wrote: char* one ="hello";
to
char one[] ="hello";
|
|
|
|