|
Christian Graus wrote:
You'll also be able to easily extend your stream to accept your own types.
How!!!!!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
By writing iostream insertion and extraction operators. I guess I should write an article...
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Christian Graus wrote:
I guess I should write an article...
Yes you should!
But by the way, I found that WritePrivateString/GetPrivateString is a much easier way to my problem!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
So you're using an ini file ? I avoid them, because the functions you're using are only provided for legacy code, Microsoft recommends putting data in the registry.
However, I use iostreams often, they are an easy way to stream state information to disk, for debugging for example.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
I've got a class with a _variant_t member variable.
When I call delete on objects of my class, I get memory leaks. Is there a safe way of getting rid of these objects?
Thanks,
funbag
skydiving....if at first you don't succeed, you're fecked!
|
|
|
|
|
What are you using in the variants? I could see where some problems might occur if you are using safe arrays, but if you are just using the regular variant union variables, then I'm not too sure..
What are the memory leaks saying? Are the leaks explicitly of object of CYourClass? Or are they variant objects?
//------------------------
CSignature::Jeff() ;
PostMessage(WM_QUIT) ;
//------------------------
|
|
|
|
|
My class is derived from IADORecordBinding, and has the two _variant_t objects. They're used to read an adVariant and an adGUID type from a recordset object, to which my object is bound.
The adVariant is just used to store a date from the db, while the GUID is used as a record identifier.
When I delete my object, a COM error is raised, 800020008 - bad variable type.
The memory leaks seem to be a cascade of the error of not deleteing my object correctly.
I hope this helps
Thanks,
funbag
skydiving....if at first you don't succeed, you're fecked!
|
|
|
|
|
This is probably a really simple question but could someone please tell me how to call a .exe program when I click a button on a dialog box. Thanks so much.
|
|
|
|
|
ShellExecute(..)
or
CreateProcess(..)
The first one is simple to use than the second!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Well would I have to specify the location of the file in the brackets.
Thanks for your help also.
|
|
|
|
|
ShellExecute(hwnd, NULL, "C:\\Program\\MyApp.EXE", NULL, NULL, SW_SHOW);
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
I have the following txt file:
S San Diego 4 20:30
------------------------
**San Diego can be the name of any city not more than 20 characters long***
How do I make the read in statment to ignore what comes after S. (Means maxiumum 20 characters and then continue reading).
Thanks GUYS
|
|
|
|
|
Why not try it the reverse way and remove all but the last 7 or 8 chars ?
Regardz
Colin J Davies
Sonork ID 100.9197:Colin
I think it's interesting that we often qu-ote each other in our sigs and attribute the qu-otes to "The Lounge". --- Daniel Fergusson, "The Lounge"
|
|
|
|
|
If the character after the city is always a number then keep eating chars until you hit a number.
Todd Smith
CPUA 0x007 ... shaken not stirred
|
|
|
|
|
You could also try delimiting the fields within your text file with some character that is not normally used by your actual data (a comma for instance) i.e.
S,San Diego,4,20:30
Now just use the delimiters to find the start of each subsequent field, as required.
(Of course, this is assuming that adjusting the text file's format is an option!)
Free
|
|
|
|
|
Hi.
I am working on a simple program that resolves hostname. Here is the concept:
Enter hostname: www.google.com
Resolve IP: 216.239.33.101
The program has a dialog box for the user to enter the hostname such as (www.google.com or www.yahoo.com).
Here is the function that does it:
-----
void CDomainDNS::resolveHost(const CString &rHName)
{
WSAData wData;
if (WSAStartup(MAKEWORD(2,2), &wData) == SOCKET_ERROR)
{
CString error;
error.Format("Error initialization Winsock");
AfxMessageBox(error);
return;
}
hostent *host = 0;
host = gethostbyname(rHName);
if (host == 0)
mVeri = false;
else
{
mIP = inet_ntoa(*(reinterpret_cast(host->h_addr)));
mVeri = true;
}
}
-----
The code above works perfect under Win32 *console*. However, it only outputs my *internal* ip in MFC application mode.
For example:
Enter hostname: www.google.com
Resolve IP: 192.168.0.1
Is there something I need to change or add when dealing with the code above in Win32 MFC environment? Maybe there is a better tool for resolve hostname via MFC?
Thanks,
Kuphryn
|
|
|
|
|
I'm afraid that this isn't really an answer, but I use a very similar method to resolve a host name in an MFC app and it works just as expected. However, I do have 2 comments to make:
1. I guess it's just a typo, but your assignment of mIP should read:
mIP = inet_ntoa( *(reinterpret_cast<struct in_addr="" *="">( host->h_addr )) );
2. I use AfxSocketInit(), called from the apps InitInstance fn, rather than WSAStartup. I'm pretty
sure that AfxSocketInit is required for MFC apps (which will eventually call WSAStartup anyway).
I'm currently using Win98 SE, but a quick search through the MSDN library that came with my VC6 brought up a few issues of gethostbyname() returning a list of all local IP addresses under certain conditions if using WinNT - might be worth checking these out?
Hope this helps,
Free
|
|
|
|
|
Okay.
The problem was that I did not call UpdateData(TRUE) before passing the hostname to function resolveHost(...).
Kuphryn
|
|
|
|
|
I went down to www.gamedev.net as i was told to do "if i was interested in making games" and i found an article that can be found here if you would like to read it:
http://www.lupinegames.com/articles/path_to_dev.html
This article basically stated the best way to start learning how to program games "It did not say how, or how to start
The Article gave you a list of projects and why they would help you learn how to program. "After i read this article i thought to my self 'What the heck' And now i am on the first project... which is a tetris like game."
The tetris example was in windows and ill asume it was done with DirectX. Ive downloaded all the DirectX 8.1 SDK files... and now just wondering: Where can i find a good real beginner tutorial on beginning DirectX 8.1?
Also, just for fun kind of question: How do you bring an image to the screen?
Thanks all!
~SilverShalkin
ps... If your interested in game development: www.flipcode.com and www.gamedev.net are great places to get started
|
|
|
|
|
Have you looked a the sample programs with the DirectX SDK. There is a game called donuts, and there are a few other examples that describe how to setup display surfaces and paint bitmaps.
Checkout my Guide to Win32 Paint for Intermediates
|
|
|
|
|
I've played the game donuts, but when ever i click on the tutorial, it comes up and says that it cannot find the tutorial of hh.exe. How do ill look at the source of the donuts game?
Thanks
~SilverShalkin
|
|
|
|
|
Did you choose to install the source files along with all of the sample applications?
If so, then you simply need to navigate to the directories where the samples are, and open them up in Dev Studio.
Checkout my Guide to Win32 Paint for Intermediates
|
|
|
|
|
Have you tried msdn.microsoft.com ? It's got heaps of stuff on DirectX. I believe www.codeguru.com has a column on it as well, or on game programming at least.
You shouldn't need DirectX for a Tetris game though - I believe there's a couple here on CP if you want to see how other people have done it. It's probably worth it to do it with and without DX IMO.
SilverShalkin wrote:
Also, just for fun kind of question: How do you bring an image to the screen?
Do you mean with or without DX ?
I have an Asteroids game, which uses DX 6, that I'm going to write an article for and post tonight. It was my 'write a simple game to learn game programming' project, so it's probably a little rough, but it's just sitting there, so I thought someone might find it useful.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
That would be cool :
Christian Graus wrote:
I have an Asteroids game, which uses DX 6, that I'm going to write an article for and post tonight. It was my 'write a simple game to learn game programming' project, so it's probably a little rough, but it's just sitting there, so I thought someone might find it useful.
Im getting a book that teaches DirectX... I'll learn from that and any other question... i got four forums to ask it
Thanks for your help
~SilverShalkin
|
|
|
|
|
The big problem ( and it will be a problem with my code as well ) is that DX changes so often, to write in DX 8, you need a book on DX 8. The book you buy will come with the SDK for the version it teaches, and for 2D stuff it probably won't matter so much, but still, be aware that the code changes between versions, therefore when you find code online you need to know what version it is for.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|