|
Addendum
I decided to try the UI thread to stop the process. Seems like a challenge and I like to torture myself with goofy programming techniques.
Now I cannot figure out how to execute the process I was after. This process ( used to be worker thread "function") and its 300+ lines of code is in the view main thread!
It is OK to make the view variable in the new UI thread? On first thought it seems like "circular reference". Any other way to do this “ function transfer” from the view?
Thanks for all you help.
Vaclav
|
|
|
|
|
"Progress" report:
I have managed to execute an equivalent of "worker thread function" located in the UI thread class.
Two problems:
1. It needs access to document and it asserts there. I am working on why.
2. The big one:
If I temporary bypass the code( won't work witout the document) and just do an infinite loop ( even with some Sleep in it) I cannot click the UI button! That means only one thing - the OS is too busy letting the main thread messages thru! That is not what I was after in the first place!
If I continue with multithreaded approach (just for kiks) I need to write some more code! Joy!?
|
|
|
|
|
Can anybody tell me a function that resets the computer?
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Resets it to what?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I mean to restart the computer, like pressing start -> Turn off computer -> Restart
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Try ExitWindowsEx(EWX_REBOOT) .
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Thank you!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
|
Thank you very much!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
As someone else already suggested, you can use the command "shutdown -r" which will run just as though you used it through command prompt. An example:
void main()
{
system("shutdown -r");
}
This will default to a 30 second timer before the computer begins to shutdown. With some effort, you should be able to find a way to decrease the timer, although I'm not positive.
EDIT: system("shutdown -r -t 10"); that will set the shutdown timer to 10 seconds, instead of the default 30. The command shutdown tells the computer what to do, "-r" is for resetting the computer, "-t xx" (-t 10) sets the time to the amount of seconds you indicate, so if your code were "system("shutdown -r -t 1");" The computer would start resetting one second after your program executes that line of code. Theoretically you can set it to 0 seconds, but I don't feel like testing that one
|
|
|
|
|
Thanks a lot!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
i have my C++ code that i developed in Visual Studio 2008
the solution contains 4 projects
i want that code to be ported to LINUX. i know the linux complier is GCC and i have no clue how to do it. i think it is done using a makefile but still if u ppl can help me.
|
|
|
|
|
VS2008 does not have a "makefile" export; So, you'd better sit down and learn how to manually generate makefiles which is one of the devil created file format (IMO). You might be interested in using one of the many IDE available on linux (kdevelop, ... ) that should ease your pain by "wrapping" the makefile in a nice environment.
One the other hand, depending on how much your application is tied to Visual Studio and/or windows (API and framework) the makefile might be the least of your problem.
M.
Watched code never compiles.
|
|
|
|
|
There are many tutorials and 'makefiles how to' on the web, see, for instance [^].
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]
|
|
|
|
|
See if this helps.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
hi,
i am trying to make a customized Clist control. i have written my Class derived from CListCtrl. The problem is in this Vertical scroll bar are not coming when i dynamically create this list control. if i create it in resource and use DDX_Control and take it as my class variable it works fine(scroll bar comes) but if i create control dynamically scroll bars dont come. This is the creation code
m_pList = new CCustomList(12);
m_pList->Create(LVS_REPORT | LVS_SINGLESEL | LVS_EDITLABELS | WS_CHILD | WS_TABSTOP ,
CRect(0,0,620,100),this,IDC_LIST3);
DWORD dwStyle = m_pList->GetExtendedStyle();
dwStyle |= (LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);
m_pList->SetExtendedStyle(dwStyle);
please help if any one has any idea. i searched on net there are many ways to remove them but no solution how to show them.
Thanks
|
|
|
|
|
hey guys
i got it.. i dint insert enough items thats why it was not coming...
Thanks
|
|
|
|
|
I want to emulate pressing a pushbutton.
I call SendDlgItemMessage(hDlg,IDBUTTON,BM_SETSTATE,TRUE,0L);
and then I have tried calling RedrawWindow(GetDlgItem(hDlg,IDBUTTON),NULL,NULL,RDW_INVALIDATE|RDW_ERASE|RDW_FRAME|RDW_UPDATENOW|RDW_INTERNALPAINT);
with various flag combinations, but the button will not redraw.
If I call MessageBox after the RedrawWindow, the button redraws, but I don't want to do that!
What am I missing?
|
|
|
|
|
Try the following scenario :
...
{
...
SendMessage(hBtn, WM_LBUTTONDOWN, MK_LBUTTON, MAKELONG(10, 10));
RedrawWindow(hBtn,...);
Sleep(100);
SendMessage(hBtn, WM_LBUTTONUP, MK_LBUTTON, MAKELONG(10, 10));
...
}
virtual void BeHappy() = 0;
|
|
|
|
|
I am getting the following error:
error C2143: syntax error : missing ')' before '&'
on building the below code:
typedef unsigned int uint4;
void Find(uint4& a, uint4 b, uint4 c);
void Find(uint4& a, uint4 b, uint4 c)
{
. . . .
}
I do not see any error in code.
Any idea as to why this error is coming up?
modified on Tuesday, April 6, 2010 4:40 AM
|
|
|
|
|
void Find(uint4& a, uint4 b, uint4 c,);
^
What's the purpose of that comma?
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]
|
|
|
|
|
sorry thats a typing mistake here
|
|
|
|
|
Your code compiles fine with my C++ compiler (are you using a C compiler?).
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]
|
|
|
|
|
yes I guess
how to find that in visual studio
I have written the code in a .cpp file
|
|
|
|
|
.cpp source files are compiled (by default) with the C++ compiler.
However, the default behaviour may be overriden by the /TC compiler option, see [^].
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]
|
|
|
|