|
Really I don't see any flaw in your answer.
[added]
Ok, now Mr.Univoter is balanced a bit.
[/added]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: Really I don't see any flaw in your answer.
I guess it's because I didn't reply with something like: "The error is on line 34 in the MyFile.cpp file. You have to replace the '.' with a '->'. " .
CPallini wrote: Ok, now Mr.Univoter is balanced a bit.
Thanks
|
|
|
|
|
CPallini wrote: Really I don't see any flaw in your answer.
humm!m there is no flaw in question but there would be multiple defect in application !
"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
|
|
|
|
|
Philosophical mood today?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Did you use of debugger and can you show your code that it generates this error to us?
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 )
|
|
|
|
|
Hello All,
I develop code in vc++,win32. Now my next part is to make GUI in very short period. 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 .
Thanks .
|
|
|
|
|
If your code is in win32 [dll] you can write a RCW[Runtime Callable Wrapper] for the exposed functions and then use them in C#. Alternatively you can also use Interop
Interop is for calling raw DLL exported functions.
RCW (Runtime Callable Wrapper) is used to expose COM objects to .NET classes - ie., to make COM objects callable by .NET code.
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
ashish8patil wrote: I develop code in vc++,win32. Now my next part is to make GUI in very short period.
You may also use MFC for this task.
ashish8patil wrote: If i use C# to make GUI and backend code in vc++.Is it possible.
Yes.
ashish8patil wrote: And Please tell good things and bad things if i use like that .and more from you .
Well, if you're a C++ developer, then you've to learn C# enough to make the GUI and at least about Platform Invoke [^] (alternatively COM interop [^]), such tasks are, of course, time-consuming.
The good things, I suppose, come from the experience gained about mixing the two worlds.
Eventually you may also conside to develop both GUI and core modules using C# (i.e go manged!).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
ashish8patil wrote: I develop code in vc++,win32. Now my next part is to make GUI in very short period.
You may opt to use MFC instead, which allows you to build dialog based applications, doc/view applications, ActiveX controls, etc., all with the help of wizards and existing templates. Give it a shot and you won't be disappointed.
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.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
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
|
|
|
|