|
Check the return value from QueryInterface() - that should give a clue regarding what error happened. Enter the return code into the Error Lookup util (on the VC Tools menu) to get a text description of the error.
--Mike--
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
Thank you for the suggestion. I forgot I could get that information from the Query call.
The code was 0x80004002 which means no such interface supported!
Any idea why?
Have you ever tried this? Do you think it is possible that MFC is actually using a differnt RichEdit implementation? I also have RICHED.DLL, and RichEd32.dll, in addition to RICHED20.DLL. The debug output shows that RICHED20.DLL is being loaded, so I should be OK right (RICHED20.DLL has v3.0 support)?
Thanks again,
David
|
|
|
|
|
|
Thank you very much.
I see the problem. I'm actually trying to use CRichEditView. I see where the call is being made.
I guess I will have to play around with loading the RICHED20.DLL, maybe by overriding PreCreateWindow()? I'll try not to bother you again.
Thank you.
David
|
|
|
|
|
Can I use those modes together?
I got an error message that says that an error occured when tried acces the file... hmnmm....
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Use CFile::modeReadWrite instead.
--
Andrew.
|
|
|
|
|
I see you got your answer so I feel able to make my usual comment in addition - if you use iostreams they will do the same thing and you won't be tied to MFC. You'll also be able to easily extend your stream to accept your own types.
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:
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
|
|
|
|