|
If this is a modal dialog, you will not have a way to externally call the showPicture() function while the dialog's window is valid.
For example:
ImageViewer dlgIM;
dlg.DoModal();
dlg.showPicture(); That only works if you are calling showPicture() from within the dialog's code somewhere either directly from OnInitDialog() or triggered by some kind of event.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
James,
I set up the dialogs to be modeless.
it's created:
<br />
void CCameraDataGenTxApp::OnImageViewer()<br />
{<br />
ImageViewer *imgViewDlg;<br />
imgViewDlg = new ImageViewer();<br />
imgViewDlg->Create(IDD_IMAGEVIEWER, NULL);<br />
imgViewDlg->SetWindowPos(NULL, 0, 0, 620, 390, SWP_NOMOVE);<br />
imgViewDlg->ShowWindow(SW_SHOW);<br />
}<br />
Called:
<br />
BEGIN_MESSAGE_MAP(CCameraDataGenTxApp, CWinApp)<br />
ON_COMMAND(ID_APP_ABOUT, &CCameraDataGenTxApp::OnAppAbout)<br />
ON_COMMAND(ID_FILE_NEW, &CWinApp::OnFileNew)<br />
ON_COMMAND(ID_CAMERA, &CCameraDataGenTxApp::OnCamera1Tx)<br />
ON_COMMAND(ID_IMGVIEWER, &CCameraDataGenTxApp::OnImageViewer)<br />
ON_COMMAND(ID_FILE_OPEN, &CWinApp::OnFileOpen)<br />
END_MESSAGE_MAP()<br />
that's why i thought that this would work.
what i'm trying to achieve at the end is to have 3 separate window where we can view pictures from 3 separate cameras we collect data from and 1 dialog box that controls the camera....
if I had just a dialog based app my code works. i simply initialize everything in ::OnInitDialog() and then it has a function called ::OnPaint() that I can call showImage()....
It is in an MDI application where everything gets hazy...
since it doesn't have an ::OnPaint() or ::OnInitDialog() function.
Please advice.
thanks,
Kathleen
Kitty5
|
|
|
|
|
When you trace your code line to line did you see a null value of variables
|
|
|
|
|
WhiteSky,
no i do not see a null value of variable because when i come into the showPicture() function the very 1st thing crashes... CPaintDC dc(this);
which gives me an error:
<br />
it crashes and gives this error:<br />
Debug Assertion Failed!<br />
Program: c:\..\test.exe<br />
File: f:\..\ship\atlmfc\src\mfc\wingdi.cpp<br />
Line: 1090<br />
<br />
Press retry to debug application<br />
<br />
When I press re-try it goes to this code:<br />
<br />
ASSERT(::IsWindow(pWnd->m_hWnd));<br />
in wingdi.cpp
<br />
CPaintDC::CPaintDC(CWnd* pWnd)<br />
{<br />
ASSERT_VALID(pWnd);<br />
ASSERT(::IsWindow(pWnd->m_hWnd));<br />
<br />
if (!Attach(::BeginPaint(m_hWnd = pWnd->m_hWnd, &m_ps)))<br />
AfxThrowResourceException();<br />
}<br />
my reply to James' post:
my dialogs are modeless...
that's why i thought that this would work.
what i'm trying to achieve at the end is to have 3 separate window where we can view pictures from 3 separate cameras we collect data from and 1 dialog box that controls the camera....
if I had just a dialog based app my code works. i simply initialize everything in ::OnInitDialog() and then it has a function called ::OnPaint() that I can call showImage()....
It is in an MDI application where everything gets hazy...
since it doesn't have an ::OnPaint() or ::OnInitDialog() function.
Please advice.
thanks,
Kitty
Kitty5
|
|
|
|
|
I need to knwo how to compare to bitmaps so as to detect motion. The bitmaps come from a webcam stream and i have managed to grab the frames as needed. I just now need help in comparing these frames for motion.
|
|
|
|
|
Interesting project. Must be some 2 lines of code, but I can't get it now!
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Hi,
Are the frames captured color? If it is color then image subtraction is time consuming. I would suggest you convert ur color images to monorchrome amd use image subtraction.
Adios,
Cool Ju
Dream Ur Destiny
|
|
|
|
|
yes they are in color at the moment. So how do i convert them to monochrome and then how to i do image subtraction?
|
|
|
|
|
Hi,
Google it. This article would be much help to you.
Motion Detection[^]
Adios,
Cool Ju
Dream Ur Destiny
|
|
|
|
|
|
Hello all,
I want to check for some folder in C:\ drive if that folder exists by default then no action if that folder does not exits I have to create the folder. For that I have used below code
CFileFind finder; <br />
CString szPath , szCMD; <br />
szPath = "c:\\A\\B";<br />
if(!finder.FindFile(szPath)) <br />
{ <br />
szCMD = "mkdir "; <br />
szCMD += szPath; <br />
system((LPCTSTR)szCMD); <br />
}<br />
<br />
This code properly in MFC application , I want to know how to do it in Win32 API application??
Please help me with this problem.
Thanking you,
Suresh HC.
|
|
|
|
|
You may use FindFirstFile API.
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.
|
|
|
|
|
#include "shlwapi.h"
TCHAR szDir[20];
_tcscpy( szDir,_T("D:\\MyNewDir\\") );
if(!PathFileExists(szDir))<font color=green>
if( CreateDirectory(szDir,NULL) )
<font color=green>
PS: You will need to link to shlwapi.lib for using PathFileExists()
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
Thank you guys CPallini , brahmma , WhiteSky , James R. Twine thanks for the examples.
Now I modified the code to as follows
<br />
int ret;<br />
<br />
char buf[ ] = "C:\\A\\B"; <br />
char *lpStr;<br />
lpStr = buf;<br />
ret = PathFileExists(lpStr);<br />
if(ret == 1)<br />
{<br />
CreateDirectory(lpStr,NULL); <br />
}
How to link shlwapi.lib file to code ???
I am getting below error
error LNK2001: unresolved external symbol __imp__PathFileExistsA@4
fatal error LNK1120: 1 unresolved externals
|
|
|
|
|
Open property window of your project and include lib file to it(I dont have vs2003 now) but I think its on linker additional path(its first item on right panel)
|
|
|
|
|
Thanks WhiteSky i did the changes its working now.
Thank you very much.
|
|
|
|
|
Suresh H wrote: How to link shlwapi.lib file to code ???
When you include the header file simply add a pragma to link the lib
#include <shlwapi.h>
#pragma comment(lib, "shlwapi.lib") Lot easier than mucking around in the project settings and you will never forget it if you reuse the file in another project.
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
|
IF the directory has to exist regardless of it being there already or your having to create it, just call ::CreateDirectory(...) ! If the directory already exists, it will return an error, if it does not, it will attempt to create it.
No need for all that other crap unless you really need to know if it exists beforehand.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Use CreateFile with OPEN_EXISTING to detect if directory exists, and, if not, use CreateDirectory(Ex) to create it.
Nuclear launch detected
|
|
|
|
|
Hi gents,
I want to retrieve image (jpg) file from access database using VC++,
Class:
CDaoDatabase and CDaoRecordset class.
In mdb file. the image stored in Long binary data format.
Sample Code:
COleVariant var;
var = m_recordset.GetFieldValue ( "AF_Photo" );
if ( var.vt == ( VT_ARRAY | VT_UI1 ) )
{
str1.Empty ( );
BYTE* pBytes = new BYTE[var.parray->rgsabound[0].cElements];
void HUGEP *pvData;
HRESULT hr = SafeArrayAccessData(var.parray, &pvData);
for ( int ncount = 0 ; ncount < (var.parray->rgsabound[0].cElements);
ncount++ )
{
pBytes[ncount ] = ( ( BYTE* ) (pvData) ) [ ncount ] ;
}
hr = SafeArrayUnaccessData(var.parray);
outfile.open ( "D:\\Vichu\\Vichu.jpg", ios::out );
for ( int i = 0; i < size; i++ )
outfile << pBytes [ i ];
outfile.close ( );
delete [] pBytes;
Is this code correct or not ?
If correct, that file is not open.
What is the exact solution for this problem ?
I am waiting for your response.
Thanks & Regards,
K.Vishvanathan.
Vichu
|
|
|
|
|
You never check returned values, does you?
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.
|
|
|
|
|
hi,
Yes pallini,But the file pointer wrote some bianry string into that jpg file.
Are the program statments correct ?
Please give clear solution for this issue.
Thanks and Regards,
K.Vishvanathan.
Vichu
|
|
|
|
|
Why do I get "undeclared identifier" error when I try to use "GET_X_LPARAM" Macro? . In the requirement(MSDN), they have specified :
<br />
Header Declared in Winuser.h, include Windows.h <br />
Minimum operating systems Windows 95, Windows NT 3.1 <br />
I have XP.
*
|
|
|
|
|
ca you show a piece of the code around, + the exact error message/code please ?
also, what version of MFC do you use ?
|
|
|
|