|
I'm trying to understand what your class CKSFileDialog does.
Why don't you directly use the CFileDialog class like this -
const char szFilters[]="Excel Files|*.xls;*.xlsx||";
CFileDialog dlg (TRUE, "xlsx", NULL,OFN_FILEMUSTEXIST| OFN_HIDEREADONLY, szFilters,this);
if (dlg.DoModal()==IDOK)
{
SetDlgItemText(IDC_EDIT1, dlg.GetPathName());
}
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
i test code given by you but still exception is same.
|
|
|
|
|
|
|
At one time this was a known problem with CFileDialog . I would have thought it to be fixed by VS2008. It has to do with the size of the OPENFILENAME structure. This structure has three extra members if _WIN32_WINNT >= 0x0500. This causes problems because CFileDialog has a OPENFILENAME member, but MFC itself was built with the smaller size. Since the class in your app will not line up with what is in MFC, it crashes. See the first Q&A here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
thanks for article.
You have any solution for that problem.
|
|
|
|
|
MsmVc wrote: thanks for article.
Which I just realized was close but not the exact one I meant to post. Sorry about that.
MsmVc wrote: You have any solution for that problem.
Did you see the CFileDialogEx class? Have you considered using GetOpenFileName directly?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
yes i try
CFileDialogEx but nothing change in output.Still i am getting exception.
|
|
|
|
|
I am using automation classes to draw chart through excel from VC
Is there any documetation where i can get the values of the variables to passed to ChartType
Ex I have this code
_Application app;
_Workbook newBook;
Workbooks books;
Worksheets sheets;
_Worksheet newSheet;
Charts charts;
_Chart newChart;
COleVariant vOpt((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
//Create Excel server (start Excel)
if(!app.CreateDispatch("Excel.Application"))
{
AfxMessageBox("Can’t start Excel server!");
return;
}
app.SetVisible(true); //set Excel visible
// app.p.put_UserControl(TRUE); //user can operate Excel
books = app.GetWorkbooks();
newBook=books.Open("d:\\wipro1.csv",vOpt, vOpt, vOpt, vOpt, vOpt,
vOpt, vOpt, vOpt, vOpt, vOpt,vOpt, vOpt,vOpt,vOpt);
sheets = newBook.GetSheets();
newSheet = sheets.GetItem(COleVariant((short)2));
charts = newBook.GetCharts();
newChart = charts.Add(vOpt,vOpt,COleVariant((short)1));
newChart.SetName("My chart");
newChart.SetChartType((long)1);
---------------------------
The above code works fine but what variables should be passed to SetChartType ? which Variable corresponds to which charttype?
Prithaa
|
|
|
|
|
good 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
|
|
|
|
|
Hello,
I have used the above chart types and to draw stock volume option
xlStockVOHLC = 91 . The data is arranged properly in excel sheet but how to select data for the chart in columns
i m using the following for data range
_Chart newChart;
Range oRang;
oRang = newSheet.GetUsedRange()
newChart.SetSourceData(oRang,COleVariant((short)1));
pritha
|
|
|
|
|
Hi,
I am trying to automate the opening file in framemaker and then try to convert it into xml file. While opening the file in framemaker i get some dialogs with OK and Cancel button.
For some file these dialogs come up but not for others.
How do i handle these dialogs in my code.
Thanks in advance for any help
|
|
|
|
|
I know that we can launch the Playback tab of the Sound control panel with the command:
rundll32 shell32.dll,Control_RunDLL mmsys.cpl,,0
But if I need to launch the Speaker Properties dialog box programmatically, how can we do that? Do we need to post some Windows message to some process?
Note: Speaker Properties can be found by mouse-clicks via right-clicking the "Speakers" entry on the list control on the "Playback" tab of Sound panel.
Maxwell Chen
|
|
|
|
|
This article[^] seems to be a nice solution to me. Let me try ...
Maxwell Chen
|
|
|
|
|
|
Hello
Does memory mapped file I/O has a real advantage over disk I/O. Because I am trying to read a file using ::ReadFile API (block by block) and compare it with memory mapped file I/O mechanism from http://www.codeproject.com/KB/files/mmfio.aspx I then tried to compare the time taken to read a file of 700MB using both the techniques. I found that the memory mapped file I/O took almost the same time as disk I/O or sometimes more time.
So, would like to know whether memory mapped file I/O does really provide an advantage over disk I/O and how do I achieve it.
Thanks
|
|
|
|
|
When reading the complete contents of a file, possibly not. However, with a big file, if you only want to read separate parts of the file, memory mapping gives you the convenience of memory-style accesses, and will only read the pages of the file you touch (whatever the page size of the VM system is). Consider if you wanted to read the first and last bytes of that file - you could map the whole file, read the first byte and the last byte and the disk IO system would have read two pages (2 x 4kB?). And you read those bytes through pointers.
Another advantage - memory mapped IO sections can be defined using pointers (pointer to start, pointer to end), which are random-access iterators as far as the STL is concerned. File iterators in STL are forward-only iterators.
I generally prefer to use memory-mapping when possible, as it's (IMO) easier to manage and use, mainly because of the STL related iterator thing.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,all
I have a windows service program with a service,and I can use "myservice/service" in cmd.exe,it sucess!
then,I can see the service in control pane,I also can start up this service;
But, this service can't run my code; why??
the whole code here
void yourfunction()
{
for (int a =0; a<10; a++)
::MessageBoxA(NULL, "ggg", "ghgh" ,MB_OK);
}
SERVICE_STATUS ServiceStatus =
{
SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS,
SERVICE_STOPPED,
SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_PAUSE_CONTINUE | SERVICE_ACCEPT_PAUSE_CONTINUE,
0,0,0,0
};
TCHAR szSvName[]=TEXT("Myservice1");
SERVICE_STATUS_HANDLE hStatus;
SC_HANDLE SCMger;
void WINAPI ControlHandler(DWORD request);
void ServiceMain(int argc, char* argv);
void CreateMyService()
{
SCMger=OpenSCManager(NULL,NULL,SC_MANAGER_ALL_ACCESS);
CreateService(
SCMger,
szSvName,
szSvName,
SERVICE_START,
SERVICE_WIN32_OWN_PROCESS,
SERVICE_AUTO_START,
SERVICE_ERROR_IGNORE,
TEXT("c:\\myservice1.exe"),
NULL,
NULL,
NULL,
NULL,
NULL);
}
int main()
{
SERVICE_TABLE_ENTRY ServiceTable[2];
ServiceTable[0].lpServiceName = szSvName;
ServiceTable[0].lpServiceProc=(LPSERVICE_MAIN_FUNCTION)ServiceMain;
ServiceTable[1].lpServiceName = NULL;
ServiceTable[1].lpServiceProc= NULL;
if(StartServiceCtrlDispatcher(ServiceTable)==0)CreateMyService();
}
//this fun also can't be debug,can't run
void ServiceMain(int argc, char* argv)
{
hStatus = RegisterServiceCtrlHandler(szSvName,ControlHandler);
ServiceStatus.dwCurrentState = SERVICE_START_PENDING;
ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_SHUTDOWN;
SetServiceStatus(hStatus,&ServiceStatus);
ServiceStatus.dwWin32ExitCode = NO_ERROR;
ServiceStatus.dwCheckPoint = 0;
serviceStatus.dwWaitHint = 0;
ServiceStatus.dwCurrentState = SERVICE_RUNNING;
SetServiceStatus(hStatus,&ServiceStatus);
yourfunction();
ServiceStatus.dwCurrentState = SERVICE_STOPPED;
SetServiceStatus(hStatus,&ServiceStatus);
}
//this fun can't be debug,can't run
void WINAPI ControlHandler(DWORD request)
{
switch(request)
{
case SERVICE_CONTROL_SHUTDOWN:
ServiceStatus.dwCurrentState = SERVICE_STOPPED;
SetServiceStatus(hStatus,&ServiceStatus);
break;
}
}
|
|
|
|
|
|
|
|
thank you Snakefoot, I finish it;
|
|
|
|
|
Hi, I am building an application using the OGRE 3D engine and Rebecca API for AIML. The problem is when creating a NetworkAimlFacade object. Its constructors need the "int argc, char* args[]" that are normally in the main method. But I'm not using any main method and I am building an independent class based on a sample console application:
Here is my class:
class ChatBot
{
private:
NetworkGraphBuilder* builder;
public:
ChatBot(){
NetworkAimlFacade aiml(argc, args);
NetworkGraphBuilder &builder = aiml.getNetworkGraphBuilder();
string botName = builder.getBotPredicate("name").c_str();
StringPimpl response = builder.getResponse("connect");
}
string askQuestionAndGetAnswer( string input )
{
StringPimpl strPimText;
builder->getResponse(strPimText);
string responseString = strPimText.c_str();
return (responseString);
}
};
Here is part of the console sample:
int main (int argc, char* args[])
{
NetworkAimlFacade aiml(argc, args);
Can anyone tell me if it is possible to initialize the "argc" and "args" variables with out the main method? (I've tried a couple of ways but they don't work
|
|
|
|
|
try another signatures in Constructor ..is it possible ??
|
|
|
|
|
argc and argv together define an array of strings. Typically they are used to pass arguments from command line to an application but it is not necessary that arguments should come from command line.
In the context of NetworkAimlFacade, just think of a class with constructor taking two arguments. First is the size of an array and second argument is the pointer to array. Read the NetworkAimlFacade documentation to see what parameters does it except. If it is the case that it can work with default settings, when no arguments are passes then you use NetworkAimlFacade aiml(0, 0);
-Saurabh
|
|
|
|
|