|
BTW, I think this will make for an interesting article... Others could extend it as a Dynamic Disassembler, etc. I'll have to put a Cryptographic spin on it.
Jeff
|
|
|
|
|
Jeffrey Walton wrote: I'll have to put a Cryptographic spin on it.
LMAO.
If you do make an article from it. Please, please, please make it 64-bit compatible.
Glad you found the error.
|
|
|
|
|
Jeffrey Walton wrote: I suspect this has to do with [something other than my code or logic]...
Famous last words.
Jeff
|
|
|
|
|
Usually my last words are "Doh! It was me"
|
|
|
|
|
hello
i am calling a web service written in C# , from MFC application , and i need to know how to change the time out of the web service from the MFC application
thanks alot
|
|
|
|
|
What do you want to do ? What time do you want to change ? Do you mean the web service returns a DateTime and you don't know how to read it ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
How I can send XML packet from client to server
|
|
|
|
|
|
Hello,
I am looking for examples of UML drawings. Drawings of class diagrams for a general dialog based GUI application. The GUI could be some general buttons for the user to press that leads to child dialogs getting opened for more user interactions.
Does anyone know of any case studies, examples, tutorials that explains what I am after? Or may be web sites of interest?
Thanks for any information you could provide.
|
|
|
|
|
Hi All,
Please clarfy this point.
I have two classes COne and CTwo.And in the class declaration of COne i have the following declarations.
Class COne Class CTwo
{ {
Public: Public:
CTwo* p; int i,j;
CTwo p1;
CTwo *p2=new CTwo;
}; };
I want to know when i should do a "CTwo *p" and When "CTwo p1" and when i should do "CTwo * p2=new CTwo" because after all the declarations we can access the member functions and data members of the class CTwo.
Thanking you,
Ashwath Hegde.
|
|
|
|
|
You dont need to ask repeated
|
|
|
|
|
He has posted slightly different code in each thread. Perhaps he should locate the 'edit' button instead?
|
|
|
|
|
It seems odd for COne to have both "has a" and "is a" constructs. Is that intentional?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello,
Does anyone know whic *.dll files I need to include with my VS2005 C++(MFC) Application
in order to run it on other machine, which does not have VS2005 installed ?
thanks
|
|
|
|
|
There's a redistributable program that comes with VC2005, which installs all the WinSXS stuff for MFC in the right folders. It's called vcredist2005 or something along those lines.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
|
Thanks for replies guys, but I am interested specifically in the *.dll files which are required for given program to run on another machine.
|
|
|
|
|
Perhaps you should read the docs pertaining to the redistritubals for your compiler/SDK. Sometimes distributing a single dll is not permitted, the whole installer must be distributed instead.
This is the case with DirectX, you cannot distribute a single 3mb dll, you must send the 40mb installer or provide a weblink ( the installer will download and install ).
|
|
|
|
|
One upon a time, in a galaxy far away, before an evil empire consumed all the protoculture on earth, you could statically link MFC to your Visual C++ application so you wouldn't have to worry about which dll's (except GDI+ on pre-XP boxes of course) you needed to send out the door with your app.
It used to be in the Project settings/properties in VC++ 6.0 and 2003.
Please tell me the children of the shadow did not remove that option from VC++ 2005. I'm still struggling with them cancelling Paul DiLascia's "C++ At Work" articles and I don't think I can take much more of this assimilation.
Does the option to statically link still exist on 2005?
|
|
|
|
|
|
I'm trying to find a good way to programmatically prevent a user from switching to, or gaining focus on, a specific application.
I have an appication which writes large files. These are intended to be used by another application.
This "Other Application" is a large elaborate system, and one of the things it does is monitor a particular directory, continuously updating its own status about the contents of that directory.
This is the directory which my application would also like to write.
If this App is allowed to monitor this directory at the same time my app is writing to it there will be trouble, including potential lost of data, deadlock, or crash.
If this App is running, but does not have focus, it's monitoring stops, so my application can write to the "shared" directory as long as the user does not switch back to this other App.
So, I would like to prevent the user from switching to it (while allowing any other action). I've thought of a few ways to attempt this -
A) Inject code into the other app and hook its message loop (I don't really want to do it that way, as it risks creating instability).
B) Hook the desktop and trap user messages which would wake that App up (but I'm not exactly sure how to go about this).
C) Use SuspendThread() and ResumeThread() to turn it off and on.
Does anyone have suggestions or ideas about how to accompish this?
Thanks.
(If there is a better discussion area for this topic, please let me know)
Brooks
|
|
|
|
|
Why don't you just hide that window while you are writing to the directory. It would be impossible for the user give it focus that way.
|
|
|
|
|
This would make the hidden application disappear - the user might not like this (I wouldn't). Also, I'm not sure if "hidden" would prevent a switch via Alt-Tab or Task Manager.
Ideally the user would find his mouse select, Alt-Tab, or Task Manager "Switch To" would not work on that App, and it would be nice to report that "Use of this Application is temporarily blocked by the OtherApp".
-Brooks
Brooks
|
|
|
|
|
I believe I've found a solution.
The following appraoch will find the Apps window, minimize it, and suspend the Apps threads. The user can't reach the App by mouse, Alt-Tab, or Task Manager.
On resume, its all restoreed.
//////////////////////
By enumnerating the desktop windows ( EnumDesktopWindows() ) and searching for the App's registered class name ( GetClassName())in the Enum CallBack one can find the application Window.
Its a good idea to minimize the App before suspending
( ::ShowWindow(m_hwndSuspended, SW_MINIMIZE);)
so the user does see the unpainted app
GetWindowThreadProcessId() will give the process ID. Open it:
m_hProcessSuspended =
OpenProcess(PROCESS_ALL_ACCESS ,FALSE, m_dwProcessIdSuspended) ;
//////////////////////
Now suspend the thread - credit for this approach goes to
// File Name: AdvancedTaskManagerDlg.cpp
// Contents : Implementation of AdvancedTaskManagerDlg class.
// Originator: Madhu Raykar.
See -
CAdvancedTaskManagerDlg::PauseResumeThreadList() of AdvancedTaskManagerDlg.cpp
This version is slightly modified :::
BOOL CAdvancedTaskManagerDlg::PauseResumeThreadList(DWORD dwOwnerPID, bool bResumeThread)
{
HANDLE hThreadSnap = NULL;
BOOL bRet = FALSE;
THREADENTRY32 te32 = {0};
// Take a snapshot of all threads currently in the system.
hThreadSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
if (hThreadSnap == INVALID_HANDLE_VALUE)
return (FALSE);
// Fill in the size of the structure before using it.
te32.dwSize = sizeof(THREADENTRY32);
// Walk the thread snapshot to find all threads of the process.
// If the thread belongs to the process, add its information
// to the display list.
if (Thread32First(hThreadSnap, &te32))
{
do
{
if (te32.th32OwnerProcessID == dwOwnerPID)
{
HANDLE hThread = OpenThread(THREAD_SUSPEND_RESUME, FALSE, te32.th32ThreadID);
if (bResumeThread)
{
// cout << _T("Resuming Thread 0x") << cout.setf( ios_base::hex ) << te32.th32ThreadID << '\n';
ResumeThread(hThread);
}
else
{
// cout << _T("Suspending Thread 0x") << cout.setf( ios_base::hex ) << te32.th32ThreadID << '\n';
SuspendThread(hThread);
}
CloseHandle(hThread);
}
}
while (Thread32Next(hThreadSnap, &te32));
bRet = TRUE;
}
else
bRet = FALSE; // could not walk the list of threads
// Do not forget to clean up the snapshot object.
CloseHandle (hThreadSnap);
return (bRet);
}
//////////////////////
// be usre to resume and restore the App
if(m_dwProcessIdSuspended && m_hProcessSuspended != NULL)
{
BOOL bRet= PauseResumeThreadList(m_dwProcessIdSuspended, TRUE);
BOOL bRetShow = ::ShowWindow(m_hwndSuspended, SW_RESTORE);
m_hwndSuspended = NULL;
CloseHandle(m_hProcessSuspended);
m_hProcessSuspended = NULL;
m_dwProcessIdSuspended = 0;
}
//////////////////////
-Brooks
Brooks
|
|
|
|
|
My appologies, I made a mistake.
The BOOL PauseResumeThreadList() function comes from Daniel Turini's Why pause and resume processes? project -
http://www.codeproject.com/threads/pausep.asp
The credit for the suspend/resume approach goes to Daniel.
I used Madhu Raykar's advanced task manager as a starting point for my experiments -
http://www.codeproject.com/system/advancedtaskmanager.asp
This was also very helpful in the invetigation.
-Brooks
Brooks
|
|
|
|