|
I might be misremembering this, but doesn't there have to be a read pending before receive notifications are sent?
(Normally I use raw sockets, or a custom class to manage TCP/UDP stuff, so my memory is a bit hazy on this one)
Steve S
Developer for hire
|
|
|
|
|
Hi Steve
Thanks for replying.
I think a read IS pending. The problem is that the socket seems to "go to sleep" and it is necessary to call AsyncSelect() to make the framework realise data can be read.
cheers,
Neil
cheers,
Neil
|
|
|
|
|
I never came across this problem in my network applications. I wonder how your code in the OnReceive() handler looks like?
|
|
|
|
|
No, I think you are right.
At the time I was using code from OpenSSL, and I think that causes some strange things to happen. I changed my algorithm, and now it is fully working. So I don't think there really is a bug with the MS software, you just have to be careful with these functions, and call them at the right times etc.
cheers,
Neil
|
|
|
|
|
hello,
In my application i am using the GetVersionOfFile() in MFC Application;
i Have doubt about the a and b . any idea about dat
GetVersionOfFile(szAppPath , a , 256 ,b ,256);
szAppPath->path of file
a->?
256->?
b->?
256->?
janan
|
|
|
|
|
ningthemcha wrote: GetVersionOfFile() in MFC Application
Dream bigger... Do bigger...Expect smaller
aji
|
|
|
|
|
a-> VersionBuffer
b-> Language Buffer
Here is the code for the function.
void GetVersionOfFile (char * pszAppName,
char * pszVerBuff,
int iVerBuffLen,
char * pszLangBuff,
int iLangBuffLen)
{<br />
DWORD dwScratch;<br />
DWORD * pdwLangChar;<br />
DWORD dwInfSize ;<br />
UINT uSize;<br />
BYTE * pbyInfBuff;<br />
char szVersion [32];<br />
char szResource [80];<br />
char * pszVersion = szVersion;<br />
<br />
dwInfSize = GetFileVersionInfoSize (pszAppName, &dwScratch);<br />
<br />
if (dwInfSize)<br />
{<br />
pbyInfBuff = new BYTE [dwInfSize];<br />
memset (pbyInfBuff, 0, dwInfSize);<br />
if (pbyInfBuff)<br />
{<br />
if (GetFileVersionInfo (pszAppName, 0, dwInfSize, pbyInfBuff))<br />
{<br />
if (VerQueryValue (pbyInfBuff,<br />
"\\VarFileInfo\\Translation",<br />
(void**)(&pdwLangChar),<br />
&uSize))<br />
{<br />
if (VerLanguageName (LOWORD (*pdwLangChar),<br />
szResource,<br />
sizeof(szResource)))<br />
{<br />
strncpy (pszLangBuff, szResource, iLangBuffLen);<br />
}<br />
wsprintf (szResource, "\\StringFileInfo\\%04X%04X\\FileVersion",<br />
LOWORD (*pdwLangChar), HIWORD (*pdwLangChar));<br />
<br />
if (VerQueryValue (pbyInfBuff,<br />
szResource,<br />
(void**)(&pszVersion),<br />
&uSize))<br />
{<br />
strncpy (pszVerBuff, pszVersion, iVerBuffLen-1);<br />
}<br />
}<br />
}<br />
delete [] pbyInfBuff;<br />
}<br />
}<br />
}
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
Hey, we don't get many psychics on CP.
If I send you some function prototypes, can you send me some source back
(I checked the online MSDN and there's no MFC function documented called that, although I would have guessed that a and b were buffers, and the two constants were buffer sizes.)
Steve S
Developer for hire
|
|
|
|
|
What happens when an Object of CWinApp derived Class is Created in MFC ??
Can Somebody answer my above question .
Thanks in advance.
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
What are the actions that takes take when I say CMyApp theApp;
in MFC Application ??
Looking forward for your reply.
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
What are the actions that takes place when I say CMyApp theApp;
in MFC Application ??
Looking forward for your reply.
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
Patience is a virtue, and virtue brings it's own reward.
When the app is loaded, the constructor is called, which is done before WinMain (from the MFC library, unless you provided your own) is called. Mostly, this will just result in the base constructor(s) being called. Mostly, this just sets some object-specific data, and initialises the various state stuff used by MFC.
WinMain is then responsible for calling the object's InitInstance(), which usually triggers window creation and stuff like that.
Of course, the MFC source is available, which is where I found this.
Steve S
Developer for hire
|
|
|
|
|
Steve S wrote: Patience is a virtue, and virtue brings it's own reward.
I am so sorry 4 posting the same twice..It happend accidently.
Thanks for the reply.
Can you provide me some link,which explains the steps in detail ??
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
No I can't, although there's probably an MSDN article on it somewhere.
But then, you could use the Star Wars technique to find out ("Use the source, Luke").
Use find in files from the IDE to look for ::CWinApp in the MFC source folder, and that should take you to step#1.
From there, you can simply work your way through the code, checking out the various bits of code as you go.
There's a book called "MFC Internals" which is probably out of print, not to mention being out of date (I have a copy at home, ~140 miles away, so I can't check the last MFC version it covered).
Apart from academic curiosity, why would you want to know?
Steve S
Developer for hire
|
|
|
|
|
I've posted a question about my aplication blocking because it reads the com continuesly and I got the answer of using threads. But reading about it i found out that: "The thread remains active as long as the thread's function is executing" so I don't see how that helps. My thread will remain active forever because i'm using a function wich has a while loop to listen to the com port, a while loop which never ends. I want to be able to acces the menu of my aplication so I can put a menu comand like stop listening. Am I wrong or isn't a worker thread the answer for me?
|
|
|
|
|
How u created the thread.
Is it CreateThread API ?
rgds
aneesh
|
|
|
|
|
I use AfxBeginThread. Shouldn't I use a separate process that deals with the reading of the COM?
-- modified at 3:15 Wednesday 26th July, 2006
|
|
|
|
|
See Here[^] maybe it is some helpful to you
|
|
|
|
|
Typically, your thread will loop continuously, with checks to see if (a) the current read has timed out, in which case you continue, or (b) an event was trggered (See CreateEvent in the API docs), in which case the thread exits. That way, you can trigger the event in your main thread when you want to quit the app, and then wait in the main thread for the comms thread to exit.
You can combine the two by using COMMS events and waiting until either a received character is available or the other event was triggered, and acting accordingly.
P.J.Naughter has written some excellent classes, one of which deals with comms ports, so check that out in the MFC/C++ libraries section here on CP.
Steve S
Developer for hire
|
|
|
|
|
Did you read this article from your last COM-related post? It goes into detail on how threads can be used for reading (and writing). Now your main UI thread can remain responsive.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
hi, does anybody know how 2 add a 3DS object in VC++.
When the goin gets tough then tough gets going
|
|
|
|
|
|
It is not that easy. You have two solutions (that I see): either you go for yourself and write everything yourself. Everything means from loading the file (so, you have to know its format and everything) to displaying it.
This will be really long and difficult (and even more if you don't have experience).
Another option is to use a 3D engine (the ones that are used for free 3D games). But I don't know which ones support 3DS format, you'll have to search on google and compare some of them.
|
|
|
|
|
I might have a copy of the Max SDK lying around and some code that loaded models and processed them, it wasn't that hard. What are you trying to do?
|
|
|
|
|
Hello,
Who can tell me "How to call Microsoft C# module in the COM component (C++)"
Thanks a lot!
|
|
|
|