|
"Dynamic linking" is the process that Windows uses to link a function call in one module to the actual function in the library module. "Static linking" occurs at compile/link time when you link various object (.OBJ) modules, run-time library (.LIB) files to create a Windows .EXE file. Dynamic linking occurs at run time. With static linking, the linker copies the code for the function into the application's executable file. With dynamic linking, a link is established when the program is loaded into memory or while it is running. So even though you can static link your DLL to your EXE, you still need a DLL that contains the exported hook function.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
That's not true. You can export the function in your EXE just as well, a DLL and EXE are basically the same, they just have different entry points and are treated differently by Windows' PE loader. I tried the exact same thing with the keyboardhook once this guy is trying and it worked fine, in one EXE. The problem is, when I tried it without MFC for some reason it didn't work, but it did work with MFC. The hook function was simply in my EXE's export table, so windows just loaded the same EXE that made the call for the hooking registration in memory (or used the same copy i dunno what it does exactly) and used that function as the hook procedure.
Kuniva
--------------------------------------------
|
|
|
|
|
Kuniva wrote:
I tried the exact same thing with the keyboardhook once this guy is trying and it worked fine, in one EXE.
Did you use a local or a global hook? The former will work in both a DLL and an EXE, while the latter will only work in a DLL.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
The keyboard hook proc must be either a global function or a static member of your class.
Also, hooks are in dll's if they are global hooks (work no matter where teh input focus is). If the hook is in your .exe then it will only catch keyboard events when the exe has the keyboard focus.
|
|
|
|
|
|
Aside from msdn.microsoft.com[^], can you be a bit more specific? Win32 SDK is a very broad term.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
|
I've used this small site in the past:
Catch 22
Painted on the side of a dog trainer's van: SIT HAPPENS
|
|
|
|
|
This site is great.
Thanks.
|
|
|
|
|
I have to add a column/bar chart into an MFC42 VC++6 dialog app. What kind of component/ocx/library would you chose to do that?
Thanks,
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Hi All
Does anyone know how to programmatically set the size of a dialog box ??
thanks
Si
|
|
|
|
|
|
MoveWindow() ???
Ninety-eight percent of the thrill comes from knowing that the thing you designed works, and works almost the way you expected it would. If that happens, part of you is in that machine.
|
|
|
|
|
I don't want to use firewall to reject SYN connection.
Can I use SPI(service provider interface )to achieve reject connection ?
If could make it,please tell me how to do it.
Thanks a lot.
|
|
|
|
|
I am not quite sure what your question is -- are you just trying to reject incoming tcp connects?
Take a look at the WSAAccept() function. It let's you filter incoming connection attempts -- either accepting or rejecting.
This all assumes I interpreted your question correctly.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
Thanks for your help.
My problem is solved.
|
|
|
|
|
I am trying to present data that its maximum length is 2000 characters using a CListCtrl.
I am using the LVN_GETDISPINFO event, so I can change the cchTextMax to 2000 and point pszText to a buffer that contains the 2000 characters to be presented.
Even though I am permitted to change, when presenting it the data is always truncated in 260 characters.
How to change it for being able to present the complete text?
Thank you for your help,
magda.
|
|
|
|
|
Your data should be fine, this is only an inability by CListCtrl to *display* more than 260 characters. Interestingly MAX_PATH is 260, ListView was designed for Explorer so it seems like a hardcoded limitation.
You can get around this by doing custom drawing. If your using WTL I'm going to have to vouch for my article on the subject. http://www.codeproject.com/wtl/ListView_OwnerDraw.asp[^]
|
|
|
|
|
Thank you for your reply!!
I will look at your link and I will bother you, if I need more help!!
Thank you again!
magda.
|
|
|
|
|
Good afternoon dear CPians,
i'm facing a problem with a popup menu (MFC programming, VS7.1). here is what i'm trying to do :
i have a vector that's been filled with several Phone numbers of a particuliar person.
what i need is creating a popup menu that is displayed next to the button clicked to display it.
the popup menu is supposed to contain all the entries of the vector...
<font color=blue>void</font> CFactEditorDlg::OnSClickShowNumbers() {
<font color=blue>using namespace</font> std;
vector<CString> vPersonNumbers;
<font color=green>
<font color=blue>if</font> (vPersonNumbers.size() != 0) {
CMenu PhonesMenu;
<font color=blue>if</font> (PhonesMenu.<font color=red>CreatePopupMenu()</font>) {
vector<CString>::const_iterator itvPhoneNumbers;
<font color=blue>int</font> iCpt = 1;
<font color=blue>for</font> (itvPhoneNumbers = vPersonNumbers.begin();
itvPhoneNumbers != vPersonNumbers.end();
itvPhoneNumbers++, iCpt++) {
PhonesMenu.AppendMenu(MF_STRING, iCpt, *itvPhoneNumbers);
}
CRect rect;
m_pbShowNumbers->GetWindowRect(&rect); <font color=green>
PhonesMenu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, rect.right, rect.top, AfxGetMainWnd());
}
}
}
the CMenu::AppendMenu() i call give me an Unhandled exception , but no more description.
i'm certainly using CMenu the wrong way, but i cannot find any good tutorial to just create a popup menu dynamically (dynamic content) and display the place i want (by the side of the button that calls it)...
did anyone ever encounter such a problem, or know how to solve this ?
now, i would like to recover the item the user click on to put it into an EditBox...
anyone ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
You need to call PhonesMenu.CreateMenu() before you can AppendMenu()
|
|
|
|
|
i did it (see the previous post to see the updates in the code), but i still have an Unhandled/Undescribed exception
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Try:
for (itvPhoneNumbers = vPersonNumbers.begin();<br />
itvPhoneNumbers != vPersonNumbers.end();<br />
itvPhoneNumbers++, iCpt++) {<br />
PhonesMenu.AppendMenu(MF_STRING, iCpt, *itvPhoneNumbers);<br />
}
|
|
|
|
|
thank you very much for that help... that point work quite fine now.
i say quite because the popup is drawn, but so thin that i can't read if there are items on (it is about 2 or 3 pixels wide) ; but high enough though.
moreover, when i click on the last item of the menu, it ends the program returning an
Run-Time Check Failure #2 - Stack around the variable 'dlg' was corrupted.
into InitInstance() (it is a dialog based application).
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I don't know what happen to your stack, however the thin menu is because your popping up the menu, you want to popup a popup of the menu. Try this:
CMenu popup_menu = PhonesMenu.GetSubMenu(0);
popup_menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, rect.right, rect.top, AfxGetMainWnd());
|
|
|
|