|
This is what my code looks like here:
void __stdcall CIEBand::OnNavigateError(IDispatch* pDisp, VARIANT* URL, VARIANT* TargetFrameName, VARIANT* StatusCode, VARIANT_BOOL* &Cancel)
{
if(StatusCode->intVal != HTTP_STATUS_OK)
{
CStringW c = "http://www.mysite.com/404.html";
VARIANT_BOOL topLevel;
if(m_pWb2 == pDisp && SUCCEEDED(m_pWb2->get_TopLevelContainer(&topLevel)) && topLevel)
{
m_pWb2->Stop();
m_pWb2->Navigate2(&CComVariant(c), &vtMissing, TargetFrameName, &vtMissing, &vtMissing);
}
}
}
|
|
|
|
|
I'm not sure... I have my code below, and I'm not quite sure that'll work...
|
|
|
|
|
Well... can't give you a good solution, but here's a hack that might do for you. Navigate to this URL (replacing winamp.com with whatever):
javascript:document.write('<body style=\"overflow:hidden;margin:0px;padding:0px;border:none;\"><iframe src=\"http://www.winamp.com/\" style=\"margin:0px;padding:0px;border:none;width:100%;height:100%;\"></iframe></body>')
Shog9
---
You'd better turn back, before the frost sets in.
These desert nights are for weathered men,
The ones who've already given in...
|
|
|
|
|
Hi!
In MFC how can we find the ip address of our own computer?
Thanks.
Avi
|
|
|
|
|
Try gethostname() followed by gethostbyname() .
(David Crow posted this reply to an identical question earlier today).
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
hi Ravi,
thanks for pointing to that message. but this is what i meant--
is it possible to obtain ipaddress of a computer, when it is not connected to network. say u run mfc application on your computer and it prints out the ipaddress of your machine. i was wondering if there was any function available in mfc for this purpose.
thanks.
Avi
|
|
|
|
|
I suspect David's solution may just return 127.0.1.1 ("localhost") if you're not part of a LAN. Perhaps you want this[^] article?
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I'm a tyro at VC++, but I've been following this thread with some interest. Forgive me if this is a stupid idea, but is there some way you can capture the output of a call to ShellExecute on the command ipconfig? If you're disconnected you may have to add the /all option to make it cough up inactive connections, and you're probably going to have to parse a bunch of text to capture the IP address. Just a thought - I haven't tried it. But I hope that it might provide some sort of solution, however kludgy it might be...
"Another day done - All targets met; all systems fully operational; all customers satisfied; all staff keen and well motivated; all pigs fed and ready to fly" - Jennie A.
|
|
|
|
|
Hi,
The ShellExecute doesn't output the text returned by ipconfig, but you can redirect the output from ipconfig to a file!
For exemple: in the console (command prompt if you will) one can type
"ipconfig /all > somefile.txt".
This way the output will be written in "somefile.txt". If it doesn't exist, it'll be created.
Knowing this, the call to ShellExecute() will look like this
<FONT COLOR="blue">int</FONT> nResult = ShellExecute(hYourMainWindowHandle,
NULL,
"ipconfig /all > SomeFile.txt",
NULL,
NULL,
0
);
All you have to do is parse "SomeFile.txt".
Hope this helps
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
That was my thought - redirect to a file and read it back. But I assumed someone smarter than I might know a way to do it more efficiently C++. In Java, of course, you'd only have to do a
InetAddress address = InetAddress.getByName(<host url="">);
byte[] addressBytes = address.getBytes();
to retrieve the machine address.
"Another day done - All targets met; all systems fully operational; all customers satisfied; all staff keen and well motivated; all pigs fed and ready to fly" - Jennie A.
|
|
|
|
|
Roger Wright wrote:
...is there some way you can capture the output of a call to ShellExecute on the command ipconfig?
Yes, see these MSDN articles for examples:
http://support.microsoft.com/default.aspx?scid=kb;en-us;190351
http://tinyurl.com/guro
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I need to present a dialog to the user similar to an installer license agreement dialog. What is the best way to present many read-only lines of vertical-scrollable text to the user with automatic horizontal word-wrapping? I thought that something like word-wrapping would be a basic feature for the MFC CEdit control, but I couldn't find any option to enable it.
|
|
|
|
|
|
Static text controls have vertical scrollbars? How do I enable them?
|
|
|
|
|
Make sure the multiline style is set (ES_MULTILINE ), and make sure the automatic horizontal scrolling style is not (ES_AUTOHSCROLL ). Also set ES_READONLY if you do not intend for it to be edited.
Shog9
---
You'd better turn back, before the frost sets in.
These desert nights are for weathered men,
The ones who've already given in...
|
|
|
|
|
Thanks, I didn't have auto-hscroll off .
|
|
|
|
|
hello i am working on an encryption project.
i have delacared a variable
HCRYPTPROV abc;
HCRYPTPROV is defined in the Wincrypt.h header file as:
typedef unsigned long HCRYPTPROV;
i have include the "Wincrypt.h" in my project and the file is present in Include directory..
but i get an error "Undeclared variable" for my statement
can any one suggest why and how to solve it
qrious
|
|
|
|
|
Are you SURE you've included it so that it is visible to the file that defines this variable ? Because, if you have, then this will work.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
yes i have included the Wincrypt.h header file in my project but still i am getting the errors.....
thank you
qrious
|
|
|
|
|
To reiterate: you are either not including this file, or you are including it in the wrong place, or it does not define what you think it does. Or possibly you have two files with that name, and the wrong one is being included.
It would help if you posted some code, and the error you are getting.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
i guess the mistake, that you are doing is that, you are using double quoutes instead of angled brackets to include the the file.
kindly write #include<wincrypt.h> at the top of your .cpp file in which you using HCRYPTPROV. You should use Microsoft C compiler instead of Turbo C.
|
|
|
|
|
hi
i have used angle brackets to include th file Wincrypt.h in my file
and iam using VC++ for doing the project .. i hope that should be enough
i am not able complie the project
thanks ...
qrious
|
|
|
|
|
Hello all,
I'm a really new c++ programmer in the U.S. Navy. I'm trying to write an airline reservation program with a class list{} class flight{} and class passenger that has to read passengers and files from a file. I have no idea how to start this program. Any help would be appreciated. this is what I was given for it. Struct flight { int number; //flight number
char *from; //departure city
char *to //destination city
struct flight *next; // link to next flight
struct pass *pass //link to passengers
};
struct pass
{
char *first; //first name
char *last; // last name
char seat[4] //seat number
struct pass *pass; // link to passengers
struct header
{
struct flight *first;
struct flight *last;
int howmany; //howmany flights
Any help on getting started with the accessors and constructors I might need would help a lot. I did this school that I was made to do in a week and trying to learn all of c++ in a week is not easy. If anyone has any good ideas on a start or how I should go about doing this please help me.
Thanks
|
|
|
|
|
Hi there. If you need to read and write information from a file, you should read my articles on iostreams. Basically you #include<fstream> and then you can read and write files easily, and you could even set yourself up to read and write your custom structures with inserters and extractors ( this is not hard, I have an article on it here on CP ). Then you could do this:
pass myPass;
ifstream myFile("c:\\file.txt");
while (myFile.good())
{
myFile >> myPass;
// do something with the passenger
}
// the end.
It's a shame you need to use char *'s instead of strings. A struct is just a class whose default access is public, you should add constructors and destructors to the structs, the constructor should set the char *'s to null, and the destructors show call delete [] on them if they are not null.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I can change what is inside of my struct or I can even make it a class i'm not bound to do it that way. It was just an example set up for us. I just have trouble starting the program. I'm so new that I still look in books and try to get ideas but still struggling. Thanks for the advice I will definetly try to figure it all out.
|
|
|
|