|
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]
|
|
|
|
|
Thanks Pallini for the inputs.
I think I have got the bug.
Actually in the VC project the file where I had been calling the fn. is .cpp while I have define it in a .c file.
I guess this may be the problem.
|
|
|
|
|
rupeshkp728 wrote: Actually in the VC project the file where I had been calling the fn. is .cpp while I have define it in a .c file.
I guess this may be the problem.
Please note you cannot use references (e.g. 'uint4 & ' as your function's parameter) in C language.
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 have changed the file name to .cpp
|
|
|
|
|
I'm not sure how using multiple .cpp files to create one .exe works but I'm attempted to using multiples to create just one .exe file. I'm currently using Microsoft Visual Studio 2008 and I've created a project built the project, and ran the file. I've either done something incorrect, or my idea of how this would work is wrong, in which case, my bad.
#include "DarkGDK.h"
void drawBlueBox();
void drawRedBox();
int x=319;
void DarkGDK()
{
dbSetWindowOff();
dbMaximiseWindow();
dbSetDisplayMode(1280, 1024, 32);
while(x=319){
dbCLS();
drawBlueBox();
drawRedBox();
}
dbWaitKey();
}
void drawBlueBox()
{
int red = dbRND(255);
int green = dbRND(225);
int blue = dbRND(225);
DWORD blue1 = dbRGB(red, green, blue);
DWORD black = dbRGB(0, 255, 0);
dbInk(blue1, black);
dbBox(0, 0, 639, 511);
}
void drawRedBox()
{
int red = dbRND(255);
int green = dbRND(225);
int blue = dbRND(225);
DWORD red1 = dbRGB(red, green, blue);
DWORD black = dbRGB(0, 255, 0);
dbInk(red1, black);
dbBox(640, 512, 1280, 1024);
}
#include "DarkGDK.h"
int y=0;
void main()
{
int width = dbScreenWidth();
int height = dbScreenHeight();
int mouseX = dbMouseX();
int mouseY = dbMouseY();
dbPositionMouse(dbScreenWidth()/2, dbScreenHeight()/2);
DWORD white = dbRGB(255, 255, 255);
DWORD black = dbRGB(0, 255, 0);
while(y=0){
dbInk(white, black);
dbText(350, 150, "Screen Width: ");
dbText(460, 150, dbStr(width));
dbText(120, 350, "Screen Height: ");
dbText(240, 350, dbStr(height));
dbText(120, 363, "Mouse Position: ( , )");
dbText(255, 363, dbStr(mouseX));
dbText(297, 363, dbStr(mouseY));
dbWait(50);
}
}
The first .cpp file makes a full screen window that makes two randomly color changing boxes, while the second .cpp files tracks your mouses movement as you move it across the screen and displays it. The code on either .cpp files is running properly when compiled alone and into two separate .exe files. If someone could explain exactly how one .exe file made with multiple .cpp files would run I think that would also be helpful.
|
|
|
|
|
I think you don't really understand how to work with multiple cpp files. In fact, the two files are not "executed at the same time". You still have only one main function which will get called when your program start. If you want to call some functions defined in your second cpp file, you have to call them in your main function.
In fact, having multiple cpp files very similar (in the way of calling the functions I mean) as having only one cpp file. It is used to structure your program a bit more nicely (you don't have one huge file with everything in it).
|
|
|
|
|