|
what you need is a modeless dialog, or a tooltip.
there are articles here on CP about both.
-c
Be very, very careful what you put into that head, because you will never, ever get it out. --Thomas Cardinal Wolsey
|
|
|
|
|
|
I have an application that works with a C++ DLL; I would like to use a dialog box in my dll. I know how to create a dialog box in an independent project, but I don't know how to implement it with my library. I do not think I need to use the CWinApp class, because as I understand that class controls start-up, execution and termination of the application; in my case the application is controlled by the application that uses my dll. In short my question is how do I call my dialog box from my dll.
Thank you.
Note: The software that uses my DLL is called Scantools II for Windows.
|
|
|
|
|
I had a similar problem of writing a plug in DLL for someone else code.
In the end, I had a major nostalgia trip and used good old Win32.
Most modern programs that allow plugins let you make COM objects, which
are (relatively) simple using ATL.
If you want more help, you'll have to me specific about the way ScanTools II
is calling your DLL...
Good luck,
Iain.
|
|
|
|
|
Hi Iain, first of all thank you for answering.
Scantools II is a scanning application for OMR/OCR scanners. Scantools has a setting where you specify the dll you would like to use. What Scantools basically does is call one function in the library, this function is passed an argument that represents the status of the scanning process (ie. Batch Entry for when the scanning starts, Document Entry for when the scanner starts reading a document, etc.)
There is a function for each stage of the scanning process, but all these functions get call by the original function that Scantools calls(based on the parameter that is passed.)
These functions are basically used to validate the data that is being scanned. It is in one of these functions that I would like to call or create a dialog box.
Thanks, once again.
Erika.
|
|
|
|
|
Hello,
I'm using the webbrowser control in an application where the crawling is totally automated.
The problem is that sometimes the browser try to crawl an archive file or whatever. In that case a security alert dialog box pops up and my webbrowser control waits for this dialog to close.
I already succeded removing all Javascript dialogs by implementing the IDocHostShowUI interface and by putting the control into the "silent" mode (put_silent()).
I also implemented the IDocHostUIHandler to return S_OK or S_FALSE wherever possible to get rid of a maximum of MSHTML UI unwanted behaviours.
But I still get this security alert dialogs and I have no ideas of how to avoid them.
The only solution I found for the moment is to filter the links the webbrowser control can crawl in a page by removing files containing 'zip','rar','mp3','jpg','gif'... And so on.
But this solution is not perfect because of the number of possible file types and because sometimes you can't even guess what it is from the URL.
If only the webbrowser control could allow me to access the HTTP file headers before display, to guess what it is from the content-type !
But even if I can filter the URL I crawl, I would really like a solution to remove the security alert dialogs.
I also tried to tweak the Internet Explorer options to avoid prompts and dialogs but I didn't solve this problem.
Any idea ?
Thanks,
R. LOPES
Just programmer.
|
|
|
|
|
Is the security alert from ActiveX controls with the Yes No buttons? If so then set your security to maximum and it wont even attempt to download them.
Todd Smith
|
|
|
|
|
Hello,
No, it's not the ActiveX download. With a proper configuration I avoided all ActiveX dialog boxes.
No I get a security alert for any kind of file that is not HTML like JPEG, GIF, MP3. In that case the browser normally ask if you want to download them, but I disabled this kind of download in IE configuration, so instead of a dialog box asking if I want to download the file I get a security alert dialog box telling me that my level of security is too high to allow the download. And I want to get rid of this security alert dialog.
Thanks,
R. LOPES
Just programmer.
|
|
|
|
|
In that case I suggest hooking into the Invoke method and canceling any DISPID_FILEDOWNLOAD requests.
If you need to support older browsers that don't support that DISPID you'll either have to filter by extension or do API hooking to get the header info similar to this tool http://www.blunck.info/iehttpheaders.html
Todd Smith
|
|
|
|
|
Thanks ! I will take a look.
Regards,
R. LOPES
Just programmer.
|
|
|
|
|
hello,
I would like to type a shortcut on my dialog and that it executes a particular routine I have coded (ie set the focus on a particular input control). I have no menu on my dialog window .
How should I do this ?
I have created a accelerator to set my shortcut, linked the accelerator to my code using the class wizard, but when I launch my appli, nothing happens when I press my shortcut ...
What is missing ? Is it the correct way to do this ?
Thanks in advance
DD
|
|
|
|
|
I did a quick search for "dialog AND accelerator" in MSDN and came up with the following:
Q222829
HOWTO: Using Accelerator Keys Within a Modal Dialog Box
which should give you exactly what you want. Classwizard won't help you much though...
I don't remember the last time I used CW!
Iain.
|
|
|
|
|
Yes, seems to be exactly what I need.
I an going to try it immediatly
Thanks for help.
DD
|
|
|
|
|
yes, it works but ... what happens when I defined several keys combinations in my accelerator, as it can be considered as a table of keystrokes.
I loaded my accelerator table in the OnInitDialog() :
m_hAccelTable = LoadAccelerators(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_ACCELERATOR1));
These special keystroke can be recognized in the override routine :
BOOL CDialogDlg::PreTranslateMessage(MSG* pMsg)
if (m_hAccelTable) {
if (::TranslateAccelerator(m_hWnd, m_hAccelTable, pMsg)) {
return(TRUE);
}
}
return CDialog::PreTranslateMessage(pMsg);
}
What I understood is that, when ::TranslateAccelerator recognizes a keystroke existing in accelerator, it send a WM_COMMAND message.
Then, using class wizard, I created a routine corresponding to dialog IDR_ACCELERATOR1-WM_COMMAND message:
void CDialogDlg::OnAccelerator1()
{
GetDlgItem(IDC_EDIT3)->SetFocus(); //special keystroke => set focus here
}
It works, but how can I perform different actions depending on keystroke?
Can I get the keystroke or is there any way to distinguish them?
Should I have several Accelerator and load them all and perform the ::TranslateAccelerator on each of them?
Could you still give me some help on this?
Thanks in advance
DD
|
|
|
|
|
Real life slowed my reply.
You can set various key combinations in the accelerator, each associated with a command value.
e.g.
ALT-Q => IDC_Q
CTRL-j => IDC_J
In your dlgs message map you would have
ON_COMMAND(IDC_Q, OnQ)
ON_COMMAND(IDC_Q, OnQ)
(I never use class wizard, as it runs into too many limitations, e.g. ON_COMMAND_RANGE())
If you are only using the accelerator for settings focus on other controls, you can just
put a static control before them in the tab order with one of the keys underlined
(i.e. Qeue: _______. When you press Alt Q, the dialog tries to put focus on the
static control, which then puts in on the next control with the WS_TABSTOP style.
So you may not need the accelerator after all!
Iain.
|
|
|
|
|
Thanks for answer on accelerator and the good idea the trick of the static control !!
I will use it !
Bye
|
|
|
|
|
If incoming TCP connections are made to one port, say 1000 and I want the actual connections to be made to another port.
Is it forward incoming connections on one port to another one on the same machine?
The two listening ports are on two different processes. Is it possible to create an app to do it without the target application not being programmed specially?
Once the forwarding is done, the forwarder should not be in the loop. ie, the connection when forwarded exists directlt between the target application and the client.
My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
modified 29-Aug-18 21:01pm.
|
|
|
|
|
|
A much easier solution is just to write a little program that listens on one port, and writes everything it receives to target port. Its a pretty standard concept (a proxy), and if you do a search on google for 'tcp tunnel' then you'll find lots of programs that will do it for you
|
|
|
|
|
|
|
What is it about the slider control that it wants to stay in the last place it was at on a window. I close the window and when I go back even thought I do a SetPos(0) it is still hanging around the last place it was left.
Any ideas on how to make it move back?
Thanks,
Jim
|
|
|
|
|
Recheck your code. Otherwise, call Invalidate().
Kuphryn
|
|
|
|
|
Not like I want a new control or anything. I just want to Derive the CAsyncSocket class in a DLL. Then I want to override the virtual members (all the "on..." functions) and add some of my own, like pre-parse buffers and such.
My purpose is to load the DLL in Visual Basic. It seems a heck of a lot more work, in the long run, to write and existing object and a new object for each other, instead of writing one that I can use in place of the two.
What do I need to do (#include, list in compile command-line, etc.) to make it compile properly as a DLL.
Then, how do I instantiate one in VB so I can go about using it?
--M.Pemrich
----------------------------------------------------
Just kinda lost everywhere. And as if lost wasn't lost
enough... I got a book on the subject...
|
|
|
|
|
Somebody out there may well correct me, but I don't think you can call a conventional C++ class from VB without cracking the mangled names and passing the this pointer across.
However it's not all bad news. .NET allows you do use (and inherit) classes across threade boundaries, so you can quite happily use a C# class derived from an MC++ class in a VB.NET app.
Chris Maunder wrote an article on the subject you might find of interest:
Cross language inheritance in .NET[^]
Anna
www.annasplace.me.uk
"Be yourself - not what others think you should be" - Marcia Graesch
Trouble with resource IDs? Try the Resource ID Organiser Add-In for Visual C++
|
|
|
|