|
You could create a transparent window that covers the MSHTML window such that you can see through it, but it captures all the mouse and keyboard messages. Or you could subclass the MSHTML window and capture any mouse or keyboard messages that go to it.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan you're the man!!! Thanks so much... I like the transparent idea a lot... do you happen to know which dstyle that is off the top of your head ?
Thanks again!!!
|
|
|
|
|
Specify the WS_EX_TRANSPARENT window style, and implement message handlers for WM_ERASEBKGND and WM_PAINT that do nothing.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hey Ryan so I tried that... I am running into two problems:
1) The newly created window is there, but it doesn't take focus, even after I call setFocus(newWindowHdl);... this means that it won't hear any WM_ messages until I actually click the window to make it active.
2) It also overlaps the window below it, and I can't see the window below it until I actually drag the overlayed window somewhere....
ideas?
|
|
|
|
|
You don't need it to have the focus. I shoulda gave more info... sorry.
WS_EX_TRANSPARENT is an extended window style, so you'd pass it in as dwExStyle to the CreateWindowEx() function. Also, specify WS_EX_TOPMOST (also an extended window style) to place the window on top of any other windows. Make sure you don't have WS_BORDER or WS_OVERLAPPEDWINDOW set otherwise the border will overlap other windows. If you've done this and you make the window the full size of the DHTML window, then when you handle WM_PAINT and WM_ERASEBKGND as I mentioned before, your window will be completely transparent, but will capture all the mouse and keyboard messages that would have gone to the window.
By the way, in your WM_ERASEBKGND handler, make sure you return TRUE, and in your WM_PAINT handler, make sure you call BeginPaint() but don't actually do any painting.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan, that's very helpful! Now it works exactly how I want it to.... except
I have to click on the now invisible window once to get it to accept keyboarad input. Just to make things stranger, it accepts mouse input already great, but no keyboard input till I click.
Thus it seems WM_MOUSE events are caputred but WM_KEYDOWN never gets picked up until I click on the newly created invisible window.
Here's my call to the invisible window:
if ((hwnd = CreateWindowEx(WS_EX_TRANSPARENT | WS_EX_TOPMOST, "TransWindow", "An HTML string", WS_POPUP ,
200, 400, 50, 100,
hWnd, NULL, NULL, 0))){
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
}
Also another random thing is that immediately upon launching it closes if I use WM_MOUSEMOVE, even if
I activate the program with <enter>. So, maybe there's a of setting the timer to not check mouse movement for the first couple ms?
Thaanks in advance! I'm almost there!
|
|
|
|
|
chasetoys wrote: have to click on the now invisible window once to get it to accept keyboarad input. Just to make things stranger, it accepts mouse input already great, but no keyboard input till I click.
You can call SetActiveWindow() to fix that.
chasetoys wrote: Also another random thing is that immediately upon launching it closes if I use WM_MOUSEMOVE, even if I activate the program with . So, maybe there's a of setting the timer to not check mouse movement for the first couple ms?
I'm not sure what you mean by this...
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
If you're using MFC you can just use the PreTanslateMessage mechanism.
Steve
|
|
|
|
|
appreciate the response, but i can't use MFC
|
|
|
|
|
Hi, I'm converting from Watcom C/C++ 10.6 and I'm receiving the following errors when I try to do this:
<br />
#define LONG long<br />
#define EXPENTRY __declspec(dllexport) __stdcall<br />
...<br />
typedef LONG (EXPENTRY FNWP)(HWND, UINT, WPARAM, LPARAM);<br />
typedef FNWP *PFNWP;<br />
...<br />
PFNWP pfnHeading;<br />
The errors are:
<br />
x:\dev\MCP2003W\usrparms.h(70): error C2059: syntax error : 'type'<br />
x:\dev\MCP2003W\usrparms.h(71): error C2143: syntax error : missing '{' before '*'<br />
x:\dev\MCP2003W\usrparms.h(236): error C2061: syntax error : identifier 'PFNWP'<br />
I don't see what I did wrong and it compiles perfectly under Watcom. How do I do this in Visual C/C++?
Thank you,
Glenn
-- modified at 20:51 Wednesday 12th April, 2006
|
|
|
|
|
gmhanna wrote: typedef LONG (EXPENTRY FNWP)(HWND, UINT, WPARAM, LPARAM);
Is that legal C++? I thought you could only have pointers to functions, since functions aren't object in C++. I'd go with:
typedef LONG (EXPENTRY* PFNWP)(HWND, UINT, WPARAM, LPARAM);
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
I believe that is legal in C++.
Steve
|
|
|
|
|
I'm not sure how the Visual C/C++ Compiler works but in the Watcom Compiler it must recgonize the difference between C and C++, as it didn't complain. This stuff is all written in C as I don't know C++, although it probably wouldn't be difficult to learn since I know C#.
Glenn
|
|
|
|
|
Hi Mike,
I tried what you suggested and I still get an error on that line:
<br />
x:\dev\MCP2003W\usrparms.h(70): error C2059: syntax error : 'type'<br />
Why does it say 'type' the only thing I have on that line is typedef?
Thank you,
Glenn
|
|
|
|
|
1. Are they included in compiled files (.obj, .dll,...)
2. What about unused friend functions?
-- modified at 7:41 Thursday 13th April, 2006
Anybody?
Look I know that different compilers optimize code differently, but I would like to know :
A) What does the standard say?
B) What code MSVC 7.1 produces?
|
|
|
|
|
Hi,
I am using the Visual Studio 6. I had the path for a folder with header files included in the Tools->options->Directories. Now I want to remove it from the global setup and put it under the project settings section. So I put the path of that directory under the project->settings - c/c++ - preprocessor section.
but when i build the project, it still gives me the link error:
fatal error RC1015: cannot open include file '*****.h'.
I have checked and double checked and checked the path again and again. can't seem to find anything. There are no spaces in the path.
Thanks,
Ankita
|
|
|
|
|
|
Thank you Michael. I added the derectory in the resource page too. Simply building the exe didn't work, so i am rebuilding the whole project again. It's a big project, so takes some time to compile. I hope it works, or I am doing something else also wrong.
Ankita
|
|
|
|
|
Ok this might seem like an obvious/stupid question but is there any way to play videos in C++ graphics? I'm using Codewarrior IDE (Learning Edition). I'm only in my high school programming class learning C++ cause our teacher doesn't teach us java. I know you can play wav files using PlaySound(). Is there anything as simple or not difficult to use to play a video? I'll convert it if need be.
|
|
|
|
|
|
Hello,
I need to implement a timer in my application. Upon receipt of a message, the application needs to wait for a specified period of time informing the end user and then continue. So I implemented the timer with setTimer() and processes the WM_TIMER message, updating the dialog for the user. When the speicified timer interval has expired, I issue killTimer(with Id) and close the dialog.
To test this from my CNotifyTimerApp::InitInstance(), I send a message like this:
AfxGetMainWnd()->SendMessage(...);
// Just to see when this gets displayed
MessageBox("After sending message");
to the mainframe class which will do as mentioned above. It seems that after SendMessage(...), immediately the MessageBox appears.
This is not what I want. When the dialog is displayed to the user with the timer counting down information, I don't want the applicatino to continue untill the time has expired. From the above, I think that SendMessage returns immediately and is executing the next instruction!
Can someone help me with this? Is there a better way of achieving this?
Thankyou,
Murali
Murali
|
|
|
|
|
SendMessage just sends a message. There's no reason for it not to return right away. If that's what you're really trying to accomplish, I think you'd be better off using Sleep()
My Music | My Pics | My Articles
BlackDice
|
|
|
|
|
Calling Sleep in a UI thread is questionable as while the application is sleeping its windows will not be redrawn and such.
Steve
|
|
|
|
|
What I want to do is, when I get this message, I want to create a timer for 60 secs and display a dialog to the user with the timer counting down. During this time, the application should not be doing anything, just wait till the timer expires and then continue from there on.
Am I being clear enough?
Thanks
Murali
|
|
|
|
|
He's one way to do it. Make a dialog and add a static text control to contain the countdown. In the OnInitDialog (I'm assuming MFC here) handler start a timer like this:
SetTimer(1, 1000);
Add a handler for the WM_TIMER message with ClassWizard. In the handler you would do something like this:
afx_msg void CCountdownDialog::OnTimer(UINT_PTR nIDEvent)
{
CString s;
s.Format(_T("Time remaining: %d"), --m_TimeRemaining);
CWnd *pStatic = GetDlgItem(IDC_COUNTDOWN);
pStatic->SetWindowText(s);
if ( m_TimeRemaining==0 )
{
KillTimer(1);
}
}
This should get you started.
Steve
|
|
|
|