|
(Steven Hicks)n+1 wrote: It is written in mc++ (which is why I posted my question here)
OK, I wondered because it was posted in the C++ forum. I've only done C# web services, I just hit F5 and it all works.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi I'm using c++ msoutlook automation.
I have no problem working with outlook.. except for the dialog that is asking me to choose the accessing time like 1min - 10 mins..
Is there any way to turn off that dialog using c++?
I dont' know whcih function to use to trun off that message prompt.
thanks for your help.
|
|
|
|
|
1
2 classes A and B. B has a private member int x and it should declare a friend function in the header for B to change A, however B's Header sould know A (inlude "a.h")and A's header should know B. but when i do so i get the error include nested level 363
2
I do I make a string member for a class.
(when i declare #include <string> in the header i must use namespace std in order to make it work but then i get the familiar problem of using namespace in header file - I do I set the conflict)
Thanks alot to whoever it be.
Nir.
|
|
|
|
|
talvezu wrote: classes A and B. B has a private member int x and it should declare a friend function in the header for B to change A, however B's Header sould know A (inlude "a.h")and A's header should know B. but when i do so i get the error include nested level 363
You need to make the member protected in order to achieve this, private is not visible to friends.
You can do one of two things. The first is to forward declare the class in the header and have your #include in your cpp ( so you put class A; at the top of the B.h file ). The other is to use a third class as a bridge between the two.
talvezu wrote: I do I make a string member for a class.
The way I do it is to put #include<string> in my stdafx.h. and then put std::string m_string; in my header file, and using std::string in my cpp file. So, I explicitly scope namespaces in my headers, and put using statements in my cpp.
talvezu wrote: i must use namespace std in order to make it work but then i get the familiar problem of using namespace in header file - I do I set the conflict)
If you're worried about conflict, don't use 'using namespace std;', but instead put using statements for the bits of std you want to use.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
First , thank you for your help,
Unfortunatly I still have not succeed in making it right
the problem is that when I declare Class B , I cannot write the folowing
class B;
class A{
...
public :
friend int* B::geta(A* a);
...
}
because it is an implementation.
and I do not have anywhere else to declare friend function beside the header.
regards the 2 answer can you give some more details for me?
Thanks again,
Nir
|
|
|
|
|
talvezu wrote: friend int* B::geta(A* a);
I didn't know you could do that at all. If you can, you certainly can't do it here, the idea is that the compiler knows that class B exists, but certainly has no idea what it contains.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
You don't have to include headers - just use declaration syntax, such as:
<br />
class A;<br />
class B<br />
{<br />
friend class A;<br />
}<br />
---------<br />
class B;<br />
class A<br />
{<br />
friend class B;<br />
}<br />
Igor Green
http://www.grigsoft.com/ - files and folders comparison tools
|
|
|
|
|
Well it is working ,so I guess it is a solution but what if I want to grant just one function,
in porpuse of grant access not to all private members
you can look at the above situation I wrote in reply for cristian.
Thanks.
Nir
|
|
|
|
|
I have a host, asume it is:
name: www.myhost.com
ip: 111.222.333.444 (I got it from cPanel)
when I pass both as server param to MFC class CFtpConnection and get the same contents.
questions:
1) how to get name (www.myhost.com) if I only know ip address and vise verse?
2) If I set a link on html file, such as:
<a href="http://www.myhost.com">link</a>
the page (index.html) can be loaded.
but for link
<a href="http://111.222.333.444 ">link</a>
the page can not be found.
why?
thx
includeh10
-- modified at 17:03 Tuesday 15th November, 2005
|
|
|
|
|
You could use the existent API for that:
gethostbyname and gethostbyaddr
What you are looking for is either resolving a domain name into an IP address or resolving an IP address into domain name
Have a look here (eventhough is a VB page, it uses the same API):
http://www.activeserverpages.su/redir.asp?link=http://www.vbip.com[^]
SkyWalker
-- modified at 17:26 Tuesday 15th November, 2005
|
|
|
|
|
CString csAdd="111.222.333.444"; //assume
int iType=AF_INET;
HOSTENT*ph=gethostbyaddr(csAdd,csAdd.GetLength(),iType);
the function faield with last error 0x2AFC (no message for it).
why?
includeh10
|
|
|
|
|
The first parameter of gethostbyaddr() is the address as a binary number in network byte order, not a CString . Use the inet_addr() [^] function to convert the address.
|
|
|
|
|
thx, it works now.
is there a function to get ip address from domain name?
includeh10
|
|
|
|
|
MSDN example:
hostent* remoteHost;
char* host_name;
unsigned int addr;
printf("Input name of host: ");
host_name = (char*) malloc(sizeof(char*)*16);
fgets(host_name, 16, stdin);
if (isalpha(host_name[0])) {
host_name[strlen(host_name)-1] = '\0';
remoteHost = gethostbyname(host_name);
}
else {
addr = inet_addr(host_name);
remoteHost = gethostbyaddr((char *) &addr, 4, AF_INET);
}
if (WSAGetLastError() != 0) {
if (WSAGetLastError() == 11001)
printf("Host not found...\nExiting.\n");
}
else
printf("error#:%ld\n", WSAGetLastError());
SkyWalker
|
|
|
|
|
remoteHost does not contain info of ip address.
includeh10
|
|
|
|
|
|
While working with windows forms, in Visual C++.net there are three options for TextAlign for a TextBox: Right, Left, Center. What about justified or blocked style text for the multi line option? Is it somewhere in the TextBox Base class? If not, I could code my own, but was wondering if it was already out there somewhere. Seems there is not much on the subject.
Thanks,
RRL
|
|
|
|
|
sveige wrote: What about justified or blocked style text for the multi line option?
That would require a rich edit control.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I would like to embed XML files in my MFC project so that they are linked into the executeable rather than installed with the application.
The XML files should than be used to fill combo boxes etc.
Has anyone used this way to embed language files (instead of string tables or dlls)?
Thanks
Andre
|
|
|
|
|
The only I know to do this is as a resource. See RT_RCDATA for more.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
I am working on accessing a directory to copy its contents (file directory, subdirectories, and all files) to another folder, which would be created via the program (eg C:\test), my question is that knowing I need to employ recursive direcotry copying what code should I look at using. I am avoiding .Net framework, and sticking to basic win32 calls. So far I have thought of using:
[CODE]RecursiveCopyFolder(CString csPath, CString csNewPath)
{
BOOL bRet = TRUE;
if( !CreateDirectory(csNewPath, NULL))
bRet = FALSE;
CString csPathMask;
CString csFullPath;
CString csNewFullPath;
csPath += _T("\\");
csNewPath += _T("\\");
csPathMask = csPath + _T("*.*");
WIN32_FIND_DATA ffData;
HANDLE hFind;
hFind = FindFirstFile(csPathMask, &ffData);
if (hFind == INVALID_HANDLE_VALUE){
return FALSE;
}
// Copying all the files
while (hFind && FindNextFile(hFind, &ffData))
{
csFullPath = csPath + ffData.cFileName;
csNewFullPath = csNewPath + ffData.cFileName;
[/CODE]
I don't know though... Am I on the right track? This seems to make sense to me, but it is not cooperating. I know that I will need to employ this in order for my project to work, so I am trying to ask around to get a better idea of whats out there. Thanks.
Rob
|
|
|
|
|
bobfilar wrote:
my question is that knowing I need to employ recursive direcotry copying what code should I look at using.
Use SHCreateDirectoryEx() and SHFileOperation() for this.
bobfilar wrote:
I am...sticking to basic win32 calls.
Using MFC is not considered basic Win32.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
U'll have to fix few things:
1. CreateDirectory works only one dir down from an existing dir so u have to write your own function that splits the path on '\\' and create "C:\\a", then "C:\\a\\b" and then "C:\\a\\b\\c" and so on
2. FindFirstFile may return INVALID_HANDLE_VALUE if there are no files to match the mask - returning FALSE isn't always the right thing to do
3. After FindFirstFile the output struct contains the first file's details so writing FindNextFile right after that skips the first file.
4. U must filter out the "." and ".." directories (yes they still exist..)
5. U must check the attributes and recurse directories
6. Use unicode - u know files can have weird names
|
|
|
|
|
At runtime, is it possible to set the (+) for a tree item even if there are no children under that item ?
I'm doing the following :
BOOL bRet = m_Tree.SetItemState( hMyItem, TVIS_EXPANDED , TVIS_EXPANDED );
I have a large dataset that will be inserted in a tree hierarchy, and I am only inserting items in the tree when the user clicks on a node that will display leave items (instead of inserting them when I load the file ) ; but I need to show the user that there are items under that collapsed node.
for example :
Root
|
+ Item1
+ Item2
|
- SubItem2
Thanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
How about adding a 'dummy' item so that the '+' is shown, and then when it is clicked, remove the 'dummy' item and insert the real items? Would that work?
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|