|
The only difference I can see between your code and the code I have written is in the definition of the callback function. Mine is defined as:
DLL_USE LRESULT CALLBACK CBTHandler(int nCode, WPARAM wParam, LPARAM lParam)<br />
{<br />
}
So it is not static and it is marked as exported from the DLL. This could be causing the problems.
Mike
|
|
|
|
|
well static can be or is unnecessary but exporting the Hook proc doesn't make any sense, coz the calling application can only set the hook or remove the hook, hook proc will be used internally, so i think need not to export the hook proc.
Anyway thanks a lot for the reply, if you have some suggestion like setting up my project (i am using VC++ 6 may be i am not setting up the project), then it might be helpful.
if you can send me the basic code for your hook dll (Only hook setup code), it can solve the issue.
Best Regrads,
Bilal Anjum
|
|
|
|
|
My basic code is the same as yours apart from the definition of the hook function.
The DLL will be loaded into the adderess space of all the other application running on your system, they will call the hook function so exporting it could make a difference. Try it, it will only take a minute to test it.
|
|
|
|
|
Hi!
I have solved my problem, infact there was no problem at all. What i was trying to do was to debug a system wide installed hook in the VC debugger, which is not possible as such, so all the events i got were from the application i was dubugging in context with. So if i run the program (not debug it), it works fine. Thanks a lot for your patience and help. Now the real problem is still there, how to debug my program (system wide hook)?
Best Regards,
Bilal Anjum
|
|
|
|
|
Hi Everybody,
Is there any API to get the users of my machine.
Also to check their rights.
Thanks in Advance
iRams
|
|
|
|
|
I'm currently trying to get valid MAC address from ethernet adapters in C++ using the following methods:-
netbios, snmp & getadapterinfo.
I have the programs only retrieving adapter type 6 which are ethernet adapters.
I have an instance where a P.C has VPN software & the VPN adapter gets pick up as a adapter type 6. The VPN adapter description is "NOC EXTRANET ACCESS ADAPTER".
Is there anyway to exclude virtual adapters?, I need to do this for liecensing purposes within our software applications.
Any help would be appreciated.
Thanks in advance
Gilc137
|
|
|
|
|
I switch the default desktop to mine,and i produce taskbar myself.So i want to receive some message when system shell is ready to launch an application and to terminate an application.
how can i do? hook? or other?
|
|
|
|
|
Typically you'd use SetWindowsHookEx with either the WH_CBT or WH_SHELL setting.
--
Joel Lucsy
|
|
|
|
|
thank you.
But can you give me a demo code?or where can download such demo?
thank you again.
|
|
|
|
|
|
can you tell me what's the difference of HCBT_CREATEWND and HSHELL_WINDOWCREATED?
|
|
|
|
|
HI!
Well according to MSDN (If its wrong it's Microsoft to blame )
HSHELL_WINDOWCREATED will be called when "A top-level, unowned window has been created. The window exists when the system calls a ShellProc function."
and
HCBT_CREATEWND will be called when "A window is about to be created. The system calls the hook procedure before sending the WM_CREATE or WM_NCCREATE message to the window. If the hook procedure returns a nonzero value, the system destroys the window; the CreateWindow function returns NULL, but the WM_DESTROY message is not sent to the window. If the hook procedure returns zero, the window is created normally."
Regards,
Bilal Anjum
|
|
|
|
|
|
Hey all.
I've got a tiny helper application that I've built that creates text files on a network/shared drive.
I'm presently just using CStdioFile to create the text files.
The problem that I am running into is username/password authentication. I don't really know where to start for this and would appreciate some pointers in the right direction. The network/shared drive is "\\S-CPU1\c\the_folder". If I open up IE, and go to \\S-CPU1\c\the_folder ... the first time I try it, IE asks for the username/password. I enter it in, it goes there. I can then close out of IE and it "remembers" the username/password combination (or keeps me logged in to it, or whatever) until I physically LOG OUT or switch users. So, if I do that one time, I can then run my helper app, and it creates the files over on that shared folder without a problem.
The problem is I would like to automate this, so that I/the user does not have to first bring up IE and go through that process (and I don't want to physically MAP a drive to that folder). I would like to be able to run my app, and if it realizes that it needs a user/password to access that folder, it will go ahead and bring up a prompt asking the user for that information. After that point, it'll just roll through and do it's thing.
I've searched for several phrases in the articles on this site, but can not seem to find anything that is doing what I want. If someone could point me in the right direction, I would greatly appreciate it.
Shultas
|
|
|
|
|
DWORD WNetAddConnection2(
LPNETRESOURCE lpNetResource, // connection details
LPCTSTR lpPassword, // password
LPCTSTR lpUsername, // user name
DWORD dwFlags // connection options
);
lpLocalName :Points to a null-terminated string that specifies the name of a local device to redirect, such as "F:" or "LPT1". The string is treated in a case-insensitive manner.
If the string is empty, or if lpLocalName is NULL, the function makes a connection to the network resource without redirecting a local device.
|
|
|
|
|
how do i change a program which wae built to compile with nmake to compile
with the c++ build tool.
please help
|
|
|
|
|
You should be able to open the .mak file with Visual Studio.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Here is my scenario
My Main Dialog creates a propertyPage , and resizes it to fit the bounds of the Main Dialog window .
mainSheet= new CPropertySheet();<br />
mainSheet->AddPage(&page1);<br />
int res=mainSheet->Create(this, WS_POPUP| WS_BORDER |WS_VISIBLE ,0 );<br />
if(!res){<br />
AfxMessageBox("Could not Create PropertySheet",MB_ICONERROR);<br />
return ;<br />
}<br />
mainSheet->AddPage(&page2);<br />
CRect r;<br />
this->GetWindowRect(&r);<br />
mainSheet->SetWindowPos(0,r.left+10,r.top+60,r.Width()-20,r.Height()-130,0);
To the PropertyPage I add 2 propertypages .
What is happenning right now is that the PropertySheet occupies the desired region of the main window , but the inner PropertyPages are displayed in their original size !
How do I make the PropertyPage resize to the current revised size of the its parent i.e the PropertyPage ?
|
|
|
|
|
|
Is there a way to save the web page contents to an image. Just the contents, no toolbar, no status bar. In other words print web page to image file??
Thanks a lot.
|
|
|
|
|
Hi all,
How can I program to pop up a WordPad window for showing some formatted text for help purpose
in visual c++ 6 ?
Thanks
|
|
|
|
|
ShellExecute or CreateProcess.
onwards and upwards...
|
|
|
|
|
Thanks for your reply.
If I use createProcess() to launch the MS WordPad, how
can I avoid the problem that there may be differences in the path name of the application in different windows platform ?
Or is there any MFC class that i could use to launch a RTF document ?
Thanks
|
|
|
|
|
That's why the recommended way to display a document is to use ShellExecute. ShellExecute will open whatever program is associated with the file extension.
onwards and upwards...
|
|
|
|
|
Hi everybody
I have written an ATL 3.0 project including two sample classes named CAttachment & CAttachments. These classes have interfaces IAttachment & IAttachments in order. IAttachments has got a method named "Item" that returns a result of the type of IAttachment. But before returning the IAttachment, I want to call some member functions of the CAttachment class to setup the IAttachment properly. I know how to create the IAttachment interface, but I don't know how to have access to the members of the CAttachment from the Item method. I will be thankful if anybody replies to me.
Regards,
Roozbeh.
|
|
|
|