|
|
The way to make it easier to parse (by you, not the compiler!) is to split the type definition from the reference declaration:
typedef double* const MyArrayType[2];
MyArrayType a = { whatever };
MyArrayType& b = a;
Simpler, no?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
hi,
May i know when to use smart pointers than ordinary pointers....
|
|
|
|
|
pradeep455 wrote: May i know when to use smart pointers than ordinary pointers....
First you should know when to use Google [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Whenever you're responsible for allocating/deallocating resources.
Which (for my programs, at any rate) is 90% of the time.
For COM, use _com_ptr_t (in the guise of COM_SMARTPTR_TYPEDEF). For BSTR, use _bstr_t. For 'normal' pointers, use Boost smart pointers[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi There !!!
Let's find someone who could help me on this problem.
I have created on VS2005 under Windows Vista a new Visual C++ ATL Server Web Service Project with:
Blob Cache
Session Services (Memory-backed session-state service)
I compiled the project sucessfully. Then, i opened IExplorer and access de URL to generate the WSDL.
The WSDL of the web service was generated with sucsess.
This is my problem:
With this simple and basic project, i changed the configuration properties to support Common Language Runtime Suport, Old Syntax (/clr:oldSyntax)
The compilation of the project was made successfully.
The problem was when i go to access the web service to generate the WSDL via web browser.
I access the URL (something like: http://localhost/ATLWS1/ATLWS1.dll?Handler=GenATLWS1WSDL) on IExplorer, and the web browser hangs and no result is returned.
Just a page indicating that "Internet Explorer cannot display the webpage".
There some dependency or configuration missing to support CLR ?? I tried the same scenario on Windows XP and this works fine.
|
|
|
|
|
Hi All,
I am working on a project with MFC and i need one of my windows to display the user detailes(First Name, Last Name, WorkPhone and Personal Phone) who logged into the computer. I Can use MAPI or CDO for this, access the address book, iterate thru the users and get the detailes.
Is there a way that i can use to identify the current user address book detailes instead of iterating thru the address book.
Some sample codes will help me.
Thankyou,
Kasi
|
|
|
|
|
The CDO Session object has a CurrentUser[^] property...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
actually i wanted to develop a program such that it restores the original mac address...
also if u can help me out with a program such as to verify a username and password along with a mac address stored in a file....the program used by isp's...
|
|
|
|
|
Hi Friends
How to use scrollbar (horz & vert ) in CStatic derived class
thanks in advance
-kk.tvm-
|
|
|
|
|
Are you wanting to know how to actually use one, or implement one?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi
I like to show a picture in Dialog box with zooming facilities
I derived a class from CStatic
I enabled horizontal and vertical scroll bar using ModifyStyle in PreSubClassWindow
I already set other details using Scrollinfo and OnHScoll and OnVScoll
but i can't scroll image using arrows and thumb in scroll bar
how can i solve this ?
-kk.tvm-
|
|
|
|
|
here i have a clue. but not sure weather it suits your requirement.
take the scroll bars outside your control,
in the on hscroll and on vscroll events, or on hitting the arrows,
increment/decrement the co ordinates of the image wrt. the control appropriately.
i remember, long back, when i had to display a big city map on my dialog,
i had to do the same thing for panning and zooming the map.
good luck.
|
|
|
|
|
You better use scrollbars in a scrollview. (it is complicated enough)
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
hi, i am doing some socket programming. the problem is that when i use the port number 80, then the error is 10051 which means Network is unreachable, but my network is working find. also when i use any random number for port, the error is 10061 which means Connection refused.
please guide me. here is my code ----
#include <windows.h>
#include <winsock.h>
#include <stdio.h>
#define NETWORK_ERROR -1
#define NETWORK_OK 0
void ReportError(int, const char *);
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow)
{
WORD sockVersion;
WSADATA wsaData;
int nret;
struct in_addr addr;
addr.s_addr = inet_addr("127.0.0.1");
sockVersion = MAKEWORD(1, 1);
WSAStartup(sockVersion, &wsaData);
LPHOSTENT hostEntry;
hostEntry = gethostbyaddr((char *) &addr, 4, AF_INET);
if (!hostEntry)
{
nret = WSAGetLastError();
ReportError(nret, "gethostbyaddr()");
WSACleanup();
return NETWORK_ERROR;
}
SOCKET theSocket;
theSocket = socket(AF_INET,
SOCK_STREAM,
IPPROTO_TCP);
if (theSocket == INVALID_SOCKET)
{
nret = WSAGetLastError();
ReportError(nret, "socket()");
WSACleanup();
return NETWORK_ERROR;
}
SOCKADDR_IN serverInfo;
serverInfo.sin_family = AF_INET;
serverInfo.sin_addr = *((LPIN_ADDR)*hostEntry->h_addr_list);
serverInfo.sin_port = htons(80);
nret = connect(theSocket, (LPSOCKADDR)&serverInfo, sizeof(struct sockaddr));
if (nret == SOCKET_ERROR)
{
nret = WSAGetLastError();
ReportError(nret, "connect()");
WSACleanup();
return NETWORK_ERROR;
}
MessageBoxA(NULL, "Great, it is good", "socket Successful", MB_OK);
closesocket(theSocket);
WSACleanup();
return NETWORK_OK;
}
void ReportError(int errorCode, const char *whichFunc)
{
char errorMsg[92];
ZeroMemory(errorMsg, 92);
sprintf_s(errorMsg, "Call to %s returned error %d!", (char *)whichFunc, errorCode);
MessageBoxA(NULL, errorMsg, "socketIndication", MB_OK);
}
|
|
|
|
|
not sure I fully understand your issue
you've created a tcp socket client app
1) you try to connect to (local loopback address 127.0.0.1) on port 80 and get an error - do you have an ethernet adaptor, and tcp/ip set up on your machine ? - you should be able to ping yourself on 127.0.0.1 and get a valid response before you try this - then you'll need something listening on port 80 - depending on what sort of a machine, it could be IIS for example, or a server harness
2) you try a random port - unless you fix the issues at (1), its not going to work AND you would need something listening on all the ports on machine to catch the connect on a 'random' port - I dont see what a random port does for your case
'g'
|
|
|
|
|
thanks for the reply.
i can ping 127.0.0.1 easily and getting a valid output.but i dont know how to ping using a port. i have 2 ethernet adaptors, one is used for internet and other is spare. my internet is working find, so port 80 is also working well ??
|
|
|
|
|
rahuljin wrote: so port 80 is also working well ??
not necessarily - you'll likely be connecting out to a web-server on port 80 on that server - unless you have something listening on your own machine on port 80 you'll get a connect fail
'g'
|
|
|
|
|
can u tell me the changes i should make so that it can work ?
|
|
|
|
|
rahuljin wrote: can u tell me the changes i should make so that it can work ?
There are no changes to make in your code. I just ran it and it works as expected.
|
|
|
|
|
which port are you using ?
if i use a port which is used by other program like utorrent, it works only when i run utorrent, else dont. if i put some other port number, it shows the errors.
i am using kaspersky internet security 2009 with windows 7rc and visual studio 2008. windows firewall is stopped. i also checked with KIS stopped, but no success.
now what to do ?
|
|
|
|
|
sorry, o/night here in Aus... as per Led Mike, there's nothing wrong with your code. Now you need to develop a server or grab some test code from someone's project to build one.
TCP programming involves two parts - a client, which you've got, and server, listening on a port - you still havnt indicated that you have a server listening to/on a connection, so Im not sure what sorta results you expect.
'g'
|
|
|
|
|
do u mean that i should write another program which listen to this port ??
also, if i want to send some information using the send() function, can i use the same port or i have to use another port for that ?
|
|
|
|
|
rahuljin wrote: do u mean that i should write another program which listen to this port ??
yes - the whole point of connecting to something is something must be waiting/listening on the other end ! .. maybe you could use something like http://www.aprelium.com/abyssws/[^]
rahuljin wrote: also, if i want to send some information using the send() function, can i use the same port or i have to use another port for that ?
if you are in the connected state, you have a channel open and you can send to and receive from it - depending on whats on the other end - the simplest test of your code is whats known as an echo server - it reads what you send it and sends you back the same info - see here for an example - I dont get why you're asking about another port
http://www.paulgriffiths.net/program/c/echoserv.php[^]
and here
http://www.csc.villanova.edu/~mdamian/Sockets/TcpSockets.htm[^]
I hate to say this, but it sounds like you're a little out of your depth - this sort of material is covered in lots of network programming books, and there's plenty out there on the net
Maybe you should spent some time doing a bit more research
|
|
|
|
|
thanks for the help. this is the first time i am writing something about tcp ip. i tried to get a book for tcp ip at my place but didn't find any.
i will try to read online.
thanks again.
|
|
|
|