|
Our C++ 5.0 code does something like this:
if the excel dispatch is successfully created, it then exports data, etc...
...
then calls these functions:
xlsApp.SetDisplayAlerts(TRUE);
xlsApp.SetVisible(TRUE);
xlsApp.SetUserControl(TRUE);
This has always worked to display the excel spreadsheet in the foreground.
Now, testing on Windows Server 2008, the excel spreadsheet is created, but in the background.
Any suggestions?
Thanks.
|
|
|
|
|
I found a simple workaround using FindWindow() and SetForegroundWindow to force the Excel window to the foreground. Note, the application parameter of FindWindow() needs to be "XLMAIN".
HWND xlsHWnd = FindWindow(_T("XLMAIN"), NULL);
SetForegroundWindow(xlsHWnd);
|
|
|
|
|
Hello there,
I have statically linked OpenCV libs to a Win32 console application in Visual Studio 2012. I got the webcam and face detection working awesome.
I am using the "haarcascade_frontalface_alt.xml" for face detection purpose and this file is currently placed in the folder where the exe is present.
I want to link in this xml to project i.e., compile into the project and then use it at run time.
i.e., extract xml data from the compiled in xml file and load it to the corresponding OpenCV function.
Does anyone has suggestions on how to do this?
Any sample code will be helpful.
Thanks in advance.
|
|
|
|
|
You could create a custom resource inside the exe, and then read it at runtime.
Check out: Creating a Resource[^]
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I need to write some code (using C++/VS2010/Windows7), that can talk to a hardware I/O module (PhoenixContact Axioline F Bus Coupler) which is connected via Ethernet and, as usual, have never done this before.
I just need someone to point me in the right direction so I can get started, if possible please...
There's plenty of stuff on MSDN, eg. Quote: Getting Started with Winsock , but I don't have the confidence to dive right in just yet.
|
|
|
|
|
Actually "Getting Started with Winsock" is a great resource, in my opinion. You could try the examples to get acquainted. However, knowing how socket works on Windods, could be not enough. You probably should have a look at the open source project "Simple Open EtherCAT master"[^] (I know it's Linux).
Veni, vidi, vici.
|
|
|
|
|
|
Thanks Richard - I'm particularly interested in that 'Beginner' link...
|
|
|
|
|
Mike Grove wrote: I can get started
1. Learn basic TCP programming (TCP is probably what you need). You can do this using nothing but your computer.
2. Research the protocol of the device that you want to talk to.
3. Insure that you have a connection between your computer at the device.
4. Using 1, create code based on the information from 2 to actually send and receive from the device.
|
|
|
|
|
I've actually done this a few times in my life, it's not any more difficult than having an API for two pieces of software to communicate across. Usually on the hardware side, they'll implement a regular ethernet stack so they follow all the same rules and guidelines that you do on the PC software side. As a matter of fact, most people usually buy an Ethernet "core" that gives them the functionality without implementing it themselves, same as you using the Winsock library. The only trick is really understanding the bytes received and what they mean (just an exercise in arranging structures and casting bytes).
|
|
|
|
|
Hello there,
I have a C++ app that uses OpenCV. Currently i am statically linking the OpenCV libs into my app. This is adding an extra overhead of 6+ MB.
Ideally i would like to remove some of the features that i am not using in OpenCV. The features am using are,
Capture frames from Webcam.
Face detection.
Image formats (JPEG, PNG).
Image rotation & resizing.
Is it possible to remove other features and trim down the libs?
My C++ app is developed in Visual Studio 2012.
Thanks in advance.
|
|
|
|
|
As I understand it, the linker only links in code that is actually called, directly or indirectly, so it would seem that your program needs all 6 MB of what's getting linked in.
EDIT:
Check your linker settings and be sure to exclude unused COMDATs.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I hope you do not consider this an insult, but are you talking about Release or Debug build?
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
|
Good
I found your question in the OpenCV forum and see that you are building the static libs yourself (that was going to be my next question).
I have not worked with statically linked OpenCV myself, but you listed the libs you added to your project and go on to say that it seems to link all the libs, not just the ones you added. I agree this is most likely your problem. Did you by chance have a path set up under your projects "Library Directories" that you did not remove?
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
I have double checked to make sure all the path's and lib's setup in the Project Properties are correct.
I am not sure whether the size of the final exe is because it's linking all lib's.
Like Richard in his response said, maybe the Visual Studio compiler links in all lib's that it deems necessary to run the exe.
|
|
|
|
|
Don Guy wrote: Like Richard in his response said, maybe the Visual Studio compiler links in all lib's that it deems necessary to run the exe. Well, Richard's point is that it only links what it needs, not that it goes searching for more than you are "pointing to".
Is it possible for you to comment out all the OpenCV you use and build the application without linking to it? I was just curious to see how large it is without any of the OpenCV.
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
If i remove the Static Link option from the Project Properties and build, then the exe is 100 KB.
With the Static Link option in, it's about 6.1 MB.
If i leave the Static Option in and just comment out the code, i.e., #include's and other OpenCV references, then am not sure how much it's going to be. I will check that out later.
Does that test tells anything?
|
|
|
|
|
Yes, it tells me that not only are you statically linking the OpenCV libraries, you are also statically linking MFC, right?
I found a post earlier by a developer from the Visual C++ Libraries team. Go through that and see if putting that #define in your stdafx.h can help you out.
http://blogs.msdn.com/b/vcblog/archive/2012/02/06/10263387.aspx[^]
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
modified 6-Feb-14 0:18am.
|
|
|
|
|
With Static Linking options in, i.e., in Configuration Properties --> General --> Use of MFC = Use MFC in a Static Library, and then comment out all OpenCV code in the app, the total exe size is 4 MB. So basically it reduced 2 MB, but no significant difference.
I added the #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS to stdafx.h file and that didn't make any difference.
Btw, i am using Visual Studio 2012.
|
|
|
|
|
|
I posted the first of those and the response was pretty much a giant shrug from Microsoft. They did reduce the static link size a little in VS 2012, but they are still big. Unless the program in question has to be small for whatever reason, I'd go the dynamic link route. If it has to be small, you may have to go back to an earlier version of VS 2008.
(I never did update that project to VS 2010 because of this.)
|
|
|
|
|
Thanks for responding. Do you know if you can reduce the size by targeting an older version of MFC in the project settings? I am not sure that would be a good idea, but I was wondering if that would make a difference.
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
The workarounds say you can target an earlier version and it helps. Makes sense since the problem is with too many cross dependencies in MFC.
|
|
|
|
|
How to link statically to OpenCV?
For dynamically linking to MFC, do i select, "Use of MFC = Use MFC in a Shared DLL"?
Right now for statically linking OpenCV i got,
Linker --> General --> Additional Library Directories = C:\opencv\install\x64\vc11\staticlib
Linker --> Input --> Additional Dependencies = "List all Lib's"
Am i missing something here?
|
|
|
|