|
Hey Sorry man, I'm just checking your reply. Before even reading it I felt I should thank you for your helping effort. I'll read it, and if I find it reasonable, I'll give up the weapons & surrender . Anyway thanks a lot.
|
|
|
|
|
Now, let's move a little bit on:
If you agree with my previous post, consider this:
int a [2][2] = { 1,2,3,4 };
int[2]* ppa = a;
Do you get it? Instead of int**, I use int[2]*: a "pointer to an array of two integers". considering the int[][] as "array of 2 arrays of two integers".
The type of int** is int* (that doesn't exist in memory since we store arrays), but the value of int[2]* is int[2] that's just one row of the matrix ( in our case
{{1,2},{3,4}}
Now ppa[1][1] is "take the address stored in ppa, add 1*sizeof(int[2]). This is the int[2] representing the second row. Now we're anymore dealing with a pointer, but with an array, whose cell "1" has the value "4".
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
I have a non MFC project with couple of .h and .cpp files. Now i wnat to add a class CDbOperations to that project temporarily which will handle the database interatctions. I have used CDatabase, CString, CSemaphore classes in CDbOperations class. I have added required includes as
#include <afxdb.h>
#include <afxmt.h>
int my CDbOperations.h file. When i compile the project i got this error
fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
How can i solve this error.
Saadhinchaali
modified on Wednesday, February 4, 2009 2:13 AM
|
|
|
|
|
Tritva wrote: I have a non MFC project with couple of .h and .cpp files.
Tritva wrote: I have used CDatabase, CString, CSemaphore classes in CDbOperations class.
Your app is no longer non MFC app. Classes you mentioned above are from MFC.
Regards,
Sandip.
|
|
|
|
|
Hi Sandip,
SandipG wrote: Your app is no longer non MFC app.
Yes. you are right. But before using that classes, i was developing a non mfc project. Since i needed a dabase interatction i used those classes. Now it has become an mfc project.
Is there a way to getrid of that error?
Saadhinchaali
|
|
|
|
|
Try removing #include <windows.h> from your code.
«_Superman_»
|
|
|
|
|
Hi,
Thank you for the reply.
I have not added the line #include <windows.h> any where in my application.
Saadhinchaali
|
|
|
|
|
add stdafx.h on top of everything in the source file where it points the error.
|
|
|
|
|
Hi Smith,
I dont have a stdafx.h file in my project.
I have created an empty console application and created my .h and .cpp files later.
Saadhinchaali
|
|
|
|
|
Where are you including afxwin.h at?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
MSDN says the requirements for timeKillEvent are
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
but the requirements for timeSetEvent are
Windows XP: Included in Windows XP only.
Really? Since timeKillEvent uses the return value of timeSetEvent, this doesn't seem to make sense.
|
|
|
|
|
I think that's incorrect - I have a very old copy of the MSDN library (October 2001) that documents timeSetEvent with:
Windows NT/2000/XP: Included in Windows NT 3.1 and later.
Windows 95/98/Me: Included in Windows 95 and later.
Header: Declared in Mmsystem.h; include Windows.h.
Library: Use Winmm.lib.
HTH!
|
|
|
|
|
Hi,
I want to know is there a event/notification/method to know that dialog box is initialized. i.e. OnInitDialog() call is finished, dialog box is visible and all controls on it are visible.
Based on this, I need to show a message box depending upon some condition after dialog box is fully intialized. Right now i am able to do it by Setting a timer in OnInitDialog() function with delay of 400 ms. And then in OnTimer, i am able to show the message box depending upont the condition.
Other methods suggested to me are Use PostMessage() inside the OnInitdialog() with some user defined message and in handler i can show message box. But This does not work as it comes in the handler of User defined message before my dialog box is shown.
Please provide your views on this.
Thanks
Prashant
|
|
|
|
|
May be you can try handling CWnd::OnActivateApp..
Regards,
Sandip.
|
|
|
|
|
Have you tried handling WM_SHOWWINDOW message(OnShowWindow ) ?
You just need to keep track of when you want to use it.
|
|
|
|
|
It's very dull, but what I've done in a similar situation is to have a member variable: m_bInitialised.
CMyDialog () : CDialog (blah)
{
...
m_bInitialised = FALSE;
}
BOOL CMyDialog::OnInitDialog ()
{
...
BOOL bReturn = CDialog::OnInitDialog ();
m_bInitialised = TRUE;
return bReturn;
}
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
I have three users viz.
User1
User2
User3
User2 has mapped network drive.
Now when i enumerate drives using GetLogicalDrieStrings in User1, i only get drives of User1.
What i want is to enumerate all the drives including mapped drive in User2 in any user context.
How can i acheive this???
Thanks in advance.
Regards,
K. Sushilkumar.
|
|
|
|
|
Mapped drives are maintained per context.
So a mapped network drive of one user may not be valid for another user.
It is also dependent on the user privileges.
So Z: may be mapped by 2 different users on 2 different locations.
«_Superman_»
|
|
|
|
|
Hi,
I have created client and server application that uses
sockets for communication. But only single client can connect to server.
I have to connect multiple clients to same server.
Can anybody help me?
Thanks in Advance
|
|
|
|
|
You will need a multi-threaded program to handle multiple clients.
One dedicated thread will only wait for new client connections and will not do any other processing.
As soon as a client connects, a new thread is created to handle that particular client.
Either this or you can create the server using IO completion ports.
«_Superman_»
|
|
|
|
|
"you can create the server using IO completion ports".
Can you please explain?
|
|
|
|
|
|
I have created separate thread for multiple clients.
In that case also connection failed from more than one client
|
|
|
|
|
It looks like your server is not keeping the wait for the next client. Can you show your server code ? that waits for the next client?
|
|
|
|
|
In server I have derived class from CAsyncSocket and had overrided OnAccept function
I am creating new thread from OnAccept function and wrote send,recieve functionalities inside the thread procedure.I have not added wait in server because OnAccept will be invoked when client tries to connect.
Can u please mention what is the problem??
|
|
|
|