|
Hi, i am sending these types:
<br />
_ConnectionPtr m_pConn;<br />
_RecordsetPtr pRecordset;<br />
_CommandPtr pCommand;<br />
<br />
these code helps you to understand:<br />
<br />
<br />
void cReadText::ConnectionAdo() <br />
{<br />
bConnected = true;<br />
<br />
try <br />
{<br />
HRESULT hr = m_pConn.CreateInstance (__uuidof (Connection));<br />
<br />
if (FAILED (hr))<br />
{<br />
AfxMessageBox ("Can't create intance of Connection");<br />
}<br />
if (FAILED (m_pConn->Open (_bstr_t("Provider=Microsoft.Jet.OLEDB.4.0;Data Source = <big>EmailReminder.mdb</big>;"),<br />
_bstr_t (""), _bstr_t (""), adModeUnknown)))<br />
{<br />
AfxMessageBox ("Can't open datasource");<br />
} <br />
}<br />
catch( _com_error &e )<br />
{<br />
_bstr_t bstrSource(e.Source());<br />
_bstr_t bstrDescription(e.Description());<br />
TRACE( "Exception thrown for classes generated by #import" );<br />
TRACE( "\tCode = %08lx\n", e.Error());<br />
TRACE( "\tCode meaning = %s\n", e.ErrorMessage());<br />
TRACE( "\tSource = %s\n", (LPCTSTR) bstrSource);<br />
TRACE( "\tDescription = %s\n", (LPCTSTR) bstrDescription);<br />
AfxMessageBox ((LPCTSTR) bstrDescription);<br />
AfxMessageBox ((LPCTSTR) e.Source());<br />
<br />
<br />
bConnected = false;<br />
<br />
}<br />
catch (...)<br />
{<br />
bConnected = false;<br />
}<br />
<br />
<br />
}<br />
<br />
void cReadText::RunCammand(_bstr_t SQL)<br />
{<br />
<br />
m_pConn->Execute(SQL,NULL,adExecuteNoRecords);<br />
<br />
}<br />
<br />
_RecordsetPtr cReadText::GetRecordset(_bstr_t SQL)<br />
{<br />
<br />
pCommand.CreateInstance (__uuidof (Command));<br />
pCommand->ActiveConnection = m_pConn; <br />
pCommand->CommandText = SQL; <br />
pRecordset.CreateInstance (__uuidof (Recordset));<br />
pRecordset->CursorLocation = adUseClient;<br />
pRecordset->Open ( (IDispatch *) pCommand, vtMissing, adOpenStatic,adLockBatchOptimistic, adCmdUnknown);<br />
return pRecordset;<br />
<br />
}<br />
<br />
|
|
|
|
|
Hi All,
Please help me to solve my problem.
I've an MFC ActiveX control(.OCX) and i created this control in one of my Extension Dll's View class(derived from CView).This view has been placed in the SDI Splitter window application as one of the view.Every thing is working fine but when i close the Application window i'm getting the Assertion in "Release" Configuration but the assertion is not in "Debug" configuration.when i check with message boxes ,all the destructors are called in order. After all destructors completed i'm getting Assertion.
Can any one give me the Solution for my problem. Thanks in Advance.
|
|
|
|
|
|
You can use AfxMessageBox function to deflate the error code.
|
|
|
|
|
i configured fisrt service failure action of "alerter" servie as "Action Run Command" with commandline "C:\\myfile.exe" ,using services.msc under winxp .
i tried to retrieve the filename using the following code ...
int main()
{
BYTE* Buf = NULL ;
DWORD dwNeeded = 0 , dw = 0 ;
SC_HANDLE hSCManager , hService ;
hSCManager = OpenSCManager( NULL , SERVICES_ACTIVE_DATABASE , SC_MANAGER_ALL_ACCESS ) ;
hService = OpenService( hSCManager , "Alerter" , SERVICE_ALL_ACCESS ) ;
QueryServiceConfig2( hService , SERVICE_CONFIG_FAILURE_ACTIONS , (LPBYTE)Buf , 0 , &dwNeeded ) ;
printf( "BufSize = %d\n" , dwNeeded ) ;
Buf = new BYTE[ dwNeeded ] ;
if( QueryServiceConfig2( hService , SERVICE_CONFIG_FAILURE_ACTIONS , (LPBYTE)Buf , dwNeeded , &dw ) )
{
for( int i = 0 ; i < ((SERVICE_FAILURE_ACTIONS*)Buf)->cActions ; i ++ )
{
if( ((SERVICE_FAILURE_ACTIONS*)Buf)->lpsaActions[ i ].Type == SC_ACTION_RUN_COMMAND )
{
if( ((SERVICE_FAILURE_ACTIONS*)Buf)->lpCommand )
{
printf( "Actions : %d\nFile : %s\n" , ((SERVICE_FAILURE_ACTIONS*)Buf)->cActions , ((SERVICE_FAILURE_ACTIONS*)Buf)->lpCommand ) ;
}
}
}
}
printf( "%d" , (sizeof(SC_ACTION) )) ;
if( Buf )
delete[] Buf ;
CloseServiceHandle( hService ) ;
CloseServiceHandle( hSCManager ) ;
}
i got the output
BufSize = 78
Actions : 3
File :
//can any one tell me where is the problem in my code ? why i was unable to retrieve filename ?
Thanks & Regards
|
|
|
|
|
How can I intercept the media stream when an application like media player starts playing a movie, so that the encoded stream can be send to a remote client?
|
|
|
|
|
I don't know about intercepting a media stream - that's a hack.
You can, however, use the Windows Media SDKs[^] to manipulate media streams
however you need to.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
How can I register a perticular extension files with my application ? It is a dialog based application, so i can't use RegisterShellFileTypes. Please tell me the other way.
|
|
|
|
|
Hi Friends
In my program contains one main window and too many child windows arranged horizontally to fill the whole main window. I like to draw a rectangle in main window. But it not seen properly, i think rectangle is painted behind the child windows. How to paint rectangle in front of child windows.
please help me !!!
thanks in advance
-RisKhan-
|
|
|
|
|
Draw Rectangle on your rootDC handle
Is this your answer?
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
Draw rectangle on your rootDC(main) handle.
Is this your answer??
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
You draw on the main window now whats your problem you cant see it?
|
|
|
|
|
Hi hamid
Actually the rectangle is shown behind the child windows. If i put a MsgBox in OnPaint i can see well.
-RisKhan-
|
|
|
|
|
Thats why i told you put it on your rootdc(main screen) handle
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
Thats why i told you put it on your rootdc(main screen) handle
Do you have check it?
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
Why you send dobule posts?
|
|
|
|
|
I dont know.
Nut when i am posting it shows some error message that message not send and when i send it again then it will be sent.
and in Message list it display two times.
Is this a website problem?
Manish Patel.
B.E. - Information Technology.
|
|
|
|
|
You can write to Suggestions and Bug Reports forum if you think its a problem for you.
|
|
|
|
|
|
|
|
Well if you dont need to child windows you can hide them?
|
|
|
|
|
I have a dll I'm trying to plug in to someone else'e code. That DLL needs to have a few functions and I want to maintain a database connection inside the DLL over multiple functions calls in to the DLL. (Connecting and disconnecting inside each function call would be wasteful and possibly too slow). So I created a global pointer and assigned the pointer in the init function call. Like this:
Init function
CConnection* Connection = new Connection;
Data Access Function
Connection is now equal to null.
Initially I though the DLL was being reloaded so I have added logging functions and it is not. Why would a DLL lose the state of it's globals? Is there something different I can try to maintain state in a DLL?
|
|
|
|
|
This [http://support.microsoft.com/kb/125677] may help you.
- Malli...!
|
|
|
|
|
My project is SDI that use multiview.
When swap view to another I also want disable the old toolbar and change to the new one.
Please advise,How can I do this.
|
|
|
|