|
Hi,
I have long value i am want to show in the dlg i used below code but its giveing error can any one help me with this..
long n;
n=INDX.total_words;
status->m_TOTAL_WORDS.SetWindowText(n);
---------------
Error
---------------
error C2664: 'SetWindowTextA' : cannot convert parameter 1 from 'long' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
----------------------------------------
Regards,
Parichay.
|
|
|
|
|
The function SetWindowText expect a char array, not a long. So use sprintf to convert this value into a char array:
char szBuff[50];
sprintf(szBuff,"%l",n);
status->m_TOTAL_WORDS.SetWindowText(szBuff);
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Hi Cedric Moonen,
Thanks for the reply,
I used the code as u have said error has gone, but the value is nt displayed in the dialog, what will be the cause ??
I used F5 and checked the n value its getting the the value correctly 72986
but its nt displaying.
IDC_TOTAL_WORDS with member of type CEdit m_TOTAL_WORDS
|
|
|
|
|
TCHAR buffer[50];
long a=20;
_ltoa(a,buffer,10);
status->m_TOTAL_WORDS.SetWindowText(buffer);
whitesky
|
|
|
|
|
Hi WhiteSky,
Thanks a lot its working ......
TCHAR buffer[50];
long n=INDX.total_words;
_ltoa(n,buffer,10);
status->m_TOTAL_WORDS.SetWindowText(buffer);
|
|
|
|
|
Hi WhiteSky,
Can u please also tell me how to change it int to char ??
TCHAR buffer1[50];
int f=INDX.getTotalFiles();
_ltoa(f,buffer,10);
status->m_TOTAL_FILES.SetWindowText(buffer1);
|
|
|
|
|
very simple
_ltoa(f,buffer,10); to itoa(f,buffer,10);
whitesky
|
|
|
|
|
Yes its working thanks a lot.
|
|
|
|
|
vinaycool wrote: Can u please also tell me how to change it int to char ??
_ltoa
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
Hi VuNic
_ltoa or itoa
whitesky
|
|
|
|
|
Can u please also tell me how to change it int to char ??
TCHAR buffer1[50];
int f=INDX.getTotalFiles();
_ltoa(f,buffer,10);
status->m_TOTAL_FILES.SetWindowText(buffer1);
Oops, I misunderstood his question. I thought he was asking about the line that does the conversion.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
yes
whitesky
|
|
|
|
|
_ltoa - Convert a long integer to a string.
_itoa - Convert an integer to a string
Knock out 'T' from CAN'T ,
You 'CAN' if you think you 'CAN'
|
|
|
|
|
pleast look at my reply to whitesky. And Btw, you can still use ltoa for converting ints to chars. int is not something totally different from long. but Only the size
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
Due to the differences in size of long and int C++ provides the seperate functions
Knock out 'T' from CAN'T ,
You 'CAN' if you think you 'CAN'
|
|
|
|
|
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
Hi,
In my application i connected server and client through sockets.In this,I have one seperate Config file that shows the IP address of different clients.i.e.,for server 1 should connected to CLient 1 IP addr,Servr2 must connected with Client 2 addr.Lile this i provide each client's IP address.So that the server must checked with that file to which client it must be connected.
My problem is, if the client is in my local machine i.e, in the server machine itself,it checks the Config File,In that i gave IPaddr of that server machine.But it does not work.
In my condition checking..I got IP address through GetPeerName().If the client is in another machine it returns IP as 192.168.3.33 like this.And if the Client is in sever itself it returns the LocalHost liek 127.0.0.1.
So,in condition checking it failed b'coz my COnfig File shows only format of IP addr.(192.168...)
Is there any way to get the Local machine IP addr instead of taking 127.0.0.1.
my code
pSocket->GetPeerName(curOpr,i);
if(curOpr.CompareNoCase(mOpListCurInstr[j])==0)
{...
}
mOpListCurInstr is the address noted in Config File.
|
|
|
|
|
Why not you use GetHostName in case if the client runs on the same machine?
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
I have created a new resource CDialog box, I am working with VS 2005.
When I try to do a DoModal with this new Dialog Box it´s happen nothing and the function return -1.
What can I check to found the problem.
AutreChien
-- modified at 3:49 Thursday 18th May, 2006
|
|
|
|
|
can you show how to use
whitesky
|
|
|
|
|
I use often those DoModal and in this case I do not understand what happend. My class derived from CDialog look like the same as a other one that works.
The code:
class CurrentViewer_Dlg : public CDialog
{
//DECLARE_DYNAMIC(CurrentViewer_Dlg)
public:
CurrentViewer_Dlg(CWnd* pParent = NULL); // standard constructor
virtual ~CurrentViewer_Dlg();
// Dialog Data
enum { IDD = IDD_DIALOGCURRENT_VIEWER };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Generated message map functions
//{{AFX_MSG(CurrentViewer_Dlg)
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
public:
CDctlctrl1 m_DdeChangeDir;
public:
CDctlctrl1 m_DdeChangePos;
public:
// use to look if the app as to be showed
CDctlctrl1 m_DdeShow;
CChartCtrl m_ChartShape;
CChartCtrl m_ChartCurrent;
public:
virtual BOOL OnInitDialog();
};
AutreChien
|
|
|
|
|
Dear NorGUI ,
it seems not problem how to call your dialog
whitesky
|
|
|
|
|
hi!
Whath is your onInitDialog code?
if you call the CDialog::OnInitDialog() function in ?
|
|
|
|
|
put a breakpoint in the OnInitDialog of the dialog you are try to open, it might be in there somewhere... Or just do a search in that dialog for EndModal call with parameter -1 and see why it gets there
|
|
|
|
|
I have put a breakpoint in OnInitDialog and the function is never called ?
AutreChien
|
|
|
|