|
You use the escape character "\":
char* c = " some string \" ";
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
|
Hi!
I run a simulation program as a child from another application. The program is a bit time consuming, so, as a user-feedback, I want the names of the output-files that are generated to be listed in a text-box, as the simulations are carried out. The child-program should in other words just display the dialog with the text-box, perform the simulations, and for each one add a file-name to the text box, and finally close the dialog and terminate after the last one. Whithout the need to click any buttons.
My question is "where do I put the call to the simulation function? Placing it at the end of the OnInitDialog-function makes the dialog show up first at the very end of the last siimulation.
maladuk
|
|
|
|
|
Without using thread you can:
(1) Post a user defined message to your dialog at the end of the InitDialog method and then, in the message handler, call the simulation function (that has also to periodically update your 'status textbox').
(2) Use, for the same purpose, a one-shot timer.
(3) ... (at the moment no further ideas)
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.
|
|
|
|
|
maladuk wrote: I run a simulation program as a child from another application. The program is a bit time consuming, so, as a user-feedback, I want the names of the output-files that are generated to be listed in a text-box, as the simulations are carried out.
If the child process is printing the names of those files, see here and here.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
I want to write a console application with WinMain, i.e. WIN32 APP but without any windows.
I want it to have a while cycle in the main func doing something and the program to exit gracefully when Windows shuts down. And my problem is I do not know how to get system information - if windows is shutting down or restarting. If I do not exit the cycle the system will hang waiting for my program to finish. And as I do not want to run it as a service there is no way to catch the messages coming from the OS because they are sent either to services or Windows Apps. Can you help me ?
modified 7-Mar-17 16:42pm.
|
|
|
|
|
You could try creating one Window but make it invisible. Not pretty but even Microsoft themselves have been known to resort to this at times. I'm sure WMI could also be used to get you the information you want but I don't knw any more about it than that I'm afraid.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
U could handle WM_ENDSESSION .
Come online at:-
jubinc@skype
|
|
|
|
|
Without a window, how are you going to respond to the WM_QUERYENDSESSION or WM_ENDSESSION message?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You have a hidden window. It's a common technique. If you use Spy you'll find a number of such windows.
Steve
|
|
|
|
|
I know that, but Daniel's requirement was, "without any windows."
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Have your application be a window - hidden and with no size.
This way, you can catch the relevant messages.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Hi Experts,
How to get Log of a value with respect base of 2.
Thanx
|
|
|
|
|
log<sub>2</sub>(x)=log<sub>e</sub>(x)/log<sub>e</sub>(2)
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.
|
|
|
|
|
Binary logarithm.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi Experts,
How can I read a byte in unsigned variable. Because this value may be nagetive.
I tried like this
<br />
short signed int m_nOneByte=0;<br />
memcpy(&m_nOneByte,btBuffer+0x40,1);<br />
Hex value is 0xf6 which is -10.But it is dispalying 246.
|
|
|
|
|
pther wrote: How can I read a byte in unsigned variable. Because this value may be nagetive.
Sorry, you seem confused: Bytes *ARE* unsigned types. Range 0-255.
0xf6 is 246. It is NOT negative.
int (the signed is the default) can hold all positive values a byte can have.
Are you perchance missing the char -type?
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
If your array is a char array, you can simply assign it:
short newValue = *(btBuffer+0x40);
BTW, you should use the prefix "m_" on class members only (m stands for member).
|
|
|
|
|
pther wrote: How can I read a byte in unsigned variable. Because this value may be nagetive.
Simple, for instance:
unsigned char buff[]={0xff, 0xf6, 0x01};
int i;
i = *((char *) &buf[1]);
<pre>
:)
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.
|
|
|
|
|
Hello everyone,
Suppose we defined a string buffer (array), like this,
char array[] = "hello world";
char buf[256]
Sometimes, I noticed that we either use,
1. array (buf)
or use,
2. &array (&buf)
or use
3. &array[0] (&buf[0])
as the beginning address of the array,
example like,
strcpy (buf, array);
strcpy (&buf, array);
...
I am wondering the differences between the 3 approaches, and which approach is the most correct?
thanks in advance,
George
|
|
|
|
|
array and buf both denote pointers to chars (char* ).
In fact, array is a const char* , as you can not alter the content of the string (well, even if you could, it would be wrong to try).
By convention, strings in C++ are null terminated, and it is your responsibility to count the \0 in. I the string literal "Hello World!", the \0 is appended automagically by the runtime. Go try and check the string lenght!
So, &buf is denoting the address of a pointer to a string of char s. When that is what you want, you want exactly that.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Thanks jhwurmbach,
So you mean buf is not the same as $buf? But in my experience buf and &buf always have the same effect, examples,
1. strcpy (buf, "Hello World");
2. strcpy (&buf, "Hello World");
regards,
George
|
|
|
|
|
George_George wrote: n my experience buf and &buf always have the same effect, examples,
1. strcpy (buf, "Hello World");
2. strcpy (&buf, "Hello World");
And this *DOES* work?
I would bet that given
char buf[256];
buf is of type char*
&buf is of type char** - that is a pointer to a char pointer.
OTOH, &buf[0] would be the same as buf , as you are dereferencing on pointer by using the operator[]
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
Hi jhwurmbach,
I have tested that buf and &buf are of the same value -- means same effect. Here is my program to test. Any comments?
int main()
{
char buf[] = "Hello World";
int p1 = buf;
int p2 = &buf;
return 0;
}
regards,
George
|
|
|
|
|
This:
#include "stdafx.h"
#include "iostream"
int _tmain(int argc, _TCHAR* argv[])
{
char array[] = "Hello World!";
if( array == &array) {
std::cout << "Equal" << std::endl;
}
else {
std::cout << "Inequal" << std::endl;
}
char* p1 = array;
char* p2 = (char*)&array;
char* p3 = &array[0];
int pI1 = (int)array;
int pI2 = (int)&array;
int pI3 = (int)&array[0];
return system("pause");
} won't compile:
test.cpp(21): error C2446: '==' : no conversion from 'char (*__w64 )[13]' to 'char *'
test.cpp(21): error C2040: '==' : 'char [13]' differs in levels of indirection from 'char (*__w64 )[13]'
So array is of type char* , wheras &array is of type char[13] .
But you are right, both point to the same chunk of memory.
It seems like the runtime is doing some magic with the adress-of -operator.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|