|
Hi, Thanks for the reply,
Actually the project is on motion detection by the webcam.
The OnTimer function creates a thread that save the current picture frame
on the disk.
I am using this timer in Application class derieved from CWinApp
does this creating a problem for me?
ritz1234
|
|
|
|
|
1. Is the timer successfully created?
2. Do you filter the timer IDs?
3. Does the execution enter the OnTimer body?
4. Could you add some OutputDebugString or write log to file to approach the last line it executes right before crash?
Usually this kind of crash relates to invalid handles or pointers.
Maxwell Chen
|
|
|
|
|
Please make sure that you do not have any un-initialized variables, they can act evil in Release mode.
Also, do you have a crash dump which you can analyse through any debugger and see which memory segment is throwing the error ?
|
|
|
|
|
Hi cagespear,
You should reply to OP's posts, otherwise he won't recieve a notification email.
Maxwell Chen
|
|
|
|
|
No, he was giving you some suggestions.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: No, he was giving you some suggestions.
Maxwell Chen
|
|
|
|
|
Thanks for the tip Maxwell 
|
|
|
|
|
|
I have a dialog based application that I would like to convert to a
SDI/MDI architecture.
Please help me out to resolve the above problem.
Thanks in advance.
Mallikarjun
|
|
|
|
|
You can do that manually by converting dialog to doc-view based SDI/MDI app by creating new Doc,View,Frame files and integrating the logic in there and doing lots of other things. But that would be very cryptic because there are very meticulous things to be done in order to achieve it.(e.g. manually editing RC to create frames, menu, toolbar and all).
I think instead of tweaking same app from dlg based to SDI/MSI, it'd be better if you create a fresh MDI/SDI app and then port the functionality one by one from your dialog based app to the SDI/MDI app.
Regards
Cage
|
|
|
|
|
lavate malllik wrote: Please help me out to resolve the above problem.
Well if you implemented any sort of Design using Best Practices and Patterns it should be very simple rote work to replace the UI with another. Of course you have to actually develop the UI which may not be simple at all.
led mike
|
|
|
|
|
In my app, I applied SetMapMode() to CView's DC for zoom in-out purpose, drawing (such as LineTo()) and bitmap (such as StretchBlt()) are changed properly with zoom's change.
Problem is that text size (such as by TextOut()) keeps the same even zoom is changed.
Do you know how to change text size automatically when zoom is changed? -- do not use SetFont() or similar functions to change font size.
thx
|
|
|
|
|
|
As I tested, the function can not change text size.
|
|
|
|
|
Friends,
I want to launch command prompt window from my application running on Windows Vista. For this purpose i am using CreateProcess. What i want is that command prompt window shoul be launched with Administrative priviliges. Please tell me how can i do so ?
Imtiaz
|
|
|
|
|
I'm not sure about CreateProcess().
But maybe this:
::ShellExecute(NULL, _T("runas"), _T("c:\\Windows\\System32\\cmd.exe"), _T(""), _T(""), SW_SHOWNORMAL);
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Not counting the run as administrator part, I'd do it like this:
#include "stdafx.h"
#include <windows.h>
#include <tchar.h>
#include <shellapi.h>
#include <malloc.h>
#pragma comment(lib, "shell32.lib")
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
DWORD size = GetEnvironmentVariable(_T("ComSpec"), NULL, 0);
LPTSTR pPath = static_cast<LPTSTR>(_alloca(size*sizeof(TCHAR)));
GetEnvironmentVariable(_T("ComSpec"), pPath, size);
ShellExecute(NULL, NULL, pPath, NULL, NULL, SW_SHOWNORMAL);
return 0;
}
This code makes no assumptions about the location of the windows folder or the location and name of the command interpreter.
Steve
modified on Wednesday, March 5, 2008 10:08 PM
|
|
|
|
|
Sweet! Thanks for that!!
Just add the runas verb and it will prompt for elevation...
ShellExecute(NULL, _T("runas"), pPath, NULL, NULL, SW_SHOWNORMAL);
Filed for future reference, thanks!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
In addition to Mark's reply, see here[^].
Steve
|
|
|
|
|
Imtiaz Murtaza wrote: For this purpose i am using CreateProcess. What i want is that command prompt window shoul be launched with Administrative priviliges
have a look at CreateProcessWithLogon, CreateProcessWithToken, CreateProcessAsUser.
|
|
|
|
|
I would really like to use CWinThread class.
I have an odd situation where i am in a dll and would like to use a thread. For come reason CWinThread is not accessible here.
When i try to inclde afxwin.h before my stdafx.h
I would not compile on :
CWinThread *pThread;
I get the following errors
error C2143: syntax error: missing ';' before'*'
error C2501: 'CWinThread':missing storage-class or type specifiers.
Any idea what is going on here?
|
|
|
|
|
Maybe there is something in my 'properties' that i am missing ?? 
|
|
|
|
|
Why not include afxwin.h IN stdafx.h?
Build a quick temporary MFC project with the project wizard and you'll see a working arrangement
for the MFC header files.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Have the same problem if i include afxwin.h IN stdafx.h
Could it be that my .dll is a win32 and cannot run MFC classes?
|
|
|
|
|
How would i get around this using a Win32 dll trying to implement an MFC class like CwinThread? If this is not possible, what are my thread options. I am simply creating a waitable timer but wanted to do this in a thread.
thanks,
|
|
|
|