You are not logged in.

TonyInMd

Beginner

  • "TonyInMd" is male
  • "TonyInMd" started this thread

Posts: 3

Location: Maryland

Occupation: Programmer

  • Send private message

1

Thursday, June 16th 2016, 7:10pm

processing windows api native event

I've sub classed QFrame to hold a 3rd party object that is used for creating graphs. It's windows native and I can only access it through the windows api. I get the WinId for the frame and add it to the window that way. They have some custom wParams that they use and I can access them using QWidget's nativeEvent function, but I can't seem to access the Windows native ones. CPeFrame is the sub-class of QFrame I created. A snippet of code that works with their api is

bool CPeFrame::nativeEvent(const QByteArray &eventType, void *message, long *result)
{
MSG *msg = static_cast<MSG*>(message);
if(HIWORD(msg->wParam) == PEWN_LBUTTONUP)
{
do stuff
}
}

when I try to add some additional code for the windows api it doesn't work. It never gets called. I've tried

if(msg->message == WM_KEYDOWN)
{ do stuff }

if(HIWORD(msg->message) == WM_KEYDOWN)
{ do stuff }

if(msg->wParam == VK_OEM_PLUS)
{ do stuff }

if(HIWORD(msg->wParam) == VK_OEM_PLUS)
{ do stuff }

none of them does anything. I tried some other VK keys but none of them worked either. From what I can see online, two of these (the ones without HIWORD) are the right way to do it. Am I doing something wrong? Am I missing something?

This post has been edited 1 times, last edit by "TonyInMd" (Jun 20th 2016, 9:48am)


TonyInMd

Beginner

  • "TonyInMd" is male
  • "TonyInMd" started this thread

Posts: 3

Location: Maryland

Occupation: Programmer

  • Send private message

2

Tuesday, June 28th 2016, 5:07pm

Wm_Command

It turns out the actual message for the HIWORD(msg->wParam) == PEWN...
was WM_COMMAND which allows custom wParams which is seen by the parent window. That's why nativeEvent was seeing it, I was accessing it from the parent window and didn't realize it. Bottom line, the graph itself was a child to the QFrame which was why I couldn't access it. I don't know if that made any sense, but it comes from putting stuff that was designed to work with MFC into Qt. It can be done, but it's messy.