|
C_Zealot wrote: EXIT_SUCCESS
Never seen that before...
I would just return 1 or 0, but you can #define them any way you like.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
|
What a program returns (to the calling process) is independent of the language used.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i have two comboboxes.one is fro user and other is for administrator.what i want is when ever administrator adding a user it will come in to user combobox.for each user ther is a corresponding password also..pls help.
|
|
|
|
|
bigphish wrote: Re: how to add dynamically in a combo box?
CComboBox::AddString()
or
CComboBox::InsertString()
nave
|
|
|
|
|
You can use of CB_ADDSTRING or CB_INSERTSTRING and for MFC m_Combo.AddString("Hello"); or InsertString(-1 for insert string to end of list,"Hello");
|
|
|
|
|
Hi all:
I am writing a program which accepts two command in parameters, "the program name" and "the file it accesses".
My codes are:
#include <iostream>
#include <fstream>
using namespace std;
int main (int argc, char* argv[])
{
ifstream in(argv[1], ios_base::binary);
if (argc != 2) {
cerr <<"Usage: conc file" <
|
|
|
|
|
C_Zealot wrote: It compiles with no errors, but it will crash if argc = 1, e.g. there is no file name given.
Why?
because in that case argv[1] will try to access invalid memory and may cause access violation.
You should put the if (argc != 2) checking above the ifstream in(argv[1], ios_base::binary);
nave
|
|
|
|
|
Thank you very much, nave.
I understand it now.
Thank you again.
|
|
|
|
|
:->I have created a class CSkinDesignerDlg derived from CDialog.As its default background color is too normal,I want to change its color.After having searched on the web,I find a way to change its color.Draw its back color in function "OnPaint()",just like below:
void CSkinDesignerDlg::OnPaint()
{
................
CPaintDC dc(this);
CRect rect;
GetClientRect(rect);
dc.FillSolidRect(rect, RGB(0,0,255));
.................
}
As I will always need to show or hide this Dialog form in my program,there will be a shimmer in my program.Is there anybody know some better way to change the background color.
|
|
|
|
|
I made it in this way :
in OnCtlColor( CDC pDC ...)
you replace the core with :
if((nCtlColor == CTLCOLOR_STATIC) || (nCtlColor == CTLCOLOR_DLG) ) {
pDC->SetBkColor(RGB(255,255,255));
return (HBRUSH) MyBrush;
}
( HBRUSH hbr = ... rests )
where MyBrush is of Type CBrush and will be initialized via MyBrush.CreateSolidBrush(RGB(255,255,255));
I hope it helps
|
|
|
|
|
I know "OnCtlColor()" is used to set child control's color.And I have also tried to use it. But it seem doesn't work, still have glimmer.
Now I will have a more detail introduction of my software. It has a main form.In the main form,there are a lot of child forms. There's a tab control in the main form which I could used to choose which child form to display. As I have changed the main form and child form's background color(main form and child form have different color), there will always be a glimmer when I change the child form to display.
Is there anybody can help me solve this problem.
Thanks to all the helper.
|
|
|
|
|
Peter, Chan wrote: it seem doesn't work,
Why it doesnt work how do you use it?
|
|
|
|
|
Sorry, I said wrong. It works, but still glimmer.
I have tried "CWnd::OnEraseBkgnd(...)". And only paint the area that I need to redraw. Now it shows well, do not have any glimmer.
|
|
|
|
|
Peter, Chan wrote: Now it shows well, do not have any glimmer
Well it seems that your problem solved.;)
|
|
|
|
|
You can use of these messages (of the MSDN)
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
|
|
|
|
|
You have tried using the CWnd::OnEraseBkgnd(...) function to paint the background yourself? Doing it in the CWnd::OnPaint(...) function may not be the best place because I think that it will only update any region that is marked as invalidated, so parts of the dialog may not get painted correctly.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
I have tried "CWnd::OnEraseBkgnd(...)". And only paint the area that I need to redraw. Now it shows well, do not have any glimmer.
I am very thankful for your kindness.
|
|
|
|
|
I want to use capDlgVideoSource function to adjust the video picture.
First,I use capCreateCaptureWindow to create a HWND to assosited with the capture,and trans the right HWND to capCreateCaptureWindow.If capturing is not active,it works well(show the adjust dialog and return TRUE),but if is active,it would fail(could not show the adjust dialog and return FALSE).
Why?
And how should I using the function to adjust the video?
GOOD LUCK
|
|
|
|
|
Not all VFW drivers will show the dialogs when the video is active, especially the source dialog.
"Newer" WDM drivers seem to have better live dialog support. I've only accessed these
through DirectShow.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I go this error:
"Unhandled exception at 0x7c964ed1 in 123.exe: 0xC0000142: DLL Initialization Failed."
Do you know how to get more information for this error?
Thanks,
|
|
|
|
|
hi all,
I wonder if it is possible to give window message different priority, or in other word, one message can interrupt the message queue and is processed before other messages although it arrives in the message queue later.
if that's not possible, what's your solution to handle the situations when a window have to process a long message queue, could be > 10 or even 20 messages waiting to be processed.
|
|
|
|
|
GameProfessor wrote: I wonder if it is possible to give window message different priority, or in other word, one message can interrupt the message queue and is processed before other messages although it arrives in the message queue
Not unless you invent it yourself with a different message queue that you handle yourself.
Windows messages can be considered to have three priority levels. Posted messages have the highest priority. This means that they have a higher priority than input messages which are the next priority level. WM_PAINT and WM_TIMER have the lowest priority, in fact they are "pseudo" messages that not even make it to the message queue. The messages are simulated by setting a flag instead and they are processed when the message queue is empty. This also means that even if a timer has expired multiple times before being handled, the message handler for the WM_TIMER message will only be called once.
GameProfessor wrote: if that's not possible, what's your solution to handle the situations when a window have to process a long message queue, could be > 10 or even 20 messages waiting to be processed.
Depends on the situation, you have to elaborate more on the problem you're trying to solve.
I suspect I would use a worker thread reading a queue with application specific contents and not use the windows message queue. The thread would wait for a semaphore that is released when a new object is placed in the queue and process the new object. But this could be a bad solution, it depends on what you're trying to do.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hello,
I have created a menu in my Application class and one of my child windows have that menu when the child window is created.
How do I create object Ids for the menu options so that I can write function handlers for the menu option through class wizard by selectiong those object Ids.
Or Is it that I cannot go through the class wizard route if I have created my menu through CMenu class.
Thanks
Prithaa
|
|
|
|