|
Call ShowWindow(SW_HIDE) on the edit control.
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"
|
|
|
|
|
It is alright now!
Thanks!
|
|
|
|
|
m_edit.ShowWindow(0 or 1);
GetDlgItem(IDC_EDIT1)->ShowWindow(0 or 1);
whitesky
|
|
|
|
|
|
I have done a small project in MFC..as the last part of the project i have to do menu bar..anyone know the best way to do menu bar in mfc application in visual C++...please help me thank you..
|
|
|
|
|
If its a dialog based project go to the resource editor . Create a menu .
Then go to the dialog in the resource editor and right click on it to open the properties. In the properties pop up dialog mention the id of the menu bar you want to attach to the dialog.
In SDI
Create the menu in the resource editor and in your application use LoadMenu()
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
makaveli_07
wrote: I have done a small project in MFC..as the last part of the project i have to do menu bar..anyone know the best way to do menu bar in mfc application in visual C++...please help me thank you..
-Add the Menu resource from the Resources
-Insert the menus into menu bar
-Load the menu using LoadMenu() API
-set the menu to the application using SetMenu() API
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
What type of application is it? If it's a dialog app, call SetMenu() on your dialog window.
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"
|
|
|
|
|
LoadMenu and SetMenu are the functions that you use for Loading and setting it on a frame window or a dialog.
First you must load the menu from a resource which is the best way to do it.
For e.g.
CMenu aMenu;
aMenu.LoadMenu(IDR_MENU1); Then we set it on a frame by calling SetMenu .
For e.g.
SetMenu(&aMenu); And it's mandatory to call DrawMenuBar after you change a menu.
There is a demo in MSDN. Please look up LoadMenu and you will find it.
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
If use this function with NULL then curren menu is removed.
if dont have any menu
CMenu m;
m.LoadMenu(AfxGetInstanceHandle(),(LPCTSTR)IDR_MENU1);
SetMenu(&m);
whitesky
|
|
|
|
|
asked in an interview --->
1. Can u change the color of menu bar?
2.How can u change the color of the dialog box initially and what is the function used for changing?
3. How can u change the color of a Button and edit box?
please specify steps in the above cases, if you have a sample code it would be great!!!
thanx in advance
kumar_windows
|
|
|
|
|
kumar_windows wrote:
2.How can u change the color of the dialog box initially and what is the function used for changing?
Override the Wnd::OnCtlColor Method
kumar_windows wrote: How can u change the color of a Button and edit box?
Override the Wnd::OnCtlColor Method
For the method one of the parameter is nctlcolor
CTLCOLOR_BTN Button control
CTLCOLOR_DLG Dialog box
CTLCOLOR_EDIT Edit control
CTLCOLOR_LISTBOX List-box control
CTLCOLOR_MSGBOX Message box
CTLCOLOR_SCROLLBAR Scroll-bar control
CTLCOLOR_STATIC Static control
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
A_Laxman wrote: CTLCOLOR_BTN Button control
Doesn't work with a button. You have to ownerdraw.
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
1. Tocahge the color 0f Menu bar :
use DrawItem methos
2. Initiallly changing the Color of dialog
handle WM_CTLCOLOR message
3. TO change the color of Button and Edit box
You ghave to derive the class from CButton and then handle WM_CTLCOLOR
Also Visit:
http://support.microsoft.com/kb/q132080/
Cheers
"Peace of mind through Technology"
|
|
|
|
|
kumar_windows wrote: How can u change the color of the dialog box initially and what is the function used for changing?
You can do one touch setting using...
SetDialogBkColor
(
RGB(255, 0 , 0),
RGB(0, 255, 0)
); From now on any dialog that comes up will be using the background and foreground color you specified. Call from InitInstance method of the application class. This is a member function of CWinApp .
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
you can use derived button and use wm_drawitem of course change owner draw in property button
for background color like Nibu thomas for initially but you can use WM_PAINT and use handle dc/cedit use WM_CTLCOLOREDIT that in event wParam is handle to device context edit use HDC hdc = (HDC)wParam;
whitesky
|
|
|
|
|
hi .. Im writing a multithreadedprogram in borland c++ builder 6 that communicate with serial port..readFile function is on a seperate thread and its called ( the thread) by
void __fastcall read_thrd::Execute() (which replace the thread function..)..so how can I write a function that reads the serial port automatically when there is something??..(how to get the serial port status(or whatever) and react to it?)
Execute() could be controled by Resume() - will resume its execution- and Suspend() - will pause and suspend its execution- and those two functions are the way to communicate with the thread from the main thread -in addition to Terminate()- , so I can write my code in execute() or in other function and then call it.
now my code it as simple as this: (Im using a butten to call resume)
<br />
void __fastcall read_thrd::Execute()<br />
{<br />
FreeOnTerminate = true;<br />
while(!Terminated)<br />
{<br />
ReadFile(Form1->m_hCom, &(Form1->sBuffer), 128, &(Form1->iBytesWritten), &osReader) ;<br />
Suspend();<br />
}<br />
<br />
if(Terminated)<br />
{<br />
void __endthread(void);<br />
}<br />
}
I need to replace it ..so I dont have to click the butten to read the comm port..can you help??please?
|
|
|
|
|
was asked in an interview --->
1. If the default constructor fails what happens?
2. What is Conversion constructor? Please give a small code example.
3. Why there is no virtual constructor?
thanx in advance
kumar_windows
|
|
|
|
|
1. Fails? In what way? If an exception is thrown, it's the same as if any other exception is thrown. The object is left in an undefined state, and should not be used.
2. A constructor that can be used to convert between different types. It takes one argument, and allows you to typecast from the argument type to the class type.
3. Because when you create a class, the compiler has to know exactly what type it is. The virtual function pointer table is initialised as part of the constructor call, so there is no way to implement a virtual function lookup until after the constructor completes.
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"
|
|
|
|
|
kumar_windows wrote: If the default constructor fails what happens?
http://burks.bton.ac.uk/burks/language/cpp/cppfaq/exceptio.htm#[17.1][^]
kumar_windows wrote: 2. What is Conversion constructor? Please give a small code example.
A constructor that accepts one argument of a different type
For e.g
CDemo d{
int m_i;
public:
CDemo(int i){
m_i=i;
}
}; kumar_windows wrote: Why there is no virtual constructor?
There is nothing like Virtual Constructor.
The Constructor can’t be virtual as the constructor is a code which is responsible for creating a instance of a class and it can’t be delegated to any other object by virtual keyword means.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
hi all
i have got a problem like i want to get the dpi which is set in the XP
inside the code like 96dpi or 120 dpi like that,but i am not finding any way.
if any of u know about it please tell me .
"Men never do evil so completely and cheerfully as when they do it from religious conviction"
-Pascal
|
|
|
|
|
I think EnumDisplaySettings() can help you.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Create a device context for the screen (GetDC(NULL) ) and call GetDeviceCaps() on it, specifying the LOGPIXELSX or LOGPIXELSY codes.
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"
|
|
|
|
|
Is it true that if I post a request for receving (WSARecv/WSA_IO_PENDING),
then just wait on GetQueuedCompletionStatus for the completion until any client send some data and the receiving is finished?
|
|
|
|
|
With IOCP, you don't wait on anything (at least not in the form of a blocking call or anything like that) as the commands return immediately.
You post your commands such as WSASend and WSARecv and your worker thread(s) get called with the CompletionPortID when they complete. Thats when you call GetQueuedCompletionStatus() and process your data buffers and then issue a new command and such. Your thread(s) should never block with IOCP but if one does, the other remaining thread(s) will pick up the slack.
It's really beautiful in concept though I've never quite gotten my multithreading skills honed enough to fully appreciate it under heavy load without some form of thread lockup issues. There are a few good articles on it here at CP. There was a Win2000 system programming book (now out of print) by Jeffery Richter and Jason Clark titled "Programming Server-Side Applications for Microsoft Windows 2000
" that has some pretty good information on them in general.
|
|
|
|