|
I am trying to hook the windows system clock so that I can execute code in it's context and subclass it. But when I try to hook it explorer (which owns the thread crashes)crashes. Here is the relevent portion of code
timeinfodll = AfxLoadLibrary("Tray");
LPCLOCKHOOK clockhook;
LPSETCLOCKHOOKID setclockhookid;
if (timeinfodll != NULL)
{
clockhook = (LPCLOCKHOOK)GetProcAddress(timeinfodll, "ClockHook");
setclockhookid = (LPSETCLOCKHOOKID)GetProcAddress(timeinfodll, "SetHookId");
if (clockhook == NULL || setclockhookid == NULL)
{
// handle the error
FreeLibrary(timeinfodll);
return FALSE;
}
else
{
CRect rect;
HHOOK hook;
CWnd *clockwnd;
clockwnd = new CWnd();
GetTrayWnd(clockwnd);
//This function crashes explorer
hook = SetWindowsHookEx(WH_CALLWNDPROC, clockhook,
AfxGetInstanceHandle(), cGetWindowThreadProcessId (clockwnd->m_hWnd, NULL));
//Send an unimportant message to the window so to stimulate the whole thing foward//
clockwnd->GetClientRect(&rect);
clockwnd->SendMessage(WM_SIZE, rect.right, rect.bottom);
FreeLibrary(timeinfodll);
return TRUE;
}
}
|
|
|
|
|
The SetWindowsHookEx would not execute in explorer's address space so it is not causing it to crash. SetWindowsHookEx would cause the dll's DllMain to execute, right? What does the DllMain do for DLL_PROCESS_ATTACH?
|
|
|
|
|
I have an application that uses a worker thread for communication for another application. During certain process-to-process communication calls a warning dialog needs to be displayed that will not allow the user to change any onscreen controls (a modal dialog essentially). This warning dialog is opened before the communication call and closed after it, this may take 3-5 seconds. I am currently trying to use PostMessage from the worker thread back to the main thread in order to display the warning dialog. This does not completely work though. Does anyone have any suggestions on what I could try?
|
|
|
|
|
Is this the same as:
http://codeguru.earthweb.com/bbs/wt/showpost.pl?Board=vc&Number=167929
|
|
|
|
|
The application runs in background and poll for an event.
If the event apears, the application should come to the top of the screen.
this code works only with WIN-NT
::SetForegroundWindow(GetSafeHwnd() ); //funktioniert evtl nicht unter Win9x
is there a function for Win9X + NT
Have somebody code that work ?
Thanks
|
|
|
|
|
Try
::SetWindowPos(hWnd,HWND_TOPMOST,X,Y,width,height,SWP_SHOWWINDOW);
|
|
|
|
|
On Win 98 and 2K, SetForegroundWindow() has been restricted so you can't just bring any ol' window to the top.
Check out the SetForegroundWindow() docs in MSDN - there's a good explanation of the behavior.
|
|
|
|
|
Hi Guys,
i just can't figure it out. in my workspaces i have to set all my source files to use 'automatic use of pre-complied headers', other wise i get:
Debug/MyApp.pch' is not a valid precompiled header file
i don't know what i've set in the project settings, but everytime i change or add something to the resources (dialogs especially), a complete re-build of the project occurs. this is really starting to p$%$ me off.
any direction appreciated
thanks and stressed
Peter
|
|
|
|
|
Are you including "StdAfx.h" in all the source files?
|
|
|
|
|
If your stdafx.h files have:
#include "resource.h"
in them then that would cause a recompile of your pre-complied headers, right?
|
|
|
|
|
Hello to all !!!
I'm quite new to DLL and I have a simple (I think) question.
Can I have a Dialog (from resource) in a DLL and have the implementation in the main program (exe) and be able to load and display that dialog from the main exe ??? If so, how can I do it !?!?!? Can someone explain to me how such a thing can be done.
Thanks in advance for any help
Have a nice day !
|
|
|
|
|
Hi :
Its pretty simple.
Insert a new resource to your dll ( Dialog ) and add class to your resource inheriting from CDialog . and in the dllmain just
CMyDialog dlg;
dlg.DoModal() or Create and ShowWindow.
Now from your Exe jusrt call load library and that is it.
|
|
|
|
|
The code :
[
float f = 10.123;
printf("%10.4E\n",f);
]
results (Microsoft Visual C++) :
1.0123E+001
How to print 1.0123E+01 ? (2 digits after E instead of 3)
Best regards,
Peter
|
|
|
|
|
It seems to me that you can't get 2 digits instead of 3.
But you can print to string using sprintf() instead of printf(), find unnecessary '0' character and remove it.
|
|
|
|
|
Hi,
I created a funtion DbgMsg(LPSTR lpszMsg, .............) that will allow me to handle to print debugging strings to the debugger. The problem is
that it will crushed if a null pointer is passed. I would like to check for the number of args passed. Is it possible to do it.
This is how I will call the DbgMsg()
DbgMsg("Testing 123 %d %s", x, szTemp)
DbgMsg(LPSTR lpszMsg, .............)
{
char szTemp[256];
va_start(args, szString);
wvsprintf(szTemp, szString, args);
OutputDebugString(szTemp);
va_end(args);
}
|
|
|
|
|
Hi,
Can I include a gif file in the resource file. If yes, how can I load it, loadbitmap(...)??? Also, how to retreive the palette used in order to support 256 colors.
Thanks
|
|
|
|
|
yes. but don't.
neither MFC nor Win32 supports GIF directly.
even worse, if you want to use GIF code in your app (reading OR writing) you have to obtain a license from Unisys. many thousands of dollars...
a better alternative is PNG - better compression, more flexible, free, well supported.
here's a plug for my stuff, but there are plenty of places to find this kind of thing:
http://www.smalleranimals.com/isource.htm
-c
|
|
|
|
|
Hi,
Surely you can include one of GIF format..
If you need draw it or .jpg file format,
use OleLoadPicture()..
You know IE can draw many image formats..
As you can see on this site...
Deep inside, this API use IPicture interface...
Anyway...If you need some sample, thead to this thead..
With best wishes,
-Ryan
|
|
|
|
|
:: You know IE can draw many image formats.
but, without a Unisys license, using it to draw GIF is illegal. if you like, i can find the MS page where they state this.
-c
|
|
|
|
|
does anybody know of a good
dice.ocx for a board game?
please!!!
|
|
|
|
|
I've tried to generate a non(!)resizeable formview and I checked several ideas but without success!
Perhaps someone has a good idea or solved this problem already in the past!
I would be glad to receive some suggestions!
Thanks a lot!
ralph
|
|
|
|
|
You must set the Window-features of the Frame, when
the frame is creting.
try function
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
cs.dwExStyle= 0 ;
cs.x=0;
cs.y=0;
cs.cx=GetSystemMetrics(SM_CXSCREEN)+1;
cs.cy=GetSystemMetrics(SM_CYSCREEN)+1;
cs.style =0; // WS_MAXIMIZE;
to manipulate some settings in the CREATESTRUCT.
Show in your MFC-Help for the discription.
|
|
|
|
|
1. if I used the SHGetFileInfo() I got folder one icon for folders and drives (only one type) and I got something document-type icon for others. (for all extensions: .gif, .htm*, .etc. got the same icon)
Or did I make a mistake?
2. if I used the IExtractIcon interface of IShellFolder I got good icons (eg. different for drives, even different if a drive is shared) but I'm using an Icon-Changer application which changed these icons more beautiful than they were.
I did dig in MSDN, overviewed many web pages, but I was not able to find a simple function which can give me the same icons what Explorer shows me in left pane as treeview.
I use the (absolute) LPITEMIDLIST argument as input in my function. I don't use MFC.
How can I get these icons correctly?
(or is it simplier to put the Explorer's left tree pane into my treeview control? if yes, how can I do this?)
Thanks in advance for those who can give me some information.
---
AkelA
|
|
|
|
|
I'm writing a program which can load some HTML pages from an external source. That is a IE application with a server of his own. Until recently everything worked fine: my program builds an url and uses CHtmlView::Navigate2() to display the HTML page.
But now I'm getting the error above. I don't have the faintest idea where this comes from and whether it's my app or the other app that causes the error. The other app still works fine.
I know it's quite vague all, but can anyone give my some clues where to look?
Thanks.
|
|
|
|
|
I need to detect the installation of Windows Media Player 6.4 or greater.
Surprisingly, I have not been able to find information on this topic. Does
anyone know how to detect the presence of this player? Registry? *ocx? I am
up against a deadline and need HELP!!!!
|
|
|
|