Click here to Skip to main content
15,911,531 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Convert a binary file to an ASCII file Pin
Eytukan22-Mar-06 20:44
Eytukan22-Mar-06 20:44 
GeneralRe: Convert a binary file to an ASCII file Pin
kakan22-Mar-06 20:52
professionalkakan22-Mar-06 20:52 
GeneralRe: Convert a binary file to an ASCII file Pin
NYTSX23-Mar-06 0:49
NYTSX23-Mar-06 0:49 
GeneralRe: Convert a binary file to an ASCII file Pin
kakan23-Mar-06 1:09
professionalkakan23-Mar-06 1:09 
GeneralRe: Convert a binary file to an ASCII file Pin
NYTSX23-Mar-06 1:39
NYTSX23-Mar-06 1:39 
GeneralRe: Convert a binary file to an ASCII file Pin
kakan23-Mar-06 2:04
professionalkakan23-Mar-06 2:04 
GeneralRe: Convert a binary file to an ASCII file Pin
NYTSX23-Mar-06 2:32
NYTSX23-Mar-06 2:32 
Questionmemory usage keeps going up when retrieving webcam image Pin
khrstopher22-Mar-06 13:21
khrstopher22-Mar-06 13:21 
I've written a JAva program that uses JNI to call some C++ methods to retrieve webcam images using video for windows. The problem is that every time I retrieve an image, memory usage keeps going up. I'm still a noob to C++ so the problem may be something really simple. Here's my code:

code:

HWND m_capWindow;
int connectedIndex;
LRESULT PASCAL callbackProc(HWND hWnd, LPVIDEOHDR lpVHdr);
LRESULT PASCAL callbackProc(HWND hWnd, LPVIDEOHDR lpVHdr)
{
return 0;
}

JNIEXPORT void JNICALL Java_client_desktop_dateclick_Test_connect
(JNIEnv *, jobject, jint index) {
m_capWindow = capCreateCaptureWindow ("", WS_CHILD, 0, 0, 0, 0, GetDesktopWindow(), 10);
//m_capWindow = capCreateCaptureWindow ("Capture", WS_CHILD | WS_VISIBLE, 50, 50, 480, 360, GetDesktopWindow(), 10);

// connect to the new driver
BOOL rval = capDriverConnect (m_capWindow, index);
capSetCallbackOnFrame(m_capWindow, callbackProc);
capPreview(m_capWindow, FALSE);
}




JNIEXPORT jbyteArray JNICALL Java_client_desktop_dateclick_Test_getImage
(JNIEnv *env, jobject) {

CString fileName;
int contentLength;
BYTE *frame;

capGrabFrame(m_capWindow);
//capGrabFrameNoStop(m_capWindow);
fileName = "capframe.bmp"; //and use this file...
capFileSaveDIB( m_capWindow, (LPCTSTR)fileName);

CFile jpegTemp;
// now read the resulting file into a buffer
jpegTemp.Open("capframe.bmp", CFile::modeRead);
contentLength = (UINT)jpegTemp.GetLength();
//allocate the buffer for the jpeg frame
frame = new BYTE[contentLength];
//now read in the jpeg file
jpegTemp.Read(frame, contentLength);
jpegTemp.Close();

jbyteArray ba = env->NewByteArray(contentLength);
env->SetByteArrayRegion(ba, 0, contentLength, (jbyte*) frame);

delete frame

return ba;
}

JNIEXPORT void JNICALL Java_client_desktop_dateclick_Test_disconnect
(JNIEnv *env, jobject) {
capDriverDisconnect(m_capWindow);
}

AnswerRe: memory usage keeps going up when retrieving webcam image Pin
MF22-Mar-06 15:48
MF22-Mar-06 15:48 
GeneralRe: memory usage keeps going up when retrieving webcam image Pin
Stephen Hewitt23-Mar-06 12:17
Stephen Hewitt23-Mar-06 12:17 
Questiondataset / datagrid in visual C++ 6 Pin
viperlogic22-Mar-06 12:20
viperlogic22-Mar-06 12:20 
AnswerRe: dataset / datagrid in visual C++ 6 Pin
Christian Graus22-Mar-06 13:45
protectorChristian Graus22-Mar-06 13:45 
AnswerRe: dataset / datagrid in visual C++ 6 Pin
Eytukan22-Mar-06 20:48
Eytukan22-Mar-06 20:48 
JokeRe: dataset / datagrid in visual C++ 6 Pin
toxcct22-Mar-06 21:18
toxcct22-Mar-06 21:18 
AnswerRe: dataset / datagrid in visual C++ 6 Pin
toxcct22-Mar-06 22:52
toxcct22-Mar-06 22:52 
GeneralRe: dataset / datagrid in visual C++ 6 Pin
viperlogic23-Mar-06 0:17
viperlogic23-Mar-06 0:17 
GeneralRe: dataset / datagrid in visual C++ 6 Pin
toxcct23-Mar-06 1:51
toxcct23-Mar-06 1:51 
QuestionSetThreadLocale Pin
SanShou22-Mar-06 12:04
SanShou22-Mar-06 12:04 
AnswerRe: SetThreadLocale Pin
MF22-Mar-06 15:59
MF22-Mar-06 15:59 
Questiondisplaying pictures Pin
Amr Shahin22-Mar-06 11:25
Amr Shahin22-Mar-06 11:25 
AnswerRe: displaying pictures Pin
Christian Graus22-Mar-06 11:41
protectorChristian Graus22-Mar-06 11:41 
GeneralRe: displaying pictures Pin
Waldermort22-Mar-06 13:54
Waldermort22-Mar-06 13:54 
AnswerRe: displaying pictures Pin
Hamid_RT22-Mar-06 17:39
Hamid_RT22-Mar-06 17:39 
Questioncode to run sample.exe program? Pin
Yonggoo22-Mar-06 10:56
Yonggoo22-Mar-06 10:56 
AnswerRe: code to run sample.exe program? Pin
Michael Dunn22-Mar-06 11:22
sitebuilderMichael Dunn22-Mar-06 11:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.