|
MainFrm.cpp
MainFrm::OnStart()
{
....
popupDlg= new CPrgpopup(NULL, iProgressBarMaxVal,iProgressBarStepVal);
hwnd=AfxGetApp()->GetMainWnd()->GetSafeHwnd();
THREADSTRUCT5 *_param = new THREADSTRUCT5;
_param->_this = this;
thMPrgBar=AfxBeginThread (StartProgressBarThread, _param);
.....}
UINT MainFrame::StartProgressBarThread (LPVOID param)
{
THREADSTRUCT5* ts = (THREADSTRUCT5*)param;
ts->_this->popupDlg->Create(IDD_PROGRESS_BAR_DIALOG,NULL);
ts->_this->popupDlg->ShowWindow(TRUE);
}
Prgpopup.cpp
CPrgpopup::CPrgpopup(CWnd* pParent, int iPrgMaxVal,int iPrgStpVal)
{
iPrgBarMaxVal = iPrgMaxVal;
iPrgBarStepVal = iPrgStpVal;
}
---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!
Program: .....\DebugMDd\navigat.exe
File: strcore.cpp
Line: 512
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
---------------------------
Abort Retry Ignore
---------------------------
---------------------------
navigator.exe - Application Error
---------------------------
The exception Breakpoint
A breakpoint has been reached.
(0x80000003) occurred in the application at location 0x77f9193c.
Click on OK to terminate the program
Click on CANCEL to debug the program
---------------------------
OK Cancel
---------------------------
---------------------------
navigator.exe - Application Error
---------------------------
The exception Breakpoint
A breakpoint has been reached.
(0x80000003) occurred in the application at location 0x77f9193c.
Click on OK to terminate the program
---------------------------
OK
---------------------------
|
|
|
|
|
You are writing too much functionality in one line. This leeds to undebugable ocde.
ts->_this->popupDlg->Create(IDD_PROGRESS_BAR_DIALOG,NULL);
is this value assigned? ts->_this->popupDlg
Whats there going wrong?
File: strcore.cpp
Line: 512
A missing resource?
Greetings from Germany
|
|
|
|
|
Did you check call stack to trace what line is causing the problem??
BTW
ptr_Electron wrote: ts->_this->popupDlg->ShowWindow(TRUE);
Use SW_SHOW and SW_HIDE.
Regards,
Sandip.
|
|
|
|
|
ptr_Electron wrote: File: strcore.cpp
Line: 512
So have you looked at line 512 of strcore.cpp to see what condition is asserting?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
when I connect sqlserver200 with VC++6.0 Error "
"[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
thanks very much
|
|
|
|
|
|
HI,
The Problem remains...
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\atlbase.h(4575) : error C3861: '_beginthreadex': identifier not found
to avoid this problem i need to set up something in Visual Studio to turn on _MT in ATLBASE.
I set runtime library to /MDd but _MT still OFF.
|
|
|
|
|
Did you include, as required, process.h ?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
You have to link with the multi-threaded libraries.
Please ignore, I think I was still sleeping...
modified on Thursday, August 21, 2008 6:33 AM
|
|
|
|
|
I also got the same error.
I avoid that problem by resetting visual studio setting.
For resetting setting:
take command prompt,
take the directory as ..\Microsoft Visual Studio 9.0\Common7\IDE
Devenv /ResetSkipPkgs
devenv /resetsettings
|
|
|
|
|
Hi All,
Say if i give, C:\\Level 1\\Level 2\\abc.txt, the return value i'm expecting is C:\\Level 1\\Level 2.
Is there an API to return the parent directory from the given path, something like PathFindFileName API, or we should extract on our own.
Thanx.
Do your Duty and Don't expect the Result
|
|
|
|
|
If you're given a full pathname, just get rid of everything after the last \\
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
Introduction to Object-Oriented JavaScript
|
|
|
|
|
|
thanx.. i'm looking for this API..
Do your Duty and Don't expect the Result
|
|
|
|
|
welcome , glad it was helpfull
Vikas Amin
My First Article on CP" Virtual Serial Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|
|
I am trying to do something like this:
> STARTUPINFO si;
> PROCESS_INFORMATION pi;
> BOOL bRes = false;
> DWORD dwCode = 0;
> ZeroMemory ( &si, sizeof ( STARTUPINFO));
> si.cb = sizeof ( STARTUPINFO);
> si.dwFlags = STARTF_USESHOWWINDOW;
> si.wShowWindow = SW_SHOWNORMAL;
>
> bRes = CreateProcess( NULL,
> (char *)it->second.c_str(), // some exe
> NULL,
> NULL,
> TRUE, // also tried FALSE
> NORMAL_PRIORITY_CLASS, //also tried 0
> NULL,
> NULL,
> &si,
> &pi
> );
> DWORD error = GetLastError();
> XERROR1( "ExecuteFailoverCommand :after execution Error=%d", error);
> if( bRes == false )
> {
> XERROR3( "ExecuteFailoverCommand :Error=%d, Could not invoke process %s
> for service %s", error, it->second.c_str(), ServiceName.c_str());
> }
> else
> {
> XTRACE2("ExecuteFailoverCommand : executed command %s on failure of %s
> returned %d", it->second.c_str(), ServiceName.c_str(),bRes);
> return true;
> }
This is working fine when I am calling CreateProcess from an exe but same is not working when it is being called from a running service. This may be due to reason that service puts the UI on a different desktop.
So, is there any other solution to this problem.
thanks in Adv
|
|
|
|
|
laksh2204 wrote: This may be due to reason that service puts the UI on a different desktop.
Possibly.
laksh2204 wrote: So, is there any other solution to this problem.
Maybe, depends on your definition of the "this problem". Most services don't have a user interface because they don't need one due to the nature of the problem they are solving. What problem are you trying to solve?
led mike
|
|
|
|
|
laksh2204 wrote: This may be due to reason that service puts the UI on a different desktop
It would be helpful to know if that's actually the case.
"not working" is pretty vague don't you think?
Have you tried using the STARTUPINFO.lpDesktop field?
You may also want to consider using CreateProcessAsUser() instead of
creating the process as the user the service is running as.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Well you were a little late, but welcome to the fishing derby!
led mike
|
|
|
|
|
led mike wrote: you were a little late
Yeah, but nothing else going on here - so what the heck
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Actually, I have a service running on Windows Server2003 sp2 called locator. This service keeps a control over another 4 services in the system. If any one of these four is down, I am supposed to run a process say Handler which is yet to be developed.
So I was trying with an existing like cmd,calc etc...
Now As Mark is saying use CreateProcessAsUser() and lpDesktop, I have a problem that I am new to windows domain. I don't know what should be the value for lpDesktop or for hToken i.e. first parameter of CreateProcessAsUser(). I am getting error 6 INVALID_HANDLE.
I think, The discussion stopped due to timezone difference.
--Arun
|
|
|
|
|
hello,
you said that you already have the "locator" service that keep control of the other 4 ones.
I think,if possible, that instead of developing another service, the "handler" that would execute a certain code under the scrash event of one of the other 4 services,then just put that code in the "locator", why complicate it ? Of course I suppose here that you have hands on the "locator" source code, something you didn't said.
Regarding the use of createProcess,etc..I wonder why you develop an MFC app
for such thing as to respond to the crashing of an NT service, then may be restart it from using that MFC app.
It is right, your UI wo'nt showup when exectued in context of a service.It's like there is a fictiouness desktop with which services interact I remember myself even to have problem trying to debug a service by trying to catch the TRACEs and log them into an UI application Window.
I am also know that it is said that it is not advised even to try make a service interact with session-wise objects : for example try to communicate something in the desktop of a logged user by the service. Do not even suppose that while your service is running or that when it has crashed that there is a user who is logged that time in order to notify him.
I have something like that : a remote service (developed by means of CUTService : a very good class that helps you write services : it is included in Ultimate TCP/IP you find here in CodeProject) which I control by a remote application which collects performances and key indicators but also with another local service (ie in the same server machine as the first service) which can open local socket channel and do efficient control of the service state..but no interaction with the desktop of the remote server machine)
Anyway..try do something and come here back if there is something to talk about.
Our Philosophy, Mohammed Baqir Al Sadr
|
|
|
|
|
laksh2204 wrote: I don't know what should be the value for lpDesktop
You could try "Winsta0\default".
Which desktop you use and which account the spawned process runs
as are two separate issues. If your service runs with privileges
above what the user should have (as is often the case), then
you need to use CreateProcessAsUser().
You should really study the docs carefully - I haven't gone into why a
service that interacts with the desktop and/or current user is a bad idea.
It's not guaranteed to work in future operating systems.
Services[^]
Window Stations and Desktops[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I think its not a bad idea in general scenario. But might not be good idea in my scenario.
As according to my problem when a particular service is down, the user which is logged in must have a process running which can handle the situation. In this way, that user is required to be logged in permanently. Which for me doesn't seems to be a good idea. In other words, What if no user is logged in and one of those services goes down. No one will be there to handle the situation.
However, "Winsta0\default" looks quite different to me. May be like someone who is always there. In this case it should work. I'll try it out.
Thanks everyone for your valuable time.
This forum is really one of the bests I've ever seen.
|
|
|
|
|
Hi,
in my application if I connect a new USB HID device I want to access the property (Location ) of the USB Human INterface Device from the devicemanager.
Can anybody suggest me a way for doing that ......
|
|
|
|