|
Rajesh R Subramanian wrote: ashish8patil wrote:
If i use C# to make GUI and backend code in vc++
You should not be doing such a thing unless it is absolutely necessary.
IMHO, I am doing this only !
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
As others also wrote, the use of a MFC-GUI is the fastest and easiset way to get a nice GUI working with C++. Making a C#-GUI (and C++ Code) is an option with leeds to more works, and is only fine if you need some C#-Features.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
ashish8patil wrote: If i use C# to make GUI and backend code in vc++.Is it possible.And Please tell good things and bad things if i use like that .and more from you
It wouldn't be wrong choice if you design your GUI in C# and use unmanaged coding at back hand.
Only question is, how you are integrating between two....?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
.Net Com Ineroperability..?
can please tell me good way..?
|
|
|
|
|
you have flexibility of designing good gui using c#, which unmanaged vc++ doesn't provide you..
you one more way, if you know little bit of managed vc++, just write wrapper on your unmanged function using this.!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Sorry Alok Sir I not get you. And is there any way i can run my gui in c#.net and whole back-end code will run in c++ (means it will not use CLR when backend code will run). Thanks for your reply.
|
|
|
|
|
Hello Sir,
Can you please tell me what is diff between "pinvoke for win32.dll " and "com interop" .which one is better.
|
|
|
|
|
Hello friend,
I am working on financial application.
I am using VC++.net VS 2008.
I want to avoid shutdown/restart/logoff while my application is storing the user data, authorisation/authentification or file/fund transfer.
I want to abort shutdown,restart or logoff if any third application call ExitWindow, ExitWindoEx with the SX_FORCE or user run the command on command promt "shutdown -l".
I know one way by Windows notification WM_ENDSESSION and WM_QURYENDSESSION return FALSE,but this is not working in "FORCE shutdown" or "shutdown -l".
Please give me a suggestion.
Waiting for the positive reply.
Thank you.
abhi
|
|
|
|
|
I don't think that would be possible or easily possible.
Anyway, how do you think you will stop "pull the plug"?
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks for the reply.
But I am not considering the case of CPU Power down or anybody plug off the power cable, UPS will take care these things.
But programaticaly if anybody trying forcefull shutdown or remote shutdown I want to delay the shutdown untill my application finish this work.
Another way I found AbortShutdown api but with this also i not able to get proper result or may be somewhere I am missing.
But If you have any idea to delay the shutdown, if anybody call ExitWindow with SW_FORCE please share it with me.
Thank you
abhi
|
|
|
|
|
Oops!
I appear to have misread your post. If you want to _prevent_ somebody from shutting down windows, you'll need to hook ShutdownWindowsEx & SetSuspendState (or to be more precise, the kernel ZwShutDownWindows or NTShutDownWindows or something like that, I forget.
This will allow you to process any requests to shut down the box before the O/S does. Then all you have to do is return an error code every time, whilst never actually shutting down/standing by or hibernating the box.
You want to do basically what SetWindowsHookEx will do, except you want to do it with calls to the functions that power windows down, instead of to the messages that are between windows . I think you'll find what you're after if you search for function hooks.
This is the sort of thing you want: http://www.bigwebmaster.com/2068.html[^], just make sure you find one that's being given away - there should be no need to pay.
[EDIT]:
See here for the answer:
Cached google copy of 'prevent EWX_FORCE' forum post[^]
modified on Wednesday, May 6, 2009 3:34 AM
|
|
|
|
|
bool shutDownWindows()
{
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
if (!OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
return false;
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
&tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
(PTOKEN_PRIVILEGES)NULL, 0);
if (GetLastError() != ERROR_SUCCESS)
return false;
if (!ExitWindowsEx(EWX_SHUTDOWN | EWX_FORCE, 0))
return false;
return true;
}
bool standbyWindows()
{
HANDLE hToken;
TOKEN_PRIVILEGES tkp;
if (!OpenProcessToken(GetCurrentProcess(),
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
return false;
LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
&tkp.Privileges[0].Luid);
tkp.PrivilegeCount = 1;
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
(PTOKEN_PRIVILEGES)NULL, 0);
if (GetLastError() != ERROR_SUCCESS)
return false;
if (!SetSuspendState(false, false, false))
return false;
return true;
}
|
|
|
|
|
Dear enhzflep,
Thanks for the reply.
But I want to avoid/prevent from the forcefull shutdown, not to make a shutdown.
Tahnk you,
abhi
|
|
|
|
|
If you're trying to do the impossible (like you are), that probably means that your design is incorrect.
In this case - I presume that you want to ensure that the system doesn't end up in an inconsistent state, by interrupting your activities? In that case, you need transactions[^] to enable you to make those operations atomic (i.e. they happen completely or not at all).
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stuart Dootson wrote: If you're trying to do the impossible...
Really? I've seen the Visual Studio process refuse to be stopped when it was in the middle of something. Funny thing is, what it was in the middle of doing is why I wanted to stop it in the first place.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
DavidCrow wrote: I've seen the Visual Studio process refuse to be stopped
Heh - it won't get the chance to refuse to stop if I get at it pskill[^] can be your friend! I suspect that "shudown -lf" (which hte OP mentioned) is equally forceful
The point is that the OP was asking the wrong question - "how can I stop things interrupting my very important financial transactions" rather than "how can I design my system to be robust against interruptions when making important financial transactions".
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I have one MFC application which is working with some PCI boards.
I have been run this application for past one year without any problem. But now i got this error "MFC application has encountered a problem and need to close". What will be the reason for this problem?
help me to solve this one...
|
|
|
|
|
Your application crashed. If you want to fix the problem, you'll need to use the debugger to track down the problem.
|
|
|
|
|
Use WinDbg[Used to debug user-mode crash dumps.]. You can take a dump using the ProcessDumper at the point when your application crashes. Analyze the dump using Windbg and correct the problem. This tool can be handy when you are not certain about the point of crash and debugging seems to be a mammoth task.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
i have MFC application tooo. but it working fine... DUDE.. you have to let people here know how exactly your application works, it would be better if you debug the code and find the point where you application actually failing
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
What's your os now and what was it previous?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
|
ganesh.dp wrote: help me to solve this one...
It could be any number of reasons. Start here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Hi all. Slightly tricky one here.
I have a template class that has more than one template argument, for example:
<br />
template< class X, int N ><br />
class Foo<br />
{<br />
public: <br />
int GetValue() const;<br />
};<br />
Now, say that I want to specialize GetValue so that it returns, say, 69 for a template argument of N = 5, but returns 42 for all other values of N. For example:
<br />
Foo< char, 3 > foo1;<br />
foo1.GetValue();
<br />
Foo< double, 17 > foo2;<br />
foo2.GetValue();
<br />
Foo< bool, 5 > foo3;<br />
foo3.GetValue();
One way that would work is to specialize the entire class for N = 5 and again for all other values, so as to provide two separate implementations of the class. For example:
<br />
template< class X, int N ><br />
class Foo<br />
{<br />
public:<br />
int GetNumber() const { return 42; }<br />
};<br />
<br />
template< class X ><br />
class Foo< X, 5 ><br />
{<br />
public:<br />
int GetNumber() const { return 69; }<br />
};<br />
But I want to avoid this approach because while it works well for this simple example class with only one function, I am in practice trying to specialize a member function on a much larger class with many functions that would be unchanged by the specialization. Thus, I need a method to specialize only the member function in question, without duplicating the rest of class Foo.
As far as I can determine, specializing the member function only works if it has a single template parameter, like so:
<br />
template< int N ><br />
class Foo<br />
{<br />
public:<br />
int GetNumber() const { return 42; }<br />
};<br />
<br />
template < int N ><br />
int Foo< N >::GetNumber() const { return 42; }<br />
<br />
template < ><br />
int Foo< 5 >::GetNumber() const { return 69; }<br />
Can anyone explain how I can apply this logic to the case of multiple template arguments? The following code, by way of example, does not compile.
<br />
template< class X, int N ><br />
class Foo<br />
{<br />
public:<br />
int GetNumber() const { return 42; }<br />
};<br />
<br />
template < class X, int N ><br />
int Foo< X, N >::GetNumber() const { return 42; }<br />
<br />
template < class X ><br />
int Foo< X, 5 >::GetNumber() const { return 69; }<br />
Any help would be greatly appreciated.
|
|
|
|
|
Why don't you simply make a check inside the function.
template< class X, int N>
class Foo
{
public:
int GetValue() const
{
return 5 == N ? 69 : 42;
}
};
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|