|
Thank you very much, thank you all.
such a silly question, ha...
|
|
|
|
|
RTTI information is a feature of the C++ language that requires no M$ macros or classes. Just use dynamic_cast, and if the return is NULL, the object was not of the type you were casting to.
The M$ version, like the M$ container classes, were a stopgap, not a replacement.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Has anybody used MySQL via MFC? All I need to do first off is get a noddy database working programmaticly using MySQL in MFC. eg
Name Table:-
(Unique ID,Surname,Forename,DOB,UniqueKey)
Address Table:-
(Unique ID,LineOne,District,Town,County,PostCode)
Contact Table:-
(UniqueID,Number,Type)
Can anybody do this in their coffee break? Im stuck where to start is the problem. Im sure its a doddle though.
"Life begins at 140"
|
|
|
|
|
Really what is the need to repost? I answered your first question. Perhaps you should follow my advice. Read MSDN a little too. People here are happy to help, but not to do your work for you.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
The reason I reposted is that you did not answer my question. I was happy to receive a response: however I do not want to use MyODBC! That is the whole point. It is too slow. I want to use MySQL++ preferably or MySQL c api. Any further constructive responses are welcome.
"Life begins at 140"
|
|
|
|
|
You said you want to use MySQL via MFC, and the MFC database classes are based on ODBC (requiring the use of MyODBC). If you want to use MySQL++ or MySQL C API, you won't be using it via MFC.
|
|
|
|
|
What you said is correct except for one thing. Its not necessary to use CRecordset. If you avoid CRecordset then you dont require ODBC drivers. I have now managed to create a project using MySQL++ api directly. It is many times faster than interfacing to the MySQL api via ODBC eg opening a table via ODBC driver was s - l - o - w ~ 2 seconds a table as opposed to 0.05 seconds using the MySQL++ api directly. That was the question I was asking and which nobody attempted to answer.
"Life begins at 140"
|
|
|
|
|
Bill Gates Antimatter Particle wrote:
Can anybody do this in their coffee break?
Ouch!!!!
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
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"
|
|
|
|
|