|
Since the thread does not have a message pump, using PostMessage() is out of the question. I think you are left with synchronization and events at this point.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Hi,
I've heard it's possible to do something like this,
struct Data myData =
{
{ #include "myData.dat" }
}
Or something like that... to include information from a file directly into a struct. My question is, what is the proper format for this, and how do I format the file so that it reads in correctly? Let's say my struct has 3 integers and a string, do I then have to have 3 integers and a string on each line of the file, separated by commas or something? Or what?
Thanks!
|
|
|
|
|
the #include preprocessor directive copies the content of the file in parameter at the place it is written. so, your code would work i think. but, i doubt the rounding { } are necessary.
however, the content of the myData.dat should be containing a correct C++ code that defines a structure...
struct Data {
#include "myData.dat;
} myData;
myData.dat :
private:
int m_i;
char m_c;
public:
Data();
~Data();
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Right, actually what I need is the information to be included in a struct array rather than the struct definition itself, but the same principle should apply. Thank you.
|
|
|
|
|
IMO, anyone coding like that should be fired.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Maximilien wrote:
anyone coding like that should be fired
yes... of course !
actually, i don't really understand the point why he tries to code this way ; i just answered consequently...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Using that method was my directive. If you understood the context and objectives you might see things differently. I can't talk about it since it's a military system.
|
|
|
|
|
i didn't see anything, i didn't heared anything...
... and you already told too much (we don't need to know you work on a confidential project or not)...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Software is software. You have good and solid software designs and bad software designs. Anyone who designs software like that, should go to school again. Any programmer who doesn't complain about such IMHO horrible design should go to school with the designer...
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Thank you for helping to perpetuate the belief that all computer scientists are elitist and arrogant and jump to conclusions about others' intelligence and skills based on their own lacking information and experience.
Anyway... to the original poster:
You're including actual data with this design, right? You're not trying to include compiled code from another file? It's basically just a data table that you have as an external file?
|
|
|
|
|
Maximilien wrote:
IMO, anyone coding like that should be fired.
No, it's sometimes (rarely) necessary for large table structures.
|
|
|
|
|
It's not necessary to do such horrible things. Especially for large table structures! If you have a very large table structure, one should redesign the class into smaller reusable classes and create a utility that combines the functionality. Thats one demand for a good design.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
The simple fact that you would criticize the code, designer, and developer without knowing the context is laughable. This code is necessary in this case. I have never used it before, but it is the only way to meet all the requirements for this piece of software at this time. Anyone who thinks this type of design is never necessary is clearly not experienced in a wide enough variety of software to have been required to use it before. Your comments are rude, uncalled for, and altogether ignorant. Get your facts together, all of you in this thread who are criticizing, get your facts together before you jump on someone's case about a software system that you have no knowledge of whatsoever.
If you have nothing useful to say, then say nothing. I have been asking and answering questions on this BBS for years, and I've never seen such unbased arrogance here before. I hope to never see it again.
|
|
|
|
|
Hello,
I apologize for my rudeness. Indeed, should not critisize people I don't know on something I don't understand. I have experiance in including stuff at places where it shouldn't be included.
I once had to hide some details that I included. One solution was to create a "private" namespace and include the header there, which was the most horrible mistake I ever made. Not only did it not solve my problems, but it created many more. Bad maintanability is one, lot's of compiler errors are another.
After giving it some more thought, I insulated the details from the physical interface and I included the file in the source file, not the header.
I know that there are many solutions to one problem, and that one solution is always better than another. I also don't know what you are trying to achieve, but since you know that it can be done, I hope that you are happy with the solution.
Again, I apologize for my rude post.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Thank you for your response, this certainly proves that there's always someone who knows more that can shame those arrogants that mocked those who knew less... great lesson.
|
|
|
|
|
Hi
Sorry to interfere with this discussion. As a novice programmer, I come to this boards to ask for advice about things that I don't know or don't understand. Very often I get invaluable help but unfortunately also very often I only get replies like this... "That would never work"... "Anyone coding like this should be fired"... etc etc etc. If we come to ask a question is not because we are stupid but because we don't have the knowledge, and actually whoever claims that he or she knows everything about C, C++, C#, etc. and is infallible MUST actually be fired.
Bottom line, if you want to help, make constructive comments, explain why things would work or wouldn't, provide sample code and refrain yourself from the impulse to riducule those who know less than you... there's always someone out there that knows more than you.
Cheers
Carlos
|
|
|
|
|
Is there a way to prevent a window within which some child controls( such as button, edit ect.)in it from being actived?
I created a custom window with a custom window procedure, and then I created some child controls (a exit control, a listbox control ect.) within it.
and I want to prevent this window from being actived (or says : I want to make the parent of this window to keep focus even I click anywhere within this window),
so I intercept the WM_MOUSEACTIVATE message and return MA_NOACTIVATE. by this way,
I can prevent this window from being activated when I pressed mouse whithin the client area of it. but when I clicked any child control within it,
the parent of this window was lost focus ....
In this scenario, what I need to do to prevent the parent of this window from losting focus when I click any child control within it???
Best regards!
JERKII, from china
Welcome to my site:
http://www.cntomorrow.com:3310
|
|
|
|
|
See if the WM_ACTIVATE or WM_ACTIVATEAPP messages are of any help.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
sorry, but I can't get any help from WM_ACTIVATE or WM_ACTIVATEAPP...
|
|
|
|
|
Why can't you get help from either of those messages?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Assume note pad is running. The API EnumWindows will return the window title
such as "Untitled - Notepad".
I am looking for an API that will tell me "notepad.exe" is running.
In short I am looking for the same information the task manager displays.
thanks
|
|
|
|
|
See the Process32First() /Process32Next() pair. There's also EnumProcesses() .
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
|
Try using GetModuleBaseName() or GetModuleFileNameEx() through u can get handle of the process and the file name that is being executed.
"Don't forget to rate the reply, if it finds the solution for you".
|
|
|
|
|