|
-
April 26th, 2013, 09:37 AM
#1
write in log file through dll
so i have this dll with a DBTProc, whenever a window gets created i want to write something in a log file. Now everytime I run it it adds three times the
text in this log file, but then it does nothing anymore. I do hear a beep everytime a window get created so it doesn't actually open my file to write in, any ideas about what's wrong?
code:
LRESULT CALLBACK CBTProc(int code, WPARAM wParam, LPARAM lParam)
{
if (code < 0)
{
return CallNextHookEx(CBThook, code, wParam, lParam);
}
hWndnew = (HWND)wParam;
if (code == HCBT_CREATEWND)
{
CREATESTRUCTA* cswnd = (CREATESTRUCTA*) lParam;
cswnd-> y = 0;
cswnd-> x = 0;
cswnd -> cx = 500;
cswnd -> cy = 400;
lParam = (LPARAM) cswnd;
FILE * logfile;
if((logfile=fopen("logfile.LOG","a")) != NULL)
{
fprintf(logfile, "hoi\n");
fclose(logfile);
}
else{
Beep(2000, 20);
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|