|
Hi,
I've got myself a HWND to a window that I didn't create.
I want to be able to get back to the process that created the window, so that I can enumerate the Modules that it loaded.
Just not sure where to go.
<br />
<br />
HWND hWndAim;<br />
WNDCLASSEX myWin;<br />
<br />
hWndAim = FindWindow("Afx:400000:b:0:0:b0247", "Messages");<br />
GetClassInfoEx(????, "Messages", &myWin);<br />
<br />
Thanks very much
|
|
|
|
|
I don't know how to get the process handle from its window handle, however,
if you know the process name, then use my code
to get the process handle by its name.
Pview.exe shows the loaded dlls for processes.
I sure that you will find the source code of that utility.
|
|
|
|
|
DWORD GetWindowThreadProcessId(hWnd,lpdwProcessId)
this function returns the identifier of the thread that created the function
and if lpdwProcessId is not null it returns also the process id
|
|
|
|
|
Continue to my previous reply:
Forget about pview.exe.
Use EnumProcessModules of PSAPI.dll (supported under WinNT/win2K/WinXP).
Check the following Enumerating All Modules For a Process
|
|
|
|
|
What is the best way to determine the following:
1. Whether a device is installed (and whether it is installed correctly)? [most important question]
2. Whether a device is plugged in?
I am writing an install app, and for point one [most important question] i need to know whether any "found new hardware wizard" windows will pop up.
For point two, i have a function which includes the following code, but it seems to be a pretty rough way of doing it:
do
{
bResult = UpdateDeviceDriver();
} while(bResult != NO_ERROR);
Where UpdateDeviceDriver is a function which encapsulates the newdev ddk function UpdateDriverForPlugAndPlayDevices().
Cheers,
Dave
Cheers,
Dave
|
|
|
|
|
Hi guys,
If I set my timer to a value( say, 1 millisecond). Am I guaranteed to get the event service function called at frequency of 1kHz? My guess is not as following reason.
My impression is: if there is a higher priority process(system process) preempt the CPU at the time of timer interrupting, the service function is simply delayed to next available interrupt. Is it correct?
Thanks
|
|
|
|
|
HI,
timeSetEvent() creates and works in a new thread. So your understanding is correct. But the documentation doesnt says anything about its priority. If the CPU has some other processes more prior to this logically it will not trigger at that moment. There other options like WaitableTimer().
regards,
Sankaran
|
|
|
|
|
He was asking about timeSetEvent(), not WM_TIMER.
|
|
|
|
|
yes, I am asking multimedia timer, which Microsoft claims an "accurate" timer
|
|
|
|
|
How to run db-library programs in Visual Studio?
what changes are required to DB Library in VS?
|
|
|
|
|
how to delete a directory which has sub-directories and files directly?
thanks
includeh10
|
|
|
|
|
Hi,
See this article in CP..
http://www.codeproject.com/file/removefiles.asp
all the best
anju
|
|
|
|
|
it is still to delete files first in a loop ...
includeh10
|
|
|
|
|
|
::SHFileOperation()
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
BOOL ClearDirectory(const char *path, BOOL recurs, BOOL deldirs)
{
if(!path)
return FALSE;
char xpath[512]="";
strcpy(xpath,path);
HANDLE hFile;
WIN32_FIND_DATA findData;
BOOL Go=TRUE;
char fullp[500]="";
char pattern[500]="";
if(xpath[strlen(xpath)-1]!='\\')
strcat(xpath,"\\");
if(!IsDirectory(xpath))
return FALSE;
strcpy(pattern,xpath);
strcat(pattern,"*.*");
hFile=FindFirstFile(pattern,&findData);
while((hFile!=INVALID_HANDLE_VALUE)&&(Go))
{
if((strcmp(findData.cFileName,".")!=0)&&(strcmp(findData.cFileName,"..")!=0))
{
strcpy(fullp,"");
sprintf(fullp,"%s%s",xpath,findData.cFileName);
if(IsDirectory(fullp))
{
ClearDirectory(fullp,recurs,deldirs);
strcat(fullp,"\\");
if(deldirs)
RemoveDirectory(fullp);
}
else
{
SetFileAttributes(fullp,128);
DeleteFile(fullp);
}
}
ZeroMemory((void*)&findData,sizeof(findData));
Go=FindNextFile(hFile,&findData);
}
FindClose(hFile);
if(deldirs)
RemoveDirectory(xpath);
return TRUE;
}
be nice an rate me !
be cool
I am the mighty keeper of the book on knowledge . Contact me to get your copy .
|
|
|
|
|
I have a USB device install procedure ready to go, but it relies on the user pressing cancel to the new hardware wizard when it comes up on insertion of the device.
Is there any way to stop the wizard coming up temporarily in code, or is there a way to grab onto the wizard handle and closing it via my program?
Cheers,
Dave
Cheers,
Dave
|
|
|
|
|
I know this isn't the best way of doing what your tring to do but it should work...
Note, I did't compile this so I may have mistyped something.. I think you get the idea.. Get a pointer to the other window and tell it to close (Only if you can find the window)...
CWnd *pOtherWnd = CWnd::FindWindow(NULL,_T("Window Title of the Wizard.."));
if(pOtherWnd)
pOtherWnd->SendMessage(WM_QUIT,0,0);
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
how to get directory of start menu programmatically?
the directory includes 'group name' as its sub-directory.
in win95, the directory is under windows directory.
in win2k, it is out of windows directory, i.e. c:\documents-and-settings.
my purpose is to add 'group name' and links to the directory vs install and delete them vs uninstall directly.
thanks
includeh10
|
|
|
|
|
Call SHGetSpecialFolderPath() and use CSIDL_COMMON_STARTMENU or CSIDL_STARTMENU depending on whether you want to add your group for all users or just the current user.
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
|
I need to measure the execution time of my programs under DOS but I don't know how to do it with Borland C++ compiler. With Microsoft C++ compilers is easy to measure the running time using the function GetTickCount() that returns the time since windows started. But now I want to compile them with Borland C++ and run under DOS.Any ideas?
Thank you for your help.
|
|
|
|
|
by "running in DOS" do you mean the old DOS like 6.x or 7.x (or older) or simply a console mode program in win32?
If it's just a console mode program, then just #include "windows.h" and use the GetTickCount() function - GetTickCount() is part of the Win32 API and should work fine in Borland (assumming you are linking to Win32 libs). If this is not the case then try using the C run time's time() function
|
|
|
|
|
I don't know exactly wich version of DOS I am using.I have Windows 98 installed and what I am doing is just go to the shut down menu,sellect 'Restart under DOS' and then find my .exe file and run it. I tried to use GetTickCount() but I was taken link errors(not compiler errors) when building the .exe file.So the next thing I am going to try is to use time() function as you suggested. Thank you very much for your help.
|
|
|
|
|
The function is clock() in <time.h>. It returns the number of clock ticks since program start. To determine the execution time in seconds divide the value returned by clock by the value of the macro CLK_TCK which defines the number of
clock ticks per second.
|
|
|
|