|
I too am annoyed by two versions of bool. What’s worse is if you use bool the compiler tells you about a performance issue. And with today’s processors I am not sure which one is really faster. Memory is slow compared to cpu cycles (disk is several orders of magnitude slower) so avoiding additional code bloat may be faster than executing a few extra cycles of cpu time... As others have pointed out BOOL is part of windows and not just MFC.
John
|
|
|
|
|
=[ Abin ]= wrote:
Anyway, I just couldn't see the necessity of BOOL even though I've been using BOOL in MFC applications for years.
I think it is just matter of who comes first and backward compatibility. For example, you cannot use type bool in a com interface (I think).
My articles and software tools
|
|
|
|
|
=[ Abin ]= wrote:
in stardard C we use bool for the "true-or-false" value
Before I started C++ programming in the mid 90's, c did not have a bool type.
One of the first things I did in every program was typedef bool or #define TRUE=1 FALSE=0
|
|
|
|
|
class A
{
public:
A();
~A();
};
======================
class B : public A
{
public:
B();
~B();
void RunOuterLoop();
};
=======================
int main()
{
A a;
B b;
b.RunOuterLoop();
return 0;
}
void B::RunOuterLoop()
{
etc.
}
The compiler returned a "LNK2001: unresolved external symbol" error message for both 'ctor' and 'dtor' of "B" even though both are defined. (Because of those two errors, it also returned one for "b.RunOuterLoop()", which is understandable.)
I have been staring at this for so long, I know I'm suffering from tunnel vision.
Thanks for any help.
William
Fortes in fide et opere!
|
|
|
|
|
You haven't defined any dtor or ctor for A or B, you've only declared them.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I didn't show them, but I did define all the 'ctors' and 'dtors'. (I believe I said that in my statement.)
A::A()
{
}
A::~A() { }
======================
B::B()
{
}
B::~B() { }
I didn't want to use up more space with my question than I had to, which is why I didn't show them.
William
Fortes in fide et opere!
|
|
|
|
|
Also, all methods in both classes A and B are private.
Best regards,
Alexandru Savescu
P.S. Interested in art? Visit this!
|
|
|
|
|
Thanks for replying.
That was totally an omission on my side in how I presented the sample. Everything in both classes are public.
I regret the oversight and will correct the sample, but the original errors still stand.
(I cannot believe some of these dumb oversights I still commit, and what's even more humiliating, is that I do it for the whole world to see!!)
Accept my word that EVERYTHING in both classes are public.
William
Fortes in fide et opere!
|
|
|
|
|
Ok, you defined everything, but did you add all .cpp files into your project? If you classes are declared in a .h file that is included in the .cpp file while the main function is located, you will get the error if your class member functions are defined in a different .cpp file and you forget to add it to your project.
I am asking this because I actually compiled your program with no problem (I put everything in one .cpp file).
My articles and software tools
|
|
|
|
|
Thanks for replying, and thanks for the solution!!
Yes, that was it. The ".cpp" file was NOT added to the project.
I was concentrating so hard on the compiler error, checking, double checking, and triple checking to make sure the 'ctor' and 'dtor' were defined (along with all the other syntax requirements), but totally overlooked the fact that the ".cpp" file had NOT been added to the project. As soon as you mentioned that as a possibility, I went to check if it were true, and sure enough, it was true. Thanks.
Up until you mentioned it, I still was not thinking in that direction, and still can't figure out why I hadn't added it to the project. Usually, when I add the ".h" file, I would also add the ".cpp" right afterwards, except in this case, I didn't, and I can't say why.
Thanks again. I appreciate the help!!
William
Fortes in fide et opere!
|
|
|
|
|
Hi
I used the SPY tool of Visual Studio to determine which messages are sent when you press the 'X'-button on a dialog: WM_CLOSE & WM_ONSYSCOMMAND if i'm not wrong.
The 'X' button makes sure you get ride of your dialog but i want the main dialog to be closed as well.
|==================================|
| Main window [ _][ X ]<----After first X click, this click too
===================================|
|==================================|
|[] Dialog [ X ]<--- First you click here;
===================================|
So i click the 'X' on the dialog, and that dialog gets closed. But the 'X' on the main window has to be closed aswell.
Anyone any ideas?!?
Greetings
Jens
|
|
|
|
|
Set a BOOL variable in your dialog when the X is clicked. After DoModal returns, check the value and close the main window if it is TRUE.
Jason Henderson "I can picture in my mind a world without war, a world without hate. And I can picture us attacking that world, because they'd never expect it."
- Jack Handey
|
|
|
|
|
Well, i can do this but i have to close the Mainframe for exiting the entire program. So how can i get a pointer to the mainframe? (If i get the pointer, i'll send a WM_CLOSE message.)
|
|
|
|
|
AfxGetMainWnd() will return a pointer to mainframe.
Jason Henderson "I can picture in my mind a world without war, a world without hate. And I can picture us attacking that world, because they'd never expect it."
- Jack Handey
|
|
|
|
|
great great
That global function did the trick:
AfxGetMainWnd()->PostMessage(WM_CLOSE,0 ,0);
thanks alot
|
|
|
|
|
hi everyone!
i'm trying to login to a site ("POST" the username and password) using ssl. the problem is that my app does not receive the cookies after the login. actually it doesn't recieve the Set-Coookie header at all.
this is the code i use:
<br />
HINTERNET hSession = InternetOpen("betfairAPI", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);<br />
HINTERNET hConnection=0, hReq=0;<br />
TCHAR hdrs[] = _T("Content-Type: application/x-www-form-urlencoded");<br />
TCHAR frmdata[] = _T("Username=<usrnm>&Password=<passwd>&fa=ul");<br />
const char **accept = new (char*);<br />
*accept=new char[12];<br />
strcpy(*accept,"Accept: */*");<br />
<br />
<br />
DWORD dwSize = 0;<br />
LPVOID lpOutBuffer = NULL;<br />
<br />
<br />
if(!hSession)<br />
{<br />
printf("damn...\n");<br />
return;<br />
}<br />
<br />
try<br />
{<br />
hConnection = InternetConnect(hSession, _T("www.mysite.com"), <br />
INTERNET_DEFAULT_HTTPS_PORT,<br />
NULL, NULL, INTERNET_SERVICE_HTTP, 0, 1);<br />
if(!hConnection)<br />
{<br />
printf("nu ma pot conecta la adresa specificata...\n");<br />
InternetCloseHandle(hSession);<br />
<br />
return;<br />
}<br />
<br />
hReq = HttpOpenRequest(hConnection, "POST", <br />
_T("User/User_Login.asp"),"HTTP/1.1", NULL, &accept, <br />
INTERNET_FLAG_SECURE | INTERNET_FLAG_KEEP_CONNECTION , 1);<br />
if(!hReq)<br />
{<br />
printf("nu pot crea request...\n");<br />
InternetCloseHandle(hSession);<br />
InternetCloseHandle(hConnection);<br />
<br />
return;<br />
}<br />
<br />
HttpSendRequest( hReq, hdrs, strlen(hdrs), frmdata, strlen(frmdata));<br />
<br />
retry:<br />
if(!HttpQueryInfo(hReq,HTTP_QUERY_SET_COOKIE,<br />
(LPVOID)lpOutBuffer,&dwSize,NULL))<br />
{<br />
if (GetLastError()==ERROR_HTTP_HEADER_NOT_FOUND)<br />
{<br />
printf("no headers...\n");<br />
} <br />
else<br />
{<br />
if (GetLastError()==ERROR_INSUFFICIENT_BUFFER)<br />
{<br />
lpOutBuffer = new char[dwSize];<br />
<br />
goto retry; <br />
} <br />
else<br />
{<br />
printf("%s", lpOutBuffer);<br />
} <br />
} <br />
} <br />
}<br />
catch( CInternetException* e) <br />
{<br />
e->ReportError();<br />
e->Delete();<br />
}<br />
<br />
<br />
InternetCloseHandle(hConnection);<br />
InternetCloseHandle(hReq);<br />
any ideas would be appreciated.
thx!
|
|
|
|
|
hello
Q1:
i have written a C++ client which parses an email from the inbox of default mail client of any machine..the program uses MAPI functions like MAPIReadmail,MAPIFindnext,MAPILogon,MAPILogoff,
MAPIReadnext..
what are the header files need to be included in my client program!
Q2:
what is the format in which the message is storerd in my system?
kindly help me in this regard!
Q3:
what is a message identifier??
Q4:
where will the profile of the user be stored in a system??
i need to specify the path of the file which contains my profile in my MAPI porgram..
ranjani
|
|
|
|
|
Hi All,
I want to disable some keys and key combinations when my applciation is running..like Alt+ F4 and Ctrl + Esc etc...I did this using Keyboard hook..but this hook seems to wrok only in WinNT and above and when I test my applcaition with Win-98..it fails..can anyone throw some light why this is happening and also if something can be done to make this happen...I need it urgently..Someone please help??? Any help or pointers are thoroughly appreciated..
Thanks a lot in advance..
Himanshu
|
|
|
|
|
I am compiling (rather most precisely try to) compile ATL COM thingys written probably in VC 5 in VC .NET. All was doin cool but now me getting following stupid errors.
FILEA.obj : error LNK2001: unresolved external symbol "public: static class ATL::CTrace ATL::CTrace::s_trace" (?s_trace@CTrace@ATL@@2V12@A)
FILEB.obj : error LNK2001: unresolved external symbol "public: static class ATL::CTrace ATL::CTrace::s_trace" (?s_trace@CTrace@ATL@@2V12@A)
.... and about thousand more just like above.
HELP!!!!!... yes, plz help me out!
Have a Good Day
mE
---------------------
A gasp of breath,
A sudden death:
The tale begun.
A rustled page
Passes an age:
The tale is done.
|
|
|
|
|
Found the solution!
Link with atlsd.lib in DEBUG mode should solve the problem.
HTH
Braulio
|
|
|
|
|
Heyyyyyyyyy..... thanks for the help. You helped me to remove 1425 errors!!! You rule.
thanks, keep on the great work.
mE
---------------------
A gasp of breath,
A sudden death:
The tale begun.
A rustled page
Passes an age:
The tale is done.
|
|
|
|
|
I'd like to develop a VC++ application using the POSIX standard
more than possible in order to reduce portability problems.
Does WINNT support POSIX semaphores and order synchronization
utilities ??
|
|
|
|
|
resp sirs
i have written a C++ client which parses an email from the inbox of default mail client of any machine..the program uses MAPI functions like MAPIReadmail,MAPIFindnext,MAPILogon,MAPILogoff,MAPIReadnext..
what are the header files need to be included in my client program!
what is the format in which the message is storerd in my system?
kindly help me in this regard!
ranjani
|
|
|
|
|
ranjjj wrote:
what are the header files need to be included in my client program!
mapi.h
ranjjj wrote:
what is the format in which the message is storerd in my system?
The MapiMessage structure might be what you are looking for. However, I don't know if the disk image is identical to the data structure kept in memory.
|
|
|
|
|
Is it possible for a user to alter the code of a .dll(in VC++) file ,used by an application.
Ur help is greatly appreciated.
|
|
|
|