|
Sorry for bad english....
My program works instead of standard shell Explorer.
I it is necessary to do in program something like standard tray.
Take any advices. For earlier thank you.
|
|
|
|
|
i want to embedd Microsoft Speech Recognition Engine in my VC++ application what can i do.
i am using windows 2000 operating system on my pc.
i am very thankful to u if any one tell me all the API related to this SDK and send me any simple Applicaiton that uses "Microsoft Speech Recognition Engine" using VC++.
Thanks in Advance
Faizi
|
|
|
|
|
|
I'm trying to use the GetNumberFormat API for integer values. No fractional digits and no decimal seperator should appear in the output. I want to use the API to account for locale settings. The results should look similar to the file sizes in Explorer's File Properties dialog.
|
|
|
|
|
Ok, so what's the problem? Do you have a code snippet that is producing a compiler or run-time error?
NUMBERFMT fmt = {0,0,3,"",",",1};
char szNumber[16] = "123456",
szFmtNumber[16];
GetNumberFormat(GetThreadLocale(), 0, szNumber, &fmt, szFmtNumber, sizeof(szFmtNumber));
|
|
|
|
|
I don't get an error, I don't want to use the NUMBERFMT structure but use the user locale settings for the number format, only without the fractional part. Maybe there's an API to get the number format, but apparently it's not GetNumberFormat And I wanted to avoid having to call GetLocaleInfo for each member of the NUMBERFMT struct.
|
|
|
|
|
You can't eat your cake and have it too. The whole premise behind using locale settings is so that applications won't make assumptions as to what the user wants. If the user sets up their machine to have , (comma) as the thousands separator, you mustn't override that with something else, or remove it altogether. Same goes for fractional digits, decimal points, negativity, etc.
I have a slightly similar situation with the project I am working on. It's a scheduling application, which makes heavy use of dates and times. The application has to work no matter what locale it is in, or what regional settings are in place. Luckily, the NLS functions minimize the pain.
|
|
|
|
|
Hi All,
I Want to develop a plugin for Adobe photoshop...I dont have any idea how to proceed with the idea, does anyone has any clue..how to start with it...any idea or pointers or tutorials..will be very helpful..Looking forward to all you guys for help???please...Thanks a lot in advance..
Himanshu
|
|
|
|
|
|
Has any one ever tried to integrate visualization toolkit in Visual C++?
I am new to both Visual C and VTK.So I have serious problems.
I have added the path for VTK libraries and headers to tools->options->directories
and projects->setting->links
but I still get following errors:
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/sample.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Can anyone help?
Regards
|
|
|
|
|
i have a problem.i want to split a CString into a CStringArray which of each element holds a fixed length characters.
for example:
CString str;
CStringArray strArray=new CStringArray();
str="abcd";
afert spliting action,the result should be below:
the value of strArray[0] is "ab"
the value of strArray[1] is "cd"
how can i do?
thanks!!
Habbit--Beginner In MFC
|
|
|
|
|
<code>
{
#define STR_WIDTH 2
CStringArray arrStrings;
CString strSource(_T("abcdefghi"));
int nPosition(0);
while(nPosition < (strSource.GetLength()-1))
{
arrStrings.Add(strSource.Mid(nPosition,STR_WIDTH));
nPosition+=STR_WIDTH;
}
}</code>
or something of this effect. NB: this is untested.
I Dream of Absolute Zero
|
|
|
|
|
that's fine!
you are a good man!
|
|
|
|
|
Hi !
I'd like to have in my application a console window. To do it, I just have a normal multiline edit control, which I would have to use to implement by myself the console functionalities.
I tried to think how to do it, but I have no idea how to solve these points :
-How can I make sure the cursor will stay at the prompt if the user click anywhere else ?
-How can I make sure that, even if the cursor stays at the prompt, the user will be able to select some text and copy it.
-How can I make sure that any keyboard input will be captured by my console window ?
Any suggestions or help will be greatly appreciated !
Thanks !
Jerome
|
|
|
|
|
Jerome Conus wrote:
I'd like to have in my application a console window. To do it, I just have a normal multiline edit control...
An edit control implies a GUI application.
If you meant something else, I missed it. Please elaborate more.
|
|
|
|
|
Yes, it is a GUI application, but the user is allowed to display a small terminal window (console window) in which he/she will type some commands to display internal states of the application.
I hope I made myself clear, now !
Jerome
|
|
|
|
|
Yes, more clear, but still not feasible to my knowledge. In other words, I know of no way to put a console window on top of a GUI window such that it acts like any other type of control.
What you could do, however, is to use two edit controls, one for input and the other for output. You'd type commands into the one box, send them to a hidden console window, and capture the output in the other edit control. See here and MSDN article Q190351 for a better explanation.
|
|
|
|
|
I know exactly what you mean and I am trying to do the same thing. We don't want a "console" as in a DOS prompt, we want a control that lets us display a prompt, get user input, take some action, display results in the same window. MatLab and SciLab do this to allow the user to enter commands to do math and then it prints out the result in the window.
|
|
|
|
|
hi,ive just started to use visual c++,i'm working on program that can draw different shapes,the problem is that i dont know how to save the drawing in an appropriate format which i can open latter.plz help.urgent
|
|
|
|
|
|
You can design a new file format youself
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
my trouble is: Is necessary to send two request for downloading a file and after download some piece data of a file
Way it stop for ever?
1、To support resume,Download a file from server(the Server has't "keep-alive" feature but support resume), I think we must send
two request, the first one get the size of the file and other feature, the second request for download.(the way may be wrong, please figure it )
2、i want to study progrmming CAsyncSocket,derived a class "CHttpAsyncSocket" from CAsyncSocket:
// define download status in HttpAsyncSocket.h
typedef enum { CONNECT_NONE = 0, CONNECT_FILEINFO = 1, RECEIVE_FILEINFO = 2, CONNECT_DOWNLOAD = 3, RECEIVE_DOWNLOAD = 4} DOWNLOADSTATUS;
DOWNLOADSTATUS m_dsCurStatus;
// CHttpAsyncSocket.cpp
//connect server
void CHttpAsyncSocket::BeginDownload()
{
if(Connect(m_strServerIP, m_nServerPort) == SOCKET_ERROR)
{
Close();
m_dsCurStatus = CONNECT_NONE;
}
else
{
m_dsCurStatus = CONNECT_FILEINFO;
}
}
//if connect successfully, then send one of the two request
void CHttpAsyncSocket::OnConnect(int nErrorCode)
{
CAsyncSocket::OnConnect(nErrorCode);
if (nErrorCode)
{
Close();
m_dsCurStatus = CONNECT_NONE;
}
else if(m_dsCurStatus == CONNECT_FILEINFO) //send request that can Get the size of the file in server and may support resume
{
CString strSend;
strSend.Format( "GET %s HTTP/1.1\r\n"
"Host: %s:%d\r\n"
"Accept: */*\r\n"
"Pragma: no-cache\r\n"
"Cache-Control: no-cache\r\n"
"Connection: close\r\n"
"Range: bytes=100-\r\n"
"\r\n",
m_strFileUrl, m_strServerIP, m_nServerPort);
int ret = Send(strSend.GetBuffer(0), strSend.GetLength());
if(ret == SOCKET_ERROR)
{
Close();
m_dsCurStatus = CONNECT_NONE;
}
else
{
m_dsCurStatus = RECEIVE_FILEINFO;
}
}
else if(m_dsCurStatus == CONNECT_DOWNLOAD) //send request for download
{
CString strSend;
strSend.Format( "GET %s HTTP/1.1\r\n"
"Host: %s:%d\r\n"
"Accept: */*\r\n"
"Pragma: no-cache\r\n"
"Cache-Control: no-cache\r\n"
"Connection: close\r\n"
"Range: bytes=%d-%d\r\n"
"\r\n",
m_strFileUrl, m_strServerIP, m_nServerPort, m_dwLocalFileSize, m_dwServerFileSize);
//m_dwLocalFileSize, m_dwServerFileSize are separately the size of local and server
int ret = Send(strSend.GetBuffer(0), strSend.GetLength());
if(ret == SOCKET_ERROR)
{
Close();
m_dsCurStatus = CONNECT_NONE;
}
else
{
m_dsCurStatus = RECEIVE_DOWNLOAD;
m_bAlreadyGetHeader = FALSE; //has decode the header of package
}
}
else
{
ASSERT(FALSE);
}
}
//received data
const int MAX_RECV_BUFFER = 1024;
void CHttpAsyncSocket::OnReceive(int nErrorCode)
{
CAsyncSocket::OnReceive(nErrorCode);
char szReadBuf[MAX_RECV_BUFFER];
ZeroMemory(szReadBuf, MAX_RECV_BUFFER);
if (nErrorCode)
{
Close();
m_dsCurStatus = CONNECT_NONE;
}
if(m_dsCurStatus == RECEIVE_FILEINFO) //get size of file in server , etc
{
m_dwServerFileSize = 0;
BOOL bSupportResume = FALSE;
if(ParseHttpHeader(&m_dwServerFileSize, &bSupportResume) == TRUE) //parse the header of packet
{
Close(); //Is it necessary? -------------
Create(); //create a new socket and connect to server again
if(Connect(m_strServerIP, m_nServerPort) == SOCKET_ERROR)
{
Close();
m_dsCurStatus = CONNECT_NONE;
}
else
{
m_dsCurStatus = CONNECT_DOWNLOAD;
}
}
else
{
Close();
m_dsCurStatus = CONNECT_NONE;
}
}
else if(m_dsCurStatus == RECEIVE_DOWNLOAD)
{
//open local file and receive data
CFile file;
int bOpenSuc = file.Open(m_strLocalFile, CFile::modeCreate | CFile::modeWrite | CFile::modeNoTruncate | CFile::typeBinary | CFile::shareExclusive);
if(bOpenSuc == FALSE)
{
TRACE("Error in file open!\n");
Close();
m_dsCurStatus = CONNECT_NONE;
}
file.SeekToEnd();
int ret = 0, nHeadLength = 0;
if(m_bAlreadyGetHeader == FALSE)
{
//reject the header of the packet in first time
do
{
ret = Receive(szReadBuf, MAX_RECV_BUFFER);
nHeadLength = GetHeadLength(szReadBuf);
}while(ret <= nHeadLength);
if(ret > nHeadLength)
{
file.Write(szReadBuf + nHeadLength, ret - nHeadLength);
}
m_bAlreadyGetHeader = TRUE;
}
while(TRUE)
{
ZeroMemory(szReadBuf,MAX_RECV_BUFFER);
int num = Receive(szReadBuf, MAX_RECV_BUFFER);
if(num == 0 || num == SOCKET_ERROR) //download finish or meet net error
{
if (GetLastError() != WSAEWOULDBLOCK && num == 0)
{
file.Close(); //HERE: thread may come here, and can not continue receive data again when download about 10 - 600 K,
return; //why? maybe use timer?
}
break;
}
file.Write(szReadBuf, num);
}
file.Close();
}
}
else
{
ASSERT(FALSE);
}
}
First, thank you look through my code above!
I study socket just now, many question are "naive", need you direct or give some advice.... thanks again ^_^
C/C++ code fans
|
|
|
|
|
The GET HTTP request seems valid. Make sure you append the to the resumed data instead of overwriting.
Kuphryn
|
|
|
|
|
Hello,
how do I get a pointer to the CMainFrame class of my project from the CView class?
I must modify the main toolbar from the CView class. Sure, I could use a global pointer, but isn't there a function like GetDocument() for CMainFrame?
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Hmm, no, I can do it the other way round... I use GetActiveView() to get the view from the CMainFrame.
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|