|
Sorry all. I figured it out. I copied the wrong dll.
***********************
Tony Fontenot
Recreational Solutions
tony@recsolutions.com
***********************
|
|
|
|
|
CString strFullName
gethostbyname(const char *name)
This won't compile under Unicode in VC 7, How should i fix this?
gethostbyname(strFullName);
Thanks
- Matt Newman / Windows XP Activist
-Sonork ID: 100.11179
01001001 00100000 01010000 01100001 01100100 00100000 01001101 01111001 00100000 01010000 01101111 01110011 01110100 00100000 01000011 01101111 01110101 01101110 01110100
|
|
|
|
|
CString only converts to LPCTSTR, which is a Unicode string when building for Unicode. The quickest way is to use an ATL conversion macro:
#include <atlconv.h>
{
USES_CONVERSION;
gethostbyname ( T2CA((LPCTSTR) strFullName) );
}
--Mike--
Buy me stuff! (Link fixed now)
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é.
Sonork - 100.10414 AcidHelm
|
|
|
|
|
Michael Dunn wrote:
{
USES_CONVERSION;
gethostbyname ( T2CA((LPCTSTR) strFullName) );
}
Where do I put this?
if I replace the original with this it just makes it unreadable characters
- Matt Newman / Windows XP Activist
-Sonork ID: 100.11179
01001001 00100000 01010000 01100001 01100100 00100000 01001101 01111001 00100000 01010000 01101111 01110011 01110100 00100000 01000011 01101111 01110101 01101110 01110100
|
|
|
|
|
|
Sorry about the delay I was gone this weekend
CString strTemp;
int item = 0;
struct hostent *host;
struct in_addr *ptr;
DWORD dwScope = RESOURCE_CONTEXT;
NETRESOURCE *NetResource = NULL;
HANDLE hEnum;
WNetOpenEnum(dwScope, NULL, NULL, NULL, &hEnum);
WSADATA wsaData;
WSAStartup(MAKEWORD(1,1),&wsaData);
if (hEnum)
{
DWORD Count = 0xFFFFFFFF;
DWORD BufferSize = 2048;
LPVOID Buffer = new char[2048];
WNetEnumResource(hEnum, &Count, Buffer, &BufferSize);
NetResource = (NETRESOURCE*)Buffer;
char szHostName[200];
for (unsigned int i = 0; i < BufferSize/sizeof(NETRESOURCE); i++, NetResource++)
{
if (NetResource->dwUsage == RESOURCEUSAGE_CONTAINER && NetResource->dwType == RESOURCETYPE_ANY)
{
if (NetResource->lpRemoteName)
{
CString strFullName = NetResource->lpRemoteName;
char buf[512];
if (0 == strFullName.Left(2).Compare(_T("\\\\")))
strFullName = strFullName.Right(strFullName.GetLength()-2);
<code>host = gethostbyname(strFullName));</code>
if (!host) continue;
ptr = (struct in_addr *) host->h_addr_list[0];
sprintf(buf, "%d.%d.%d.%d", ptr->S_un.S_un_b.s_b1,
ptr->S_un.S_un_b.s_b2, ptr->S_un.S_un_b.s_b3, ptr->S_un.S_un_b.s_b4);\
List->InsertItem(item++, strFullName, 0);
List->SetItemText(item - 1, 1, (LPTSTR)buf);
List->SetItemText(item - 1, 2, NetResource->lpComment);
}
}
}
This is the original code,
- Matt Newman / Windows XP Activist
-Sonork ID: 100.11179
01001001 00100000 01010000 01100001 01100100 00100000 01001101 01111001 00100000 01010000 01101111 01110011 01110100 00100000 01000011 01101111 01110101 01101110 01110100
|
|
|
|
|
Look at the function WideCharToMultiByte to convert the UNICODE string to a char*.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
This is basically a guess.
But you might try using WideCharToMultiByte to convert the unicode string to a normal string
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
Here you go, no please tell me how to make it work.
It does not like my CList expression (and neither do I )
<br />
typedef struct <br />
{<br />
int data;<br />
int temp;<br />
<br />
}dataStructure;<br />
<br />
typedef CList <dataStructure,dataStructure> dataList;<br />
<br />
<code><br />
<br />
p.s thanks bracket tip
|
|
|
|
|
Coremn wrote:
typedef CList <<datastructure,datastructure>> dataList;
You should change that to this:
typedef CList <dataStructure,& dataStructure> dataList;
BTW, you can add the single < or > by using & lt; and & gt;, or excapsulate all of your code in between <PRE> and </PRE> tags.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
< broken record >
CList sucks. Use std::list instead
< /broken record >
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Agreed
|
|
|
|
|
Hi,
suppose there are to struct type,
struct small
{
float x;
double y;
};
struct large
{
int x;
float y;
double z;
bool w;
};
and in my program I coding as this:
large b;
small *p =(small) b;
what's going on inside the code operation?
Thank you.
Best regard.
I confess that I am a stubborn guy, but why not put things thoroughly, logically and systematically clean. One concrete prolem is worth a thousand unapplied abstractions.
|
|
|
|
|
NicholasCougar wrote:
small *p =(small) b;
This won't even compile. You are attempting to assign small to small*,( via unsafe casting).
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
how do you add libs to a project in msvc? do you add the file itself to the project or include the name of said lib in the list of included libs in the project settings.
|
|
|
|
|
You can do it either way, but I prefer to do it in the project settings.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Sometimes (always) I'm lazy...
so I add libs via include file, here an snip from my OpenGL project:
<br />
#pragma comment(lib, "OpenGL32.lib") //link with OpenGL32 Library (VC6 Sytnax)<br />
#pragma comment(lib, "Glu32.lib") //link with Glu32 Library<br />
Hoep it helps, Moak
|
|
|
|
|
I'm learning to use DialogBoxes in "C", via LCC-win32 compiler. My question is about managing virtual-keys. I can manage them while dialogues don't have controls (via WM_KEYDOWN message) but otherwise can not capture these virtual-keys. I guess this is about focusing on child-windows(buttons, checkboxes etc). But why? How?... In fact I can manage them if I use "ACCELERATOR" but want to learn that if is there a solution to do this without accelerator tables. I can not give a meaning to this. Isn't this WM_KEYDOWN message sending before a control? For instance, I have an aboutbox which has two buttons(OK-CANCEL), how can I capture VK_END virtual-key?(again; without accelerator tables). Thanks from now on whose interested in.
|
|
|
|
|
Maybe you could try handeling the pretranslate message and trap it there. Not sure, just a guess.
Paul S
|
|
|
|
|
In dialog boxes, handling accelerator keys require a slight tweak. I have explained this in the following article :-
http://www.codeproject.com/useritems/pretransdialog01.asp
Nish
The posting stats are now in PDF:-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
Updated - May 04th, Saturday
|
|
|
|
|
Hi,
Thanks Nish. Thanks for your advance. In fact I'm very weak in C++, nevertheless I will try your article
|
|
|
|
|
Anyone have some info on that? I'd very much like to learn something about it. The new Winamp 3 has it, anyone know anything about it?
Thankyou
|
|
|
|
|
I don't remember the names of the functions you use to make transparent windows, but search in the articles, I know there's a couple about this subject...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
They are supported only in W2000 and XP AFAIK. So to write an app that uses them you need to late bind to the function and detect the OS before callng them. I've done it, LMK if you can't find an article that covers this stuff and I'll knock one up for you.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
You should be able to find a couple of articles in MSDN and the APIs if you do a search on Layered Windows .
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|