[Qt-interest] Problem using QWidget::winEvent

anjani gupta anjanigupta_dce at yahoo.com
Tue Jun 16 07:43:12 CEST 2009


Hi Scott,

bool QMainWindow::winEvent ( MSG * msg, long * result )


  {


      if(msg->message == WM_USER)


      {


          char* param1 = (char*)(msg->wParam);


          char* param2 = (char*)(msg->lParam);


  


          //Process message


      }

...

}



I tried using SendMessage( ), now also 'param1' and 'param2' show garbage values when msg->lParam and msg->wParam are type casted to char*. 
Actually, msg->lParam and msg->wParam contain some numerical values which when type casted to char* give garbage characters. 

Thanks a lot for your time!

Regards,
Anjani

--- On Mon, 6/15/09, Scott Aron Bloom <Scott.Bloom at sabgroup.com> wrote:

From: Scott Aron Bloom <Scott.Bloom at sabgroup.com>
Subject: Re: [Qt-interest] Problem using QWidget::winEvent
To: "QtInterest" <qt-interest at trolltech.com>
Date: Monday, June 15, 2009, 5:37 PM




 
 






I would look into the fact that PostMessage returns immediately,
try SendMessage 

   



From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of anjani gupta

Sent: Monday, June 15, 2009 4:02 AM

To: QtInterest

Subject: [Qt-interest] Problem using QWidget::winEvent 



   


 
  
  Hi All,

  

  I have a Windows application that sends message to already running Qt
  application like this:

  

  {

    char* file_path;

  

    //Assign some value to file path.    

        

    PostMessage( hwnd, WM_USER, (WPARAM)(file_path), (LPARAM)(file_path)
  );

  }

  

  This message is handled by Qt application by overriding 'winEvent' method as
  below:

  

  bool QMainWindow::winEvent ( MSG * msg, long * result )

  {

      if(msg->message == WM_USER)

      {

          char* param1 = (char*)(msg->wParam);

          char* param2 = (char*)(msg->lParam);

  

          //Process message

      }

      return false;

  }

  

  Here issue is that 'param1' and 'param2' are not populated with values passed
  in WPARAM and LPARAM of 'PostMessage( )'. I am using Qt-4.4.3 on Windows.

  

  I think I am missing something here. Please help me out in this.

  Thanks in advance!

  

  Regards,

  Anjani 
  
 


   



 


-----Inline Attachment Follows-----

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090615/07c2b8c3/attachment.html 


More information about the Qt-interest-old mailing list