|
Following is the code from MFC frame work,
if I call "pThread->InitInstance()" method application is calling CWinApp->InitInsatnce() method,
CWinThread is super class of CWinApp when I call with super class object "InitInsatnce" method
it should call CWinThread:InitInstance method,
how it is going to sub class,
can any body explain to me
thanks,
Siva
---------------------------------------------------------------------
int AFXAPI AfxWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPTSTR lpCmdLine, int nCmdShow)
{
ASSERT(hPrevInstance == NULL);
int nReturnCode = -1;
CWinThread* pThread = AfxGetThread();
CWinApp* pApp = AfxGetApp();
// AFX internal initialization
if (!AfxWinInit(hInstance, hPrevInstance, lpCmdLine, nCmdShow))
goto InitFailure;
// App global initializations (rare)
if (pApp != NULL && !pApp->InitApplication())
goto InitFailure;
// Perform specific initializations
if (pThread->InitInstance())
{
if (pThread->m_pMainWnd != NULL)
{
TRACE0("Warning: Destroying non-NULL m_pMainWnd\n");
pThread->m_pMainWnd->DestroyWindow();
}
nReturnCode = pThread->ExitInstance();
goto InitFailure;
}
nReturnCode = pThread->Run();
InitFailure:
#ifdef _DEBUG
// Check for missing AfxLockTempMap calls
if (AfxGetModuleThreadState()->m_nTempMapLock != 0)
{
TRACE1("Warning: Temp map lock count non-zero (%ld).\n",
AfxGetModuleThreadState()->m_nTempMapLock);
}
AfxLockTempMaps();
AfxUnlockTempMaps(-1);
#endif
AfxWinTerm();
return nReturnCode;
}
---------------------------------------------------------------------------------
|
|
|
|
|
Siva Sankar Koyi wrote: if I call "pThread->InitInstance()" method...
Why would you want to call this method directly? It is a virtual method that is intended to be overridden.
Other than that, I'm not really sure what it is that you are asking.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I have one server and three clients, Messages come as XML format from client1 and I have to send it to client2 (without knowing the content of the message)through server and then send back the ACK to client1 when client2 gives it to server, Now the problem is that if client1 sends a particular message to server(say if the message is sign on request)I should send it to client3 through rotor and internet and then get the response back from cliet3 and send it to client1 and client2( )
I have a socket class written for this problem but I do not know how to handle the WHOLE THING. I guess I hould check the content of the message that comes from client1 in my APIClass and then use different sockets to send it to different clients.
Please help me to solve this issue
Nahitannahi@yahoo.ca
|
|
|
|
|
Sounds like you have to define a nifty little protocol of your own, where you can distinguish the different message types from each other. The payload of each packet could be the XML info.
Or perhaps I didn't understand your problem correctly...
Hope it helps anyway
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
Hi there.
----Client 1
------ |
Server| --------+---Client 2
------ |
----Client 3
Two solutions come to mind. My assumptions
. your server is acting as a proxy - i.e. clients 1,2,3 only talk to the server, not directly to each other.
. client 1 is only ever a socket client, it does not listen for a connection
. client 2,3 have sockets open waiting for a connection from the server.
Firstly, if you want one socket listening on your server, you will have to inspect the messages.
No sign message
The steps,
. Client 1 sends message
. Server (starting a new thread for the connection) inspects message and opens a connection a connection to client 2 and sends message to client 2
. Client 2 ACKS message to Server
. Server ACKS message to Client 1
Sign on request message
. Client 1 sends message
. Server (starting a new thread for the connection) inspects message and opens a connection a connection to client 3 and sends message to client 3
. Client 3 signs and returns to the message to the server.
. Server opens a connection a connection to client 2 and sends signed message to client 2
. Client 2 ACKS message to Server
. Server ACKS message to Client 1
Alternatively, if you use two different sockets on your server, one for signed messages, one for normal messages, then you will not have to inspect the messages on the server.
Remember to use threads when accepting your socket connections.
Hope this helps concrete your design.
Cheers
|
|
|
|
|
Tnx for the help,
Here what I have is that in the code I have a messagetype as PKT_MSGTYPE_FORM_DATA which I receive from client1 (a small machine programmed by micro C a wireless thing working like a intract machine) my program recognizes this Form if it's value is 0F(Hex) and if it's first byte (the string) is number 04H it should send the packet to client3 otherwise send to client2,
could you help me to write the C code for this problem?
also as I am new in socket programming, I am not sure how to handle all the socket thread stuff
SOS
tnx a lot!
nahitannahi@yahoo.ca
|
|
|
|
|
Hello.
I'm not an artist, but I need some graphics for icons, buttons, bitmaps and want all this stuff to look professional.
How you solving that problems?
If existing any good icon or bmp libraries for non-artist programmer?
Or if you paint icons bmps by own what editor you use?
Thanks.
|
|
|
|
|
|
Sounds like we are the opposites, I am a graphic designer and know only the basics of programing. Needless to say I am always being complemented on the good graphics in my games but not so much for the playability.
|
|
|
|
|
Also check out http://iconbazaar.com/[^].
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
|
nope nibu...
i posted this link first, but removed it, because the author specifies that these icons are for web application only...
|
|
|
|
|
But why they cannot be used with web applications. Any specific issues!
Nibu thomas
Software Developer
|
|
|
|
|
i don't get you.
i tell you that the icons are for web applications only, and you ask me why they ca't be used for web apps ?
>> Any specific issues!
not issues, but license restrictions.
|
|
|
|
|
Heh sorry buddy...
I misread your post. I just put a 'not' before 'for'. Sometimes my eyes has this tendency to modify posts.
Why two copies of the same message!;P
Nibu thomas
Software Developer
|
|
|
|
|
Nibu thomas wrote: Why two copies of the same message!
because whenever i delete the wrong one, CP keeps it there
|
|
|
|
|
|
hey, seems to have disapeared... can you see it ?
|
|
|
|
|
v2.0 wrote: hey, seems to have disapeared... can you see it ?
No,Gone! Mission Success...
Nibu thomas
Software Developer
|
|
|
|
|
I think it's too small sizes.
If there is place to read about technology of making own bmps?
|
|
|
|
|
I would to add two methods to already existing activex control. How to do go about it. Should I add a new interface. If yes, how to do it. Any article or help.
Best Regards
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg."
- Bjarne Stroustrup
|
|
|
|
|
Do you have the source code of this ActiveX ? If no, then it is impossible to do. An ActiveX is a specialized dll which is executable code. So, you cannot add code to such a module, you need to start from the source code, then add your specific code and recompile it.
|
|
|
|
|
No, you can do this if you actually add the control to your control. Then you'll have to have functions in your control that call all of the embedded control's functions, plus adding the two new methods you want.
My Music | My Pics | My Articles
BlackDice
|
|
|
|
|
Yeah I do have. but I dont know how to add the new interface in existing activex control. Can u please guide me to it ?
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg."
- Bjarne Stroustrup
|
|
|
|
|
Hi
I found that char could be converted to an interger as follows:
char c = 250;
int a = int(c)
How can I get the a value of a to be the same as what I put in? It sometimes comes out negative, although I can add 256. There is a simpler way?
thank you
|
|
|
|