|
There's following problem :
When I try to add schema to XMLSchemaCache
the program fails.
MSXML2::IXMLDOMSchemaCollectionPtr pSchemaColl(__uuidof(MSXML2::XMLSchemaCache));
//schema ptr
if(pSchemaColl!=0)
{
hr=pSchemaColl->add(_bstr_t(L"x-schema:books"),
_variant_t(L"c:\\temp\\bookschema.xml"));
//here the program fails.
...
}
I tried to load some other XML schema (the one below) and it succeeds.
//=============================================
<Schema xmlns="urn:schemas-microsoft-com:xml-data">
<ElementType name="TITLE" />
<ElementType name="AUTHOR" />
<ElementType name="PUBLISHER" />
<ElementType name="DATE" />
<ElementType name="BOOK" model="closed">
<element type="TITLE" />
<element type="AUTHOR" />
<element type="PUBLISHER" />
</ElementType>
<ElementType name="COLLECTION" model="closed">
<element type="BOOK" />
</ElementType>
</Schema>
//=============================================
[on the other hand XML Spy says that this document is not valid..
but, it doesn't matter - I don't need it]
The problem is that I cannot load (add_method) schema generated/edited
with XMLSpy using MSXML Parser.
For example: XMLSPY claims that the below schema is valid
(both syntax and sematics) , but the VC++ code fails when loading
it (add method).
//=============================================
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:element name="all_devices">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="device" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="device">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="part_name"/>
</xsd:sequence>
<xsd:attribute name="code" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="part_name" type="xsd:string"/>
</xsd:schema>
//=============================================
Is there any namespace conflict or something ?
What do I do wrong. Thanx for any suggestions.
Michal Januszczyk
|
|
|
|
|
I have created a dialog with a grid drawn directly on to it. I use the cursor keys to traverse that grid. However I also have two buttons on the dialog, the cursor keys affect the buttons, by chaning the currently selected button. I have turned tabbing off on the buttons but still the focus changes when the cursor buttons are pressed. Is there a way of stopping this??
Please help me, cos it is driving me nuts!!!!!
Andy
|
|
|
|
|
Try setting focus back to the last selected grid element in the button handlers.
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
I am not actually using any control for the grid, it is directly painted onto the dialog using the PDC*. I somehow need to stop a cursor message getting passed to the buttons, any ideas how?
Andy
|
|
|
|
|
I don't know how to easily do that. You may want to use a different approach. Drawing directly on the dialog's background for purposes other than adornment is probably not a good thing to do.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
When I try to launch an external app with args, it doesn't work. It try to launch an app with name equal to my args. After several tests for string AppName and CommandLine of CreateProcess, when I launch sucessfully app, the external app doesn't receive my args.
My code below:
HANDLE LanceProcess(CString nom_fic_exec,CString paramstring)
{
char param[500];
STARTUPINFO startup_info; // STARTUPINFO
/* Set up the STARTUPINFO structure for the CreateProcess() call */
memset(&startup_info, 0, sizeof(startup_info));
startup_info.cb = sizeof(startup_info);
PROCESS_INFORMATION proc_info; // PROCESS_INFORMATION
strcpy(param,(LPCTSTR)nom_fic_exec);
strcat(param," ");
strcat(param,(LPCTSTR)paramstring);
if (!CreateProcess(NULL,(LPSTR)param,NULL,NULL,TRUE,NORMAL_PRIORITY_CLASS,NULL,NULL,&startup_info,&proc_info)) {
DWORD erreur=GetLastError();
CString chaine;
chaine.Format("Problème lors du lancement du process %s %s",nom_fic_exec,paramstring);
AfxMessageBox(chaine);
}
return(proc_info.hProcess);
}
|
|
|
|
|
Try this. You ought to specify the executable name in first arg of createprocess, and use the second solely for your arguments.
Also, Virtually everything in CreateProcess is nullable. Including the last arg, for process information. But i included that since it looks like you wanted a process handle.
Jon
HANDLE LanceProcess(CString nom_fic_exec,CString paramstring)
{
BOOL bStatus; PROCESS_INFORMATION PI;
CString strProcess = nom_fic_exec;
CString strCommandLine=paramstring;
bStatus=CreateProcess( (LPCSTR) strProcess,
(LPTSTR) strCommandLine.GetBuffer(MAX_PATH),
NULL,
NULL,
TRUE,
NORMAL_PRIORITY_CLASS,
NULL,
NULL,
NULL,
&PI );
if (!bStatus)
AfxMessageBox("your error message);
return PI.hProcess;
}
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
When I try this, the app launch but don't receive the params.
|
|
|
|
|
In fact, it works but I use m_lpCmdLine to detect if there are args and m_lpCmdLine doesn't point on the good command line ( in fact, it seems that this variable is not valid)?
Thanks for your help.
|
|
|
|
|
Hello HF,
I tried 4 separate scenarios with different results. The following is a summary :
1. Using your original code :
if (!CreateProcess(NULL,(LPSTR)param,NULL,NULL,TRUE,NORMAL_PRIORITY_CLASS,NULL,NULL,&startup_info,&proc_info))
1.1 param would hold the string "testapp.exe param1, param2"
1.2 This code works fine.
1.3 I used a sample MFC app for launching.
1.4 CWinApp::m_lpCmdLine points to the parameters correctly (i.e. "param1, param2").
2. Putting "param" as the first parameter :
if (!CreateProcess(param,(LPSTR)NULL,NULL,NULL,TRUE,NORMAL_PRIORITY_CLASS,NULL,NULL,&startup_info,&proc_info))
2.1 param would hold the string "testapp.exe param1, param2"
2.2 This time the CreateProcess() API failed.
2.3 GetLastError() returned value 2 ("The system cannot find the file specified.") which implies strongly that the entire string "testapp.exe param1, param2" is taken as the program name.
2.4 I believe you are already aware of this.
3. Putting the app name as the first parameter and the command line as the second :
char process[256], parameter[256];
strcpy(process,(LPCTSTR)nom_fic_exec);
strcpy(parameter,(LPCTSTR)paramstring);
if (!CreateProcess((LPCTSTR)process,(LPTSTR)parameter,NULL,NULL,TRUE,NORMAL_PRIORITY_CLASS,NULL,NULL,&startup_info,&proc_info))
3.1 process holds the string "TestApp.exe"
parameter holds the string "param1, param2".
3.2 This time, very strangely, CWinApp::m_lpCmdLine holds "param2". But when I call GetCommandLine() in TestApp, the returned string is "param1, param2".
4. Finally, I used the same style as (3) but put a space character at the beginning of the string parameter :
char process[256], parameter[256];
strcpy(process,(LPCTSTR)nom_fic_exec);
strcpy(parameter, " ");
strcat(parameter,(LPCTSTR)paramstring);
if (!CreateProcess((LPCTSTR)process,(LPTSTR)parameter,NULL,NULL,TRUE,NORMAL_PRIORITY_CLASS,NULL,NULL,&startup_info,&proc_info))
4.1 process holds the string "TestApp.exe"
parameter holds the string "param1, param2".
4.2 This time, CWinApp::m_lpCmdLine holds "param1, param2". And GetCommandLine() returned the string " param1, param2" (a space at the front).
I believe using GetCommandLine() instead of using CWinApp::m_lpCmdLine may be a good alternative.
Hope the above helps, HF.
Regards,
Bio.
|
|
|
|
|
Thanks for your answer.
Finally, I have detected the problem with m_lpComdLine in using the class CCommandLine I have found on codeproject.
it seems MSDN talks about this supplementary space but it is not very clear.
I have had difficulties to detect my problem because I use only one parameter and in this case, the m_lpCmdLine contains nothing.
Regards.
HF
|
|
|
|
|
Hello HF,
Most welcome, HF. Glad to be of any help.
Regards,
Bio.
|
|
|
|
|
Hi All,
I'm just playing really, trying to make a skinned app. Success so far from painting my own background, using a non-rectangular window region, and painting non client areas myself.
Thing I can't figure out though is how to make funny sized/shaped non client areas, such as title bar. I can't find a way to change the size at all.
Any ideas??
Jon
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
See:
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
Hi,
I have a DIB that i want to extract a particular region from. So basically i am cropping the DIB.
My problem is i don't want to do this through a DC. Reason been if i have monochrome DIB, selecting it into a device context which is compatible with the screen result in a 24bps image.
Can anyone offer me any advice?
Thanks Again
Richard
|
|
|
|
|
to do this reliably, you'll have to know how to parse all of the different DIB formats - or at least the formats that you know you'll be working with. while this isn't an impossible task, it's certainly not simple. with monochrome (or < 8bpp) you're going to have to do a lot of bit masking and shifting to get at the individual pixels - yuck. things get even worse, if there's the chance you'll be working with RLE DIBs.
but, you can create monochrome DCs, if you want to just use the BitBlt stuff. search the MSDN for "create monochrome DC". it's easy.
-c
Smaller Animals Software, Inc.
|
|
|
|
|
Has anybody used MySQL via MFC? If so please point my in the right direction. Example code / db would be very useful..
"Life begins at 140"
|
|
|
|
|
Use MySql's odbc drivers. You can get these from mysql.com. Then it's just like programmign any odbc source.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Hello
Printing a bitmap using the fraction of code below fails. The bitmap is visible in the preview mode.
int CListCtrlPrint::PrintBitmap (CDC *pDC, CRect rcBmp)
{
BITMAP bm;
CBitmap Bitmap, *pOldBitmap;
CDC memDC;
int nW, nH, nDstW, nDstH;
BOOL bRC;
Bitmap.LoadBitmap (IDB_BITMAP2);
Bitmap.GetBitmap (&bm);
nW = bm.bmWidth;
nH = bm.bmHeight;
memDC.CreateCompatibleDC(pDC);
memDC.SetMapMode(pDC->GetMapMode());
pOldBitmap = memDC.SelectObject (&Bitmap);
nDstW = nW * 10;
nDstH = nH * 7;
CRect rc(rcBmp.left, rcBmp.top, rcBmp.left + nDstW, rcBmp.top + nDstH);
pDC->StretchBlt(rcBmp.left,
rcBmp.top,
nDstW,
nDstH,
&memDC, 0, 0, nW, nH, SRCCOPY);
memDC.SelectObject(pOldBitmap);
return (nDstH + 75);
}
Has anybody any idea what's the problem ?
Thanks
|
|
|
|
|
Could you be more specific? I.e. where does it fail when you step thru the code?
/ravi
"There is always one more bug..."
ravib@ravib.com
http://www.ravib.com
|
|
|
|
|
Hi Ravi,
I do not know where it fails. Looking to the the code below, there are to bitmaps. Loading the resource ID, you see the bitmap on preview, but does not print.
Using the compatible bitmap, I only see a black rectangle and I do yet not know how to load the bitmap here. But this black rectangle is printed.
int CListCtrlPrint::PrintBitmap (CDC *pDC, CRect rcBmp)
{
BITMAP bm;
CBitmap *pBitmap, *pOldBitmap, Bitmap;
CDC memDC;
int nW, nH, nDstW, nDstH;
BOOL bRC;
Bitmap.LoadBitmap (IDB_BITMAP2);
Bitmap.GetBitmap (&bm);
nW = bm.bmWidth;
nH = bm.bmHeight;
memDC.CreateCompatibleDC(pDC);
pBitmap = new CBitmap;
VERIFY(pBitmap->CreateCompatibleBitmap(pDC,nW,nH));
pOldBitmap = memDC.SelectObject (&Bitmap);
//pOldBitmap = memDC.SelectObject (pBitmap);
nDstW = nW * 8;
nDstH = nH * 5;
bRC = pDC->StretchBlt(rcBmp.left,
rcBmp.top,
rcBmp.right + nDstW,
rcBmp.bottom + nDstH,
&memDC, 0, 0, nW, nH, SRCCOPY);
if (!bRC)
AfxMessageBox(_T("Bitmap not drawn"));
memDC.SelectObject(pOldBitmap);
delete pBitmap;
return (nDstH + 75);
}
Perhaps this helps.
|
|
|
|
|
Here is a solution not using StretchBlt() and using memDC.CreateCompatibleDC(NULL) with argument NULL.
int CListCtrlPrint::PrintBitmap (CDC *pDC, CRect rcBmp)
{
// this function prints bitmap
BITMAP bm;
CBitmap Bitmap, *pOldBitmap;
CDC memDC;
int nW, nH;
Bitmap.LoadBitmap (IDB_BITMAP2);
Bitmap.GetBitmap (&bm);
nW = bm.bmWidth;
nH = bm.bmHeight;
memDC.CreateCompatibleDC(NULL); // NULL !
pOldBitmap = memDC.SelectObject(&Bitmap);
pDC->BitBlt(rcBmp.left,
rcBmp.top,
rcBmp.left + nW,
rcBmp.top + nH,
&memDC, 0, 0, SRCCOPY);
memDC.SelectObject(pOldBitmap);
return (nH);
}
Preview and print ok, but bitmap very small (expand bitmap with Paint ...)
|
|
|
|
|
not all printers support StretchBlt. use GetDeviceCaps to test. if it doesn't support StretchBlt, you'll have to use StretchDIBits.
to fix the 'small image' problem, see SetViewportExt, SetWindowExt and SetMapMode.
-c
Smaller Animals Software, Inc.
|
|
|
|
|
Hi all!
How data could be displayed in db grid control using ado are some other technique.Is there anyone who can help me!
Thanks:
imran
|
|
|
|
|
I create a DIALOG project,and put a Edit control on the dialog,then define a variable through DDX:CEdit m_edit;
I create another class in the project,in this class, I want to give the variable 'm_edit' of the dialog a value,so I:
CMyDlg dlg;
dlg.m_edit.SetWindowText("sdjsd");
//or
CMyDlg* dlg;
dlg->m_edit.SetWindowText("sdksdlk");
The two method above is all wrong,help me plx,thanks very
much.
I want to know how to deal other dialog's content.
|
|
|
|
|