|
Using a const would be a better choice, but unfortunatly it would conflict with other parts of the program that are better of being enums.
I found an excellent article on enum types here[^], which helped me solve the problem.
m_sActiveSeat = SEAT(m_sActiveSeat+1);<br />
if ( m_sActiveSeat > WEST ) m_sActiveSeat = NORTH;
|
|
|
|
|
Hi everyone,
I have a scenario where I wish to send and receive broadcast UDP packets to and from an embedded piece of hardware. The embedded hardware listens for a certain broadcast UDP packet (on port 46051), and responds with a single broadcast UDP packet (to port 46050). The HW and PC are connected directly together. The embedded HW does not transmit anything else. I can transmit a broadcast UDP packet (as seen by Ethereal) and the HW sends its response usually within 375us (which can also be seen by Ethereal) but my app never receives the data. When I connect my PC to another PC running a microsoft UDP sample program (msocupd) which can send broadcast UPD packets, my app does get the data. I noticed that when the 2 PC's were linked together, all sorts of packets were being exchanged (ARP requests, etc..) whereas the embedded HW doesn't transmit anyting. Can what I wish to do be done using sockets?
Thanks in advance,
Jeron
|
|
|
|
|
Did you set IP_ADD_MEMBERSHIP using setsockopt in the application running in your Embedded Device?
Eg:
setsockopt(hSock,IPPROTO_IP,IP_ADD_MEMBERSHIP...
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
Found it...The person who wrote the embedded device assured me that his packet was good...but I found an issue with the 'Total Length' field in the IP header, it was off by 1. As soon as he made the change, my app got the data (my hairline is thankful). Oddly enough Ethereal (which is a great product) didn't make mention of this discrepency. Luckily we had an old Agilent packet analyzer which clued me in. I really appreciate your response.
Jeron
|
|
|
|
|
in my project require to run the exe multiple times,at the same time when new exe of same project is run then immediately previous instatiation of that exe is neceaasry to close.ie when new instance is open then previous insatace should close.please kindely help in my project.
#sanroop#
|
|
|
|
|
Sanroop wrote: please kindely help in my project.
for that, you will have to express yourself a bit more clearly,because i don't really understand what you're trying to explain...
|
|
|
|
|
What's the use of closing the old one and running the new one? why not you stop the new one instead?
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
Is this what you are looking for?
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi All's
i used MySQL 5.0 as an databases in my project But
in my PC there are not any library for connecting Front End (VC++)
can i download it from net and simply copy in my PC
or
i have to again download the MySQL from net and then instroled it.
what i have to do now .Please Help Me
Thanking to all of you
mailing me
Yogi
|
|
|
|
|
Can't you just use ODBC or ADO?
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
What about going the ADO way?
#import "C:\Program Files\Common Files\System\ADO\msado15.dll" \
no_namespace rename("EOF", "EndOfFile")
I use the above ADO COM dll for my DBs. That's cool.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
I have built a dll using vc++. It is a multithreaded ATL dll using MFC class. It arises events. I included the dll in VB and tried to handle those events. But it shows a application error (when the event is raised) and exits. anyone please provide help. thanks
cleo
|
|
|
|
|
as you don't provide much infos, we cannot help you.
if you feel the problem is more relating to the VB part of your code, ask in the VB forum.
|
|
|
|
|
What happens if you use the DLL in a separate application created with VC++?
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Are you calling the event from a thread? If so you cannot do it directly. You need marshalling before you could fire the event from your worker theard. Tell me are you calling it from a worker thread?
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
Link2006 wrote:Let's take it outside of CP
Jeremy : Please don't.I would love to see this.I'm making the popcorn already.
|
|
|
|
|
There's a lot that could be wrong, especially since it's a multithreaded server.
One common mistake is to fire events from a secondary thread without setting up the apartment for the secondary thread properly and not marshalling interfaces when crossing apartment boundaries.
If you by any chance are firing events from a secondary thread, have a look at Michael Lindig's solution for the problem here[^].
Another way is to post a message to the thread that created the server and fire the event from there.
Don't forget to call ::CoInitializeEx() / ::CoUninitialize() in you secondary thread if you're using any COM objects inside it.
Hope this helps
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
After executuin the application the windows will be started same position.
How we fix the position?
|
|
|
|
|
SetWindowPos()<br />
<br />
MoveWindow()
|
|
|
|
|
|
hi all i had made a projec named i.e abc then it make the exe of that project named abc.exe, now i want to change the project name so that it changes the exe name as well how it is possible one way is to manually change the exe name but it had to do again and again which i dont want. any solution of that.
Tasleem Arif
|
|
|
|
|
You don't need to change your project name in order to change the executable name. To change the output file name, it depends of the IDE you are using. For VC2005, go into your project properties -> 'Linker' -> 'General' -> 'Output file'.
|
|
|
|
|
thanks i was using vc++6 but changed the output file name as u hinted.
Tasleem Arif
|
|
|
|
|
|
We have a downloadable COM component which traps user actions on html form elements,stores them and later replays them.
Now,assume the distributable is UNICODE built.
And heres an sample scenario to capture the value from a text-box element on a form:
CComPtr<ihtmlelement> spElem;
CComVariant varval;
hr=spElem->getAttribute(CComBSTR(L"Value"),FALSE,&varval);
if(FAILED(hr))
{
return S_FALSE;
}
we convert it into a wstring using OLE2T (unicode)- and later set it back on the element as a BSTR, during replay.
Will this arrangment handle clients from ASCII locales too?or does a ASCII entry need a MBCS distributable?i.e can wstring handle both ASCII and non-ASCII locales seamlessly?
|
|
|
|
|
Hi, all...
I do the followings (in VC++ 6) :
1. Create an 'MFC AppWizard (exe)' project
2. Just delete the text : "TODO : ..." in the dialog box
3. Add an EditBox (IDC_EDIT1)
4. With ClassWizard, define this MemberVariable for IDC_EDIT1 : Member : m_edit1, Type : CEdit
5. For supporting Unicode parameters :
5.1. Add the _UNICODE in -> [Menu]->[Project]->[Settings...]->[C/C++] (with category General) -> in {Preprocessor definitions}.
5.2. Add wWinMainCRTStartup in ->[Menu]->[Project]->[Settings...]->[Link] (with category Output) ->in {Entry-point symbol:}
6. Add EN_CHANGE Message to IDC_EDIT1
6.1.Write this line in EN_CHANGE Message handler function for IDC_EDIT1 (void CTestDlg::OnChangeEdit1() ) :
m_edit1.SetWindowText( _T("Any text, even NULL") );
OK, then the program builds successfully, and runs...
Problem : now, I input a character in editbox, Oops! the program terminates!
Whats the problem ?!
Thanks.
|
|
|
|