|
Hello,
Does anyone know how to give a dialog box the ability to all ways be on top? eg.. even if some other app not related to yours is open (like your internet browser), I want my dialog app to stay on top..
Rob
|
|
|
|
|
This answer MUST be in the FAQ, but ::SetWindowPos (&wndTopMost, 0,0,0,0,SWP_NOMOVE | SWP_NOSIZE);
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Thanks Christian.. In the future, I'll do a little more searching before I post.
Thanks again for the fast response.
Rob
|
|
|
|
|
Hi,
I have a MFC test app with 2 edit fields. I want to pass the edit fields handle to an MFC ActiveX control which will just return the contents of these fields.
The problem I am facing is that ActiveX control does not allow to take in HWND as a parameter.
Is there a way to pass HWND in my activeX control.
Thanks in advance
Bobby
|
|
|
|
|
I'm not exactly sure what you're trying to do, but you can add an IUnknown derived interface and create a method that lets you pass the handles. You can also cheat and cast them to a LONG if you're using a dispinterface.
But for most stuff this doesn't seem like a good idea. What exactly are you trying to accomplish?
--CoolDev
|
|
|
|
|
Well basically my MFC activex control contains hook functions. So from my MFC test app if I pass a handle of the edit field, then my ActiveX control should process the information based on Hooks.
When I try to add a method to my ActiveX control, it doesnt allow me to add HWND as one of the argument. There is something called OLE_HANDLE instead but I dunno if that will solve the purpose.
Any help will be greatly appreciated.
Thanks
Bobby
|
|
|
|
|
It sounds like you're using a wizard, and the interface you're trying to add the method to derives from IDispatch. A handle is not an OLE Automation type. As I said before, you can create a new interface that's derives from IUnknown, or cheat and make your function take a LONG and then cast it as appropriate.
I do question the design, though. I don't see why an ActiveX control would ever want to hook a WndProc of a control in its container...
--CoolDev
|
|
|
|
|
Thanks again ..
I know it sounds wierd that an ActiveX control hooking to a WndProc of a container but it is kinda needed since when the control is downloaded then it will help me to analyze some data.
I tried the function that takes OLE_HANDLE and casting it appropriately but didnt work. I will give it a shot with LONG.
The other solution u mentioned is through ATL COM(in which I dont have my hands dirty)..is it possible through just MFC.
Thanks a mucho..
Bobby
|
|
|
|
|
I'm creating a synchronized queue where callers can register to have a function called after a specified timeout (or after the previous one has finished, whichever comes last). Everything works great, but I would like to extend this so that any thread can queue up items, and the callback is guaranteed to be executed on that thread.
Ideally, a function like SetTimerOnThread(DWORD dwThreadID, TIMERPROC lpTimerFunc) is what I'm looking for.
SetTimer() will call back on the originating thread, but the problem is that after it returns from the callback I need to set the timer for the next workitem, which may have been queued up from a different thread.
Posting messages to various windows would help, but might get hairy. I'm trying to build this so that it doesn't depend on a windprocs having direct knowledge of the queue, or the queue having direct knowledge of windows.
Another potential solution is to CoMarshalInterThreadInterfaceInStream the item when it enters the queue, and unmarshal just prior to executing it. The marshalling should take care of making sure everything happens on the right thread. I don't particularly like this solution though. It's overkill and the queue doesn't currently use COM.
Any suggestions?
--CoolDev
|
|
|
|
|
the callback is guaranteed to be executed on that thread
Wow, that's quite impressive requirement. What should happen if that thread is busy? Seems that you'll need some cooperation from the thread you want your callback to be executed on - for example, waiting for Win32 event when there's no work to do. When the event is in signaled state, thread picks up callback address from the queue and jumps into it.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
The idea is that it's on a timer, so it happens whenever the thread gets around to handling the message. (I'm not trying to do something like QueueUserAPC() without expecting the thread to be in a waitable state!) This requires that all threads using the queue have a message pump, but that will always be the case for this application.
If you do away with encapsulation and let a WndProc on each thread know about the queue, and have the queue store a handle to a window on each thread, than it would just be a matter of posting a message to the window once the timer has elapsed.
If MSDN didn't explicitly disallow it I could pass an HWND who's message pump lives on another thread to SetTimer() with the expectation that it would post a WM_TIMER message to that window after the timeout. If params I sent to SetTimer() included a callback then it could call the callback without having to handle WM_TIMER in each WndProc.
--CoolDev
|
|
|
|
|
I think you should use PostThreadMessage and place the call to message handling code inside the thread's message loop, since messages posted with PostThreadMessage have hwnd == NULL.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi.. Just wanna ask???
How do u determine how long a sound or a video file is played? Is there some form of command that VC++ has that would allow me to input a file name and it automatically gives me an approximate playing time of the sound or video file?
Thanks in advance....
|
|
|
|
|
You can do it through DirectShow. There is one interface (sorry I can't remember the name at this time, but you can find it very easily in the DirectX SDK documentation) that you can query through the IFilterGraph interface, and use the methods to get the time of the media file.
|
|
|
|
|
Cool - I was hoping someone would answer this question. Looks like my weekend has been plotted out - I am working on a database for media files and this was my next problem.
Thanks
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I would like to use the CMyTabCtrl class for Tabs. I put a tab control on my dialog and implemented the code. The problem is that the buttons I have put on the tab have local message maps. I would like for them to call functions on my main dialog. I can not get the handle so that I can call class functions there. Help?
|
|
|
|
|
Sample function:
CMyTabCtrl::MyFunction()
{
CMyDialog *pDlg = (CMyDialog*)GetParent();
pDlg->TheOtherFunction();
...
}
Do that only if the dialog is the parent window and it is of class CMyDialog.
Cheers,
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Duh! This is what I get for not doing any windows programming for about a year. will not let that happen again. I think my problem was that I was casting as a CDialog instead of the derived class that includes all of my functions. Thanks Paolo.
Sometimes to catch mice, you have to act like cheese...
|
|
|
|
|
Sometimes when I edit a resource in a project and then do a build it doesn't seem to recompile the resources. I'm using some includes and defines to conditionally include external resources files. Is there a way to setup a VC project so that compliling the main rc file will depend on these external files?
|
|
|
|
|
When you open the properties for your .rc, what's displayed at 'Dependencies' tab? Are these external files listed there?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
There are some externaly listed .rc files yes. And those external .rc files also contain links to files such as .ico, .bmp, and .txt which are compiled as resources.
|
|
|
|
|
Any chance of adding references of these .ico, .bmp and other files to your project?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I am developing an ISAPI extension in C++. My project uses many HTML forms with text input boxes. When the forms are submitted (using "GET") I am parsing the values from the browser URL. This works nicely but the strings have escape characters (+ instead of space etc).
Is there a better way to process the form information so that there are no escape characters, or does anyone know of a function/code that replaces the escape characters?
Thanks
|
|
|
|
|
Actually, it's pretty easy to write a function that replaces escape characters and vice-versa. Escape characters are pretty good thing, and moreover, it is the standard.
I vote pro drink
|
|
|
|
|
You should really look at ATL Server in that is coming out with VS.NET. It will make ISAPI Extension development much easier and more flexible. The urls and all the data submitted is very easily accessible.
Cheers,
-Erik
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My thoughts are my own and reflect on no other.
|
|
|
|