|
rotorcli wrote: So can we say if we use static libnrary we need libraries header file(.h)because compiler must see the function's parameter list but when we use we do not need header files?
yes, that's true. the compiler doesn't know anything about functions you load with GetProcAddress.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Thanks for answers.
I have one more and last question.
I know that we can linking dlls by staticly or by dynamicly.(If this is not true please warn me).
When Linking dynamic linking libraries dynamicly(at run-time) we do not need header files of that dll.
But if we lnking dynamic linking libraries by staticly(compile-time), do we need header files too(like linking static library)?Or dont we need header file?
Can you give me please some information about that.(about linking dll staticly , dynamicly and header files)
Thanks again.
|
|
|
|
|
I'm trying to compile my first console app with VC++ 2005 Std and it has the following error
c:\program files\development_tools\microsoft visual studio\vc\platformsdk\include\winnt.h(3857) : error C2146: syntax error : missing ';' before identifier 'ContextRecord'<br />
Any ideas ?
|
|
|
|
|
Defenestration wrote: Any ideas ?
Yes, a ';' is missing before the identifier 'ContextRecord'.
If you don't provide more information (like some code around the line at which the error occur) we won't be able to provide you with a solution.
Error message in general are very explicit. If you get a message like that, I'm almost sure it is not because you forgot to plug your computer
|
|
|
|
|
When I look at the winnt.h include file, the struture where PCONTEXT is defined is greyed out, which means that it's being conditionally compiled out. This is defined differently depending on whether the preprocessor constant _X86_ or _AMD64_ is set. In my case neither is being set.
Would I be right in thinking that this needs to be manually set depending on whether you are targetting 32-bit or 64-bit ?
|
|
|
|
|
Solved the problem... It was because I had
#include <windef.h>
before
#include <windows.h>
I just removed the windef.h one and everything's OK
|
|
|
|
|
Please help me to understand the commands:
{{AFX_INCLUDES()
#include "Mylibrary.h"
//}}AFX_INCLUDES
Thank you!
Le Van Long
|
|
|
|
|
please specify more details, how did u get this? what project type do you work in?
in order to help you we need more details....
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
#include is a preprocessor directive that instructs the preprocessor to insert the named file as if it had appeared in the source program at the point where the directive appears.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
I think he ment where did the remark of AFX_INCLUDE comes from...or did i missunderstand him???
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
YaronNir wrote: I think he ment where did the remark of AFX_INCLUDE comes from...
It all depends on how you interpreted the question. Technically, AFX_INCLUDE is not a command. In any case, it is added by ClassWizard.
YaronNir wrote: ...or did i missunderstand him???
Your reply to him implied there was no understanding at all.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Hi all
i have adialog -based application.when a button is pushed a user defined function has to be called which will have to read every word from (one word in one line)notepad to the CString varaible used in my VC++6.0 program.
how can i do that
is there any built-in methods or is it necessary to use the database connection?
Thanks in advance
--lekshmi
|
|
|
|
|
not sure i undestand correctly what you mean but,
if you find the notepad window, one of its child is the rich edit control (where the words are in place) from there all you have to do is read them line by line into a CString....
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
YaronNir wrote: if you find the notepad window, one of its child is the rich edit control (where the words are in place)...
I'm not sure what OS you are using, but with Windows XP, Notepad does not use a richedit control.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
"I'm not sure what OS you are using, but with Windows XP, Notepad does not use a richedit control."
my bad, it uses a Edit....
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Fairly simple my friend!
What i do is that,
first of all include fstream.h and string class in your dilog's cpp file.
Now in the function associated with that button, write code like this
ifstream fin;<br />
string data;<br />
int size = 0;
char *name;
fin.open("myfile.txt");<br />
while (!fin.eof())<br />
{<br />
fin>>data;<br />
size = data.strlen();
name =(char*)malloc(size + 1); <br />
strcpy(name, data);<br />
CString myCString = CString(name);
}
I did not run this code. So if you find any problem let us know.
Good luck
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
He wanted to read data from notepad, not from a file.
An advice also:
fin>>data;
size = data.strlen();
name =(char*)malloc(size + 1);
streams (ifstream for example) are part of C++ and malloc is more a C programming style. In general, it is not really nice to mix C and C++ in this way. But this is just a detail .
|
|
|
|
|
hello,
thank you for the sudden response.
i know this is now mixing of C And C++.but how can i eliminate the problem.plz help me
thanks in advance
lekshmi
lekshmi
|
|
|
|
|
You've not been clear with your questions right from the beginning. Now what do you want to eliminate? You use VC++, but you don't wanna use C++, you want C rather? Anyway, If you want one from MFC, you can have a look at this.
<br />
CFile cf;<br />
cf.Open("c:\\test.txt",CFile::modeCreate|CFile::modeWrite);<br />
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
Sorry, I don't know the answer. I was just answering to another post.
|
|
|
|
|
Yes it is but i dont know any other way to do it. I think if it works, do it. Can you please tell me what could be the problems when we mix c and c++?
Thank you
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Aqueel wrote: Yes it is but i dont know any other way to do it
Use new instead of malloc:
name = new char[size + 1];
For char arrays, there is no difference but if you use arrays of classes, then definitively you should use new instead of malloc. malloc will only allocate the memory and when you release it, it will just free the memory. With new and delete, the constructor and destructor of your class will be called which allows you to put some initialization and some clean-up code in your object. This is a much more object-oriented way of working.
Aqueel wrote: Can you please tell me what could be the problems when we mix c and c++?
There won't be any problems (or at least not that I'm aware of). It is more to have your code to be consistent. That's why I said it wan't very important .
|
|
|
|
|
Thank you Cedric!
I got it...
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
hi
Aqueel's code really works for me.but it is a mixing of both c and C++
how can i remove this.
i am using VC++6.0.is there a similar methods available in VC++
thanks in advance.
lekshmi
|
|
|
|
|
what do you want?
Menu:
1.Read A Text File.
2.Read The Text Content Of A NotePad.
3.Not Sure.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|