good morning in MFC what you can do is define a member in your mydialog.h CListBox m_MyListBox; use DDX to link you member with the control. DDX_Control(pDX, IDC_MYLIST_BOX, m_MyListBox) Then to read the content CString sText; int ListSize = m_WLinks.GetCount(); for(int i=0; i!=ListSize; ++i) { m_MyListBox.GetText(iIndex, sText); } Regards Franck
Franck Paquier
Posts
-
Win32 to MFC -
how to convert any format to pdf using C(or)C++ [modified]Hello The best is to use a PDF Printer Driver. it is a virtual printer that you install on your computer and you call when you want to print your document. Somes are free .. and somes not. (PDF995, PDFCreator, Amyuni, ...). Regards Franck
-
_variant_t vItem = pRange->Item[ iRow ][ iCol ]; [modified]i wanted to type
Excel::RangePtr pRange = pSheet->GetRange( _bstr_t(_T("A1") ) );
if ( pRange == NULL ){
return;
}_bstr_t sText= pRange->GetText();
-
_variant_t vItem = pRange->Item[ iRow ][ iCol ]; [modified]code bellow will return you something like: "12:56:32" for a cell containing time.
Excel::RangePtr pRange = pSheet->GetRange( _bstr_t(_T("A1") ) );
if ( pRange == NULL ){
return;
}_bstr_t sText= pRange->GetText(); it exist also something called CellFormat. but i cannot find how to call it. Sorry for the short answer but i do not have good code sample with me right now. regards
-
_variant_t vItem = pRange->Item[ iRow ][ iCol ]; [modified]Hi I think like you do yourself when you watch an excel spread sheet. Either you retrieve the Text dispalyed by the cell and you recognize that it is a time. or you right click on the cell and look at the format of the cell. and you see something like dd:mm:ss Right now in your code you just query the double value of the cell it is not enough. You have to explore your cell deeper in order to be able to make a decision. To do that you can: Getting the STRING/TEXT displayed by the cell. and or the FORMAT associated with the cell. Regards.
-
_variant_t vItem = pRange->Item[ iRow ][ iCol ]; [modified]Hi If your switch detect nothing i guess it is because the date time is really stored as a double inside excel. Your call:
pRange->Item [1][iColumn]
always return the value as a double at least for date and time. To by-pass that i would try to retreive the Text of the cell which is what the cell show. Text if from VBA doc but it should exist the same entry point in automation. In that case i am pretty sure you will recieved the 10:23:00 value. In the web site above there is an explanation about how to translate an excel date time: http://www.cpearson.com/excel/datetime The last soulution: If your date time cell is at a fixed place then just retrieve the value and translate as explain in the above link. Regards Franck
-
_variant_t vItem = pRange->Item[ iRow ][ iCol ]; [modified]Good morning I agree with Richard. You know your excel document. so if you expect to find time cells inside, you should detect that when reading it. I think you could try to retreive from excel the cell format. detect the date time mode and react accordingly. if you cannot find the cell format then if i remeber well you can retreive the value of your cell as a string. in that case i would post analyze it and if something like "07:07:13" is detected i will do the tranformation for a time. bye the way did you try to analyze the type of your read vItem to see what is in the BSTR value for a date time cell ? Regards FRanck.
-
_variant_t vItem = pRange->Item[ iRow ][ iCol ]; [modified]Good morning Are you sure that your cell containing a time value return a string ? may be Excel put in your variant a type which is not compatible with a string you may need to convert it before put in the string. Hope this will help Regards Franck.
-
MFC - Passing data between dialogs in Tab ControlHello, What i usually do in that cases is to use a kind of data model at parent dialog box level. Each tab works only with the data model. You monitor Activation unactivation of each tab and update itself based of changes in the common data model. hope this will help. Regards Franck
-
excel automationgood morning Here are the value for excel 12 ? well the values retrieved from Microsoft.Office.Interop.Excel.dll runtime version v1.1.4322 version 12.0.0.0 public enum XlChartType { xlXYScatter = -4169, xlRadar = -4151, xlDoughnut = -4120, xl3DPie = -4102, xl3DLine = -4101, xl3DColumn = -4100, xl3DArea = -4098, xlArea = 1, xlLine = 4, xlPie = 5, xlBubble = 15, xlColumnClustered = 51, xlColumnStacked = 52, xlColumnStacked100 = 53, xl3DColumnClustered = 54, xl3DColumnStacked = 55, xl3DColumnStacked100 = 56, xlBarClustered = 57, xlBarStacked = 58, xlBarStacked100 = 59, xl3DBarClustered = 60, xl3DBarStacked = 61, xl3DBarStacked100 = 62, xlLineStacked = 63, xlLineStacked100 = 64, xlLineMarkers = 65, xlLineMarkersStacked = 66, xlLineMarkersStacked100 = 67, xlPieOfPie = 68, xlPieExploded = 69, xl3DPieExploded = 70, xlBarOfPie = 71, xlXYScatterSmooth = 72, xlXYScatterSmoothNoMarkers = 73, xlXYScatterLines = 74, xlXYScatterLinesNoMarkers = 75, xlAreaStacked = 76, xlAreaStacked100 = 77, xl3DAreaStacked = 78, xl3DAreaStacked100 = 79, xlDoughnutExploded = 80, xlRadarMarkers = 81, xlRadarFilled = 82, xlSurface = 83, xlSurfaceWireframe = 84, xlSurfaceTopView = 85, xlSurfaceTopViewWireframe = 86, xlBubble3DEffect = 87, xlStockHLC = 88, xlStockOHLC = 89, xlStockVHLC = 90, xlStockVOHLC = 91, xlCylinderColClustered = 92, xlCylinderColStacked = 93, xlCylinderColStacked100 = 94, xlCylinderBarClustered = 95, xlCylinderBarStacked = 96, xlCylinderBarStacked100 = 97, xlCylinderCol = 98, xlConeColClustered = 99, xlConeColStacked = 100, xlConeColStacked100 = 101, xlConeBarClustered = 102, xlConeBarStacked = 103, xlConeBarStacked100 = 104, xlConeCol = 105, xlPyramidColClustered = 106, xlPyramidColStacked = 107, xlPyramidColStacked100 = 108, xlPyramidBarClustered = 109, xlPyramidBarStacked = 110, xlPyramidBarStacked100 = 111, xlPyramidCol = 112, } Regards Franck
-
CreateProcess doesn’t passes command line arguments [modified]good morning Not sure it will solve your problem but did you notice that lpCommandLine is an in out parameter ? in MSDN Help i found the following information: The Unicode version of this function, CreateProcessW, can modify the contents of this string. Therefore, this parameter cannot be a pointer to read-only memory (such as a const variable or a literal string). If this parameter is a constant string, the function may cause an access violation. Hope this will help. Regards Franck
-
direct mapHello You can use the one from the STL. have a look to std::map. Regards Franck
-
Problem using struct as std::map value typehello i am not sure you can put a struct into a map. if i were you i would change the struct into a class with a copy constructor regards
-
Updating window data from other windowgood morning. if you use the mfc doc/view architecture pattern. the update of the views comes from the document by calling UpdateAllViews(). what you should do is: when a form is changed / updated by the user it needs to inform the document about the changes that can then decide of the view updates. hope this will help. Franck.
-
Looking for some "C" source code, Please.Good morning. to check if dayligh saving is on i use the reading of a registry value. Key: HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\TimeZoneInformation Value: DisableAutoDaylightTimeSet [DWORD] if the value exist and is egal to 1 then the Daylight Saving option is ON. [Actually i do not remember where i have found that (may be here)] For the time zone you are in you can use the Win32 methods _gmtime32_s and _localtime32_s and you make the difference. you will have the current value for the time zone. Hope this will help Regards Franck
-
Problem running a .bat file from a C# forms applicationGood morning. May be you should also specify the working directory. or try to launch cmd.exe with your batch file as argument (same command as the one created when you make a shorcut on a batch file: C:\WINDOWS\system32\cmd.exe /k mybatch.bat. Regards.