|
Johpoke wrote: without the char ender ofcourse
If it's a non-Unicode build you can use
CString str = data;
For a unicode build you can use
TCHAR data[64] = "101...........";
CString str = data;
For a unicode build where the string must stay a char type you can use
char data[64] = "101...........";
CStringA str = data;
For a unicode build where the data must stay a char type but the CString is UNICODE you can use
char data[64] = "101...........";
CString str = CA2T(data);
|
|
|
|
|
Thanks, its fixed,
and yet another problem, with my char array, i now need to set it, but it doesnt seem to work, ie.
char data[64];
data = "011111....";
[im feeding it the right amount of char
any ideas?
thanks
/Johannes
|
|
|
|
|
Johpoke wrote: im feeding it the right amount of char
Are you saying there's 64 characters in your initialization string? If so then that's bad
You need to have room for the NULL terminator. If you need 64 chars then define your data
variable to a length of 65.
|
|
|
|
|
yea i know about the end part the /0 or if its a \0 but i use 63 of them, 64 with that, but i just need to be able to set all of it like
data = "10100010.....
its probably something simple im forgetting as usual-..
thanks
/Johannes
|
|
|
|
|
Johpoke wrote: its probably something simple im forgetting as usual-..
Instead of
char data[64];
data = "011111....";
try
char data[64] = "011111....";
or
char data[64];
strcpy(data, "011111....");
|
|
|
|
|
Johpoke wrote: char data[64];
data = "011111....";
You might like to modify it to ,
char data[64] = {0};
data = "011111....";
|
|
|
|
|
Hi All ,
i am woking in a SDI based MFC(VC++) application, i want to know that how can i make my application to adjust main frame window as the screen resolution changes from 1024X768 to 800X600 or any other?
Currently, as soon as my screen resolution changes to 800X600 my main frame window gets out of the screen and is no more visible entirely.
Please provide me with any solution.
thanx all
Aamir
Aamir Zia
|
|
|
|
|
You could resize your main frame window in response to a WM_DISPLAYCHANGE message.
Mark
|
|
|
|
|
Consider also messages WM_SETTINGCHANGE and WM_WININICHANGE.
|
|
|
|
|
Greetings,
I have some text that I want to print to a CView. However, instead of just having it print to the end of the view (horizontally), I need it to print within a certain area (i.e. a box/rectangle/area of the CView 300 pixels wide by 500 pixels high). How do I print out the text so that it wraps properly and perhaps even justify it within a rectangular part of the CView?
Thanks,
BP
|
|
|
|
|
It sounds like you need to call ‘DrawText’ or ‘DrawTextEx’ as it was designed for that purpose.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Thanks, I will go check it out.
|
|
|
|
|
I agree with Mr John R. Shaw It seems DrawTextEx is helpfuls
|
|
|
|
|
Thanks, I will go check it out.
|
|
|
|
|
Hello,
The check boxes provided in the resource editor are pretty, but I would like to create check boxes without using the resource editor (dynamically). How do I do this? Any help is appreciated.
|
|
|
|
|
Need to use CButton class with BS_CHECKBOX style .
e.g.
m_Button.Create(_T("Check Box"), WS_CHILD |WS_VISIBLE|BS_CHECKBOX,
CRect(10,10,100,30), pParentWnd, 1);
|
|
|
|
|
Hello,
I put the following code into CPrintOptionsDlg::OnInitDialog()
CButton m_Button;
// Create check box.
m_Button.Create(_T("Check Box"), WS_CHILD |WS_VISIBLE|BS_CHECKBOX,
CRect(0,0,10,30), this, 1);
However, I didn't see the check box. Any ideas? My CPrintOptionsDlg class is derived from CDialog.
|
|
|
|
|
mla154 wrote: I put the following code into CPrintOptionsDlg::OnInitDialog()
Did you call CDialog::OnInitDialog() before creating the button?
|
|
|
|
|
Yes, I did. My function looks like this:
BOOL CPrintOptionsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CButton m_Button;
// Create check box.
m_Button.Create(_T("Check Box"), WS_CHILD |WS_VISIBLE/*|BS_CHECKBOX*/,
CRect(0,0,10,30), this, 1);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
|
|
|
|
|
your CButton object is going out of scope (so it is destroyed) when the OnInitDialog() method
returns.
Try moving
CButton m_Button;
to your class definition (so it's a member of your CPrintOptionsDlg class).
|
|
|
|
|
|
I've mentioned CButton variable name as m_Button , which implies its a class member variable.
|
|
|
|
|
|
My Pleasure.
|
|
|
|
|
Try this
CButton m_Button;
m_Button.Create("Test",WS_CHILD|BS_AUTOCHECKBOX|WS_VISIBLE,CRect(0,0,100,23),this,1);
</code>
|
|
|
|