|
I ask it before ant this is the answer that I gets:
look in help for main, wmain etc. - they return int
t!
Who can explain me it ???
|
|
|
|
|
If you have a console app, the value returned from main() is the exit code of the program.
For GUI apps, the return from WinMain() is the exit code. Normally you return the wParam of the WM_QUIT message, which itself is the parameter passed to PostQuitMessage(), however this is not a requirement.
--Mike--
http://home.inreach.com/mdunn/
"You named the Borg... Hugh?"
-- Guinan
|
|
|
|
|
something very simple, I want to have two sets of radio buttons, I cant for the life of me seperate them. I always thoguht it woul be a matter of putting them in a group contorl but no luck. I was told to try putting the taborder so they are sequential but this doesnt work either
thanks
|
|
|
|
|
You also have to set the Group style on the first radio button in the group, and turn that style off for the remaining buttons.
--Mike--
http://home.inreach.com/mdunn/
"You named the Borg... Hugh?"
-- Guinan
|
|
|
|
|
I just had the same problem. Open the .rc file in text mode then cut and paste so that the radio control buttons are all bunched together, and then make sure the group box follows. I believe that should do it even though there probably is an easier way.
Ex: I had a dialog for selecting comm ports and a device type, 1 group box for each...the correct .rc file looks like so:
CONTROL "DEVICE1",IDC_DEVICE1,"Button", BS_AUTORADIOBUTTON,23,34,70,10
CONTROL "DEVICE2",IDC_DEVICE2,"Button", BS_AUTORADIOBUTTON,23,48,70,10
CONTROL "DEVICE3",IDC_DEVICE3,"Button", BS_AUTORADIOBUTTON,23,62,70,10
GROUPBOX "Device Type:",IDC_DEVICE_SELECT,19,24,78,52,BS_LEFT | WS_GROUP
CONTROL "1",IDC_COM1,"Button",BS_AUTORADIOBUTTON,137,29,22,10
CONTROL "2",IDC_COM2,"Button",BS_AUTORADIOBUTTON,137,43,22,10
CONTROL "3",IDC_COM3,"Button",BS_AUTORADIOBUTTON,137,57,22,10
CONTROL "4",IDC_COM4,"Button",BS_AUTORADIOBUTTON,137,71,22,10
CONTROL "5",IDC_COM5,"Button",BS_AUTORADIOBUTTON,168,29,20,10
CONTROL "6",IDC_COM6,"Button",BS_AUTORADIOBUTTON,168,43,20,10
CONTROL "7",IDC_COM7,"Button",BS_AUTORADIOBUTTON,168,57,20,10
CONTROL "8",IDC_COM8,"Button",BS_AUTORADIOBUTTON,168,71,20,10
GROUPBOX "COM Port:",IDC_COM_PORT,131,19,63,65
- John
|
|
|
|
|
You need to do both the things that have been said already. First, go to the first radio button of each group and check the 'group' property. Then go into the resources unless you are sure the groups are together - if you created three radio buttons, a listCtrl ( or anything else ) and another button, the last button will not be in the group until it gets moved under the others in the resource file.
Another warning. You can now add a variable of type int for the 'group' radio button. It is a zero based index of which button is pressed. I have found that using this sometimes ( like right now ) causes the item selected to jump when I click another control in the window. I have no idea why, although it happens more if you initialise the value to something other than -1. Set it to 0 and UpdateData(false) in your OnInit, not your constructor.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
The easy way to think of it is that a group of radio buttons will start with a radio button that has its "group" property checked and will include all subsequent radio buttons with unchecked group property (by tab order) up to BUT NOT INCLUDING the next control that has its group property checked. This last control can be, but does not have to be another radio button.
The way I usually implement for simlicity - for each group of radio buttons I make a surrounding group box. I make that group box follow the last radio button in the tab order, then I set its group property to checked.
Steve T
|
|
|
|
|
Hi!
I am trying to set the text color for a RichEditCtrl, and here is what I have been using:
CHARFORMAT cf;
cf.cbSize = sizeof(CHARFORMAT);
cf.crTextColor=RGB(255,0,0);
SetCharFormat(cf);
I have not used the CFM_COLOR flag, since it seems that it would override my color selection.
The code above does not work for some reason.
avneesh
|
|
|
|
|
For apply this you need to select a text, or if you need to write in some color from a point to ahead, select that point and apply the color.
Cheers!!!
Carlos Antollini.
|
|
|
|
|
yes, I do select the text, in the control, before invoking these calls..
Any other suggestion?
ab
|
|
|
|
|
If you want to set the color for text you add later, use SetDefaultCharFormat().
--Mike--
http://home.inreach.com/mdunn/
"You named the Borg... Hugh?"
-- Guinan
|
|
|
|
|
How do I retrieve the command line arguments from an MFC Dialog Based application
Stephane
|
|
|
|
|
With CWinApp::ParseCommandLine() and after with CCommandLineInfo::ParseParam for get each param.
Cheers!!!
Carlos Antollini.
|
|
|
|
|
You can also use __argv and __argc variables. These are globals maintained by MFC.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi,
I'm using CFileFind to search files:
CListBox* pListBox = (CListBox*)GetDlgItem(IDC_FILE_LISTING);
pListBox->ResetContent();
CFileFind finder;
CString extension = "*.scr";
CString filepath = "";
BOOL haveFile = finder.FindFile(extension);
while (haveFile)
{
haveFile = finder.FindNextFile();
pListBox->AddString((LPCTSTR)finder.GetFileTitle());
}
I want to make it to search for a directory...for example, search c:\abc\cde\*.scr, where my program.exe file is in c:\abc....how can i do that?
|
|
|
|
|
To get the directory where your program is located :
void GetLaunchedDir(CString& strLaunched)
{
TCHAR szFullPath[MAX_PATH];
TCHAR szDir[_MAX_DIR];
TCHAR szDrive[_MAX_DRIVE];
//
// get apps full path
//
::GetModuleFileName(NULL,szFullPath,MAX_PATH);
//
// break full path into separate components
_splitpath(szFullPath, szDrive, szDir, NULL, NULL);
//
// Store apps drive and path
strLaunched.Format(_T("%s%s"), szDrive, szDir);
}
Usage :
CString exePath;
GetLaunchedDir(exePath);
SetCurrentDirectory(exePath);
|
|
|
|
|
Let your function take a starting directory as a parameter (that you pass to FindFile).
Then if you are looking at a directory in your list (IsDirectory()), call your own function with the parameter of the current directory. You will then recursively go through all of your files.
A common 'add' function in your application called from your find routine will let you gather them all up.
--Mark Terrano
www.ensemblestudios.com
(Creators of the Age of Empires series)
|
|
|
|
|
Can somebody help me in showing me how to create different types of view.
I have an MDI app which in one view I would like to show a derived class from CFormView for inserting,updating purpose.
And I want to show Another view with the listings. Of course show each one in separates views.![Cry | :((](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_cry.gif)
|
|
|
|
|
Create another class derived from whatever type of view you want such as CListView, etc. Then use add a splitter window to the MainFrame class and viola. This can also be done in an SDI and would be more practical if you don't need multiple windows since the splitter window can split a single window.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
Hello, I have an MFC application in which when I run one of the .dlls, I wish for the dialog box it pops up to be able to display HTML documents. I'm pretty sure I need to do this with an ActiveX control but I have no clue how to go about doing it .. could someone point me in the right direction?
|
|
|
|
|
You need to use the CHtnlView Class.
The problem is that this class is a View Class, but if you need to use it in a dialog you can see an excelente article of Paul Dilascia in the MSDN magazine or MSJ where Paul used that class in a Dialog.
Check Here http://www.microsoft.com/msj/0100/c++/c++0100.asp
Good luck!!!
Carlos Antollini.
|
|
|
|
|
Anybody knows how can I get an specific parameter of a current CPen object (color, style, or width) and how to change it?
|
|
|
|
|
You can't - you need to make a new one. Use GDI+ for a pen that allows parameter changes.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I suppose you have a CPen object, pen.
Use pen.GetObject() to retrieve a LOGPEN structure.
Modify the parameters you need, then create another CPen to replce the old one. You may also reuse the same object: pen.DeleteObject(); pen.CreatePenIndirect().
If the pen you want to modify is selected into a CDC, use this to get a pointer to a temporary CPen:
CPen* pPen = (CPen*)dc.SelectStockObject(NULL_PEN);
Paolo.
|
|
|
|
|
Hello,
I'm having trouble using the SQLGetPrivateProfileString() method. I have an ODBC Sybase database configured as "123" in the User Data Sources section. This corresponds in the registry to:
\HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\123
I want to retrieve the string value (REG_SZ) "DatabaseSwitches" which just
contains "netbios". I called SQLGetPrivateProfileString() as follows:
int numread =
SQLGetPrivateProfileString(
"123",
"DatabaseSwitches",
sdefault,
buffer,
retbuf,
"ODBC.INI");
and it does not return anything. Any ideas what I'm doing wrong?
Thanks!
Derek
|
|
|
|
|