|
i want to do a project on VoIp using TAPI After having some basic knowledge.
pls tell me from where i can take start.
Faizi
|
|
|
|
|
I want to add the following behaviour to CDateTimeCtrl:
show the embedded month calender control when the user double clicks on the editbox of the datetime control.
So double-clicking on the datetime control would give the same result as clicking on the drop-down button on the right.
Don't ask me why, this is actually a request by a customer.
how should I accomplish this behaviour?
Any help is appreciated.
|
|
|
|
|
I know this is a relatively irrelevant issue but it's been in my mind for long time: while in stardard C we use bool for the "true-or-false" value, in MFC we see BOOL instead, which is in fact a typedef of 32 bit int on win32 plateform(I think). Now my question is why.
Seeing that in contrast with bool , BOOL does:
1, Occupy more memory storage, four bytes instead of one, not that matters a lot, but after all one has always been smaller than four since the first day when the human being could count.
2, Have pseudo-ambiguous data type comparing to bool , I said "pseudo" because the ambiguity is not for the compiler, but for the programmers themselves. In common sense I would think void Func(BOOL bVal) and void Func(int nVal) are different functions but they are in fact the same, so doing such overloading would generate compiler error. However, void Func(bool bVal) and void Func(int nVal) are indeed different and can be overloaded each other. Which one makes more sense to us?
Perhaps BOOL was introduced due to the fact that C++ allows an integer value to be treated as a "true-or-false", so without BOOL , then if (65535 * 2) { ...; } would generate a "data truncate" warning since a one-byte bool could not hold value of "65535 * 2", thus they came up with such a new BOOL which is capable of holding larger values. Hehe, personally, I never exam a pointer using if (p) { ...; } , I always use if (p != NULL) { ...; } instead, which I think is a better practice.
Anyway, I just couldn't see the necessity of BOOL even though I've been using BOOL in MFC applications for years.
|
|
|
|
|
I believe that prior to the C++98 standard, which MFC pre-dates, there was no "standard" built-in boolean type in C++ so MS defined their own (as many did back then).
Im not sure when C got the built-in boolean type bool (if it does), probably in C99, otherwise C++98 should have had it pre-98.
“Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002
|
|
|
|
|
Hi,
I'm not absolutely sure, but i think the 'bool' is not part of ansi C. This could be the reason why microsoft introduced the BOOL, and it makes perfect sense.
If my assuption is correct, then the question is: Why the hell didn't they define BOOL as char instead of int?
greets,
Jason
|
|
|
|
|
The original Win16 API defined a bunch of data types for use in the API. Things like WORD , HWND , BOOL , LPARAM , etc., etc. date back to the 16-bit Windows days. This creates a type system that can be somewhat independent of the underlying hardware and operating system platform. This worked with some - though not complete - success when migrating code from Win16 to Win32 and from Win32 to Win64 (my understanding only, I have no direct Win64 experience).
Back in the Win16 days, the bool type was not part of the C or C++ language standards. It wasn't introduced until Visual C++ V5.0. So BOOL was defined in terms of types supported by the compilers of the day.
The definition has probably remained to ensure backward compatibility with both code and data.
Brad
|
|
|
|
|
=[ Abin ]= wrote:
In common sense I would think void Func(BOOL bVal) and void Func(int nVal) are different functions but they are in fact the same, so doing such overloading would generate compiler error. However, void Func(bool bVal) and void Func(int nVal) are indeed different and can be overloaded each other.
I have ran into this several times and had to use bool.
John
|
|
|
|
|
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
|
|
|
|
|