|
This is just for my personal knowledge, but ion C++, is tere an easier way to convert a string into an LPCTSTR? Here's how im doing it now, which is quite laborious...
<br />
int ch_num = 0;<br />
string tool_name;<br />
LPCTSTR str_word = "";<br />
channel_gettoolname(ch_num, tool_name);<br />
tool_name += ".";<br />
CString boo;<br />
char bleh[100];<br />
for(int i = 0; i < tool_name.size(); i++)<br />
{<br />
bleh[i] = tool_name[i];<br />
boo += bleh[i];<br />
}<br />
str_word = boo;<br />
GetDlgItem(IDC_ch0edittxt)->SetWindowText(str_word);<br />
where channel_gettoolname(ch_num, tool_name); passes a string, 'tool_name' by reference.
i have to covnert my string into an array of Char, convert the array of Char into a CString, then convert the CString into an LPCTSRT. i tried strcpy() but it kept saying i cant convert a string into a char.
*.*
|
|
|
|
|
|
If you mean a std::string , bear in mind that it isn't a Unicode string, it's an ANSI one. If you're compiling for ANSI, this isn't a problem (since TCHAR == char, for a build where UNICODE isn't defined).
You can access the array of characters in a std::string by calling the c_str() member function.
You should be able to write:
std::string tool_name;
channel_gettoolname( ch_num, tool_name );
tool_name += ".";
SetDlgItemText( IDC_ch0edittxt, tool_name.c_str() ); Hey, where'd my line-spacing go??
--
Mike Dimmick
|
|
|
|
|
thanks
*.*
|
|
|
|
|
How can I do my program work with windows api? for example: when an user click with mouse anywhere out window, windows api will send to my programa this event, or better when I click on button at internet explorer my program have that know about that was did.
|
|
|
|
|
|
Hallo !!!
I Have a Problem:
I have a ListControl and the Horizontal Scroll Bar
should not dissepear when it is no longer needed.
It should only be disabled.
What can I Do ??
Thanx for helping me............
cu
Dirk
cadnt@web.de
schonus
|
|
|
|
|
The default behavior is for it to be removed, thus freeing up a bit more of the control. Why would you want it to stay around?
|
|
|
|
|
It Is a little bit complicated to exlplain, but I use it beside a text editor , which has also a scroll-bar .
This text-editor scroll bar do not disappear, and the
CListCtrl Scroll bar also shold not dissepear!!
So, can you help me??
|
|
|
|
|
i want to add datatime pickup activeXcontorl on the dialg in my dll.
can i do like that, if can, how to realize ?
gucy
|
|
|
|
|
Do you have to use ActiveX or may be you could settle for the common control? If yes use resource editor in VC7(6) and pick it from the Dialog editor's list of available controls.
|
|
|
|
|
i don't want to use ActiveX control,i want common control.
But i use vc6.0 resource editor.is there any solution?
gucy
|
|
|
|
|
i'v found the control now
gucy
|
|
|
|
|
Hi,
Created a MFC app that uses the CEditView as a base class. I wanted to know if it was possible to insert text on the editor that pops up automatically. If it is, can i make it so that it comes up on each editor window that comes up?
Also, is there a way to change the app from a multiple document app to just a single document app without starting over?
Thanks in advance.
|
|
|
|
|
Lookup CView / CEditView :: OnInitialUpdate ().
This would be an ideal place for a "SetText (...)".
It is possible to switch to an SDI configuration, but I can't remember all the steps.
If you have a lot of code you don't want to simply copy across, create a blank SDI and
a blank MDI app, and compare the two to get the information you want.
Iain
|
|
|
|
|
There is not an OnInitialUpdate() in my program. I did not see it in class wizard either.
Could you possibly explain to me in more detail?
Is there another way to do this?
thanks again for your help.
|
|
|
|
|
I have a CDialogBar and I put a ComboBox and Button on it. I used the ComboBox property 'Data' and added ITEM; to it. When I load my appl. the word ITEM do not appear. My ComboBox type is a DropDown type, also I wanted the user to be able to add in new items in the combobox. How do I accomplish that?
|
|
|
|
|
The combobox "data" you type in using the resource editor actually exists as a separate resource
(DLGINIT) in the rc file. This is referenced when a dialog box is created, but presumably not
for a dialog bar.
Fortunately, it is not difficult to add items to a combo box.
After creating the dialog bar, get a pointer to the combo box.
CComboBox *cb = (CComboBox *) (pBar->GetDlgItem (IDC_MYCOMBO));
cb->AddString (....);
cb->SetCurSel (....);
Iain.
|
|
|
|
|
The box initializes, but when the user type in something, the program doesn't recognize it and also the initial information is deleted and the combo box is empty again.
This is the code to get the information out.
pActWin = GetActWin();
//Get the MainFrame obj and get the address out of the combo box
CMainFrame* pFrame = ((CMainFrame*) m_pMainWnd);
CDialogBar* pDBar = &(pFrame->m_wndAddressBar);
CComboBox* pCombo = (CComboBox*)
pDBar->GetDlgItem(IDC_Address);
CString strAddress = _T("");
int nIndex = 0;
nIndex = pCombo->GetCurSel();
if(nIndex == CB_ERR)
return;
pCombo->GetLBText(nIndex,strAddress);
How do I let the user enter in information and I do I get that information out?
Thanks for the help
|
|
|
|
|
I try to do a ListBox by myself,because i need a different style ListBox.
Now, i have a problem.it's a scroll bar(yes, the scroll bar by myself).
i don't know how to calculate the scroll bar pos,have any one ever do the ListBox by self?Please Help me!thx!
|
|
|
|
|
|
Thank you,I found a method can to calculate the pos.
|
|
|
|
|
Can anyone please tell me how to use ADO connection pooling using Visual C++.
Imtiaz
|
|
|
|
|
What's the basic difference between cout and printf, and between cin and scanf?
Thanks
|
|
|
|
|
cout and cin are stream functions, outputting a stream to the display. They use the < and > operators, which can be overriden to set up the display according to what is in the stream. This is C++.
printf and scanf are C functions, which have their own formatting process.
~RaGE();
|
|
|
|