|
False Chicken wrote: Im trying to convert a string to a Const Char* How do I do that? Im using Dev and this is ther error i get:
cannot convert `std::basic_string<char,>, std::allocator<char> >' to `const char*' for argument `1' to `int system(const char*)'
This way!
string StrSysCommand = "cls";
system( StrSysCommand.c_str() );
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
False Chicken wrote: Im new to C++
that doesn't forbids you to interrogate the documentation...
the std::string class (which is a specialization of the std::basic_string template class) has a c_str()[^] member function...
|
|
|
|
|
I have created a dialog to display message on my application for 5 seconds after which the dialog closes. I created the dialog using the following code before which I update the display message text for the dialog
sDispMsg = (CString)"Setting up the Design Condition";
CProgressDlg pProg;
pProg.DoModal();
The above code is within a function. When I call the function it works fine. But when I call the above function after creating a thread using the code:
if( bAteRunThreadActive == FALSE )
{
htAteRunThread = CreateThread( NULL,0,(LPTHREAD_START_ROUTINE)tExecuteAte,(LPVOID)NULL,NULL,&dwAteRunThreadID );
if( dwAteRunThreadID == NULL )
{
AfxMessageBox( "ATE Thread Creation Failed" );
return;
}
bAteRunThreadActive = TRUE;
}
Note that when I am creating the dialog inside the thread function, my application crashes at the point after I call the Settimer in the below code. When I call normally outside the thread in a normal function it works fine. Also when I did a step by step debugging it works fine in the thread function also.
Pls provide some solution.
//My Dialog code
BOOL CProgressDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
GetDlgItem(IDC_STATIC_DISPMSG)->SetWindowText(sDispMsg);
tID = SetTimer(1,5000, NULL);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CProgressDlg::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
/* int nRet = 5; */
KillTimer(tID);
//EndDialog(0);
CDialog::OnCancel();
// DestroyWindow();
// AfxGetMainWnd()->UpdateWindow();
//CDialog::OnTimer(nIDEvent);
}
|
|
|
|
|
Whow, you've managed to make a lot of conceptional errors.
Perhaps you don't need a secondary thread at all.
If you would create a modeless dialogue instead of a modal one, you would be able to continue doing what you should in one single thread.
But if you think that you do need a secondary thread, you'd better read this[^] before you continue. In your case it's essential that you do read the article.
Main issues are:
- don't do GUI stuff from a worker thread
- SetTimer is considered GUI stuff since it is a member of CWnd
- If it was not out-commented, AfxGetMainWnd() would return NULL
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
|
Hi all,
I have made a sdi application, in which i have made several ui threads...
Now, i want to debug my program..
how should i debug it...
Thanks in advance
|
|
|
|
|
Just Googled [^] and Found this[^]
What the exact kind of UI/Application problem you're going to resolve?
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
break points , message boxes , log files that what I do
Vikas Amin
My First Article on CP" Virtual Serial Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|
|
|
When I run a VC++8.0 Project I got a dialog box which states "The application failed to initialize properly(0xc0150002). Click on OK to terminate the application.". If I terminate the application, the following message is displayed in the output Window:
LDR: LdrpWalkImportDescriptor() failed to probe C:\Program Files\Delta3D_REL-2.0.0\bin\dtUtild.dll for its manifest, ntstatus 0xc0150002
How to resolve the error?
Note:
This error occurs only under Debug mode.
modified on Friday, September 5, 2008 7:29 AM
|
|
|
|
|
T.RATHA KRISHNAN wrote: How to resolve the error?
wait, you're compiling your project in debug mode, aren't you ?
compile in release mode, and see if it's better. The Release Mode should be linked to dtUtil.dll (not dtUtild.dll).
|
|
|
|
|
clean the output directory and recompile the full project .
Vikas Amin
My First Article on CP" Virtual Serial Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|
|
Dear All,
My project requirement is MFC application need to create setup package.I have created the setup package using Inno setup. Im using filters and equipment driver in my applicaion. so i need to connect filter(.bat file) and install that driver then only setup.exe should execute. How to use .bat file and install the driver in .iss file.
Plz helpme.....
It will be much helpful to me to give some advice on this..
Thank you very much,
Regards
Anitha
|
|
|
|
|
|
try this
[Files]
Source: "C:\Dir\InstallDriver.bat"
[Run]
Filename: "{app}\InstallDriver.bat"; Parameters: "/WHATEVER_PARAMS_YOU_NEED"; StatusMsg: "Installing driver..."
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hi sashoalm,
I got the output.Thanks a lot....
Regards,
Anitha
|
|
|
|
|
Hi,
I want to install a driver file in setup package using Inno setup.
I tried the following code:
[Files]
Source: "C:\Program Files\Inno Setup 5\xx.sys"; DestDir: "{app}"
Source: "C:\Program Files\Inno Setup 5\xx.inf"; DestDir: "{app}"
[Run]
Filename: "{sys}\rundll32.exe"; Parameters: "setupapi,InstallHinfSection DefaultInstall 132 C:\Program Files\Inno Setup 5\P100.inf"; WorkingDir: {app}; Flags: 32bit;
but it doesn't install of my drivers.
help me...
Regards,
Anitha
|
|
|
|
|
AnithaSubramani wrote: [Run]
Filename: "{sys}\rundll32.exe"; Parameters: "setupapi,InstallHinfSection DefaultInstall 132 C:\Program Files\Inno Setup 5\P100.inf"; WorkingDir: {app}; Flags: 32bit;
I thought you were trying to execute a bat file.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hi all
How can i know Capacity of USB Device?I want to know USB is Capacity (2gb or 3gb).Plz help me..
Thx's in advance
|
|
|
|
|
Did you try GetDiskFreeSpaceEx() ?
|
|
|
|
|
Hi,
I want to show the progress bar as animation. Can any one give me an example to show how to use CAnimationCtrl
Thanks
|
|
|
|
|
this is the easiest control ever use,
just add an animate control on a dialog box,
add a variable of type CAnimateCtrl.
in the OnInitDialog() function call the function Open() and Play().
remember to call function Close() in ua dlg box's OnClose() function or onDestroy()
like this.
//////////////////////////
m_ctlMyAnimation.Open(_T("C:\\Windows\System32\\migwiz\\progress.avi"));
m_ctlMyAnimation.Play();
////////////////////////
remember that this avi shud be some of those simple animation files, not music video or moviz, a good example is that microsoft dog that shows up when yu are searching.
::OnButtonStop()
{
m_ctlMyAnimation.Stop();
}
::OnClose()
{
m_ctlMyAnimation.Close();
}
|
|
|
|
|
Hi,
I have used the following code
m_avi.Open(IDR_AVI1);
m_avi.Play(0,-1,-1);
but its giving debug assert at open function
whats the problem
|
|
|
|
|
Dhiraj kumar Saini wrote: whats the problem
Find out for yourself what the problem is - use the debugger to find out what assert is being called.
Alternatively, put a break point in your code and use the Step Into debug option to follow through the MFC code.
Have you tried having the avi as a file, and using Open ("myfile.avi")? Does that work?
I suspect you'll either not have the avi properly embedded as a resource, or IDR_AVI1 means different things in different places (it is only defined in resource.h?), or maybe as the wrong resource type.
Good luck,
Iain.
|
|
|
|
|
how/where is IDR_AVI1 defined? Does it contain a valid path for the AVI File
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|