|
It sounds like you have made some of the required progress already. As your call to
CWnd * Handle=FindWindow("AIM_CSignOnWnd",NULL);
Is returning a valid pointer to the main window, from here, you can use this CWnd* pointer to get controls/windows on the main window. If you start up spy, you should be able to snoop the AOL window to find out the ID number of the window you want to set the text of, Once you have done that, you should be able to get a CWnd* pointer to it:
CWnd *pWindow = handle->GetDlgItem(id_of_control) ;
if (pWindow != NULL)
{
pWindow->SetWindowText("Some text") ;
}
I am not sure about how valid it is passing the string across, as you may need to mess around with memory in the system address space (which should be accessable from both applications).
Give it a try and see if it works.
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
|
|
|
|
|
Has anybody had a problem with the VC.Net make always rebuilding resource files when you build the project? This was an imported project from VC6.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Have you checked the date on the file ?
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Just verified that the .rc is from 11/20/01 while the .res is from today. Checking the includes...
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Could anyone give me an example of some code that would dump the contents of a file, line by line, into an array?
|
|
|
|
|
ifstream str(_T("Myfile.txt"));
if (!str.is_open())
{
AfxMessageBox(_T("Could not open file"));
return FALSE;
}
vector<string> file_contents;
copy(istream_iterator<string>(str), istream_iterator<string>(), back_inserter(file_contents));
This assumes you've done the approproate includes (fstream, vector, algorithm, string I believe ) and the appropriate using std:: commands ( ifstream, vector, back_iterator, string and copy ).
I've just tested this ( and found my typo, sorry ), and it works, but it builds a list of words, not sentences. I dunno off the top of my head how to get a stream to not take a space as a delimiter.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
<Center><A href = "http://www.sonork.com" target = "_Blank">Sonork</A> ID 100.10002:MeanManOz</Center><Center>I live in <U><B>Bob's HungOut</B></U> now</center>
|
|
|
|
|
|
With thanks to the wise folks at comp.lang.c++, here is a version that reads a line at a time into the vector:
#include <string>
#include <vector>
#include <algorithm>
#include <fstream>
#include <iostream>
using std::copy;
using std::vector;
using std::string;
using std::ifstream;
using std::ostream_iterator;
using std::cout;
using std::back_inserter;
using std::getline;
int main(int argc, char* argv[])
{
string currentLine;
ifstream str("c:\\winzip.log");
if (!str.is_open())
{
cout << "It's stuffed\n";
return -1;
}
vector<string> file_contents;
while ( getline(str, currentLine) )
{
file_contents.push_back(currentLine);
}
copy(file_contents.begin(), file_contents.end(), ostream_iterator<string>(cout, "\n"));
return 0;
}
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
How can I change the size of an array?
i need to change from a zero-size array to a n-bytes array
ex:
BYTE anything[];
and after some code :
redimensionfunction(anything[], length);
i am using vc++ 6
|
|
|
|
|
You have two options.
1/ USe a pointer. Then you can do this:BYTE * pByte = new BYTE[256];
// use it
delete [] pByte;
pByte = new BYTE[300];
Of course every time you resize, you lose all the contents of the array.
2/ Use vector. Like this:
#include <vector>
vector<BYTE> vecBytes;
for (int i = 0; i < 256; ++i)
vecBytes.push_back(i);
now you have an array of 256 values that can be accessed using [n] notation if you like, or the .at function. But you can also delete from the ends and add new items dynamically at will.
If you want to delete from the middle you want list, but beware, list has the problem of slower access to individual fields ( as it's a linked list it must step through to the element you want )
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
<Center><A href = "http://www.sonork.com" target = "_Blank">Sonork</A> ID 100.10002:MeanManOz</Center><Center>I live in <U><B>Bob's HungOut</B></U> now</center>
|
|
|
|
|
Hi use malloc and realloc
ex.
void *pV = NULL ;
...
...
..
//now u want to allocate 100 bytes
pV = malloc( 100 ) ;
...
..
..
//Now u want to make the same memory 200 bytes.
pV = realloc(pV, 200);
..
..
//Now u want to make it 50 bytes
pV = realloc(pV, 50) ;
|
|
|
|
|
Do NOT use malloc/realloc if you can at all avoid it. They are C functions, and new/delete is highly preferred, especially for complex types. The best reason for this is the fact that new/delete call constructors/destructors and the C functions do not.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
i use globalalloc() and globalfree() and globalrealloc() a lot and they work just fine if you remember to free the memory when u finished with it
whats the problem with this?
---
"every year we invent better idiot proof systems and every year they invent better idiots ... and the linux zealots still aren't being sterilized"
|
|
|
|
|
lauren wrote:
whats the problem with this?
There's no *problem* per se, but if you mix C and C++ memory allocationj calls, you need to be careful not to free something you new'd. You also don't get the benefit of constructors and destructors. If you need to realloc, you should instead use a container like vector. Your code will obviously work, but the way of doing things I am suggesting is *better*.
To read Stroustrup on this ( and I've pretty much quoted him, so you don't need to as such ), turn to page 577 of the third edition of the C++ Programming Language.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Youve all see the new napster Beta i assume, how did they create the toolbar logo. ive tried using a background bitmap but it stays in the same position when the window is resized. i wish mine to glue to the window edge so it will always be on the right hand side frame edge.
.NET or not .NET? MFC is the question......
|
|
|
|
|
I realize I am years behind the times but I am just now moving from VC 5 to VC 6. However, because of third party objects, one application will have to remain in the VC 5.0 environment.
Anyway, do any of you good people know of or have a utility to swap back and forth the debug libraries for each product?
Or maybe even a list of objects that are not compatible?
thanks
|
|
|
|
|
I have heard of such a utility, but never seen it.
If it just the one application you could put a copy of the 5.0 debug dlls in that applications debug directory. If you are running the 5.0 debug version beyond that testing environment put it in a seperate directory and put a copy of the debug 5.0 dlls there.
|
|
|
|
|
Hello all,
How do I detect a CD-RW drive? How do I read/write files onto a CD-RW? Any code or links would also be helpful.
TIA.
#define MOSTLY_LEAN_AND_MEAN
|
|
|
|
|
I've created sdi app using mfc AppWizard and have created my own classes in a header file called game.h.
What I want to do is create an instance of that class in my CChildView (CWnd) class.
ie.
(in the file ChildView.h)
#include "game.h"
CChildView : CWnd
{
//blah blah
protected:
CGame *game;
};
When I do this though I get this error
"error C2011: 'CGame' : 'class' type redefinition"
The reason I'm trying to do this is that I need all of my CChildView functions to have access to this CGame instance and it seems like an easy way to do it.
Any suggestions?
|
|
|
|
|
The file is getting included more than once. Does your class have a #ifndef CGAME$%)(^@($% type macro wrapping it ?
Try including the header file in your .cpp file and putting a dummy class definition in the .h, as in
class CGame;
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
As we know..
MFC have the GetDlgItemText function to retrieves the string (char datatype)
and GetDlgItemInt function to translate the text into integer value. (integer datatype)
But I wonder is there any function for Float datatype?
If you know .. please explain along with the parameter within the function.
Thanks..
|
|
|
|
|
No there is not such function, but you can use atof() to convert the string you got from GetDlgItemText() to a float
hope this helps
regards
Gregor
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I would like to convert the integer value to float value.
I got some error when I used atof function.
Do u know any function that same as atof() that convert integer to float?
Thanks a lot.
Lee Teong
|
|
|
|
|
Maybe something like this:
int i = 10;
float f = 0.0;
f = (float) i;
|
|
|
|
|
I would have to say that this is one of the cases that you may want to use the DDX_ functions. One of the overrides does exactly just that.
But there are limitations to those functions so if you are hitting on those limitations, you may still have to roll your own code.
|
|
|
|