|
change
bool Test(int n, fC* p)
to
bool Test(int n, fC p)
Also remove the cast.
void main()
{
Test(3, (fC*) &fc);
}
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
Ooops! My bad ...
Maxwell Chen
|
|
|
|
|
|
Maxwell Chen wrote: bool Test(int n, fC* p)
Change to
bool Test(int n, fC p)
Maxwell Chen wrote: Test(3, (fC*)&fc);
Change to
Test(3, fc);
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks!
Maxwell Chen
|
|
|
|
|
I've been looking at callback stuff of my own, and if you your code to:
typedef void (*fC)(int* p);
bool Test(int n, fC p)
{
int* pN = new int;
*pN = 3;
(p)(pN);
delete pN;
return true;
}
void fc(int* p)
{
*p;
}
void main()
{
Test(3, (fC)fc);
}
Then it works just fine...
But your code doesn't look bad to me. Just more indirection than you need. fC is already a type of "pointer to a function", so why make things work with "pointer to a pointer to a function"?
In the interests of science, I added these two lines to main:
fC p0 = fc;
fC *p1 = &fc;
And on the second line I get: "error C2440: 'initializing' : cannot convert from 'void (__cdecl *)(int *)' to 'void (__cdecl ** )(int *)'".
This leads me to suggest that you're seeing the same behaviour as when you try to get a pointer to an array - you get the first element of the array back. This is probably a C thing that's biting you. And then you manually cast it in your original main and things blow up later...
That's my theory, anyway!
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Thanks!
Maxwell Chen
|
|
|
|
|
Iain Clarke wrote: In the interests of science
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
I want to create one email notification application for outlook express 6.
i used "MAPIFindNext()" function to get whether unread messages are present inbox.
this function returns first unread messages id.
but i need to find number of unread messages. Is there any function to find that?
Thanks.
|
|
|
|
|
I'm no great expert, having never used MAPI, but the following line from the documentation may be of help:
MSDN wrote: The MAPIFindNext function allows a client application to enumerate messages of a given type. This function can be called repeatedly to list all messages in the folder.
This implies to me that you can just run the function repeatedly, and just count how often it succeeds - the you have your number!
Good luck,
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Iain,
Yes this function gives notification based on messagetype.
i already tried this...
But consider inbox have three 'x' type messages, call the MAPIFindNext function three time with x messagetype.
it repeats the same message id and not give other message id.
Reason is it's another functionality is, it will give first unread messageid of messagetype 'x'.
am i correct?
Thanks.
|
|
|
|
|
Hai..
Can anyone help me ...
how to get ip address of the system using getadapterinfo function..but I tried using that function but it is not retrving the ip address...
Regards
Sunny G
|
|
|
|
|
And what is retrieving instead? See here [^], for instance.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
optical123 wrote: but I tried using that function but it is not retrving the ip address...
What does your code look like:
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi everyone
Can you give give me a good tutorial about device driver programming,maybe codeproject has articles about make it or using google we can find a lot info about it but I want to start of first,what is device driver and then start to writing code in MFC?
Thanks
|
|
|
|
|
Writing a driver using MFC is like using psychology to get some insight of quantum mechanics .
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Steps:
1: Get a copy of Windows Driver Kit V6001.
2: Install Windows Driver Kit.
3: You get lots of sample code in the hard disk.
BTW, there is no MFC in device driver code.
Maxwell Chen
|
|
|
|
|
Thanks for the info. Can u suggest any tutorials which gives the basic idea of Device Driver Programing...
Thanks
|
|
|
|
|
Look at the Device Driver articles by Toby Opferman[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
brucewayn wrote: Can you give give me a good tutorial about device driver programming...
This is about as good as it gets.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
HI ,
im using UrlDownloadtofile() to download some files ...but the issue is if the file is present im able to download file(With return value S_OK) ...but if the server is not accessible ie (some issue with IIS or any other..) or if the file is not present im not getting the exact return value from UrlDownloadtofile to specify to user whether it is server issue or File not present...in MSDN it was given that if the return value is INET_E_DOWNLOAD_FAILURE then file is not present in the server but...im getting some junk value like -2146697210...when the file is not present in the server or server is not accessible....
So please let me know how can i notify user what is the exact problem....
|
|
|
|
|
As per the documentation, this function will return, either of the following values,
S_OK - 0
E_OUTOFMEMORY - 0x80000002
INET_E_DOWNLOAD_FAILURE - 0x800C0008
and from the error code you've given the value is negative which means that you're taking this values to a signed variable like int.
The actual return type is HRESULT and the values are defined with unsigned hexadecimal. Please compare it with INET_E_DOWNLOAD_FAILURE, S_OK or E_OUTOFMEMORY to know whether it has succeeded or not.
The error code you've given is close to INET_E_DOWNLOAD_FAILURE value. Please compare against it.
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Thanks for ur reply .......i have changed view to Hexadecimal display...and now im getting return value as 0x800C0006...May i know what this return value indicates.....
|
|
|
|
|
p_1960 wrote: May i know what this return value indicates.....
Have you tried errlook.exe?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
May i know from where can i get that exe...?Is it a third party exe..
|
|
|
|