|
WH_JOURNALRECORD and WH_JOURNALPLAYBACK
I try to use SetWindowsHookEx() and use two Hook type
WH_JOURNALRECORD and WH_JOURNALPLAYBACK to make
a capture and playback mechanism.
while on WH_JOURNALRECORD ,I store every messages that
the hookproc received,
and On WH_JOURNALPLAYBACK
I feed the messages I stored previously.
It seems works now,but still have some problems
while playback those messages.
1. it has TIME DELAY phenomena.
2. it has some messages lost phenomena.
the lost messages seems depends on system loading..
sometimes won't lost,but some times do if repeat playback
those messages recorded only once.
could someone have been done works like I do..??
any comment will be appreciate..
|
|
|
|
|
I have a dialog window with a CWebBrowser2 control on it, which I use to display a simple HTML report and allow it to be printed. I want the fact it is a web browser control to be transparent to the user, and therefore want to stop the IE menu from appearing when they right click on the control. Does anyone know where I can find code or an explaination on how to do this? I don't have much experience with ActiveX controls, and don't understand the explaination given to someone a while back.
|
|
|
|
|
there is an interface you can use IDocHostUIHandler
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|
|
I am still a bit confused, I tried the following code:
CMyDialog::OnInitDialog()
{
...
DOCHOSTUIINFO *pInfo;
IDocHostUIHandler::GetHostInfo(pInfo);
pInfo->dwFlags = DOCHOSTUIFLAG_DISABLE_HELP_MENU;
...
Am I using IDocHostUIHandler incorrectly? And I don't understand why I am getting undeclared variable errors?
|
|
|
|
|
|
Hi,
In my main application, i've created a thread which must send a message to a Document. Is this possible???
The ::Postmessage(...) work to send a message to a View (the first argument is a handle HWND)...
For the moment I send a message from this thread to the View and that work:
POSITION pos = GetFirstViewPosition();
HWND MyHwnd = (HWND) GetNextView(pos)->GetSafeHwnd();
DWORD error_flag = GetImage(m_pChannel, m_pImage, idcam);
::PostMessage(MyHwnd, WM_DISPLAYERRORMESSAGE, 0, (LPARAM) error_flag);
I want to send a message to the Document to simulate the use of a menu (e.i. "Stop" with the ID = ID_ACQUISITION_STOP)... How to do that...
Thanks in advance.
Hello World!!!
from Raphaël
|
|
|
|
|
Raphaël Kindt wrote:
Is this possible???
It's possible for WM_COMMAND , through the main frame. I have tried for user defined messages and it didn't work.
Anyway, i think the best method is the one you are currently using; it's strange to send messages to documents.
rechi
|
|
|
|
|
Hello everyone,
I am writing a server using winsock overlapped IO functions(WSASend, TransmitFile, and etc). I am wondering what situations will cause those operations exit without sending all packets.
Is is necessary to check the return value whenever an overlapped operation is completed to verify whether the those functions complete sending all data?
And where can I find some sample codes for server-side overlapped io operations?
thanks very much!
Kerry Chou
|
|
|
|
|
When the peer closes the socket prematurely; when a network error occurs; etc etc
#include <beer.h>
|
|
|
|
|
Hi!
I'm using owner draw buttons, and i have the need of making them disabled in some situations, i have this function:
void CMyButton::Activa(CWnd *pWnd, BOOL bEnable)
{
int iCtrl=0;
CString sTexto;
pWnd->EnableWindow(bEnable);
m_ToolTip.DelTool(pWnd, 0);
iCtrl=pWnd->GetDlgCtrlID();
pWnd->GetWindowText(sTexto);
}
This is called by the form class where the button is.
With pWnd i would also like to call its LPDRAWITEMSTRUCT, so i can call
void CMyButton::DrawButton(int nIDCtl, LPDRAWITEMSTRUCT pDI, CString sTexto)
and redesing the button for that situation, i'm not sure if this is the best solution for the propose but its the only i know!
Thank you for your time!
rui
|
|
|
|
|
How can i assign a value to the LPDRAWITEMSTRUCT struct parameters?
I tried :
void CMyButton::Activa(CWnd *pWnd, BOOL bEnable)
{
CRect rc;
pDIS->itemAction = ODA_DRAWENTIRE; <-error
pDIS->hwndItem = pWnd->GetSafeHwnd(); <-error
pDIS->hDC = (HDC)pWnd->GetDC(); <-error
pWnd->GetWindowRect(rc);
pDIS->rcItem = rc; <-error
CString sTexto;
//desactiva a o botao e os seus tooltips
pWnd->EnableWindow(bEnable);
m_ToolTip.DelTool(pWnd, 0);
//vai buscar ourtros dados do botao
iCtrl=pWnd->GetDlgCtrlID();
pWnd->GetWindowText(sTexto);
//passa o estado do botao para uma member variavel
bDisabled=bEnable;
DrawButton(iCtrl, pDIS, sTexto);
}
having
BOOL bDisabled;
int iCtrl;
LPDRAWITEMSTRUCT pDIS;
as member variables
Thank you
|
|
|
|
|
I am trying to create a pen in the following code:
LOGBRUSH logbr;
logbr.lbStyle = BS_SOLID;
logbr.lbColor = RGB(0, 0, 0);
logbr.lbHatch = 0;
if (MyPen.GetSafeHandle() == NULL)
MyPen.CreatePen(PS_COSMETIC|PS_ALTERNATE, 1, &logbr);
CreatePen fails in Win98 and succeeds in other platforms. Does anyone know what is wrong in my code? I need your help.
Thank You
|
|
|
|
|
It seems that W98 is not supporting this feature. Step in the CreatPen call and you will see it.
You should find another soultion for W98 machines.;)
Try this @ home. (B&B)
|
|
|
|
|
Hello!
I don't find a way to dock a bar on the bottom of the frame, above the statusbar.
I'd appriciate your help.
Guy.
|
|
|
|
|
Have you try this ?
In the OnCreate of the MainFrame:
if(!m_MyBar.Create(...)){
return -1; // fail to create
}
m_MyBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_MyLogBar, AFX_IDW_DOCKBAR_BOTTOM);
HTH,
A rock pile ceases to be a rock pile the moment a single man contemplates it, bearing within him the image of a Cathedral[^].
Antoine de Saint-Exupery (1900-1944)
|
|
|
|
|
Yes I did, the problem is that the statusbar is bing positioned above the docked bar and it looks ugly as interface. it might be because of the indicators of the statusbar because in other programs I created in the past this problem didn't occur. thanks for the help anyway, and I'll be glad for new ideas
|
|
|
|
|
Do you create your status bar before your dialog bar ?
A rock pile ceases to be a rock pile the moment a single man contemplates it, bearing within him the image of a Cathedral[^].
Antoine de Saint-Exupery (1900-1944)
|
|
|
|
|
I keep getting an unknown runtime error 3705 or 0x0800A0E79 when I tried to open the recordset.
I tried look them up with VC's "Error Lookup". It says "Message Not Found"...
// ADOSchema.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#define INITGUID
#import "C:\Program Files\Common Files\System\ADO\msado15.dll" rename_namespace("ADOCG") rename("EOF", "EndOfFile")
using namespace ADOCG;
#include "icrsint.h"
void DisplayHR(HRESULT hr, char * lpszErrorMsg)
{
int nCode = -1;
cout << endl;
cout << "ERROR MSG: " << lpszErrorMsg << endl;
nCode = SUCCEEDED(hr);
cout << "SUCCEEDED(hr) = " << nCode << endl;
nCode = HRESULT_SEVERITY(hr);
cout << "HRESULT_SEVERITY(hr) = " << nCode << endl;
nCode = HRESULT_CODE(hr);
cout << "HRESULT_CODE(hr) = " << nCode << endl;
return;
}
int main(int argc, char* argv[])
{
HRESULT hr;
char * pszErrorMsg = NULL;
char * pszTableName = NULL;
char ** pTableArray = NULL;
int nMaxTableNameLength = -1;
int nNumUserTable = -1;
::CoInitialize(NULL);
pszErrorMsg = new char[100];
//STEP 1: Connection object
_ConnectionPtr pConn = NULL;
hr = pConn.CreateInstance( __uuidof(Connection) );
if(hr!=S_OK)
{
//Additional error handling here.
:isplayHR(hr, "ERROR: failed to instantiate connection pointer");
return 1;
}
//Data Source=norm OR 127.0.0.1 (It doesnt matter, it's the default instance)
hr = pConn->Open(L"Provider=sqloledb; Data Source=127.0.0.1; Initial Catalog=realtime", L"sa", L"sa", NULL);
if(hr!=S_OK)
{
//Additional error handling here.
:isplayHR(hr, "ERROR: failed to establish connection with target database");
return 1;
}
//STEP 2: Command object.
_CommandPtr pCmd;
pCmd.CreateInstance( __uuidof(Command) );
pCmd->ActiveConnection = pConn;
pCmd->CommandText = "SELECT * FROM sysobjects";
//STEP 3: Recordset - play with it.
_RecordsetPtr pRs;
try
{
pRs = pCmd->Execute(NULL, NULL, adCmdText);
}
catch(_com_error &e)
{
//Additional error handling here.
cout << "ERROR: Failed to execute command." << endl;
cout << "ERROR msg: " << e.ErrorMessage() << endl;
hr = e.Error();
cout << "ERROR: HRESULT_CODE( e.Error() ): " << HRESULT_CODE(hr) << endl;
return 1;
}
//Null variant:
_variant_t vNull;
vNull.vt = VT_ERROR;
vNull.scode = DISP_E_PARAMNOTFOUND;
try
{
//CursorType: adOpenForwardOnly; LockType: adLockReadOnly; Option: adCmdUnknown
pRs->Open(vNull, vNull, adOpenForwardOnly, adLockReadOnly, adCmdUnknown);
}
catch(_com_error &e) //QUESTION: Runtime error HERE!!! Cant figure out why!!
{
//Additional error handling here.
cout << "ERROR: Failed to open recordset." << endl;
cout << "ERROR: e.ErrorMessage(): " << e.ErrorMessage() << endl; //CAUTION: This turns out to be "Unknown error 0x800A0E79.
hr = e.Error();
cout << "ERROR: HRESULT_CODE( e.Error() ): " << HRESULT_CODE(hr) << endl; //CAUTION: And this turns out to be 3705.
return 1;
}
//STEP 4: Retrieve a list of user tables from sysobjects
nMaxTableNameLength = 100;
pszTableName = new char [nMaxTableNameLength];
pRs->MoveFirst();
while( !EOF )
{
hr = pRs->MoveNext();
if( hr!=S_OK)
{
//Additional error handling here!
DisplayHR(hr, "ERROR: MoveNext");
}
//If field=xType==1, Then the object is a user table. Increment nNumUserTable here.
}
//STEP 4: Get individual table properties: Field/data type/number of records/number of columns/PK-FK.
//STEP 5: Cleanup
delete [] pszTableName;
delete [] pszErrorMsg;
CoUninitialize();
return 0;
}
Can anyone spot the error? i'm dying...
norm
|
|
|
|
|
A quick search in google on 800A0E79 cam up with
Once you have called the Open method on an ADODB.RecordSet object, you must call the Close method before you can reuse it. Check for more than one Open using the same object name, or an Open in a loop without a matching Close
so you need to Close the pCmd object before you Open it again.
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|
|
u're right, i:
pRs->Close
before I pRs->Open(...).
and it worked. all exception suddenly disappeared. The following line must have implicitly openned the recordset...
pRs = pCmd->Execute(NULL, NULL, adCmdText);
I still dont understand, i will search the error code on google and see if i can find a better explanation for this...
if "pRs = pCmd->Execute(NULL, NULL, adCmdText)" implicitly "open" the recordset, then why do we need to call pRs->Open(...)
norm
|
|
|
|
|
Its the connection pConn and you had already opened it and then attached it to your pCmd
hence it was open before you called Execute.
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|
|
My ADO is pretty poor but I don't think you have to open the recordset - I think you can just get on tith reading from it after you have called Execute
Stupidity dies.
The end of future offspring.
Evolution wins.
- A Darwin Awards Haiku
|
|
|
|
|
thanks for the feedback. but one silly question:
what does it mean by pRs->Close()??
pConn->Close() is an API that tells SQL server to drop the connection and it is NOT equivalent to "delete pConn". That's okay and I can understand.
But recordset is a data structure. What do u mean by "closing" a data structure? remove it from memory?
I am confused by the two concepts:
1. closing... a memory/variable?
2. removing a variable from memory/stack/...etc
thanks.
norm
|
|
|
|
|
from MSDN:
"When you have concluded your operations over an open Recordset object, use the Close method to free any associated system resources. Closing an object does not remove it from memory; you can change its property settings and use the Open method to open it again later. To completely eliminate an object from memory, set the object variable to Nothing"
so, what about the connection object associated/attached to a recordset?
norm
|
|
|
|
|
I'm using a CRichEditCtrl object as one of the many windows in an app, and now need to use print preview. I have other windows, such as grids, and everything works fine except....
I'm using RT v3.0 control under NT4/2000/XP. When I ask it to format for printing, the rendering dc and formatting dc are the same (m_hDC and m_hAttribDC respectively), and it looks OK. When I format it for preview, the rendering DC and formatting dc aren't the same (which you'd expect, I guess).
However, it consistently doesn't preview the final line on the 'page' (ie in the rect I've given it. Now I know that it's a preview, but my customers expect WYSIWYG, so they'll complain about missing lines;
I'm rendering to a memory dc and blitting, but I know it's not the blit doing the clipping, as this is 'transparent' to the printing (it's done in OnPrint for every page, and the rect for printing the RTF is way smaller than the page).
Can anyone point to an RTF rendering example that works with MFC's print preview (or not, if it renders to a memory dc!) that doesn't exhibit this problem?
I'm using FormatRange and DisplayBand to do the formatting and rendering, but MSDN seems pretty light on preconditions for these, doesn't mention stuff like mapping modes needed etc, although it seems that the DC has to be MM_TEXT before it works at all.
Steve S
[This signature space available for rent]
|
|
|
|