|
How to edit, add, delete these values found in Tools->VC++ Directories?
Чесноков
|
|
|
|
|
|
I meant to add new one e.g. $(MyOwnPath) or change path for available variables e.g. $(ProgramFiles) points to c:\program files to change the path value say to d:\program files
I need to find where these $ values are defined in VS
Чесноков
|
|
|
|
|
Chesnokov Yuriy wrote: I need to find where these $ values are defined in VS
See if this helps.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Chesnokov Yuriy wrote: How to edit, add, delete these values found in Tools->VC++ Directories?
What do you mean? Just click and edit, as you would any other entry.
It's time for a new signature.
|
|
|
|
|
I meant to add new one e.g. $(MyOwnPath) or change path for available variables e.g. $(ProgramFiles) points to c:\program files to change the path value say to d:\program files
I need to find where these $ values are defined in VS
Чесноков
|
|
|
|
|
I'm not sure where these macros are defined but I expect they are setup during install, so are probably somewhere in the registry. As to changing them I have never tried it; if I want extra search items I just add my own paths in the list of directories and adjust the search order as necessary.
It's time for a new signature.
|
|
|
|
|
If you only wish to add to these lists then you can create a new environment variable as follows
clicky[^]
|
|
|
|
|
Hy everyone ! I need to do some conversion , from 'CString' to 'const unsigned char *' into function parameter ... can you help me ?
My definition of function is :
std::string CSmtp::base64_encode(const unsigned char *bytes_to_encode, unsigned int in_len)
{
...
...
}
and I want pass an CString parameter :
std::string encoded_login = base64_encode(m_sLogin,m_sLogin.GetLength());
but it won't compile , and the error is :
error C2664: 'base64_encode' : cannot convert parameter 1 from 'class CString' to 'const unsigned char *'
I try in many ( dummy ) ways , but in vain ...
|
|
|
|
|
just like this:
std::string encoded_login = base64_encode(m_sLogin.GetBuffer(m_sLogin.GetLength()),m_sLogin.GetLength());
|
|
|
|
|
Sorry , don't function :
error C2664: 'base64_encode' : cannot convert parameter 1 from 'char *' to 'const unsigned char *'
modified on Saturday, May 8, 2010 6:16 AM
|
|
|
|
|
Unless the internal buffer of m_sLogin needed changed, why would you suggest using GetBuffer() ?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
|
Koma Wang wrote: the error code:
error C2664: 'base64_encode' : cannot convert parameter 1 from 'class CString' to 'const unsigned char *'
You could either use:
base64_encode((LPBYTE) (LPCTSTR) m_sLogin, m_sLogin.GetLength());
or
base64_encode((const LPBYTE) (LPCTSTR) m_sLogin, m_sLogin.GetLength());
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Have you tried casting the CString from LPCTSTR ), like this:
std::string encoded_login = base64_encode((const unsigned char*)(LPCTSTR)m_sLogin,m_sLogin.GetLength());
It's time for a new signature.
|
|
|
|
|
Great ! It's working ! Thank you all !
|
|
|
|
|
Hi all,
I created SDI based project in MFC.In View class(OnInitialUpdate()), i initialized serial port and created a worker thread which has to read data continuously and post data to a Framedialog.The Problem is ,only once the thread is posting message, not continuously.
My code is below.
UINT ClientThreadProc(LPVOID pParam)
{
CSerialCommView *pMyprocess = (CSerialCommView *)pParam;
CString mystr=pMyprocess->SerialPortContinuousRead();
LPTSTR lpMessage = new TCHAR[mystr.GetLength()];
_tcscpy( lpMessage , mystr);
::SendMessage(pMyprocess->GetSafeHwnd(),
WM_READ_DATA_AVAILABLE,0,(LPARAM)lpMessage);
return 0;
}
LRESULT CSerialCommView::OnDataAvailable(WPARAM wparam, LPARAM
lparam)
{
LPTSTR data= (LPTSTR)lparam;
CMainFrame *pFrame = (CMainFrame*)AfxGetMainWnd();
CEdit* DispBox=(CEdit*)pFrame->m_wndDlgBar.GetDlgItem(IDC_DISPLAY_BOX);
DispBox->SetWindowTextW(data);
return 0;
}
Thanks in advance.
|
|
|
|
|
From what you've posted it looks as if your program:
Enters new thread at ClientThreadProc .
Calls SerialPortContinuousRead which presumably completes and returns a string when it receives one.
Sends the string to the handler using SendMessage doesn't return until the handler completes (Consider PostMessage ).
ClientThreadProc then ends.
To read more than one message try a loop within ClientThreadProc or SerialPortContinuousRead and post (or Send) messages from there rather than returning the message from SerialPortContinuousRead and then exiting the threadproc.
modified on Saturday, May 8, 2010 8:24 AM
|
|
|
|
|
I have a problem setting up OpenGL in a C++ program using Win32. I have a main window that has buttons and checkboxes to control different parameters. After that I want to have two windows that will draw OpenGL code. The two child windows do not reside inside the main window, they are floating, WS_OVERLAPPEDWINDOW style(but I can make it any other style, it just has to work).
I am unsure how to properly create the two child windows and where to place the drawing code. I also do not know where to place the message loop for both of them.
Basically I press a button inside the main config window and my first window would show. If I press it again, then it should destry that window. Is there an example of something similar on the internet? Can someone help me? Thanks.
|
|
|
|
|
This thread has all the details
http://www.codeproject.com/Messages/3427974/Re-Second-Window-in-Win32.aspx
LRESULT CALLBACK childWndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK parentWndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain ()
{
while (GetMessage (&messages, NULL, 0, 0))
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
return messages.wParam;
}
LRESULT CALLBACK parentWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
...
}
return 0;
}
LRESULT CALLBACK childWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
...
}
return 0;
}
|
|
|
|
|
Thank you for your help, it is working well. However, I have a question. Where should I place the drawing code for the child window? I understand the procedure if I want to create another child window, i will call it child2. If I do create it, then where should I place the OpenGL code for it? I am not interested in drawing in the parent window, just inside the child window. Thank you again.
|
|
|
|
|
Gamedev has a great article on this topic.
http://www.gamedev.net/reference/articles/article540.asp[^]
Create a function say PaintOpenGL() , put all the OpenGL stuff in that function.
place PaintOpenGL() in the child window's message pump at case WM_PAINT .
case WM_PAINT:
PaintOpenGL();
break;
..
|
|
|
|
|
I want to use google translator aapi through an application I wrote the following code but CHttpFile::SendRequest() method always time out I could n't found what's my problem. Can any one help me?
CString szTranReq(L"/translate_a/t?client=t&sl=en&tl=tr");
CString szText(L"text=Hello");
CString szServer(L"www.google.com");
DWORD inetPort = 80;
CInternetSession inetSession(::AfxGetAppName(), 1, PRE_CONFIG_INTERNET_ACCESS, NULL, NULL, NULL);
inetSession.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 1000 * 3);
inetSession.SetOption(INTERNET_OPTION_CONNECT_BACKOFF, 1000);
inetSession.SetOption(INTERNET_OPTION_CONNECT_RETRIES, 1);
CHttpConnection* pInetHttpConnection = inetSession.GetHttpConnection(szServer, inetPort, NULL, NULL);
CHttpFile* pHttpFile = pInetHttpConnection->OpenRequest(
CHttpConnection::HTTP_VERB_POST,
szTranReq, NULL, 1, NULL, NULL,
INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_DONT_CACHE);
pHttpFile->AddRequestHeaders(L"Host: www.google.com\r\n", HTTP_ADDREQ_FLAG_ADD_IF_NEW);
pHttpFile->AddRequestHeaders(L"User-Agent: Mozilla/5.0\r\n", HTTP_ADDREQ_FLAG_ADD_IF_NEW);
pHttpFile->AddRequestHeaders(L"Accept-Encoding: deflate\r\n", HTTP_ADDREQ_FLAG_ADD_IF_NEW);
pHttpFile->AddRequestHeaders(L"content-length: 10\r\n", HTTP_ADDREQ_FLAG_ADD_IF_NEW);
pHttpFile->AddRequestHeaders(L"Connection: Close\r\n", HTTP_ADDREQ_FLAG_ADD_IF_NEW);
pHttpFile->SendRequest();
SendRequest() Method always timeout.
|
|
|
|
|
Hi,
m_code wrote: pHttpFile->AddRequestHeaders(L"content-length: 10\r\n", HTTP_ADDREQ_FLAG_ADD_IF_NEW);
You have hard-coded a content-length of 10 bytes but I do not see where you write these bytes. The server is timing out because it is waiting for those bytes...
Best Wishes,
-David Delaune
|
|
|
|
|
Thanks You were right.
That solved. But Again the following returns" http status 400" which means bad request any idea why this happens:
CString szTranReq(L"/translate_a/t?client=t&sl=en&tl=tr");
CString szText(L"text=Hello");
CString szServer(L"www.google.com");
DWORD inetPort = 80;
CInternetSession inetSession(::AfxGetAppName(), 1, PRE_CONFIG_INTERNET_ACCESS, NULL, NULL, NULL);
inetSession.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 1000 * 3);
inetSession.SetOption(INTERNET_OPTION_CONNECT_BACKOFF, 1000);
inetSession.SetOption(INTERNET_OPTION_CONNECT_RETRIES, 1);
CHttpConnection* pInetHttpConnection = inetSession.GetHttpConnection(szServer, inetPort, NULL, NULL);
CHttpFile* pHttpFile = pInetHttpConnection->OpenRequest(
CHttpConnection::HTTP_VERB_POST,
szTranReq, NULL, 1, NULL, NULL,
INTERNET_FLAG_EXISTING_CONNECT | INTERNET_FLAG_DONT_CACHE);
pHttpFile->AddRequestHeaders(L"Host: www.google.com\r\n", HTTP_ADDREQ_FLAG_ADD_IF_NEW);
pHttpFile->AddRequestHeaders(L"User-Agent: Mozilla/5.0\r\n", HTTP_ADDREQ_FLAG_ADD_IF_NEW);
pHttpFile->AddRequestHeaders(L"Accept-Encoding: deflate\r\n", HTTP_ADDREQ_FLAG_ADD_IF_NEW);
pHttpFile->AddRequestHeaders(L"content-length: 10\r\n", HTTP_ADDREQ_FLAG_ADD_IF_NEW);
pHttpFile->AddRequestHeaders(L"Connection: Close\r\n", HTTP_ADDREQ_FLAG_ADD_IF_NEW);
pHttpFile->SendRequestEx(szText.GetLength());
pHttpFile->WriteString(szText);
pHttpFile->EndRequest();
DWORD dwRet;
pHttpFile->QueryInfoStatusCode(dwRet);
|
|
|
|
|