PDA

View Full Version : IPC- char * to WCHAR* convertion?



Ricardo_arg
6th December 2010, 14:48
i getting bugs with this line and i cannot find a guide in google, can anybody help me?
error message :"cannot convert char * to WCHAR* in assigment"
here is the code:

#define WIN32_LEAN_AND_MEAN
#include <stdio.h>

#include <windows.h>

#include <commctrl.h>
int main(int argc, char *argv[])
{
//QCoreApplication a(argc, argv);
//return a.exec();
//el numero de la ventana o proceso dentro de windows

HWND hwnd=FindWindow(NULL,NULL);
HWND listview=FindWindowEx(hwnd, NULL, NULL, NULL);
int count=(int)SendMessage(listview, LVM_GETITEMCOUNT, 0, 0);
int i;
//estructura q recibe o especifica los atributos de la list View recibida
LVITEM lvi, *_lvi;
char item[512], subitem[512];
char *_item, *_subitem;
unsigned long pid;

HANDLE process;//manejador del kernel de windows

GetWindowThreadProcessId(listview, &pid);

process=OpenProcess(PROCESS_VM_OPERATION|PROCESS_V M_READ|PROCESS_VM_WRITE|PROCESS_QUERY_INFORMATION, FALSE, pid);

_lvi=(LVITEM*)VirtualAllocEx(process, NULL, sizeof(LVITEM),MEM_COMMIT, PAGE_READWRITE);
_item=(char*)VirtualAllocEx(process, NULL, 512, MEM_COMMIT,PAGE_READWRITE);
_subitem=(char*)VirtualAllocEx(process, NULL, 512, MEM_COMMIT, PAGE_READWRITE);

lvi.cchTextMax=512;

for(i=0; i<count; i++) {
lvi.iSubItem=0;

lvi.pszText=_item;// here is where the error generate

high_flyer
6th December 2010, 14:55
You have a problem with character set settings of your project.

But how is this related to Qt?

and i cannot find a guide in google,
Try this (http://www.google.com/#hl=en&expIds=17259,17311,25752,25854,26339,27758,27789,2 7868&sugexp=ldymls&xhr=t&q=%22cannot+convert+char+*+to+WCHAR*+in+assigment&cp=45&qe=ImNhbm5vdCBjb252ZXJ0IGNoYXIgKiB0byBXQ0hBUiogaW4 gYXNzaWdtZW50&qesig=sBcv_AO64HNIGSMrT5TIug&pkc=AFgZ2tluEpegQJeVjoivkXtgp-QJGstWoPL4zNW7Kor0xSTMpZhVh8YP1duXDcDMS-cwSTcjwtfiIFGfnigyRwCZWRkgrA_Axg&pf=p&sclient=psy&site=&source=hp&aq=f&aqi=&aql=&oq=%22cannot+convert+char+*+to+WCHAR*+in+assigment&gs_rfai=&pbx=1&fp=3abe5adf4192a0aa).

Ricardo_arg
6th December 2010, 15:39
sorry i ll try to say, that i cannot find a themme according to the subject of my question. By the way, how do i setup this issue? i find some links similar to my problem bu i cannot address the operatio needed it.

Added after 36 minutes:

problems resolved! thx

Timoteo
6th December 2010, 18:55
Since the solution wasn't posted, I will post one. A quick fix is just to change


LVITEM lvi
to


LVITEMA lvi