|
|
David Crow wrote: It does what it needs to do.
Are you developing commercial products with VC6?
Best Wishes,
-David Delaune
|
|
|
|
|
Yes.
"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
|
|
|
|
|
Hmmm,
You are working at IBM now? I thought you were at Pinnacle Business Systems. I remember e-mailing you there many years ago when you needed help with a CEdit derived class.
|
|
|
|
|
Randor wrote: I thought you were at Pinnacle Business Systems. Still am. We own the AJS product that IBM sells.
"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
|
|
|
|
|
Respect!
I use VS2017 and still miss the old good VS6!
|
|
|
|
|
My preferences:
Visual Studio 2017 on Windows
CLion on Linux
|
|
|
|
|
Mostly I use Visual Studio, but once in a while Eclipse too does the job for me.
|
|
|
|
|
Code::Blocks
Wont touch VS any more unless I need to debug something - that pig of a thing is far, far too slow nowadays.
|
|
|
|
|
I have the basic level knowledge of pointers, arrays and recursion's.
But i it is really confusing and hard to implement in programming, like when returning a multi-dimensional array from a user-defined function to the main, and problems like that. I surfed through the net but did not get enough questions to practice these concepts neither did get any books that i can practice from.
So it would be really helpful if i can get some recommendations for the books or even websites from where i can practice.
THANK YOU.
|
|
|
|
|
You may find tons of reference (and dereference) material on pointers and the like, just Googling.
|
|
|
|
|
Tarun Jha wrote: ...like when returning a multi-dimensional array from a user-defined function... The issue you may be having is you are searching for something very specific. Broaden your search. Instead of searching for a two- or three-dimension array, just focus on arrays in general. Visually, you might look at them something like:
int arr[5];
int arr[3][5];
int arr[2][3][5];
"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
|
|
|
|
|
They're all pointers, and pointers are simply an address in memory.
Everyone is different, but for me, the best way to really understand a C++ concept is to write a small console program and experiment using the scientific method--that is, I hypothesize how something should work, write simple code to test that hypothesis and refine. (Sometimes, I open a disassembly view in debug mode, but that may understandably be even more confusing for many.)
Edit: A word of warning. Don't return a pointer to an object allocated on the called function's stack. While the data it points to may be valid immediately after the call, it will likely become corrupt with the next function call.
|
|
|
|
|
Hello,
Can you guide me though simple steps to create a console application which can also handle windows events?
|
|
|
|
|
A console app is not a Windows app, so it does not receive Windows events.
|
|
|
|
|
My mean to say...
Can I create windows console based app which can receive events?
I think in Windows service we can receive events, same way I want. Is that possible?
|
|
|
|
|
Fedrer wrote: windows console based app What does that mean? An app is either Windows based or Console based, it cannot be both.
|
|
|
|
|
Not true for a long time .. there is no such thing as a "real console" anymore the whole DOS kick has been dead since Windows 7.
The console is entirely emulated now on windows, they just use a different message handler by default.
In vino veritas
|
|
|
|
|
leon de boer wrote: there is no such thing as a "real console" I never claimed that there was. I merely stated that the two application types are quite different.
|
|
|
|
|
Fedrer wrote: Can I create windows console based app which can receive events?
I think in Windows service we can receive events, same way I want. Is that possible?
What do you mean by "events"?
Is it what we see in the Windows Event Viewer?
Or you meant the Windows Messages?
If you mean a kind a "messaging" for services then you should choose some of the IPC mechanism such as Named Pipes.
See also winapi - Receive Windows Messages in a Service - Stack Overflow
|
|
|
|
|
If you mean by events Windows messages, you just have to implement a message loop. But a console application does not have a window that is required as message recipient. So you can only receive messages posted to threads. See How to post a thread message to a console application[^] for an example.
Alternatively you can create a (optionally hidden) window that receives the messages. Or create a GUI application (usually dialog based) and hide the window.
|
|
|
|
|
Ok so the whole console now is full emulated since Windows 7 it is just a normal window.
However it has a special message handler which filters out the normal windows messages and it doesn't have a proper message queue setup. It's rather technical to go thru and add the steps to convert it when there is a much simpler way.
For the record WM_TIMERTICK and a few other windows message do get passed thru (you can use timers now on a console app) .. This will work as illustration there is a normal windows queue present on a console window however expanding the queue and removing the filter is far more problematic
int main()
{
SetTimer(0, 1, 1000, 0);
SetTimer(0, 2, 750, 0);
MSG Message;
while(GetMessage(&Message, 0, 0, 0))
{
if(Message.message == WM_TIMER)
{
std::cout << "Timer" << std::endl;
}
}
}
By far the easiest way to do what you want is actually setup for a proper windows app but then create and attach a console to it which is the new fancy feature.
AllocConsole function - Windows Console | Microsoft Docs[^]
AttachConsole function - Windows Console | Microsoft Docs[^]
So it basically does exactly what you are after you have a full windows message queue underneath and you can pump whatever message you want to the console. The actual GUI window can remain hidden by simply never setting the WS_VISIBLE flag or attaching it to the taskbar in minimized form.
Your whole app is basically a minimal hidden standard window throwing messages up to a console which is I believe what you are after.
In vino veritas
modified 4-Feb-18 19:53pm.
|
|
|
|
|
Solution:
To arrive all the priests and devils to the other side, 6 steps are to be followed:-
1) Firstly one devil and one priest will go to the other side. Devil will stay to the other side while priest will come back with the boat.
2) Remaining two devils will go to the other side.
One devil will stay to the other side while one devil will come again with the boat.
So total two devils are on the another side of river and 3 priests and 1 devil is on the one side of the river.
3) Now two priests will go. One priest will stay while 1 priest and 1 devil come back with the boat.
4) Now remaining two priests will go to the other side of the river.
Total 3 priests and 1 devil is on the one side while 2 devils is on the another side of the river.
1 devil will come back with the boat.
5) 2 devils will go to the other side of the river. 1 devil will stay and 1 devil will again go back with the boat.
6) Now the remaining 2 devils will come to the other side of the river.
All the 3 priests and 3 devils arrive safely.
kindly help this project
|
|
|
|
|
Help how? Since you have the solution you know what code to write.
|
|
|
|
|
At the top of this forum is a topic "How to ask a question", please read and pay particular attention to #2.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|