|
|
how shall i start a dll for hooking that will trace the client data and gets the data
naresh
|
|
|
|
|
u can use SetWindowsHookEx api.
u have to specify what type/id of Hook like Keyboard,GetMessage (for more info go to msdn and type setwindowshookex).
Then according to the hook type the hook procedure prototype changes.
export the hook procedure using
__declspec(dllexport) LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
// here u can write the code.
// At last u have to call CallNextHookEx
// The handle returned by SetWindowsHookEx has to be passed to this module through another exported function or some user defined messages.
}
//
Regards
Sudeesh
|
|
|
|
|
hi all i had made the service in vc++6. now i want that when that service is installed it start automatically,i had used SERVICE_AUTO_START parameter in the createservice API but it does not start when that function is executed.
Tasleem Arif
|
|
|
|
|
As I understand it that flag only means the service will automatically start up on boot, not necessarily as soon as you install the service. You'll need to start the service yourself manually once you've installed it, with StartService.
|
|
|
|
|
Hello,
I have created an application in vc++, using mfc. I have to create the setup file for the application.
I am confused as to what files to include in the setup. When I run the program in 'Release' configuration, I get the .exe file. Now, I ran this exe file on win98 and xp. It works perfectly.
SO, how do I find out what dll to package with my application?
Thanks.
Fortitudine Vincimus!
|
|
|
|
|
Build your 'exe' by setting 'Use MFC' option to 'Use MFC in a Static Library'...
To set this...go to project properties.. Choose General and set the 'Use MFC' option
Do your Duty and Don't expect the Result
|
|
|
|
|
Open your .exe in Depends and view the list of DLLs it depends on. Depends can be found in Programs | Visual Studio 6.0 | Microsoft Visual Studio 6.0 Tools.
/ravi
|
|
|
|
|
and in the case you don't have VS6 or don't find it, Ravi was talking about Dependency Walker[^]
|
|
|
|
|
I have VS6. I checked out depends. Its there. Thanks a lot.
Fortitudine Vincimus!
|
|
|
|
|
Hello,
I ran depends for my program and it gave a huge list of dll's
ADVAPI32.DLL
COMCTL32.DLL
COMDLG32.DLL
GDI32.DLL
KERNEL32.DLL
MFC42.DLL
MSVCRT.DLL
NTDLL.DLL
OLE32.DLL
OLEAUT32.DLL
RPCRT4.DLL
SHELL32.DLL
SHLWAPI.DLL
SIMPLE HOME BUDGET.EXE
USER32.DLL
Do I have to include all of these in the setup program. What I do not understand is that if my program(just the .exe) works fine without any setup, why do I have to add all these dll's while creating the setup?
Please can you explain?
Thanks.
Fortitudine Vincimus!
|
|
|
|
|
Tara14 wrote: Do I have to include all of these in the setup program
yes.
Tara14 wrote: What I do not understand is that if my program(just the .exe) works fine without any setup
because, the m/c you are running your program on is already having these dlls.
Tara14 wrote: why do I have to add all these dll's while creating the setup?
Setup is meant to install your program on user m/c. Its not necessary that all necessary dll's will present there. The software you will use for making set up program , will take care of copying these dlls at desired location.
|
|
|
|
|
Thank you for your reply.
The setup will have to copy only the dlls that are not there on the users m/c, right?
I worked my program on win98, 2000 and xp. It worked on all of them without any error. That means all of the sysems have the necessary dlls needed.
Fortitudine Vincimus!
|
|
|
|
|
Tara14 wrote: The setup will have to copy only the dlls that are not there on the users m/c, right?
partially, because sometimes you need tocopy updated version.
Tara14 wrote: I worked my program on win98, 2000 and xp. It worked on all of them without any error. That means all of the sysems have the necessary dlls needed.
yes. It means that all these m/cs have visual studio installed ,too.
But it will not be case with user m/cs. So you need to consider that.
|
|
|
|
|
prasad_som wrote: yes. It means that all these m/cs have visual studio installed ,too.
Well... non of them had vs installed in them. I even sent the exe file to client.
Fortitudine Vincimus!
|
|
|
|
|
Tara14 wrote: Well... non of them had vs installed in them. I even sent the exe file to client.
Oops ! search for MFC42.DLL,MSVCRT.DLL on those m/cs. And hope that same are present on client m/c in windows folder.
Its impossible to have these dlls present on clean m/c.
|
|
|
|
|
Oh! Ok. I just got lucky then!
Thanks a lot for the help.
Fortitudine Vincimus!
|
|
|
|
|
I use the folowing code to listen the com:
void CMina_sView::OnListenCom1() <br />
{ <br />
running = TRUE;<br />
AfxBeginThread(run,this);<br />
}
void CMina_sView::ascultarea()<br />
{<br />
<br />
CSerial serial;<br />
LONG lLastError = ERROR_SUCCESS;<br />
DWORD dwBytesRead = 0 ;<br />
char szBuffer[21];<br />
CString str2="jjk";<br />
char of[5]= "Addd";<br />
int i=10;<br />
const int nBuflen = sizeof(szBuffer)-1;<br />
<br />
lLastError = serial.Open(_T("COM1"),0,0,false);<br />
lLastError = serial.Setup(CSerial::EBaud9600,CSerial::EData8,CSerial::EParNone,CSerial::EStop1);<br />
lLastError = serial.SetMask(CSerial::EEventBreak |<br />
CSerial::EEventCTS |<br />
CSerial::EEventDSR |<br />
CSerial::EEventError |<br />
CSerial::EEventRing |<br />
CSerial::EEventRLSD |<br />
CSerial::EEventRecv);<br />
<br />
lLastError = serial.SetupReadTimeouts(CSerial::EReadTimeoutNonblocking);<br />
<br />
lLastError = serial.WaitEvent();<br />
<br />
const CSerial::EEvent eEvent = serial.GetEventType();<br />
<br />
if (eEvent & CSerial::EEventRecv)<br />
{<br />
while (running)<br />
{Sleep(300);<br />
dwBytesRead = 0;<br />
<br />
<br />
serial.Read(szBuffer,nBuflen,&dwBytesRead);<br />
szBuffer[dwBytesRead] = '\0';<br />
str2.TrimLeft();<br />
str2.TrimRight();<br />
str2.TrimLeft();<br />
str2.TrimRight();<br />
}<br />
}<br />
running = FALSE;<br />
serial.Close();<br />
<br />
}<br />
<br />
UINT CMina_sView::run(LPVOID p)<br />
{<br />
CMina_sView * me = (CMina_sView *)p;<br />
me->ascultarea();<br />
return 0;<br />
<br />
}
If I run the program I get an error. If I run it in debug mode I when try to watch str2 i get the error: "symbol "str2" not found" What's wrong? I can watch any other variable.
|
|
|
|
|
tanarnelinistit wrote: If I run the program I get an error
What error ?
|
|
|
|
|
|
Did you use your debugger to see on which line of code it crashes (if needed, use the call stack to see in which of your function it crashes).
|
|
|
|
|
Cedric Moonen wrote: Did you use your debugger to see on which line of code it crashes (if needed, use the call stack to see in which of your function it crashes).
But I can see what the error is, because when I use the debugger I don't have a value for str2, it says "symbol not found". But why does this happen? Does it have anything to do with multithreading?
|
|
|
|
|
It's not because you can't see the value of str2 that you are not able to see where your program crashes.
Maybe you are trying to watch str2 out of its scope. It can only be watched if you have a breakpoint in the function where it is declared. Outside it, its not visible.
|
|
|
|
|
Cedric Moonen wrote: Maybe you are trying to watch str2 out of its scope. It can only be watched if you have a breakpoint in the function where it is declared. Outside it, its not visible
But I try to watch the variable str2 inside the function and I can't. I know what ur trying to say, that's why I asked you if it's because of the multihtreading, is that why I can't see it's value?
|
|
|
|
|
When you get an assert, the first step is to break into the code. If you can't work out what's wrong, the next step is to post the line number and even the actual line of code that's causing the assert. We need the line number and file as well, if we're to see it in context.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|