|
This is by settings in XP - Screen properties/Appearance - then Effects button and uncheck Hide underlined...
|
|
|
|
|
Yes, but how Visual Studio and MS-WORD are showing underline symbol when the option is either selected or not selected ??
Imtiaz
|
|
|
|
|
Because they have their menu ownerdraw and decided for whatever reason to ignore this system setting.
The setting for the system can be retrieved by
function SystemParametersInfo , using flag SPI_GETKEYBOARDCUES .
You can change the setting for the system by using SPI_SETKEYBOARDCUES flag with the mentioned function.
Hope that helps.
|
|
|
|
|
Hi all,
can anybody gimme the program with code to create a anolog clock.
thanks in advance.
Mr.Dayala
ThomasKennedyBose
|
|
|
|
|
search for analog clock in c++ section at http://www.planetsourcecode.com
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
hi alok,
thanks for quick reply..I found it in planetsource bit it is on general C++.I want it in VC++..can help me out?? my problem is with time, otherwise I can manage by wriitng myself.
thanks in advance.
ThomasKennedyBose
|
|
|
|
|
could you eloborate you problem or mail me at thatsalok@gmail.com
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Mr Bose Dayala wrote:
can anybody gimme the program with code to create a anolog clock.
Probably, but nobody will. Why don't you write it yourself and if you run into any problems, ask a question about how to do a particular thing. You're much more likely to get a useful response that way.
Ryan "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"
|
|
|
|
|
I found one some months ago here on CP. have you looked here in the articles?
besides I don't think it should be so dificult to make.
think of what parts a clock consists (circle, lines, pointers,...) All of them are static accept the pointers, the base is static (center of the circle) while the point moves, it moves (for the seconds) 360/60 of the circle every second.
The only thing you need to do is to redraw this pointer every second on the right place.
Just know your geometry.;)
hope this helps...
[EDIT]
Oh by the way, I did analog meters for a car once, which worked perfectly, the one thing you may want to consider is buffering to reduce flicker. I did it as described above, but I don't have the code anymore
[/EDIT]
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
I am calling Form2 from Form1, and depending on the input in Form2, I want to enable/disable buttons in Form1 when I exit. However, because I need to call Form2 header before I define class Form1, Form1 is not defined when the compiler sees my call to it. If I therefore call Form1 header in Form2 header, then the compiler will see my call to Form2 before Form2 is defined!!.
Basically therefore, I wanna be able to call each form from each form, but have to define and make the call in one first.
This seems to me a very obvious thing to want to do, but I can't figure out myself how to do it, as you can't declare an extern class, or see any examples on the net of how to do it in Visual C++.net.
Any help appreciated, as is a real stumbling block for me.
UltimateNewbie
|
|
|
|
|
Hi,
In any case one form will be the parent of the other form. So in the 2nd form use the GetParent() function to get the pointer cast it to the parent parentclass, set the parent's values using the currently got value
Have a look @ the following code,
CParentDlg *pParent = (CParentDlg *) GetParent();
pParent->m_iNewValue = m_iGotValue;
Hope this will help you.
Sujan
|
|
|
|
|
Your question is a little confusing, but I think you need to a forward declaration of one of your classes.
class Form1; in your Form2.h
or
class Form2; in your Form1.h
A lot depends on how the classes are referencing each other.
Michael
CP Blog [^]
|
|
|
|
|
Hi
I am creating a class derived from CListBox so I can control the fonts, color, etc2. I also want to control the background color of the listbox (not the text's background color, but the whole listbox' background color), and I am doing it by handling WM_ERASEBKGND message in OnEraseBkgnd() function.
The OnEraseBkgnd() implementation is very simple, basically I just obtain the client rect and the use CDC::FillSolidRect to fill it with the background color of my choice.
The problem is, the background color is correctly drawn if there is at least one item in the listbox, but when the listbox is empty, the background color is always displayed as white, even though I have stepped in the debugger and make sure that the FillSolidRect function is executed.
Could someone tell me what the possible cause for this is? Thanks!
|
|
|
|
|
Hi
this is from MSDN :
<br />
The WM_CTLCOLORLISTBOX message is sent to the parent window of a list box before the system draws the list box. By responding to this message, the parent window can set the text and background colors of the list box by using the specified display device context handle.<br />
|
|
|
|
|
Are you calling the base class OnEraseBkgnd() ?
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
I need to make my application non-resizable. how do i do that?
Single Doc Interface, CFormView (all set up through MFC App Wizard).
|
|
|
|
|
Hi,
Add the following code to CMainFrame's PreCreateWindow
cs.style = WS_OVERLAPPED | WS_SYSMENU | WS_BORDER;
Sujan
|
|
|
|
|
Hello, I'm creating a program that displays a menu to the user and gives the user the option to open the following programs:
1. Freecell
2. Minesweeper
3. Paint
4. Quit
It does open the programs correctly but when the user enters 4 for quit, I want my program to close all of the programs the user opened. I am not sure how to do that though. I have created a function called ExitProcess and have a call to it when the user enters 4 as their choice. There is no code in that function.
Here is most of the code:
#include <iostream.h><br />
#include <windows.h><br />
#include <string.h><br />
#include <stdio.h><br />
<br />
void DisplayMenu();<br />
void CreateProcess(int option);<br />
void ExitProcess(void);<br />
void main()<br />
{<br />
DisplayMenu();<br />
<br />
return;<br />
}<br />
<br />
void DisplayMenu()<br />
{<br />
int option;<br />
<br />
<br />
cout << "\n\nPlease type your choice "<br />
<< "and press the return key : ";<br />
<br />
cin >> option;<br />
CreateProcess(option);<br />
<br />
return;<br />
}<br />
<br />
void CreateProcess(int option)<br />
{<br />
STARTUPINFO si;<br />
PROCESS_INFORMATION pi; <br />
<br />
ZeroMemory( &si, sizeof(si) );<br />
si.cb = sizeof(si); <br />
ZeroMemory( &pi, sizeof(pi) ); <br />
<br />
switch (option)<br />
{<br />
case 1 : if( !CreateProcess( NULL, <br />
"C://FreeCell.exe",NULL,NULL,FALSE,NULL,NULL,NULL,&si,&pi)) <br />
{<br />
ExitProcess(1);<br />
} <br />
system("cls");<br />
DisplayMenu();<br />
<br />
break; <br />
<br />
case 2 : if( !CreateProcess( NULL, <br />
"winmine.exe",NULL,NULL,FALSE,NULL,NULL,NULL,&si,&pi)) <br />
{<br />
ExitProcess(1);<br />
} <br />
system("cls");<br />
DisplayMenu();<br />
<br />
break;<br />
<br />
case 3 : if( !CreateProcess( NULL, <br />
"MsPaint.exe",NULL,NULL,FALSE, NULL,NULL,NULL,&si,&pi )) <br />
{<br />
ExitProcess(1);<br />
} <br />
<br />
system("cls");<br />
DisplayMenu();<br />
<br />
break;<br />
<br />
<br />
<br />
case 4 : WaitForSingleObject( pi.hProcess, INFINITE );<br />
ExitProcess();<br />
CloseHandle( pi.hProcess );<br />
CloseHandle( pi.hThread );<br />
<br />
exit(100);<br />
<br />
break;<br />
<br />
<br />
default : cout << "\a\aOption Not Available\n";<br />
system("cls");<br />
DisplayMenu();<br />
}<br />
<br />
return;<br />
}<br />
void ExitProcess(void)<br />
{<br />
<br />
}
|
|
|
|
|
Send WM_QUIT message to each running application.
PROCESS_INFORMATION pi[3];
STARTUPINFO si[3];
ZeroMemory( &si[0], sizeof(si[0]) );
si.cb = sizeof(si[0]);
ZeroMemory( &pi[0], sizeof(pi[0]) );
ZeroMemory( &si[1], sizeof(si[1]) );
si.cb = sizeof(si[1]);
ZeroMemory( &pi[1], sizeof(pi[1]) );
ZeroMemory( &si[2], sizeof(si[2]) );
si.cb = sizeof(si[2]);
ZeroMemory( &pi[2], sizeof(pi[2]) );
if(pi[0].hProcess==NULL)
CreateProcess( NULL, "C://FreeCell.exe",NULL,NULL,FALSE,NULL,NULL,NULL,&si[0],&pi[0]));
if(pi[1].hProcess==NULL)
CreateProcess( NULL, "winmine.exe",NULL,NULL,FALSE,NULL,NULL,NULL,&si[1],&pi[1]);
if(pi[2].hProcess==NULL)
CreateProcess( NULL, "MsPaint.exe",NULL,NULL,FALSE, NULL,NULL,NULL,&si[2],&pi[2]);
if(pi[0].hProcess)
::PostThreadMessage(pi[0].dwThreadId,WM_QUIT,0,0);
if(pi[1].hProcess)
::PostThreadMessage(pi[1].dwThreadId,WM_QUIT,0,0);
if(pi[2].hProcess)
::PostThreadMessage(pi[2].dwThreadId,WM_QUIT,0,0);
CloseHandle( pi[0].hProcess );
CloseHandle( pi[0].hThread );
CloseHandle( pi[1].hProcess );
CloseHandle( pi[1].hThread );
CloseHandle( pi[2].hProcess );
CloseHandle( pi[2].hThread );
Regards,
Andrzej Markowski
|
|
|
|
|
Enumerate All Windows on specified thread. Post WM_CLOSE to them , in order to close the application in safe manner.Later u may call terminateprocess API
|
|
|
|
|
Thanks for the reply.
I am getting an 3 errors which say "left of .cb must have class/struct/union type".
This is the part of the code it is giving those errors:
<br />
PROCESS_INFORMATION pi[3];
STARTUPINFO si[3];
ZeroMemory( &si[0], sizeof(si[0]) );<br />
ZeroMemory( &pi[0], sizeof(pi[0]) ); <br />
ZeroMemory( &si[1], sizeof(si[1]) );<br />
ZeroMemory( &pi[1], sizeof(pi[1]) ); <br />
ZeroMemory( &si[2], sizeof(si[2]) );<br />
|
|
|
|
|
Change the code like this:
PROCESS_INFORMATION pi[3];
STARTUPINFO si[3];
ZeroMemory( &si[0], sizeof(STARTUPINFO));<br />
si[0].cb = sizeof(STARTUPINFO); <br />
ZeroMemory( &pi[0], sizeof(PROCESS_INFORMATION)); <br />
ZeroMemory( &si[1], sizeof(STARTUPINFO));<br />
si[1].cb = sizeof(STARTUPINFO); <br />
ZeroMemory( &pi[1], sizeof(PROCESS_INFORMATION)); <br />
ZeroMemory( &si[2], sizeof(STARTUPINFO));<br />
si[2].cb = sizeof(STARTUPINFO); <br />
ZeroMemory( &pi[2], sizeof(PROCESS_INFORMATION));
Regards,
Andrzej Markowski
|
|
|
|
|
Thanks for the help Andrzej
I have configured the code as shown below: Including a couple of functions. The program builds with 0 errors and 0 warnings, but for some reason when I enter a choice like (1) for "Freecell", my program quits, the program that I have opened remains open, so I do not have the chance to quit the Freecell program. Not sure why it is not giving me another choice:
#include <iostream.h><br />
#include <windows.h><br />
#include <string.h><br />
#include <stdio.h><br />
<br />
void DisplayMenu();<br />
void process(int option);<br />
<br />
<br />
void main()<br />
{<br />
DisplayMenu();<br />
return;<br />
}<br />
<br />
void DisplayMenu()<br />
{<br />
int option;<br />
<br />
cout << "\n\n\n";<br />
cout << "\n\t*********************************";<br />
cout << "\n\t* *";<br />
cout << "\n\t* MENU *";<br />
cout << "\n\t* *";<br />
cout << "\n\t* 1. FreeCell *";<br />
cout << "\n\t* 2. MineSweeper *";<br />
cout << "\n\t* 3. Paint *";<br />
cout << "\n\t* 4. Quit *";<br />
cout << "\n\t* *";<br />
cout << "\n\t*********************************";<br />
<br />
cout << "\n\nPlease type your choice "<br />
<< "and press the return key : ";<br />
<br />
cin >> option;<br />
process(option);<br />
<br />
return;<br />
}<br />
<br />
void process(int option)<br />
{<br />
<br />
STARTUPINFO si[3];<br />
PROCESS_INFORMATION pi[3]; <br />
int i=0;<br />
<br />
ZeroMemory( &si[0], sizeof(si[0]) );<br />
si[0].cb = sizeof(si[0]); <br />
ZeroMemory( &pi[0], sizeof(pi[0]) ); <br />
<br />
ZeroMemory( &si[1], sizeof(si[1]) );<br />
si[1].cb = sizeof(si[1]); <br />
ZeroMemory( &pi[1], sizeof(pi[1]) ); <br />
<br />
ZeroMemory( &si[2], sizeof(si[2]) );<br />
si[2].cb = sizeof(si[2]); <br />
ZeroMemory( &pi[2], sizeof(pi[2]) ); <br />
<br />
switch (option)<br />
{<br />
case 1 : if(pi[0].hProcess==NULL)CreateProcess( NULL, <br />
"FreeCell.exe", <br />
NULL, <br />
NULL, <br />
FALSE, <br />
NULL, <br />
NULL, <br />
NULL, <br />
&si[0], <br />
&pi[0]); <br />
<br />
{<br />
ExitProcess(1);<br />
} <br />
<br />
<br />
system("cls");<br />
DisplayMenu();<br />
<br />
break; <br />
<br />
case 2 : if(pi[1].hProcess==NULL)CreateProcess( NULL, <br />
"winmine.exe", <br />
NULL, <br />
NULL, <br />
FALSE, <br />
NULL, <br />
NULL, <br />
NULL, <br />
&si[1], <br />
&pi[1]); <br />
<br />
{<br />
ExitProcess(1);<br />
} <br />
<br />
<br />
system("cls");<br />
DisplayMenu();<br />
<br />
break;<br />
<br />
case 3 : if(pi[2].hProcess==NULL)CreateProcess( NULL, <br />
"MsPaint.exe",
NULL, <br />
NULL, <br />
FALSE, <br />
NULL, <br />
NULL, <br />
NULL, <br />
&si[2], <br />
&pi[2]); <br />
<br />
{<br />
ExitProcess(1);<br />
} <br />
<br />
system("cls");<br />
DisplayMenu();<br />
<br />
break;<br />
<br />
<br />
<br />
case 4 : if(pi[0].hProcess)::PostThreadMessage(pi[0].dwThreadId,WM_QUIT,0,0);<br />
if(pi[1].hProcess)::PostThreadMessage(pi[1].dwThreadId,WM_QUIT,0,0);<br />
if(pi[2].hProcess)::PostThreadMessage(pi[2].dwThreadId,WM_QUIT,0,0);<br />
CloseHandle( pi[0].hProcess );<br />
CloseHandle( pi[0].hThread );<br />
CloseHandle( pi[1].hProcess );<br />
CloseHandle( pi[1].hThread );<br />
CloseHandle( pi[2].hProcess );<br />
CloseHandle( pi[2].hThread );<br />
exit(100);<br />
<br />
break;<br />
<br />
default : printf("\a\aOption Not Available\n");<br />
system("cls");<br />
DisplayMenu();<br />
}<br />
<br />
return;<br />
}
|
|
|
|
|
You should declare the arrays (si and pi ) as global variables. Also you can't call the DisplayMenu from within the process function (recursion).
Here's an example how to fix these problems:
STARTUPINFO si[3];
PROCESS_INFORMATION pi[3];
int DisplayMenu();
void process(int option);
void main()
{
ZeroMemory( &si[0], sizeof(si[0]) );
si[0].cb = sizeof(si[0]);
ZeroMemory( &pi[0], sizeof(pi[0]) );
ZeroMemory( &si[1], sizeof(si[1]) );
si[1].cb = sizeof(si[1]);
ZeroMemory( &pi[1], sizeof(pi[1]) );
ZeroMemory( &si[2], sizeof(si[2]) );
si[2].cb = sizeof(si[2]);
ZeroMemory( &pi[2], sizeof(pi[2]) );
while(DisplayMenu()!=4)
return;
}
int DisplayMenu()
{
int option;
system("cls");
cout << "\n\n\n";
cout << "\n\t*********************************";
cout << "\n\t* *";
cout << "\n\t* MENU *";
cout << "\n\t* *";
cout << "\n\t* 1. FreeCell *";
cout << "\n\t* 2. MineSweeper *";
cout << "\n\t* 3. Paint *";
cout << "\n\t* 4. Quit *";
cout << "\n\t* *";
cout << "\n\t*********************************";
cout << "\n\nPlease type your choice "
<< "and press the return key : ";
cin >> option;
process(option);
return option;
}
void process(int option)
{
switch (option)
{
case 1 : if(pi[0].hProcess==NULL)CreateProcess( NULL,
"FreeCell.exe",
NULL,
NULL,
FALSE,
NULL,
NULL,
NULL,
&si[0],
&pi[0]);
break;
case 2 : if(pi[1].hProcess==NULL)CreateProcess( NULL,
"winmine.exe",
NULL,
NULL,
FALSE,
NULL,
NULL,
NULL,
&si[1],
&pi[1]);
break;
case 3 : if(pi[2].hProcess==NULL)CreateProcess( NULL,
"MsPaint.exe",
NULL,
NULL,
FALSE,
NULL,
NULL,
NULL,
&si[2],
&pi[2]);
break;
case 4 : if(pi[0].hProcess)::PostThreadMessage(pi[0].dwThreadId,WM_QUIT,0,0);
if(pi[1].hProcess)::PostThreadMessage(pi[1].dwThreadId,WM_QUIT,0,0);
if(pi[2].hProcess)::PostThreadMessage(pi[2].dwThreadId,WM_QUIT,0,0);
CloseHandle( pi[0].hProcess );
CloseHandle( pi[0].hThread );
CloseHandle( pi[1].hProcess );
CloseHandle( pi[1].hThread );
CloseHandle( pi[2].hProcess );
CloseHandle( pi[2].hThread );
break;
default : printf("\a\aOption Not Available\n");
break;
}
return;
}
Regards,
Andrzej Markowski
|
|
|
|
|
Finally got it!
Thanks for all the help
|
|
|
|
|