Results 1 to 4 of 4

Thread: IPC- char * to WCHAR* convertion?

  1. #1
    Join Date
    Jan 2008
    Posts
    39
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default IPC- char * to WCHAR* convertion?

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: IPC- char * to WCHAR* convertion?

    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.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jan 2008
    Posts
    39
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: IPC- char * to WCHAR* convertion?

    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
    Last edited by Ricardo_arg; 6th December 2010 at 15:39.

  4. #4
    Join Date
    Sep 2010
    Posts
    145
    Thanks
    1
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: IPC- char * to WCHAR* convertion?

    Since the solution wasn't posted, I will post one. A quick fix is just to change
    Qt Code:
    1. LVITEM lvi
    To copy to clipboard, switch view to plain text mode 
    to
    Qt Code:
    1. LVITEMA lvi
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Convertion from QString to unsigned char *
    By vcp in forum Qt Programming
    Replies: 5
    Last Post: 13th August 2010, 18:26
  2. WCHAR and CHAR
    By halianka in forum Newbie
    Replies: 1
    Last Post: 9th February 2010, 21:28
  3. QString to wchar
    By rajveer in forum Qt Programming
    Replies: 2
    Last Post: 13th October 2008, 11:19
  4. wchar to T50 conversion
    By rajveer in forum General Programming
    Replies: 1
    Last Post: 29th August 2008, 13:32
  5. MinGW: char to WCHAR
    By Darhuuk in forum General Programming
    Replies: 4
    Last Post: 25th March 2008, 23:21

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.