|
Well, have you tried MSDN? The documentation for SetWindowsHookEx() [^] tells you exactly what you want!
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
sorry,I have not read it carefully,I have got it:
Hook Scope
WH_CALLWNDPROC Thread or global
WH_CALLWNDPROCRET Thread or global
WH_CBT Thread or global
WH_DEBUG Thread or global
WH_FOREGROUNDIDLE Thread or global
WH_GETMESSAGE Thread or global
WH_KEYBOARD Thread or global
WH_MOUSE Thread or global
WH_MSGFILTER Thread or global
WH_SHELL Thread or global
WH_SYSMSGFILTER Global only
WH_JOURNALPLAYBACK Global only
WH_JOURNALRECORD Global only
WH_KEYBOARD_LL Global only
WH_MOUSE_LL Global only
|
|
|
|
|
I am using TrackPopupMenu() to display a popup menu and allow a user to make a selection. I would like to have an event occur (have a method called) each time the selected item in the menu changes. In other words, as the user moves the mouse up and down the menu, as a menu item becomes selected (not clicked, simply highlighted), I would like an opportunity to take an action (such as display information regarding what will occur if the user selects that menu option).
Thanks
|
|
|
|
|
I was able to accomplish my goal by handling WM_MENUSELECT;
Thanks
|
|
|
|
|
I struggled whether to post this question here in in the COM forum, but I ultimately decided the answer is more of a generic C++ question rather than C++ so I am posting it here
MFC6 has the CHtmlView class and like most classes in MFC using visual studio you can quickly add an handler for the events fired by the IWebBrowser2 actually according to MSDN (AFAIK)
it's the WebBrowser...cuz IWebBrowser2 doesn't seem to have events
BEGIN_EVENTSINK_MAP(CHtmlView, CFormView)
ON_EVENT(CHtmlView, AFX_IDW_PANE_FIRST, 104 , OnDownloadComplete, VTS_BSTR)
END_EVENTSINK_MAP()
Then in your derived CHtmlView class you override a virtual function OnDownloadComplete and voila you now have the ability to tell when a document has been fully loaded.
How does MFC accomplish this task of event sinking, etc all with a couple of macros? I looked at the macros and I couldn't make anything of them
Basically I want to use this same technique, but on a different interface...so I can avoid all the mumbo jumbo that goes along with capturing events sent from IHTMLDocument2, etc...
Anyone care to shed some light on how this is accomplished?
Thanx in advance
Cheers
How do I print my voice mail?
|
|
|
|
|
Is it possible? And where To Find the full information about this Dll, and it's possibilities (IXMLDOMdocument, IXMLDomNode.....)?
I've already posted this question, but no one answered.
So, please help.
|
|
|
|
|
Try "save" function in IXMLDOMDocument.
You just have to give the File Name as the parameter.
|
|
|
|
|
Yes , i tried this function, and i tried to change some data in existing xml file - and i succeded. But when i try to create a NEW XML file (insert new Nodes - this is my problem). Could you please write a short example?
Thank you.
|
|
|
|
|
IXMLDOMDocument *pDomDoc;<br />
<br />
CComVariant vFileName("C:\\MyXML.xml");<br />
VARIANT_BOOL vBool;<br />
pDomDoc->loadXML(L"<root><child></child></root>",&vBool);<br />
<br />
VARIANT V;<br />
V.vt = VT_I4;<br />
V.lVal = 2;<br />
<br />
hResult = pDomDoc->createNode(V,strName,L"",&pXMLDOMNode);<br />
<br />
IXMLDOMElement *pDomElement;<br />
pDomDoc->get_documentElement(&pDomElement);<br />
<br />
IXMLDOMNodeList *pDomNodeList;<br />
pDomElement->get_childNodes(&pDomNodeList);<br />
<br />
IXMLDOMNode *pChildNode = NULL;<br />
pDomNodeList->nextNode(&pChildNode );<br />
<br />
IXMLDOMNamedNodeMap *pXMLAttributes = NULL;<br />
pChildNode->get_attributes(&pXMLAttributes);<br />
<br />
IXMLDOMNode *pXMLAttrNode = NULL;<br />
pXMLAttributes->setNamedItem(pXMLDOMNode,&pXMLAttrNode);<br />
pDomDoc->save(vFileName);
|
|
|
|
|
Hi dear!
I'd like to put a scrollbar's tap on last position.
My program created much some results files since it runned for a couple hours.
So It is tiresome to find last test result's file because there are a lot file in that directory.
Every time I had to move to last position in scroll bar even though annoying.
-------- problem section in my program -------
CFileDialog dlg(TRUE, sFi , NULL, OFN_HIDEREADONLY|OFN_NOCHANGEDIR|
OFN_ALLOWMULTISELECT,//|OFN_VALIDATE, NULL, this);
SCROLLINFO scrInfo;
int nPos, nMin;
HWND hDlg = dlg.m_hWnd;
dlg.GetScrollRange(SB_HORZ, &nMin, &nPos);
nPos = scrInfo.nMax;
dlg.SetScrollPos(SB_HORZ, nPos);
This didn't fine out right valuse for nMin and nPos.
I would be very happy if anyone replay me any answer concering it,
I've wasted a couple week already.
yours sincerely
|
|
|
|
|
Ok, I'm still using VC++ 6.0 (non MFC) coding to create a child window. I did the following on my callback wndproc function:
case WM_NCCREATE:<br />
if (CreateWindow (szWindowClass, "This Window", WS_CAPTION | WS_SYSMENU | WS_CHILD | WS_VISIBLE,<br />
200, 200, 300, 250, hWnd, (HMENU) 0xFF00, hInst, NULL) == NULL)<br />
{<br />
MessageBox (NULL, "Can't create child window", ERROR, MB_OK);<br />
}<br />
return DefWindowProc(hWnd, message, wParam, lParam);<br />
The problem is the child window's title bar is already grey (just like the focus isn't on the window). We know if a window is on the focus the title bar should be blue. Yet, the main window title bar is always blue, meanwhile no matter what I do, the child window title bar is always grey.
I've been looking for the solution for a while, but don't know what the problem is. I downloaded some MFC examples (can't find a VC++ ex.), those have child windows are working fine...so, I'm very lost about what the problem is.
Thanks for any advices.
|
|
|
|
|
I was hoping someone could point me to a good resource that would explain how to access data in MS Access database, join tables, get specific information (not info from all columns), and export the data in an excel file. I know this is a lot to ask for but if there was a resource on the MS Access portion (getting and joining), that would be more than sufficient. I have looked at various articles on this website and found them useful to the point that I can now open a MS Access db and get the information from one table but I need certain information from several tables that need to be joined. Any ideas?
|
|
|
|
|
well as far as accessing access database is concerned there is nothing better than Visual Basic as it provides in built functions for all kind of data processing. and moreover if u will search this site a bnit more u will be able to find urself various means to export the data to any other application including excel. cheers!
Sachin Jain
Software Developer
|
|
|
|
|
I have for some time used a small DLL that, when loaded, then loads a VB ActiveX dll by creating an instance of its registered class.
I can inject this DLL into any target process without problem, but only if I use a hook-based injection method. If I inject it with CreateRemoteThread (using LoadLibrary, etc) the DLL falls over trying to create the same objhect.
Does anybody have any idea what the difference might be?
Cheers
|
|
|
|
|
How can I get the HDC from CBitmap or HBITMAP in Visual C???
I need to use BitBlt:
BOOL BitBlt(
HDC hdcDest, // handle to destination DC
int nXDest, // x-coord of destination upper-left corner
int nYDest, // y-coord of destination upper-left corner
int nWidth, // width of destination rectangle
int nHeight, // height of destination rectangle
HDC hdcSrc, // handle to source DC
int nXSrc, // x-coordinate of source upper-left corner
int nYSrc, // y-coordinate of source upper-left corner
DWORD dwRop // raster operation code
);
but I don't know how to get the HDC from a CBitmap or a HBITMAP from BMP files.
Tkz
MarQua
|
|
|
|
|
HDC does not come from the CBitmap or HBITMAP. If you want to get the HDC for a window do something like below:
CDC* pDC = GetDC();
HDC hdc = pDC->GetSafeHDC();
:
:
ReleaseDC(pDC);
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
I think this should do the trick....
CDC dcMem;
CPaintDC dc(this);
//create a compatible dc
dcMem.CreateCompatibleDC(&dc);
// Select the bitmap into the in-memory DC
dcMem.SelectObject(CBitmap::FromHandle(m_hBitmap));
dcMem.DeleteDC();
Then in Bitblt u can use dcMem.m_hDC
|
|
|
|
|
mahade1 wrote:
Then in Bitblt u can use dcMem.m_hDC
Only before the dcMem.DeleteDC() line...
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I have been trying to store away an array of variables that I wish to display via a general display routine (i.e. deal with any type of variable).
e.g.
typedef struct<br />
{<br />
void* data [10][20][20];<br />
DATA_DETAILS dataDetails[10][20][20];<br />
short feildsInDisplay [10][20];<br />
}DISPLAY_DB;<br />
<br />
DISPLAY_DB myDB;<br />
<br />
myDB.feildsInDisplay[0][0] = 2;<br />
myDB.data[0][0][0] = &(shortInteger1);<br />
myDB.dataDetails[0][0][0] = short_integer_details;<br />
myDB.data[0][0][1] = &(float_data_item);<br />
. etc
At some point later in the program
dataStr.Format ("%d", myDB.data[0][0][0]) ;<br />
strName = myDB.dataDetails[0][0][0].fieldDesc;<br />
m_cEditTest.SetWindowText (strName + dataStr);<br />
What I get is the correct dataDetails but the address of the data not the data itself. How do I dereference this data.
e.g. Test Data 1 = 438181 and not Test Data 1 = 1234
If I try dataStr.Format ("%d", *myDB.data[0][0][0]); I get an illegal indirection error.
Also I cannot store away the address of bit fields I get the following errors
c:\Export_LibDlg.cpp(479): error C2104: '&' on bit field ignored
c:\Export_LibDlg.cpp(549): error C2100: illegal indirection
where the data is
unsigned dataBit : 4;<br />
<br />
myDB.data[0][0][0] = &(dataBit);<br /> Any suggestions,
grahamfff
|
|
|
|
|
myDB.data[0][0][0] is a void* so if you say *myDB.data[0][0][0] you should get an illegal indirection.
Try (int*)myDB.data[0][0][0] in your format. Could be wrong.
|
|
|
|
|
Actually, if u r setting myDB.data[0][0][0] to a short integer (as the name says), then it would be wiser to use (short int *)myDB.data[0][0][0] in your format.
|
|
|
|
|
Grahamfff wrote:
Also I cannot store away the address of bit fields
That's correct. This is prohibited by the C standard. This is simply because if the field starts part-way through a byte, there is no way the compiler can take its address - it has to be on a byte boundary.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
If anyone can help me with a character counter, I would be very appreciative.
I have a Rich Text Edit box in an MFC app. I would like to limit the number of characters a user enters by having a "Characters Left" count box below my edit box indicating how many additional characters the user has left. This counter chould be dynamic enough so users would actually see the number decrement by one for each character typed, and if they deleted a 5 letter word, it should go up by 5.
In addition, when the counter is 0, the edit box should not allow any more input.
This should be similar to the java script done on many HTMLs.
Anyone ever done this before in C++ MFC? Can anyone provide me with a suggestion on where to begin?
Thank you!!!
|
|
|
|
|
Hi!
the "normal" edit control has a method, that allows you to set the maximum input len. So I guess, the RichEditControl has some similar method.
and then, you can catch the TEXT_CHANGED message
(don't know the correct name ) , get the text from the control, calculate the Len and update your "counter" control.
|
|
|
|
|
Yea, I know the "concept" behind what I need to do, I just cant find any specifics. TEXT_CHANGED is nice, but again, the real name alludes me. I simply cannot find it and I am getting a little frustrated.
|
|
|
|