|
Hi.
Is it easy to integrate XPath functions into regular XML files?
selectNodes() is not a member function of IXMLDocument for example
|
|
|
|
|
JensB wrote:
Is it easy to integrate XPath functions into regular XML files?
I don't know what you mean. If you are using any parser that supports XPath queries ( MSXML does ) then it is integrated for you. You construct the XPath statement through whatever means is required to solve the current problem. You provide the statement as a text string to the parser engine (with MSXML it is the IXMLDOMDocument::SelectNodes() and SelectSingleNodes() methods) and it returns a node list of all nodes matching the XPath statement.
JensB wrote:
selectNodes() is not a member function of IXMLDocument for example
It is a member of IXMLDOMDocument. It inherits that method as well as selectSingleNode() from the IXMLDOMNode interface. That allows you to execute relative XPath statements.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/xmmthselectnodes.asp[^]
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Yes. This is verry handy and works great. I wasn't aware of the existence of 'XPath'.
Thanks alot for the excellent help.
Greetings,
Jens
|
|
|
|
|
Hello,
How does one do about rebuilding Classwizard's data/info?
I have just created some projects from scratch by adding the appropriate source files to them but, unfortunately, I seem to have lost all Classwizard data. Not that it matters the world, but ClassWizard is indeed handy.
Is there anything I can do to (re)solve this?
Thanks,
David
|
|
|
|
|
Delete the .CLW file from your project directory and then class wizard will rebuild the information the next time you run the class-wizard.
Michael
CP Blog [^]
|
|
|
|
|
Hi there,
The problem is I didn't even have a .CLW file. I just added the source files I needed in to a blank static-lib project hoping that ClassWizard would then be available... but no chance! The menu item is even disabled.
What should I do now?
|
|
|
|
|
ClassWizard is a MFC facility. I'm not sure if class-wizard is supported in a static-lib, even if you set-up the lib to use MFC. I only have one static lib that uses MFC and I can't see any options to enable class-wizard for it.
Michael
CP Blog [^]
|
|
|
|
|
Hai all,
I am doing an application VC++ 6.0 MFC.
In my application, I have to add folders in the TreeView Control.
The folders are physically present in a system directory.
If i choose a folder from the Treeview, the contents of the folder
should be displayed in a ListView Control.
how can i place a physical folder in a ListView Control and navigate through it?
please help me.
With thanks and regards
Arun Chakaravarthy.
|
|
|
|
|
I hope this will help you,
The ListView sample demonstrates the extended ListView styles and item indenting.
File: ListView.c
HANDLE g_hInst;
TCHAR szClassName[] = TEXT("ListViewClass");
BOOL g_bCustomDraw;
#define IDC_LISTVIEW 1000
WinMain
int PASCAL WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MSG msg;
INITCOMMONCONTROLSEX iccex;
//required to use the common controls
iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);
iccex.dwICC = ICC_LISTVIEW_CLASSES;
InitCommonControlsEx(&iccex);
g_hInst = hInstance;
if(!hPrevInstance)
if(!InitApplication(hInstance))
return FALSE;
/* Perform initializations that apply to a specific instance */
if (!InitInstance(hInstance, nCmdShow))
return FALSE;
/* Acquire and dispatch messages until a WM_QUIT uMessage is received. */
while(GetMessage(&msg, NULL, 0x00, 0x00))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
/******************************************************************************
MainWndProc
******************************************************************************/
LRESULT CALLBACK MainWndProc( HWND hWnd,
UINT uMessage,
WPARAM wParam,
LPARAM lParam)
{
switch (uMessage)
{
case WM_CREATE:
{
HWND hwndListView;
g_bCustomDraw = FALSE;
// create the TreeView control
hwndListView = CreateListView(g_hInst, hWnd);
//initialize the TreeView control
InitListView(hwndListView);
}
break;
case WM_NOTIFY:
return ListViewNotify(hWnd, lParam);
case WM_SIZE:
ResizeListView(GetDlgItem(hWnd, IDC_LISTVIEW), hWnd);
break;
case WM_INITMENUPOPUP:
UpdateMenu(GetDlgItem(hWnd, IDC_LISTVIEW), GetMenu(hWnd));
break;
case WM_CONTEXTMENU:
if(HandleContextMenu(hWnd, wParam, lParam))
return FALSE;
break;
case WM_COMMAND:
return HandleCommand(hWnd, wParam, lParam);
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
break;
}
return DefWindowProc(hWnd, uMessage, wParam, lParam);
}
/******************************************************************************
AboutDlgProc
******************************************************************************/
BOOL CALLBACK AboutDlgProc( HWND hDlg,
UINT uMessage,
WPARAM wParam,
LPARAM lParam)
{
switch (uMessage)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
switch(wParam)
{
case IDOK:
EndDialog(hDlg, IDOK);
break;
case IDCANCEL:
EndDialog(hDlg, IDOK);
break;
}
return TRUE;
}
return FALSE;
}
IF you need further details visit microsoft.com ListViewControl
|
|
|
|
|
Hi everybody,
I need to write a kind of scheduler program in MFC. As far as I know there is a SeTTimer
funtion but it only gives me periodic ON_TIMER message which is not a proper way to alert the program ,for example, at 03.agu.2004 16:30:00.
Please guide me.
Thanks,
Muharrem
|
|
|
|
|
here is you r solution buddy
,just check the current time every time the WM_TIMER message Generate.
like this way
CTime tm=CTime::GetCurentTime();
-----------------------------
"I Think It will Work"
Formerly Known As "Alok The Programmer" at CP
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Don't you think It is not necessary to check every ,let say, one second if
time has alredy expired or not. I assume there should be some way shorter and smarter
to set a kind of timer for an absolute time. But I don't know how?
Any way thanks for your reply.
Muharrem
|
|
|
|
|
This sounds like a job for the ITaskScheduler interface. See also the ITask and ITaskTrigger interfaces.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I am just starting with C++, and have a problem. I wrote a text game but the thing is some times I want the new question etc to start at the top of a clean black screen (that is erase all previous lines).
I could just put a pile of endl; but a couple of days ago somewhere on the site I saw a clrScrn; statment or something like that and remembered BASIC.
Could someone tell me the the #include and the correct way to use it.
Thanks in advance!
|
|
|
|
|
the DOS-command 'cls' clears the screen.
If you can execute this command...
Good luck.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
Here is you solution
If you working in Text mode
see cls() function it is defined in <conio.h>
if you working in Graphis mode
see function cleardevice() ,it is defiend in graphics.h
-----------------------------
"I Think It will Work"
Formerly Known As "Alok The Programmer" at CP
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
>>erase all previous lines).
For dos baserd compiler... the function is: clrscr();
The header file for it is #include<conio.h>
conio=Console I/O
I hope that makes you happy.
...Avenger
Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
|
|
|
|
|
im assuming you have Visual C++, unfortunatly VC++ doesnt come with the old functions like gotoxy() or clrscrn() that Dev-C++ offers
here is a ClearScreen() function i wrote along time ago (with SetXY() function)
void SetXY(int X, int Y){
COORD dwCoord;
dwCoord.X = X;
dwCoord.Y = Y;
SetConsoleCursorPosition(STDHANDLE,dwCoord);
}
void ClearScreen(){
COORD dwCoord;
DWORD nLength;
DWORD lpResult;
CONSOLE_SCREEN_BUFFER_INFO Info;
GetConsoleScreenBufferInfo(STDHANDLE, &Info);
dwCoord.X = 0;
dwCoord.Y = 0;
nLength = Info.dwSize.X * Info.dwSize.Y;
FillConsoleOutputCharacter(STDHANDLE, ' ', nLength, dwCoord, &lpResult);
SetXY(0,0);
}
ohh i almost forgot
#define STDHANDLE GetStdHandle(STD_OUTPUT_HANDLE)
|
|
|
|
|
I want to log data into MS-ACCESS from my application.
But if a machine does not have MS-ACCESS, will the application hang?
i also found that there is a microsoft access driver which is really needed instead of MS-ACESS.
Now in my application, i want to first search for the driver(instead of assuming that it is present) and then start logging. Can any1 please give me some knowledge in this matter?
|
|
|
|
|
A lot depends on the method you are using to communicate with Access?
With ADO, you should just need to redistribute MDAC.
This[^] article tells you the files need for redistributing a DAO app.
Michael
CP Blog [^]
|
|
|
|
|
i seem to be having a problem using GetFileSize in MFC
when i get the file size of anything other than an .exe it returns 0
code sample
hFile = ::CreateFile( m_FileToSplit, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
if( hFile != INVALID_HANDLE_VALUE )
{
dwFileSize = ::GetFileSize( hFile, NULL );
//doesnt seem to work
//m_FileSize.Format( "File Size: %d KB", dwFileSize );
/**/
if( dwFileSize >= 0x100000 )
{
m_FileSize.Format( "%d%s", (dwFileSize/0x100000), " MB" );
}
else if( dwFileSize >= 0x40000000 )
{
m_FileSize.Format( "%d%s", (dwFileSize/0x40000000), " GB" );
}
else
{
m_FileSize.Format( "%d%s", (dwFileSize/0x100000), " KB" );
}
/**/
CloseHandle( hFile );
}
as you may have noticed my other problem
m_FileSize.Format( "File Size: %d KB", (dwFileSize /0x100000) );
doesnt work while
m_FileSize.Format( "%d%s", (dwFileSize/0x100000), " KB" );
does anyone know why?
extra prob: m_OutputDir.Format( "%s\\%s\\Output", FileDrive, FilePath );
puts double slashes in the edit box, when i do
m_OutputDir.Format( "%s\%s\Output", FileDrive, FilePath );
it only puts single slashes, and i get a warning that \% and \O are not valid escape sequences
|
|
|
|
|
»Archer282« wrote:
//doesnt seem to work
Which means what? Is an error produced? Does the compiler complain? Does GetFileSize() return the wrong size? Does Format() not format the number correctly? Is an assertion fired, or an exception thrown?
How about:
HANDLE hFile = ::CreateFile(m_FileToSplit, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile != INVALID_HANDLE_VALUE)
{
DWORD dwFileSize = ::GetFileSize(hFile, NULL);
if (dwFileSize != INVALID_FILE_SIZE)
{
CString m_FileSize;
if (dwFileSize < 0x100000)
m_FileSize.Format("%f KB", (dwFileSize / 1024.0));
else if (dwFileSize < 0x40000000)
m_FileSize.Format("%f MB", (dwFileSize / 1048576.0));
else
m_FileSize.Format("%f GB", (dwFileSize / 1073741824.0));
}
CloseHandle(hFile);
}
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
char temp[] = "1.15";
double dbl = atof(temp);
If I run this code in Visual Studio 6 dbl = 1.15
If I run this code in Visual Studio 2003 dbl = 1.1499999999999999
Can anyone explain this for me please
|
|
|
|
|
i dont know what that would happen.
but you could alwase round it up (i think there is a round function that would suit if not you could always make your own)
|
|
|
|
|
Exactly what is telling you those values ?
I am willing to bet that if you look at the 8-byte binary value they will be identical. It is the output display that is the only thing that differs. If you use a format specifier of "%.2f" with one of the printf family of functions (print, sprintf, or fprintf) I expect that you will see 1.15.
It is important to note that it is virtually impossible to acquire exactly accurate floating point values. There are nearly always rounding errors involved that you must just deal with.
__________________________________________
a two cent stamp short of going postal.
|
|
|
|