|
Does anyone have any tricks for auto-restarting an app? I have a few settings in my app that require the user to close the app and then restart it for the settings to take affect. It would be nice to auto-restart for the user if needed. I know I could do it with a seperate exec but I was hoping to stay away from that.
Any ideas?
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
You could try executing your own program using ShellExecute() as the very last thing before you exit. Use GetModuleFileName(AfxGetInstanceHandle()) (if you're using MFC) to get your exe filename and path, or GetCommandLine() if you want to reuse all the same parameters as well. You can strip the parameters off if you don't need them.
Hope this helps
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Hi,
where can i find 'Undelete/recover' files source code ?
thanks
Hari Krishnan
|
|
|
|
|
|
When i post code here and use the <code> </code> tags all it does in change the color of the font and I loose the tabs. How are some people able to change the background color from this blue to the codeproject beige and keep the formatting???????
|
|
|
|
|
Use the proper tag. Check the stylesheet.
--
"The money power of the country will endeavor to prolong its rule by preying upon the prejudices of the people until all wealth is concentrated in a few hands and the Republic destroyed."
-- Abraham Lincoln
|
|
|
|
|
Use the <pre></pre> tags
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Thanks Ryan,
That did the trick. I actually spent time digging around the css for the <proper> tag. Now, don’t I feel stupid. I guess this proves I'm not a "web page programmer" - whatever they are.
-Kevin
|
|
|
|
|
You're welcome .
Don't worry about it. I had to ask as well .
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Hi,
I am using VC++ and able to open an Excel file: File.xls (if it does not need a Password) with the following code:
<br />
CDatabase database;<br />
CString Xfile = "c:\\File.xls";<br />
<br />
sDriver = GetExcelDriver();<br />
if( sDriver.IsEmpty() )<br />
{<br />
AfxMessageBox("No Excel ODBC driver found");<br />
return;<br />
}<br />
<br />
sDsn.Format("ODBC;DRIVER=<br />
{%};DSN='';DBQ=%;PWD=ATC",sDriver,Xfile);<br />
database.Open(NULL,false,false,sDsn);<br />
However, with the same file, if I use Save As (with
Option) with Password:ATC, then when I run the same
program, it said: Could not decrypt file
Anyone knows what was wrong?
Many thanks
|
|
|
|
|
Hiya I have a string like:
char buffer[] = this,is,not,needed,12,grahamoj,34,this,is,not,needed,either;
What I need to do is search for 12 and then do a search after that for the 34, and extract the part in between them e.g "grahamoj" for displaying..
I have been using strstr to search the string but can't get it right.
Can anyone help me on this..
Thanks.
|
|
|
|
|
char buffer[] = "this,is,not,needed,12,grahamoj,34,this,is,not,needed,either";
char *p1 = strstr(buffer,"12,");
if(p1)
{
p1 += 3;
char *p2 = strstr(p1,",34");
if(p2)
{
*p2 = 0;
printf("%s",p1);
}
}
"I'm a bit bored at the moment so I'm thinking about writing a new programming language" - Colin Davies
My book :- Summer Love and Some more Cricket [New Win]
Review by Shog9 Click here for review[NW]
|
|
|
|
|
I don't get when the current selection is actually the new selection made by the user. When I'm calling GetCurSel()with my combo box, I'm getting the previous value that was in the combo box. I've tried it in OnOk, OnCurSel,OnSelchange and OnSelendok. Each time the currently selected item is seen as the previous item, not the new item that was selected? What's up with that?
Here's the code I'm trying to execute!
void RDialogForControlSegments::OnSelendokSegmentGainMatrixCombo() <br />
{<br />
this->m_dwGainMatrixId = <br />
this->m_ctrlSegmentGainMatrixCombo.<br />
GetItemData(this->m_ctrlSegmentGainMatrixCombo.GetCurSel());<br />
<br />
}
|
|
|
|
|
I figured it out. It was a LAME mistake!
|
|
|
|
|
Intellisense shows that I can access myPlines (myGroups[i]->)... why can't I access myVerts? (see bold code below). Shouldn't this work like a nested structure? Thanks for any help.
class Group
{
public:
list < Pline * > myPlines;
void addPline(Pline *p) {myPlines.push_back(p);}
}
class Pline
{
public:
void addVert(CPoint *v) {myVerts.push_back(v);}
void removeLastVert() {myVerts.erase(myVerts.end());}
list < CPoint * > myVerts;
};
**********FormView.h****************
Group *myGroups[10];
*********FormView.cpp ***************
FormView::OnDraw(CDC* pDC)
{
pDC->Polyline(myGroups[i]->myPlines[k]->?
}
**********************************************************
**********************************************************
I had hoped it'd work like this:
*************** Nest.h *******************************
typedef struct {
int *x1;
} One;
typedef struct {
One *x2;
} Two;
typedef struct {
Two *x3;
} Three;
class Nest
{
public:
Nest();
Three myNest;
virtual ~Nest();
};
************** Nest.cpp *********************************
Nest::Nest()
{
myNest->x3->x2->x1 = 10;
}
|
|
|
|
|
The STL list, which you have used for myPlines, does not overload the array access operator, []. If you need to access it using this operator, you should use a vector instead, otherwise you should be iterating through the list, rather than trying to retrieve an item at a specific index.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Hi,
I have a function
bool equal(double val)
{
if(val == 0.0) return true;
else return false;
}
if val = 0.0;
function will return true
if val = 0.0000000000000001;
function will return false
Is there a way to set a tolerance so that 0.0 == 0.000000000000001 -> true?
Thanks
Everything's beautiful if you look at it long enough...
|
|
|
|
|
Sure, you can try something like:
<br />
bool equal(double val)<br />
{<br />
if(fabs(val) < 0.00000000001) return true;<br />
<br />
else return false;<br />
}<br />
|
|
|
|
|
|
Thanks for the link. It looks like a good and efficient solution.
John
|
|
|
|
|
Hi all
where can I find a combobox that displays the shell tree (like the one in the Windows explorer)? I need it in my MFC app
|
|
|
|
|
One solution is CTreeCtrl.
Kuphryn
|
|
|
|
|
|
Hi !
I created a FrameWnd and attached a tool basr to it, but when I scroll the window, the tool basr moves with the window and goes away...
Any way to fix it ?
Shay
|
|
|
|
|
I am writing a filter for an array of classes. I want users to type in the filtering parameters as text in a script file. E.g.
Price > 10;
Country = "US";
Currency = "CAD";
Years <= 5, etc.
The c++ code should then create an unfiltered array, read this file, and then filter the array. One way of doing this is to come up with a bunch of if statements:
if( sLHS == "Price" )
{
if( sSign == ">" )
if( GetPrice( ) > 10 ) bPassed = true;
else if( sSign == "<" )
if( GetPrice( ) < 10 ) bPassed = true;
...
}
...
if( sLHS == "Years" )
{
if( sSign == ">" )
if( GetYears( ) > 5 ) bPassed = true;
....
}
and so on.
With many parameters to choose from I am going to end up with a thousand of if statements. I AM LOOKING FOR AN EASIER WAY AND I NEED YOUR HELP.
It would be really nice if I could come up with an array of something like this:
Price GetPrice( );
Country GetCountry( );
Years GetYears( ), etc.
then go through the array, find the corresponding item in the left column and then call a specific function in the right column based on its name. BUT HOW CAN I DO THIS AT RUN TIME?
Any thoughts are appreciated.
Thanks
|
|
|
|