|
I'm trying to create a very simple diagnostic utility for Win98. In VC++ with MFC, how do I found out the numeric IP address of the computer on which the program is running?
|
|
|
|
|
One way is to call gethostname() followed by gethostbyname() .
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Thank you but that seems to only get me the domain name. I'm trying to get the IP number so that I can track when the DHCP assigns a new one.
|
|
|
|
|
I'm not sure what your code looks like, but gethostname() and gethostbyname() is for getting the IP address of the host machine (i.e., the machine running the application).
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
What exactly does the line:
rGfxOptionsWnd* m_pGfxOptionsWnd;
do?
I have chased this bug and narrowed it down to something that I believe should not happen and I don’t even know what could possibly cause it to happen.
My basic application structure is simple.
An Application Class,
An App Class derived from the Application Class
The application class has a member varible which is a Paramater class
e.g.
Application {
Public:
Param_class m_Params;
};
In it’s constructor Application instalises m_Params values.
<code> m_Params.Window.bWindowed = false;
m_Params.Window.width = 500;
m_Params.Window.height = 500;
m_Params.Window.icon = NULL;
m_Params.Window.title = "rDirectXApp Default Window Title";
m_Params.Window.wnd_type = RJM_WNDT2;
m_Params.Window.res_x = 0;
m_Params.Window.res_y = 0;
m_Params.Window.esc_to_quit = true;</code>
In it’s Constructor, App (Derived from Application) then alters some of the values as nessecary.
<code> m_Params.Window.icon = (const char *) IDI_ICON1;
m_Params.Window.title = "Super Game in this window!!!";
m_Params.Window.bWindowed = true;
m_Params.Window.wnd_type = RJM_WNDT5;
m_Params.Window.width = 600;
m_Params.Window.height = 300;
m_Params.Window.bWindowed = true;
m_Params.Window.res_x = 100;
m_Params.Window.res_y = 100;</code>
Now I can compile and run this code perfectly. I have set break points on each line shown here and I can watch the values as they go through this process and change.
I have another completely empty class, just an empty constructor and destructor.
RGfxOptions. I add the following line into Applications private section:
rGfxOptionsWnd* m_pGfxOptionsWnd;
With this line in the program I run the debug version of the program.
The Application constructor sets up m_Param exactly as it’s supposed to.
Control then passes to App’s constructor.
When: m_Params.Window.icon = (const char *) IDI_ICON1;
executes, m_Param.Height changes (nothing else)
when m_Params.Window.title = "Super Game in this window!!!";
executes, m_Params.title changes but the new value is corrupt
when m_Params.Window.bWindowed = true;
executes, nothing in m_Params alters
when m_Params.Window.wnd_type = RJM_WNDT5;
executes, nothing
when m_Params.Window.width = 600;
executes bWindowed alters
when m_Params.Window.height = 300;
executes, width alters
when m_Params.Window.bWindowed = true;
executes, nothing
when m_Params.Window.res_x = 100;
executes, wndtype alters but to an invalid value
and after m_Params.Window.res_y = 100;
the program crashes because of the invalid data.
But with the line:
rGfxOptionsWnd* m_pGfxOptionsWnd;
remmed out it all works perfectly.
Can anyone help? What does that line do? How is it possible that the statement altering the height actually alters the width member variables? I havn’t used or refered to m_pGrgOptionsWnd anywhere at all in my code. How can simply adding a pointer member varible to my class have this effect?
Thanks in advance for any suggestions. I have absoultly no ideas at the moment at all!
---
Posted By Robert Metcalf
|
|
|
|
|
My bet is that you need to do a rebuild-all. The line added just adds an extra 4 -bytes (a pointer) to the size of your object. If its declared before the m_Params member, then m_Params is now offset by an additional 4 bytes. If your .cpp file(s) have not been completely rebuilt since this declaration change, you may find that one file is using the old declaration and another the new one. This will cause assignnments etc to change the wrong members of m_Params.
To check this, move the declaration of m_pGFx... to after m_Params
Or just force a rebuild all
Roger Allen - Sonork 100.10016
If your dead and reading this, then you have no life!
|
|
|
|
|
Hello-
I would like to use a very simple XML description to layout some customizable dialogs in an application. I was hoping I could find a relatively simple XML parser available as open source.
I looked at Xerces and although it would certainly do the job, it is far more complicated than necessary. Any suggestions?
Jake
|
|
|
|
|
|
or try searching for
CMarkup (Here on CP For Developers version, from FirstObject)
pugXML (Here on CP)
both are 'tiny' and do great job
'G'
|
|
|
|
|
|
for all c++ coders out there...
i need to write a program that determines dependencies between c++ source files. Besides parsing and scanning for "#includes" and "::'s" what else would do? I need to parse and find ALL calling dependencies (ie. function calls). How would yo go about it to try to encompass all of them (if possible)?
btw, I am most definitely not asking anyone to write code for me. I would like to hear your approaches and sugestions regarding such a problem. What patterns should I look for? Thank you.
tuco
|
|
|
|
|
Well, I've written a small part of what you are talking about here:
http://www.codeproject.com/useritems/includefinder.asp[^]
However, I've undertaken projects to do what you are talking about, and if I were you, I'd start with the source of a proven compiler like g++ to do this. If you are trying to do it from a "this would be cool to write" perspective, then start by getting yourself a good book on compiler architecture, like the Dragon Book (Compiler Principles, Techniques, and Tools[^]), or some such other book (there are probably other good books out there).
Good luck with it anyways
Chris Richardson
|
|
|
|
|
How to do that? I have a directory filled with *.gif images (but if it'd be more useful, I can convert them to *.bmp) and I want to have them displayed in a Picture box. How to do that?
I only have to know how to open an image file (*.gif or *.bmp or whatever) and display it in a picture box. I can manage all the other steps (Well, I guess I can...)
Tnx.
|
|
|
|
|
use the CBitmap class from the MFC to load *.bmp files. but then, you have to draw it with GDI
a Picture Box aequivalent is maybe the CPictureHolder class
scio me nihil scire
My OpenSource(zlib/libpng License) Engine:
http://sourceforge.net/projects/rendertech
Its incurable, its a Pentium division failure.
|
|
|
|
|
"use the CBitmap class from the MFC to load *.bmp files"
But how exactly? I see no functions in that class or any parent classes that could do that...
|
|
|
|
|
Hi, I'm doing a simple packet filtering firewall as my final year project. I'm at the early stages of my project and I've already studied about the types of internet firewall out there and other security overview information.
So, I need detailed information on how to build a firewall. Can you guys point me to good tutorials/information that might help? I'm using Visual C++ to code and MFC to create the GUI. Also, since I'm doing it in a Windows platform, I've heard that I need some sort of a driver, can you help explain this part as well?
Thx,
gildan2020
|
|
|
|
|
For the winsock part of the design, I recommend this book.
Network Programming for Microsoft Windows, Second Edition by Anthony Jones and Jim Ohmund.
Kuphryn
|
|
|
|
|
yup, thx for da tip
i remember that i've to deal with some kernel-level stuffs for my firewall. any ideas on that?
|
|
|
|
|
http://www.amazon.co.uk/exec/obidos/ASIN/020163466X/rpanetwork-21/202-3867982-5617414
then
http://www.rpanetwork.co.uk/wp/fw.rhtm
(this was a one minute search @ google )
another tip:
don't use the MFC Socket Class for Socket Programming, because under the hood, there are Win16 Functions(in version 4.x, i don't know, if this is in version 7 also so)
scio me nihil scire
My OpenSource(zlib/libpng License) Engine:
http://sourceforge.net/projects/rendertech
Its incurable, its a Pentium division failure.
|
|
|
|
|
hmm..bout dat link to "Firewalls and Internet Security: Repelling the Wily Hacker" book.
i think i've read a similar book by Elizabeth D. Zwicky entitled "Building Internet Firewalls". do you think there's any difference between the two?
i've pretty much covered the necessary basics of firewall. so u know wat i should read for really complex stuff bout firewall?
thx,
gildan2020
|
|
|
|
|
sry
i have no experience with this book
scio me nihil scire
My OpenSource(zlib/libpng License) Engine:
http://sourceforge.net/projects/rendertech
Its incurable, its a Pentium division failure.
|
|
|
|
|
Is there any way where one can migrate a process / thread from one computer to another connected computer and have the results returned to the first computer for load balancing?
Take for example I run two extreme memory-intensive program, minesweeper and solitair, and the program will migrate one of the processes to the other computer (which is running nothing) for better performance.
If this is not possible on pre-programmed applications like those stated above, then is there a way where new applications can be written such that this is possible?
thanks in advance
|
|
|
|
|
zichun wrote:
If this is not possible on pre-programmed applications like those stated above
Probably possible but would require alot of work...
zichun wrote:
there a way where new applications can be written such that this is possible?
I believe thats what SETI project does
http://setiathome.ssl.berkeley.edu/[^]
Cheers
The word of the day is legs, let's go back to my house and spread the word
|
|
|
|
|
Therre are some tools that watch files and can get if the file change or not(I know how to do it),I want to know is that possible to get the changes for the file too? For example what is written to the file or the location of it or what is read from it?
I want to write a lock for my software and want to keep some information in a file,and now want to know if it is possible to spy it in this way?
Mazy
No sig. available now.
|
|
|
|
|
I got the "Internet Explorer_TridentCmboBx" element in to the HTML document.
But I can not expand the element from the MFC application.
Please help me to expand the "Internet Explorer_TridentCmboBx" from the MFC application
TAUHID
|
|
|
|