|
i tried doing that but it doesnt work i made a variable called CEdit m_bytes then i did this to the array:
Array[m_bytes] = {m_patch};
but all i got were a lot of errors
|
|
|
|
|
I want to save some file to harddisk such as C:\\Data\\Mydata.txt and then I want to call Window Explorer to open at the page" C:\\Data" automatically.
Anybody know, how to write the code for this issue.
|
|
|
|
|
::ShellExecute(NULL, "open", "C:\\Data", NULL, NULL, SW_SHOW);
|
|
|
|
|
Hello,
how can I set the focus to my SDI-applications toplevel window?
Problem: I have an application. The main dialog creates dynamically a subdialog which is displayed and has the focus. This subdialog creates and executes a thread. This thread creates also dynamically a (error-)dialog which is closed by buttonclick or automatically after some seconds. After the thread created subdialogs closes, I want to have back the focus on my applications top level window, which is the window who creates the thread. Til now, the main dialog receives the focus.
Any ideas?
Thanks
Juergen
-- modified at 10:55 Thursday 21st September, 2006
|
|
|
|
|
Just changed a few #defines into enum, and now getting compiler errors. How are enum types compared?
typedef enum tile_from_t
{
NORTH=0,EAST,SOUTH,WEST
} TILEFROM, SEAT, *LPSEAT;
bool cTiles::VerifySeat( const LPSEAT sSeat )
{
switch ( m_sNumPlayers )
{
case 2:
if ( sSeat == NORTH || sSeat == SOUTH )
return true;
case 3:
if ( sSeat >= EAST && sSeat <= WEST )
return true;
case 4:
if ( sSeat >= NORTH && sSeat <= WEST )
return true;
default:
return false;
}
}
|
|
|
|
|
waldermort wrote: bool cTiles::VerifySeat( const LPSEAT sSeat )
waldermort wrote: if ( sSeat == NORTH || sSeat == SOUTH )
You are comparing the pointer to the enum constants here. You can avoid this by just declaring the method as:
bool cTiles::VerifySeat(SEAT sSeat)
Using a const-reference or pointer for this method doesn't gain you anything.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Doh!!
Another question if I may.
Is it possible to increase the enum type? In my previous code I used this formula to get the next seat
m_sActiveSeat = (m_sActiveSeat+1)%4;
However this cause the compile error
cannot convert from 'int' to 'enum tile_from_t'
I also tried
m_sActiveSeat++
which would be great if it wrapped around, but still no success.
Is there a simple way to do this rather than using a switch ?
|
|
|
|
|
enums in C++ are basically just named integer constants. They won't wrap around automatically. You can write your own wrapper for Enums (I actually have an article on here somewhere that makes a pretty good cut at it), or you can use const int 's instead. Since you said you were coming from #define 's, I would recommend using the latter.
const unsigned long NORTH = 0;
const unsigned long EAST = 1;
const unsigned long SOUTH = 2;
const unsigned long WEST = 3;
void myFunc(unsigned long direction)
{
switch (direction)
{
case NORTH:
case SOUTH:
case EAST:
case WEST:
doSomething();
break;
default:
throw exception("Oooops!");
}
}
To make sure it is always valid, you could use your modulo operation as well.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
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?
|
|
|
|