|
Alessandra77 wrote: ...tips on how to improve my programming skills in C++
Fourth tip:
live it, breathe it, love it.
|
|
|
|
|
fifth tip:
go get a break (and use that time to buy a book)
|
|
|
|
|
Maybe you think its not necessary but always provide comments for your code ,use of become names for variables,your program must check exception
|
|
|
|
|
Thanks to you all!
Alessandra
|
|
|
|
|
You're welcome
|
|
|
|
|
Hello,
I think if I have an object of CDatabase class,to which if a proper connection string is given then it enables me to access a database from a server whose OS is windows xp.
But if the OS is Unix or linux then what changes I have to bring about in my program written in VC++ for windows.
I have a different OS only on the server .
Will the code wriiten on the server using CSocket class work ?
Where am I going wrong.Which topics should I cover?
Thanks
Prithaa
|
|
|
|
|
it doesn't matter what OS runs on the remote dataabase server because Sockets are made to communicate through IP protocol so fully independant of the implementation
|
|
|
|
|
Hello,
Thanks
Which topics should I cover to understand databases and remote access of data
Prithaa
|
|
|
|
|
I am a new poster, and a long time reader... that sounds so familiar... and cheesy.
Anyhow, I am experiencing some strange errors while compiling my application for 64 bit, and have tried google without much luck.
One of the more consfusing problems I am running into is with the following line that compiles fine in 32 bit, but not 64 bit, and am looking for advice or direction (even a smack in the head - if its obvious).
Here is the line, and the compile error, as well as the definition of the function being called...
definitions
WINMMAPI MMRESULT WINAPI timeSetEvent( IN UINT uDelay, IN UINT uResolution,<br />
IN LPTIMECALLBACK fptc, IN DWORD_PTR dwUser, IN UINT fuEvent);<br />
void TSstringSocket::SelectTimer(UINT wTimerID, UINT msg, ULONG_PTR dwUser, DWORD dw1, DWORD dw2) {<br />
...<br />
}<br />
Code
UINT m_timerID;<br />
m_timerID = timeSetEvent( 100, wTimerRes, SelectTimer, (ULONG_PTR)this, TIME_PERIODIC );<br />
Error
Error 162 error C2664: 'timeSetEvent' : cannot convert parameter 3 from 'void (__cdecl *)(UINT,UINT,ULONG_PTR,DWORD,DWORD)' to 'LPTIMECALLBACK' c:\Documents and Settings\mikec\Desktop\tix64\Backend\BaseObjects\TSstringSocket.cpp 217 <br />
Any ideas?
Mike Curry
-- modified at 11:17 Tuesday 13th February, 2007
|
|
|
|
|
So what does SelectTimer() look like?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Its very lengthy, but I will post the definition...
void TSstringSocket::SelectTimer(UINT wTimerID, UINT msg, ULONG_PTR dwUser, DWORD dw1, DWORD dw2)
I probably should have posted that earlier, sorry
|
|
|
|
|
Mike Curry - Canada wrote: void TSstringSocket::SelectTimer(UINT wTimerID, UINT msg, ULONG_PTR dwUser, DWORD dw1, DWORD dw2)
Does this match what a LPTIMECALLBACK is?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I don't think so, however under the 32 bit compile it seems to work without issue.
|
|
|
|
|
i think i'm reading this correctly...
the 4th param on your type declaration, "DWORD_PTR dwUser", that's going to be a 64 bit pointer in x64, but you've apparently defined your function to take a DWORD (which remains 32-bits in x64) ?
|
|
|
|
|
A timecallback is (UINT,UINT,DWORD_PTR,DWORD_PTR,DWORD_PTR)
|
|
|
|
|
I want to retrieve information from secured(requires user name and
password) web service. I can connect it with .NET using
NetworkCredentials class. But when I tried it with C++, I cannot even
send the username and password. I analyze the network activity with
Ethereal, the code doesn't send any authentication information. So the
server send HTTP 401 Authectication error back.
I'm searching web since last friday. I read and tried all I found.
What am i doing wrong?
Thanks for your help.
class CSampleBasicAuth : public CBasicAuthObject, public IAuthInfo
{
public :
void setUserName()
{
username = L"foo";
password = L"bar";
}
void Init(CAtlHttpClient *pSocket, IAuthInfo *pAuthInfo)
{
CBasicAuthObject::Init( pSocket, pAuthInfo );
}
bool Authenticate(LPCTSTR szAuthTypes, bool bProxy)
{
return CBasicAuthObject::Authenticate( szAuthTypes, bProxy );
}
HRESULT GetPassword(LPTSTR szPwd, DWORD* dwBuffSize)
{
if (CopyCString( password, szPwd, dwBuffSize ))
return S_OK;
return E_FAIL;
}
HRESULT GetUsername(LPTSTR szUid, DWORD* dwBuffSize)
{
if (CopyCString( username, szUid, dwBuffSize ))
return S_OK;
return E_FAIL;
}
HRESULT GetDomain(LPTSTR szDomain, DWORD* dwBuffSize)
{
ATLASSERT(false);
return S_OK;
}
CString username;
CString password;
};
...
void CWSdenemeDlg::OnBnClickedOk()
{
CString strMessage;
CoInitialize(NULL);
CWebService *ws = new CWebService();
ws->CleanupClient();
CAtlHttpClient &httpClient = ws->m_socket;
CSampleBasicAuth authObject;
authObject.setUserName();
httpClient.AddAuthObj(ATL_HTTP_AUTHTYPE_BASIC, &authObject,
&authObject);
bool val = httpClient.NegotiateAuth(true);
WSInputClass in;
in.member = ...
WSOutputClass* out = new WSOutputClass();
HRESULT hr = (HRESULT) ws->process(in, out);
if(FAILED(hr)){
switch(ws->GetClientError( ))
{
...
case SOAPCLIENT_SEND_ERROR :
strMessage="SOAPCLIENT_SEND_ERROR";
...
}
MessageBox(strMessage);
}
}
|
|
|
|
|
xelontr wrote: HTTP 401 Authectication
hum, are you sure you provide the correct Id + password there ? behaves as if you didn't
|
|
|
|
|
Yes, I send the right id and password. I also tried the web service with the HttpClient demo from Visual Studio. It is not working too. I didn't send any authentication information. I looked the network activity with Ethereal.
With .NET(C#) code I can see the authentication line in Ethereal, but with C++ no authentication line is seen.
Also there is strange thing in .NET. I discovered that the .NET code tries the web service twice(not tries it within code, in code the access to the web service was made once) First it tries without Authentication information, and server gives Authectication error(HTTP 401). Then it tries with Authentication information, and server returns successful message(HTTP 200).
I really doesn't understand anything.
Any idea
|
|
|
|
|
I solved the problem. The code is worked with the following line
httpClient.SetSilentLogonOk(true);
To send the password information out of the intranet SetSilentLogonOK method must be called.
Thanks
|
|
|
|
|
Hi all
I just want to know, what could be more complicated among these two topics..Stega(.JPG AND .MP3) or 3d Game Engine using Visual C++.
I am asking this because i am not that great programmer, i am learning and trying hard to bnecome good programmer but this is one thing which comes with practice.But project comes every yr. So i have to create a final yr project for my uni. Still time is there for about 6 months. So need to know what should be good option for me.
And if its stega then where should i start implementing it. Is there any book with C++ explaing the same or something similar.
Please guide me the right path.
Thanks a lot
|
|
|
|
|
there's an excelent series about steganography written around here by Corinna John[^], but it's in C#, so you'll have to adapt it if you still want it.
see here, in the security section[^] if you want the other articles by Corinna
|
|
|
|
|
I couldnt find any stega article for .JPG and .mp3?
Is there not any source code in C++ ?
Thanks for reply
|
|
|
|
|
Is there a way to prevent the "auto-scroll" when expanding a child in the CTreeCtrl ?
For example, if my item that I expand is near the bottom of the "view", and I expand it, it will scroll up to show the newly expanded children.
I checked the different Tree Window Styles, and nothing seems to be dealing with that.
Thanks.
|
|
|
|
|
Are you sure you wont care if the newly expanded children goes invisible as a result of stopping the scroll?
Dario: How is "directory" in French? (I mean a file system directory).
John Simmons: "zee file holdaire thingie"
|
|
|
|
|
hi
i m doing my proj in .net 2005.
i m passing string to a fuction in c++ called funt()
First the function is called from vb proj..
obj.funt(ByVal str As string).
but i dont know how to accept it in c++ funt().
plz help me
|
|
|
|