|
#include <stdio.h>
#include <stdlib.h>
char buf1[50]="",buf2[50]="";
DWORD x1=1923;
float x2=0.5;
sprintf(buf1,"%d",x1);
sprintf(buf2,"%f",x2);
x1=atol(buf1);
x2=atof(buf2);
quite simple ? right !
//be cool
I am the mighty keeper of the book on knowledge . Contact me to get your copy .
|
|
|
|
|
I've written some code to try and authenticate with a proxy server but I'm having some difficulty, and I suspect it's something to do with supplying a domain name. The proxy server I use to connect to the Internet requires a user, password and a domain. Here's my code:
INTERNET_PROXY_INFO proxyinfo;
proxyinfo.dwAccessType = INTERNET_OPEN_TYPE_PROXY;
proxyinfo.lpszProxy = "proxy:80";
proxyinfo.lpszProxyBypass = NULL;
session.SetOption(INTERNET_OPTION_PROXY, (LPVOID)&proxyinfo,
sizeof(INTERNET_PROXY_INFO));
pConn = session.GetHttpConnection(svr, port, user, pwd);
pFile = pConn->OpenRequest(CHttpConnection::HTTP_VERB_GET, obj, NULL, 1,
NULL, NULL, dwHttpRequestFlags);
pFile->AddRequestHeaders(szHeaders);
pFile->SendRequest();
pFile->QueryInfoStatusCode(dwRet);
...
Note that I've already set the members svr , port , and obj by calling the AfxParseUrl() function. I've also set the variables pwd to my password and user to the following:
<domain>/<user>
Unfortunately dwRet is always set to 407 (failed authentication). I've tried the following format instead as some info on the Internet suggested:
<domain>\<user>
This didn't work either!
Strangely, I've written some Java which successfuly authenticates with the proxy server by creating an authorisation string using the following format:
<domain>/<user>:<password>
Can anyone suggest a solution?
"The folly of man is that he dreams of what he can never achieve rather than dream of what he can."
"If you think education is expensive, try ignorance."
|
|
|
|
|
OK, found the problem at MSDN - Q254396
Set the INTERNET_FLAG_KEEP_CONNECTION flag when you call the HttpOpenRequest WinInet API or add the "Proxy-Connection: Keep-Alive" header in the Execute method of Internet Transfer Control.
So we have:
proxyinfo.dwAccessType =
INTERNET_OPEN_TYPE_PROXY | INTERNET_FLAG_KEEP_CONNECTION;
...and the format of domain and username is as follows:
<domain>\<user>
"The folly of man is that he dreams of what he can never achieve rather than dream of what he can."
"If you think education is expensive, try ignorance."
|
|
|
|
|
What is "windowsx.h" and for what purposes it is used?
Thank you.
|
|
|
|
|
the file ? or what's inside ?
anyway, it looks like help macros to commonly used stuff.
Max.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
Hi,
does anybody have some code to draw a marching ants rectangle? I found two techniques on the web, one using the LineDDA (http://www.undu.com/DN960901/00000009.htm) function, and one using a specific brush (http://www.funducode.com/freevc/gdi/gdi3.htm).
I would like to combine this with the CRectTracker. Does anybody have experiences with this?
Thanks
Dirk
|
|
|
|
|
In the sample theres a class derived from CTolbar. In it I see, generated by the CWizard:
/ Overrides
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
However if I do a context menu on the class in the class view pane, I dont see any way to add a virtual function to the class (like it exists for say the MyCview class). However this above was written by t he class wizard, so how did they do it? If I add it manually I am not supposed to type in the afx area right? Yet somehow in the sample the CW generated it...(I am assuming the author didnt put in in there himself). Is is okay to override this function by hand in any class I wish?
Appreciate your help,
ns
|
|
|
|
|
OnCommand is virtual-ized by CWnd and not the CToolbar class. That what they are doing in the class wizard. They are just overriding the function from up the heriarchy. I don't think CToolbar does anything with it at all. If you'd like to override it on your (by hand) it shouldn't cause any problems. The one stipulation about overriding the method is that it must be done from a CWnd derived class. Hopes this helps.
Joseph Dempsey
joseph_r_dempsey@yahoo.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
THat sure makes me feel more comfortable...
How they ever got it in the grey afx are I dont know. I dont plan to put it in that area. I tested it out...I can put the declare anywhere in the class definition and it still works.
Appreciate your help,
ns
|
|
|
|
|
In a dialog based appl. is it possible to create a region outside the dialog window?
|
|
|
|
|
Someone may end up correcting me here but i don't think you are going to be able to do that simply. I would need more information by making a final decsion. A region is created within a window and drawn by the gdi device context for that window. If you want to draw a region outside of your dialog that you will have to get the device context for the window that the region will be drawn in.
// guess work begins here.
// You would have do something like.. ( to draw the region over the desktop )
HDC hDC = ::GetDC( GetDesktopWnd() );
// ... Do region Creation code ...
// .. use device context to draw region
::ReleaseDC( hDC );
Of course a major problem will be repainting your region when the desktop draws over it.
Having said all that... it would probably be easier for you to create an "invisible"/transparent window and just position it as need be and then draw inside its space using its device context. This would allow you to retrieve the proper WM_PAINT messages so that you could redraw your region as need be when the rect becomes invalidated.
Hope this helps.
Joseph Dempsey
joseph_r_dempsey@yahoo.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
That's what I thought.
Anyway thanks a lot for you suggestion.
Could you please show me some sample of creating transparent window without title bar?
Thanks in advance.
|
|
|
|
|
Hello,
INTRODUCTION:
------------------------------------------------------------------------
I'm writting into an HTML view HTML code directly from memory in an application that shows information to the user using a HTML view.
In order to create the HTML document I use the workaround "about:" and the navigate method, this gives me a new document that I can access using the code below:
*****************************************************
CComQIPtr<ihtmldocument2> spHTMLDocument = this->m_HTMLCtrl.GetHtmlDocument();
if(spHTMLDocument)
{
CComQIPtr<ihtmlelement> spHTML;
spHTMLDocument->get_body(&spHTML);
...
*****************************************************
In this way I create a document in the OnInitdialog by calling the code below:
**********************************************************************
this->m_HTMLCtrl.Navigate("about:");
**********************************************************************
and then I access the HTML document when I need it using the first portion of code.
QUESTION:
------------------------------------------------------------------------
Using the "navigate" code (this->m_HTMLCtrl.Navigate("about:....)
makes that the HTMLView get a document created but when I acces it and I place the real html code inside the document, I leak some memory.
How should I create a HTMLDocument instance using COM (I think that is called "COM", I'm referring at the code model followed in the first block of sample code in the "INTRODUCTION" part)?
if there is no possibility to do it, how do I remove the memory occupied by the document, or at least, how do I remove the contents of the document in order not to leak the memory?
SUMMARY
-------------------------------------------------------------------------
I want the equivalent to the code below (used in order to create an instance of a XML doc):
hrInstanciarXMLDoc = this->m_pxmlDoc.CreateInstance(__uuidof(MSXML2::DOMDocument40));
but I don't want a new XML doc I need a new HTMLDoc.
Thank you in advance...
|
|
|
|
|
Hello There.
I can't really help you with you immediate problem but when you get some time I would suggest you look into the new CDHtmlDialog class in MFC 7. It allows a much cleaner interface between the C++ code and the HTML document.
Art
|
|
|
|
|
...
I'm feeling so stupid... but...
Where do I can find the MFC7.0 to download (I'm using VC++6).
Thank you in advance...
|
|
|
|
|
Sorry,
MFC7.0 is the latest MFC version available with VS.net. Some people call it VC++7 or MFC7.0 to distinguish it from the .Net languages.
Art
|
|
|
|
|
Then... I'll need to wait to have the VS .NET in my hands...
Thank you for your interest.
|
|
|
|
|
Hi all,
I'm trying to change the default icon that is used in Windows explorer for my file type, so I've changed the registry entry for HKEY_CLASSES_ROOT\MyFileType\DefaultIcon (Default) = "c:\windows\shimgvw.dll,1" , but my icon remains unchanged in explorer. Is there something I need to do to get explorer to use the new value? Or have I set it up incorrectly in the registry?
Dylan
|
|
|
|
|
if you have the associations made correctly try restarting windows
be cool
I am the mighty keeper of the book on knowledge . Contact me to get your copy .
|
|
|
|
|
I am trying to run a program including <string> but I get some warning messages with Borland C++ compiler saying:
string.h: Functions containing for,while or some return statements are not expanded inline
string.h: conversion may lose significant digits
string.h: cannot create pre-compiled header: code in header
Any ideas about what's going wrong?Thank you for your help.
|
|
|
|
|
Hi everyone. You're not gonna like this one. I know I don't But I have to figure it out and I'm really stumped. I hope there is someone here who can help
here's the situation:
I've created an MFC Dll that contains some dialog boxes does A,B & C. It uses CDialog and CWinApp (remember this). This Dll is called by an application.
Now here's the Big problem. The application calling the MFC dll is an Xvision App (running through an Xwindows converter called Nutcracker) on a windows P.C. My problem is that the message loops from the CWinThread (parent of CWinApp) and in CWnd (parent of CDialog) don't allow the XWindows message loop to be processed.
I've done this before but the dlls I used didn't have the message loop in them, so I was able to create a message loop in the "Xwindows conversion" which allowed me to insert a trigger (XtAppAddTimeOut(...) ) that would allow the Xwindows messages to be processed.
I'm stuck with this method at the moment. I know it stinks but that's what I have to work with.
If ANYONE has ANY comments or suggestions (even if it's a comment on how much of a kludge this is ) Please please let me know.
Thank you in advance!
Dan Willis
|
|
|
|
|
I didn't think anyone would tackle this one, just based on the fact that it intertwines both Xwindows and Windows.
Oh well.
|
|
|
|
|
I am trying to add the contents of the editbox part of the CCombobox to its listbox area when the user presses enter.
I tried the foll, but as I suspected this traps every keystroke. I just want the final text when the user is done and presses enter...
void CCombtestView::OnEditchangeCombo3()
{
}
void CCombtestView::OnEditupdateCombo3()
{
CString h ;
m_combo1.GetWindowText(h);
m_combo1.AddString( h);
}
Appreciate your help,
ns
|
|
|
|
|
Try to pretranslate the message WM_KEYDOWN and then filter the return... if you want another and more polite way to do it, derive a class from the combobox and handle the keys from there...
I was wondering if WM_CHAR could help you too...
Hope this helps...
|
|
|
|
|
Hello
I am trying to create an application that has a main windoe and two child frames inside the main window. One frame needs to be dialog based so I can place a number of controls and edit fields on it. The other needs to be a plain window that can except drawing and/or plot information from the program. I would like to have both windows fixed in size and position and have both of them come up automatically when the program starts. Ther are a few other features that I want to add but that will be addressed after I get this structue working and the program running.
I have figured out how to create an MDI application. I chose to use an MDI because it looks like the only window style that will do what I want. I will admit that I am a hardare designer and this is my first time with Visual C++. So I am an extream novice. I do have two copies of "Teach youself Visual C++" books by SAMS, however they are not much help for this application. So I thought I would locate some experts! Any help would be greatly appreciated.
|
|
|
|