|
help always goes like this:
void OnHelp()
{
WinHelp(m_hWnd,helpfile,0,0);//
// if you set helpfile like "C:\\path\\help.chm"
//then you may find no help file on another computer if no such file in such folder.
//i mean you should put all the help files in the subfolder where the exe file is.example:
//execute file path is "." so, the help file should be in ".\\help\\"
}
|
|
|
|
|
I used this function to get mouse cursor coodinates. I got different results when the program run in the Woindows 98/Me and Windows 2000/Xp. Why?
Thanks
|
|
|
|
|
Is the program using the same font and size on all systems. Dialogs will resize themselves based on changes in fonts and the mouse coordinates will come in differently for the same proportional movement. In other words if you click the mouse at the right and bottom of the dialog the mouse coordinates will be quite different.
Art
|
|
|
|
|
An extreme novice question,...
I have been searching the Internet, mostly at the Microsoft Developer Network site and, of course, here.
Undoubtedly, you guys have all gone through this in developing applications.
Is there a comprehensive reference for File Management using streams, and/or strings, and/or alpha-numeric character arrays?
I am envisioning writing a complex mathematical modeling program and would like to structure data files, for both diagnostic reasons and as initial data fields for additional components.
Thanks for any suggestions,...
|
|
|
|
|
My STL articles between them offer a decent overview of using iostreams.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
|
|
|
|
|
Still the best book on all things C++ IMHO is Bruce Eckel's "Thinking in C++", available for free download at http://www.mindview.net/ (the version in the bookshops is outdated).
Bruce includes a comprehensive discussion of streams and streams vs files.
However, from your post I am not sure that your issue is one of streams vs files. As a C++ programmer, you should use streams. Period.
Now, when you say "structure data files", that's where I think you should be talking XML. Which kind-of voids the question of streams vs files: because you shouldn't reinvent the wheel, you should use a readily available XML engine (such as Microsoft's free MSXML4, but many others exist, too). These engines have facilities to fetch and persist XML data, including the storage in a local file.
Bernd
|
|
|
|
|
Christian Graus and Bernd,
THANKS! Excellent suggestions from both of you, I really appreciate it. Very helpful.
Christian, your articles are EXCELLENT (exactly what I was looking for) , and Bernd, I hadn't even thought of XML, but, it's a great idea. I suspect you both saved me alot of time exploring inadequate approaches to the problem.
|
|
|
|
|
If I filter TCP packets, and rewrite the destination port on the SYN packets before being forwarded to the Winsock layer, will the connection get established to the new destination port in the packet or will it disrupt the three-way handshake and go into some indeterminate state?
This is a fundamental question that needs to be answered before I can go ahead and implement a piece of software that redirects incoming connection to different ports based on some parameters. The software is not supposed to be a proxy; and should not be in the path once the connection is established to the translated port.
My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Hi,
You need to do such a translation in both directions (when you change port A to X on incoming packets you have to change the X to A on outgoing packets in the same 'connection').
If I very simplify the problem - if you change the port on recvd packet from say 80 to 8080, the ip stack on your machine will have no problem with it, but as a response he will send back to the connection originator reply from port 8080. If you will not change this number back from 8080 to 80, it will be delivered to the connection originator, but he will just drop it, because he didn't require connection to port 8080, but to 80.
For that very some reason your software must stay in the way as a proxy as long as the connection will remain. (because the same rule is valid for 'regular' data packets - the client doesn't expect packets from 8080, so it will be dropped)
Anyway, what you wrote will not work, but the ip stack (winsock) will not go into some indeterminate state .
Hope this helps you, if you have another question you can ask, I worked on project where exactly this kind of problems were solved unfortunately the management spent all money for a new cars, buildings etc ...as usual...
|
|
|
|
|
|
TCP or UDP socket is identified by the key. The key containing IPaddress of the source machine, source port (client port), IPaddress of the destination machine and destination port.
If all the numbers are equal, it is recognized as a packet for some socket.
In case of TCP there follows some additional checkings like SEQuence number etc. But it is already delivered to some session
|
|
|
|
|
|
I am having problems "refreshing" a picturebox in Windows 98. In winXP this doesn't seem to be a problem. Is anyone aware of this, or can offer a solution, or where to look in my code
Here is a snippet of one of my functions to let you know how I am displaying in the picturebox. The picturebox has a baseball diamond, and I write little .bmps of the baserunners and then I use TextOut to display the runner's names, but The names get written on top of eachother, which only happens in Windows 98.
<br />
void CJoeBroadCastDlg::DrawBatter(CString str_PlayerName)<br />
{<br />
CEdit* Picture;<br />
Picture=(CEdit*)GetDlgItem(IDC_PICTUREBOX);<br />
Picture->EnableWindow (true);<br />
Picture->ShowWindow (SW_SHOW); <br />
CDC * my_cdc = Picture->GetDC();<br />
if (!my_cdc)<br />
{<br />
AfxMessageBox("Error: Invalid CDC pointer!!!");<br />
return;<br />
}<br />
CBitmap oBitmap;<br />
VERIFY(oBitmap.LoadBitmap(IDB_BASEBMP));<br />
<br />
CBitmap oField;<br />
VERIFY(oField.LoadBitmap(IDB_FIELDBMP));<br />
my_cdc->SetBkMode(TRANSPARENT);<br />
my_cdc->SetTextColor(RGB(255,255,255));<br />
my_cdc->SetBkColor(RGB(189,153,103));<br />
my_cdc->DrawState(CPoint(127,210), CSize(0, 0), &oBitmap, DST_BITMAP, NULL);<br />
my_cdc->FillSolidRect(127, 227, 100, 16, RGB(189,153,103));<br />
my_cdc->TextOut(127, 227, str_PlayerName); <br />
}<br />
This is called to "refresh" this screen, basically draws on top of all other displayed items before next event/drawing happens. But it doesn't seem to be working in Win98 If a .bmp baserunner is drawn, it too is not cleared.
<br />
CBitmap oField;<br />
VERIFY(oField.LoadBitmap(IDB_FIELDBMP));<br />
m_picturebox.SetBitmap(oField);<br />
Thanks
Later, JoeSox www.joeswammi.com A Season in Hell[^]
|
|
|
|
|
You are drawing all that to an edit control? I don't know if you need to use an edit for some specific reason, but I think it would be much easier to derive a class from CStatic and do your drawing in the OnPaint of the CStatic subclass. Then, when you want to redraw it, you simply call Invalidate().
Chris Richardson
C/C++ Include Finder[^]
|
|
|
|
|
Thanks for replying to my disparate plea for help. For some reason I didn't get my regular email notification, so I just saw your reply late last night and I have been doing testing off and on thru out the day, in my spare time.
Chris Richardson wrote:
You are drawing all that to an edit control? I don't know if you need to use an edit for some specific reason
When I was doing research on the subject I found this link:
http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_20403906.html[^]
My user clicks on the menu "Open Virtual Game Cast" which then opens a dialogbox(CDialog(CJoeBroadCastDlg) it must be a dialog box because the user must tell the program which simulation number they would like to watch, and the dialog has stop and cancel button etc. In this dlg is a picturebox which has the Baseball diamond and baserunners running around , plus I use text to speech engine so the user also hears playby play.
But take a look and the link and tell me what you think, if you wish . I know I could have used a better approach but I am short on time and need to implement a fix ASAP, because the goal is to release by baseball season.
Thanks again.
Later, JoeSox www.joeswammi.com Killing In The Name[^]
|
|
|
|
|
If it wouldn't be too much of a problem, could you send me the bitmaps you use? I'll write up an example program, showing the proper way to get this type of thing done. Then it should be pretty straightforward to integrate it into your code
Chris Richardson
C/C++ Include Finder[^]
|
|
|
|
|
I just figured it out!!! woo hoo. I needed to add RedrawWindow() , in XP it did it automaticlly, I think.
I didn't get the notification email, so I don't have your email address but I posted the .bmps and the class that handles this here http://joeswammi.com/downloads/RES.zip[^]. It is not the best code in the world, I am self taught and have been programming for speed since I need to get the basic features done by baseball season. I appreciate your help. I think I understand what your saying, but I would have to redesign my whole class, which I would lose at least a week or two and that's when the real baseball season starts. That's nice of you to offer, if's it's not that much trouble, I would like to see the correct way of doing it, I tried researching this before designing the class but I couldn't find the correct material, but don't spend too much time on it, if you don't want to. Thanks I better goto bed
Later, JoeSox www.joeswammi.com Killing In The Name[^]
|
|
|
|
|
Joe, i followed ur "rant" into here
your really missing the whole "window" paradigm. i have never tried to do what you are doing since it is so non-standard.
typically you don't draw into a device context of a child window from a parent window.
the standard approach for your situation would be to derive a class from CWnd that represents your drawing canvas, let's call it CDiamond. The parent window can handle placement and sizing of the child window if you desire. then when CDiamond class receives a WM_PAINT message you do your drawing to the device context at that time.
hope this helps
-pete
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
|
|
|
|
|
|
um, not to overstate the obvious, but does RedrawWindow() not work?
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
|
I tried you suggestion again but in a different spot in my code and it works Thanks!!
Later, JoeSox www.joeswammi.com Killing In The Name[^]
|
|
|
|
|
Cool. NP.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Hi,
How do you retreive the path and filename of the running program?
It's so I can create self-extracting modules.
Thanks in advance.
|
|
|
|
|
|