|
Just to be clear
1. Works in environment A
2. Doesn't work in environment B
Obviously then the environment, not your code, is where the problem originates.
As one possibility there is a firewall rule that is disconnecting/dropping the connection after 2 hours. If that is the problem then the solution is to either fix the rule or alter your application such that it recreates the connection more frequently than the rule disconnects. So say every hour although I might go with less than that. That said though defensive programming would suggest that the connection could be lost, arbitrarily, for any number of reasons so you should be attempting to restore the connection anyways.
FYI might want to verify "crash" versus exit. I worked with one system where it turned out there was some sort of monitor that was externally terminating the application after a certain amount of time. As a windows client app all threads should have a generic global system catch which catches "system" exceptions and logs them. Also normal requests to exit should be logged as well.
|
|
|
|
|
Is there any way to get information about installed anti-virus in system?
|
|
|
|
|
You can look in Control Panel\System and Security
|
|
|
|
|
Thank you but this is manual way.
Can I same using C++ / MFC?
|
|
|
|
|
You can check for a virus scanner under the installed programs in the windows registry in:
HKEY_LOCAL_MACHINEACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall (System wide installs)
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall (User installs)
modified 13-Sep-18 21:01pm.
|
|
|
|
|
There are many keys. Is there any straight way of doing this?
|
|
|
|
|
|
Hello Everybody,
In our application we have added a Ribbon control with multiple tabs.
Is there anyway to select / change tabs through code? I can see an option available in C# (SelectedIndex), like that is there anything available in C++ also?
for eg, I am in 3rd tab in my application, and when I reset, first tab needs to be selected.
Thanks in advance.
Regards,
Gopinath.
|
|
|
|
|
You can set IsSelected to true on the RibbonTab you want to select.
modified 13-Sep-18 21:01pm.
|
|
|
|
|
Hi Thaddeus Jones,
Thanks for your reply.
I don't see any option like isSelected in RibbonControl tabs.
Can you give me a sample code if any, so that I will get some idea.
Regards,
Gopi.
|
|
|
|
|
|
Hi,
Thanks again.
Let me give this a try and let you know.
Regards,
Gopi.
|
|
|
|
|
Your answer is for the .NET Framework, but I think the OP's question is about native C++.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Because of the comparison with the C# version I expected it to be about the same control, but you may be right.
In the CMFCRibbonBar , tabs are called categories and they can be set with SetActiveCategory() .
modified 13-Sep-18 21:01pm.
|
|
|
|
|
I think, this will not work for my solution. Anyways, let me try.
|
|
|
|
|
Hi Richard,
Yes, you are right, its for C++ only.
Regards,
Gopi.
|
|
|
|
|
I have a code as below.
#include <ppltasks.h>
#include <iostream>
using namespace concurrency;
using namespace std;
int wmain()
{
auto t = create_task([]()
{
wcout << L"Task A" << endl;
return create_task([]()
{
wcout << L"Task B" << endl;
});
});
t.then([](task<void>& t3)
{
wcout << L"Task C" << endl;
t3.wait();
}).wait();
}
I expected the output to be
/* Output:
Task A
Task B
Task C
Task B
*/
But the output is
/* Output:
Task A
Task B
Task C
*/
Why t3.wait(); isn't calling the B task again or a tleast should throw error?
Jesus saves
|
|
|
|
|
That's the thing with parallelism, it never does what you expect.
|
|
|
|
|
why is the code giving error while compiling?
task<wstring> my_task()
{
auto s = make_shared<wstring>(L"First value");
return create_task([s] {
wcout << *s << endl;
*s = L"Second value";
return *s;
}).then([s] {
wcout << *s << endl;
*s = L"Third value";
return *s;
});
}
UPDATED
The error is as follows,
Quote: 1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\ppltasks.h(372): error C2338: incorrect parameter type for the callable object in 'then'; consider _ExpectedParameterType or task<_ExpectedParameterType> (see below)
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\ppltasks.h(402): note: see reference to class template instantiation 'Concurrency::details::_FunctionTypeTraits<_Function,_ReturnType>' being compiled
1> with
1> [
1> _Function=my_task::<lambda_fe524192daf67b16ea75ab49971b7103>,
1> _ReturnType=std::wstring
1> ]
1> c:\vc++\concurrency_program\createtask\source.cpp(41): note: see reference to class template instantiation 'Concurrency::details::_ContinuationTypeTraits<my_task::<lambda_fe524192daf67b16ea75ab49971b7103>,_ReturnType>' being compiled
1> with
1> [
1> _ReturnType=std::wstring
1> ]
1>c:\vc++\concurrency_program\createtask\source.cpp(41): error C2440: 'return': cannot convert from 'Concurrency::task<concurrency::details::_badcontinuationparamtype>' to 'Concurrency::task<std::wstring>'
1> c:\vc++\concurrency_program\createtask\source.cpp(41): note: Constructor for class 'Concurrency::task<std::wstring>' is declared 'explicit'
I am just trying to understand ppl programing structure. Where as the following code compiles.
task<wstring> t1 = create_task([]() {
wprintf(L"create_task\n");
return wstring(L"create_task");
});
Jesus saves
modified 12-Jun-18 2:50am.
|
|
|
|
|
Daniel Ramnath wrote: why is the code giving error while compiling? Should we make an attempt at guessing the error?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Sorry, my description was not elaborate. I updated the error. But I found out the reason and posted it below.
Jesus saves
modified 12-Jun-18 2:56am.
|
|
|
|
|
This issue is solved when 'then' function call is parameterized as follows
task<wstring> my_task()
{
auto s = make_shared<wstring>(L"First value");
return create_task([s] {
wcout << *s << endl;
*s = L"Second value";
return *s;
}).then([](wstring s) {
wcout << s << endl;
s = L"Third value";
return s;
});
}
Jesus saves
modified 12-Jun-18 2:55am.
|
|
|
|
|
Hello, I'm trying to solve the 3 subset sum problem witch dynamic programming using a 3D array but I don't really now which rules to use to fill the array, can someone please help me to figure out the rules.
Example (I need 3 subsets such that they have same sum)
Input: {2,2,1,1}
A = {2}
B = {2}
C = {1,1}
Return: true
How I understand it: With 3D array I'm searching if I can find 2 Subsets with sum = TotalSum/3 each. But how to fill the array, which rules should I use
int subSetsFound(int n, int set[], int sum1, int sum2) {
int cuboid[sum1+1][sum2+1][n+1];
for (int i = 0; i <= n; i++) {
cuboid[0][0][i] = 1;
}
for (int i = 1; i <= sum1; i++) {
cuboid[i][0][0] = 0;
cuboid[0][i][0] = 0;
}
for (int i = 0; i <= sum1; i++) {
for (int j = 1; j <= sum2; j++) {
cuboid[0][j][i] = 0;
}
}
for (int i = 1; i <= sum1; i++) {
for (int j = 0; j <= sum2; j++) {
for (int k = 1; k <= n; k++) {
cuboid[i][j][k] = cuboid[i][j][k-1];
if (i - set[k-1] >= 0)
cuboid[i][j][k] = cuboid[i][j][k] || cuboid[ j-set[k-1] ] [j] [k-1];
}
}
}
return cuboid[sum1][sum2][n];
|
|
|
|
|
how InitInstance() is implimented internally
|
|
|
|
|
Open the file C:\Program Files (x86)\Microsoft Visual Studio <version>\VC\atlmfc\src\mfc\appcore.cpp.
|
|
|
|