List Control and UNICODE...

Hi.

My project is ANSICODE.
And my project has a List Contorl.
So I use to insert any string like next code:

ListView_SetItemText(m_lstFiles.m_hWnd, dwItemIndex, 1, (char*)szText);

The List Control has 5 columns.
Second column have many UNICODE strings.
So I need to use WCHAR* in order to insert strings second column.

How can I insert ANSICODE string and UNICODE string in the List Control?

0
keandi (17)
1/13/2007 3:27:12 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
769 Views

Similar Articles

[PageSpeed] 39

I gather this is not MFC, since you are using the windowsx.h macros.

You should not presume that characters are char *; you should use LPCTSTR or LPTSTR as
appropriate.

Note that there is an LVITEMW structure that is Unicode-based; I have never tried to add
Unicode strings in an ANSI app, but the structure is suggestive that if you use
LVM_SETITEMW it will work.

If you are programming in MFC, I'm curious why you are using macros like
ListView_SetItemText, which are not really appropriate in MFC.
c_YouListControl.SetItemText would make more sense here.
					joe

On 12 Jan 2007 19:27:12 -0800, "keandi" <keandi@lycos.co.kr> wrote:

>Hi.
>
>My project is ANSICODE.
>And my project has a List Contorl.
>So I use to insert any string like next code:
>
>ListView_SetItemText(m_lstFiles.m_hWnd, dwItemIndex, 1, (char*)szText);
>
>The List Control has 5 columns.
>Second column have many UNICODE strings.
>So I need to use WCHAR* in order to insert strings second column.
>
>How can I insert ANSICODE string and UNICODE string in the List Control?
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
1/13/2007 4:15:57 AM
In addition to Joe's advice, if your text really is Unicode you can not 
simply cast it to char * to convert it.  You will have to use one of the 
conversion macros to get a new string to display.

http://msdn2.microsoft.com/en-us/library/87zae4a3(VS.80).aspx

Tom

"keandi" <keandi@lycos.co.kr> wrote in message 
news:1168658830.476166.229800@38g2000cwa.googlegroups.com...
> Hi.
>
> My project is ANSICODE.
> And my project has a List Contorl.
> So I use to insert any string like next code:
>
> ListView_SetItemText(m_lstFiles.m_hWnd, dwItemIndex, 1, (char*)szText);
>
> The List Control has 5 columns.
> Second column have many UNICODE strings.
> So I need to use WCHAR* in order to insert strings second column.
>
> How can I insert ANSICODE string and UNICODE string in the List Control?
> 

0
tserface (3860)
1/15/2007 7:03:52 PM
Tom Serface schrieb:

> In addition to Joe's advice, if your text really is Unicode you can not 
> simply cast it to char * to convert it.  You will have to use one of the 
> conversion macros to get a new string to display.

Or, better, use the LVM_SETITEMTEXTW message instead of LVM_SETITEMTEXT.

Norbert

0
nunterberg (207)
1/15/2007 9:09:56 PM
Reply:

Similar Artilces:

Better to "nest" or use multi-level list?
I'm in the process of creating/defining a style(s) for a list that will be numbered in "level 1" and have indented bullets in "level 2." For such a list is it better to define a multi-level list style and linked paragraph styles? Or use one's already defined numbered list and use one of the Word's pre-defined bullet lists when needed for the second level? As part of this question, is is preferable not to have a style "nested" within another style or doesn't it matter? Thank you. -- Norm Hi Norm: I'm not sure why yo...

Distribution List Changes
Hi All, I have a mail enabled distribution list with four users. Only those users plus the Administrator have rights on this group. Yet a seperate user is able to add / edit or remove users to this group even though they do not belong to this group. The user does not even have admin rights and is able to make changes. Let me know of any options I can try. Thanks Waynear wrote: > Hi All, > > I have a mail enabled distribution list with four users. Only those > users plus the Administrator have rights on this group. > > Yet a seperate user is able to add / edit or remov...

Customizing Activities\History LIst
Is there a way to add a date to Activities' History list? It would be nice to know when each activity happened. Thanks, Troy Troy, no way currently, although Microsoft has mentioned it might be an option in version 2.0 (nothing is guaranteed!) A few ISVs have custom products that do it... www.salentica.com www.c360.com Dave "Troy" <anonymous@discussions.microsoft.com> wrote in message news:af6b01c436bd$ce671f00$a001280a@phx.gbl... > Is there a way to add a date to Activities' History > list? It would be nice to know when each activity > happened. >...

DPM 2010 domain controller requirement?
From the RC (DPMv3Deployment_Pre-Release.doc) documentation there is the following statement: DPM 2010 must be deployed on a 64-bit server within a Windows Server 2008 Active Directory domain. The domain controllers must be running Windows Server 2008. I'm confused a little aboutthe domain controller requirement. I do have my forest and domain prepped to 2008 (R2 in fact), as I'm running >1< DC on 2008, but I have several at 2003 and it's going to take some time for me to upgrade those. Is the DPM requirement above strict? I've run it in a test enviro...

Control Button help needed
In the microsoft template database "Classroom"/ Classes form there is a command button that will open another form (Students) on a specific record in the subform. I can't figure out how to do this. Can anyone out there help me? The code behind the button is using the OpenForm method and is passing the ID of the record to open to as part of the "WHERE" argument. Look up OpenForm method (or action to see the macro version) and review the arguments. "Obeide115654" <Obeide115654@discussions.microsoft.com> wrote in message news:325A53B7-7553-40F0...

Sound shows on custom Annimation list yet no sound heard
When the PP Presentation is saved as a show,some slides have sound and some do not. All sound came from the same folder. Also, when playing the slides while in PPPresentation, swome have sound and some do not despite all being indicated on custom annimation lisy and all startin "after previous." Thanks! Often when one sound plays but another doesn't, it's an issue of the length of the file path. What's the file path to your music? Is it really long? If so, the longer-named songs might just be hitting the length limit. -- Echo [MS PPT MVP] http://www.ec...

Drop Down List and Check Box
Hi...I was search for this topic but don`t found the solve...Anyway I have a drop down list like this [image: http://www.geocities.com/augurtrade/excel_checkbox.txt] and this [image: http://www.geocities.com/augurtrade/excel_checkbox2.txt] ok my questions is what is (Blanks) and (NonBlanks)...? Is it possible for me to see only all the check box that was checked or vice versa...??? How to make a total below the checkbox i mean when someone check the check box, a total number appear below the last check box [image: http://www.geocities.com/augurtrade/excel_checkbox3.txt] [image: http://www.g...

CRM not starting after Domain Controller change
Hi all, I added a new domain controller in my domain. This worked fine, no replication problem or any other problem. But since, CRM (which runs on another server) doesn't start. SQL is running on the CRM server. Each time I try to access CRM through IE, I get a generic error message and the following event is logged on CRM server (event id 2) : MSCRM Platform Error Report -------------------------------------------------------------------------------------------------------- Error: Défaillance irrémédiable Error Message: Défaillance irrémédiable Error ...

how reliable is the "Who has you in their contact list" list?
Because someone who I think has recently (within the last week) deleted me is still on this list (I don't think she blocked me), but when I check who deleted me on blockstatus.com, he shows up. could it be it's not updated? which of the two would be more reliable? -- maykk Greetings, Do not use these websites, they will steal your identity and sell it. You should change your password immediately. That said, in general, the "who has..." list within Messenger is accurate. There have been instances over the last six-months or so where the list (and m...

Selecting from contacts list
I have all my contacts in the Contacts List and I want to delete all those with a common extension i.e. all those who have email addresses @hotmail. I am using Outlook 2007 Can you do a search or advanced search which will show the contact you want to delete? You should be able to highlight & delete them from the results. "GrahamC" <GrahamC@discussions.microsoft.com> wrote in message news:6AC1880D-9632-4ED9-BAE2-7083690B9FA7@microsoft.com... > I have all my contacts in the Contacts List and I want to delete all those > with a common extension i.e. all t...

Text Disappears from Controls after 4 Hours
Hi: I have a vc++ (vc.net 2003) dialog-based application that reads a 129 byte burst of data from the serial port every second and displays the received information every 5 seconds in a static text box, a couple of list boxes and a number of progress bars. The data is read in a separate thread and the thread posts a message to the main dialog on the 1st and 5th seconds. On the 1st second the static text box is changed and on the 5th second the list boxes and progress bars are updated. My problem is that after the application runs about 4 hours the static text box disappears. Then, if I mi...

Script to list access right
Hi I am trying to find any script which would generate list of login users with certain access level (select, write etc.) at one particular database. Is there something like that? Thanks. Justin ...

a list of lists
currently i use CArray to keep track of a list of objects, but I don't know MFC classes well enough to keep track of a list of lists. I'd appreciate some suggestions "wanwan" <ericwan78@yahoo.com> ha scritto nel messaggio news:1187535523.924671.143350@j4g2000prf.googlegroups.com... > currently i use CArray to keep track of a list of objects, but I don't > know MFC classes well enough to keep track of a list of lists. I'd > appreciate some suggestions You might want to embedd your list based on CArray into a class (e.g. CListOfSomething), and then ...

Smart List export to Excel #2
Hi, We are using Dynamics 9.0 and Office 2003. When we try to do a Smart List export to Excel, we keep getting an "Exception_Class_Object_Exception" that references varying object errors, such as 'Cells' or 'Value'; the object errors will change each time we try an export. As a workaround, I've found that closing Excel before doing the export allows the export to complete successfully. However, that solution isn't acceptable, as our Dynamics users would like to be able to work in Excel, doing other tasks, while the export is processing. Does anyone...

List of different values in data area
Hi excel specialists, How Can I automatically get the list of different values from the dat area and to find out their frequence? INDIVIDUALLY MEASURED VALUES: 3,5 4 3,5 4 3 3,5 4 4 3 3,5 4 3 3,5 3 3 3,5 4 4 Thanks for your help in advance. Balcovja -- balcovj ----------------------------------------------------------------------- balcovja's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2623 View this thread: http://www.excelforum.com/showthread.php?threadid=39572 Take a look at FREQUENCY in Hep -- HTH RP (remove nothere from the email address if m...

Controls order
I'm writing a controls editor. The user may create few controls and make them overflow (I mean one control beneath few others). When a user pressing the left button down, I get the window class (CWnd) using FromHandle() method in my PreTranslateMessage. The problem is that I always get the most lower control while I want the top most control. How do I do it ? How does the system chooses the control when a user click on a heap of controls ? Thanks, Janiv. > How does the system chooses the control when a user click on a heap of > controls ? Thats done based on the Z-order. You can ...

Global Address List and Handhelds
We use Ipaqs throughout the company, and I was wondering if there is anyway to have exchange add the GAL to the outlook contacts on the workstation, so that when they sync up, they will retrieve the Global Address List? In news:%23TkYtT0$GHA.3560@TK2MSFTNGP04.phx.gbl, Flip <phil.atkinson@beltek.com> typed: > We use Ipaqs throughout the company, and I was wondering if there is > anyway to have exchange add the GAL to the outlook contacts on the > workstation, so that when they sync up, they will retrieve the Global > Address List? No (and this wouldn't really be an ...

Fields in items list-- add/delete
Hai, I am using RMS version 1.2. In Stores Operations Manager it displays list of items when click on Database-->Items. It displays only five columns. Now i need to add / delete some fields in this list. Is it possible to add or delete the fields? if yes how can i add the fields? Thanks in advance, Nagendra On Wed, 27 Apr 2005 01:22:02 -0700, "Nagendra" <Nagendra@discussions.microsoft.com> wrote: >Is it possible to add or delete the fields? if yes how can i add the fields? I don't think so antonio ...

remove small list from large list
I have two mail lists on excel. The first has 16,000 names, the second has about 6,000. I need to remove the 6,000 from the 16,000 as they all appear in the big list as well. How do I extract those 6,000 entries from the larger list? My expected result is a mailing list with 10,000 names. Chip Pearson has some techniques at: http://www.cpearson.com/excel/duplicat.htm Howie J. wrote: > > I have two mail lists on excel. The first has 16,000 names, the second has > about 6,000. I need to remove the 6,000 from the 16,000 as they all appear > in the big list as well. How do ...

To-do list
In Outlook 2007, I can't find a way to show a short summary of my e-mail inbox on my Calendar page, similar to the way Outlook shows a To-do list of calendar items on my Mail page. It would save me a lot of switching back and forth. If there is a way, please tell me. If not, maybe you could consider adding it to the next version of Outlook. Otherwise, I love the program. -- BB ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the mes...

Control the day & time in project accounting ( timesheet & equip.
We need to control the time sheet in project accounting as follows: No same time should be allowed to be entered on the timesheet & equipment log for the same project & cost category. In addition, the times should be controlled in way not to allow an employee to work on 2 or 3 projects at the same date & time. In addition, no equipment should be to work in 2 or more projects at the same date & time Thank you -- Joseph Abou Nader MCSA MCBMS Specialist ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes....

exception list
where can I find the exception list for intelligent message filtering? Global Settings in ESM Nue "jlconley" <jlconley@discussions.microsoft.com> wrote in message news:DDF580F1-71C4-4A59-B502-5736266E74AD@microsoft.com... > where can I find the exception list for intelligent message filtering? Not sure what you mean - there's no exception list as such. You can insert IP addresses of known/trusted hosts (from customers/partners and such.. ) in Connection Filtering's Global Accept/Deny lists and these will bypass all other filters. Will need to enable Connect...

Conditional Formatting w/ a List/Icons
I am trying to allow someone to select "Green", "Yellow" or "Red" from a list and the cell to display a green/yellow/red icon appropriately. Or, if possible, the user could just select the icon (instead of selecting text). Is this possible? Use Data Validation for the list. Type in Red, Yellow, Green as the list. This give the user the list to select from. Use Conditional Formatting for the fill part. Set three conditions, If Cell Value-"Green" (select a green fill), etc.. -- If this helps, please remember to click yes. "...

Email Distribution List
When I send a email form my Distribution List - All contacts in that list will get email 7-15 times, untill I deleat from the outbox. How do I fix? "Steve" <Steve@discussions.microsoft.com> wrote in message news:385F5F26-5C60-467C-A6D7-FBD57E7F82EB@microsoft.com... > When I send a email form my Distribution List - All contacts in that list > will get email 7-15 times, untill I deleat from the outbox. How do I fix? This is usually caused by scanning your mail with an antivirus program. Uninstall your AV program and reinstall it without the mail scanning feat...

Pivot Field List
I was wondering if there is an easy way to locate a specific field in the pivot field list in Excel 2007 without having to scroll the list of fields and find the one you are looking for if you have many? I know in 2003 you were able to start typeing the word or numeric and it would find the first match as you typed. Excel 2007 PivotTable Expanded, auto-complete PivotItem drop-down list in RowField. With macro. http://c0718892.cdn.cloudfiles.rackspacecloud.com/04_14_10.xlsm Pdf preview: http://www.mediafire.com/file/mewgzmiwzyd/04_14_10.pdf ...