|
Did you only use SetForegroundWindow or combination of SetForegroundWindow and SetWindowPos???
Try This..
Sleep(5000);
::SetForegroundWindow(this->m_hWnd);
::SetWindowPos(this->m_hWnd, HWND_TOPMOST,0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
|
|
|
|
|
I had only used SetForegroundWindow. Yup! This combination is also working.
|
|
|
|
|
rahul.kulshreshtha wrote: Yup! This combination is also working.
What else is working?
|
|
|
|
|
Check out my first reply.
It is also working
Sleep(5000);
::BringWindowToTop(this->m_hWnd);
::SetWindowPos(this->m_hWnd, HWND_TOPMOST,0,0,0,0, SWP_NOMOVE | SWP_NOSIZE);
::SetWindowPos(this->m_hWnd,HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE | SWP_NOSIZE);
Third line is to make it NoTopMost otherwise it will be always on Top.
|
|
|
|
|
Hello all,
I have a question, Can we install IIS in client system programmatically? , If yes then i will appreciate some links and answers regarding that.
Regards
Ashish
|
|
|
|
|
Which version of IIS do you intend to install?If it is IIS6 see here.
[EDIT]
In addition this may be useful too.
[/EDIT]
Life is a stage and we are all actors!
|
|
|
|
|
Thanks for your reply, But i intend to install IIS version 5.1..
|
|
|
|
|
I've found that for IIS 5.1 .
Life is a stage and we are all actors!
|
|
|
|
|
To be very frank, I don't see any help code in the link.. How do i do this in VC??
|
|
|
|
|
Does anyone know how to install IIS using Sysocmgr.exe?
|
|
|
|
|
Hey everybody.
Here's a C++ question.
I have 2 classes:
template<typename T>
class A_template
{
public:
... other stuff ...
void operator = (T* other){ _obj = other; }
protected:
T* _x;
};
class B : public A_template<C>
{
... some functions ...
};
Now, the problem is that if I have the following line of code:
C* x = CreateC();
B b;
b = x; // <--- compiler returns that there is no possible conversion, but it does, in A ! what am I doing wrong??
Thanks a lot !!!
|
|
|
|
|
Oh,
and the definition of B is:
class B : public A_template<c>.
|
|
|
|
|
assignment operator works like the constructor when it comes to inheritance. You should read more about this.
Also read about:
<br />
using A<T>::operator =;<br />
which should be placed in the declaration of B
|
|
|
|
|
Thanks
I read about what you said, and I understand why the copy assignment is not being derived,
but I can't find anything about the "using A<t>::operator =;".
Can I tell c++ explicitly that I want to use the operator at the base class?
|
|
|
|
|
just put that line in your B implementation and it should work
|
|
|
|
|
Hi,
I want to create a model-less dialog as a child of CFormView class.
what I did is as follow :
m_pDlg = new CMyDlg(this);
if(! m_pDlg->Create(IDD_DIALOG_DIAGRAM, this))
{
::AfxMessageBox(L"An unknown error occurred while creating the window.");
return;
}
I have created a Dialog with the ID of IDD_DIALOG_DIAGRAMbut in my resource editor And also I override the necessary methods to have model-less dialog But It always fail.
When I trace the dialog creation note that the
BOOL bResult = CreateIndirect(hTemplate, pParentWnd, hInst); returns the error.
What is my problem?
|
|
|
|
|
Check the template of your dialog is correct, lso your CMyDlg constructor. Perhaps you should post the code for both parts here.
It's time for a new signature.
|
|
|
|
|
thanks I found the mistake the uninitialized RichEdit was causing the error.
|
|
|
|
|
Who can tell me how to use the "Detours" to Hook WriteProcessMemory?
I want to get WriteProcessMemory the memory of information.
<br />
BOOL WINAPI MyWriteProcessMemory(<br />
HANDLE hProcess,
LPVOID lpBaseAddress,
LPVOID lpBuffer,
DWORD nSize,
LPDWORD lpNumberOfBytesWritten
);<br />
DETOUR_TRAMPOLINE(BOOL WINAPI CopyWriteProcessMemory(HANDLE, LPVOID, LPVOID, DWORD, LPDWORD), WriteProcessMemory);<br />
BOOL WINAPI MyWriteProcessMemory(<br />
HANDLE hProcess,
LPVOID lpBaseAddress,
LPVOID lpBuffer,
DWORD nSize,
LPDWORD lpNumberOfBytesWritten)
{<br />
BOOL nResult=WriteProcessMemory(hProcess,lpBaseAddress,lpBaseAddress,nSize,lpNumberOfBytesWritten);
MessageBoxA(NULL,(LPCTSTR)lpBaseAddress,"Hook!",MB_OK); <br />
return nResult;<br />
}<br />
this's my code ,but is not work.
|
|
|
|
|
rockago wrote: but is not work
what exactely do you mean ?? - what are the signs, symptoms and/or error codes - we cant read your mind and formulate an answer based on not knowing what 'not working' means
'g'
|
|
|
|
|
<br />
#include "stdafx.h"<br />
#include "DetourDll.h"<br />
<br />
#include "detours.h"
<br />
#pragma comment(lib,"detours.lib")<br />
<br />
BOOL WINAPI MyWriteProcessMemory(<br />
HANDLE hProcess,
LPVOID lpBaseAddress,
LPVOID lpBuffer,
DWORD nSize,
LPDWORD lpNumberOfBytesWritten
);<br />
DETOUR_TRAMPOLINE(BOOL WINAPI CopyWriteProcessMemory(HANDLE, LPVOID, LPVOID, DWORD, LPDWORD), WriteProcessMemory);<br />
BOOL WINAPI MyWriteProcessMemory(<br />
HANDLE hProcess,
LPVOID lpBaseAddress,
LPVOID lpBuffer,
DWORD nSize,
LPDWORD lpNumberOfBytesWritten)
{<br />
BOOL nResult=WriteProcessMemory(hProcess,lpBaseAddress,lpBaseAddress,nSize,lpNumberOfBytesWritten);
MessageBoxA(NULL,(LPCTSTR)lpBaseAddress,"Hook!",MB_OK); <br />
return nResult;<br />
}<br />
<br />
BOOL APIENTRY DllMain( HANDLE hModule, <br />
DWORD ul_reason_for_call, <br />
LPVOID lpReserved<br />
)<br />
{<br />
switch (ul_reason_for_call)<br />
{<br />
case DLL_PROCESS_ATTACH:<br />
OutputDebugString("Detour dll Load!");<br />
DetourFunctionWithTrampoline((PBYTE)CopyWriteProcessMemory, (PBYTE)MyWriteProcessMemory);<br />
break;<br />
case DLL_THREAD_ATTACH:<br />
break;<br />
case DLL_THREAD_DETACH:<br />
break;<br />
case DLL_PROCESS_DETACH:<br />
OutputDebugString("Detour dll Exit!");<br />
DetourRemove((PBYTE)CopyWriteProcessMemory, (PBYTE)MyWriteProcessMemory);<br />
break;<br />
}<br />
return TRUE;<br />
}<br />
<br />
<br />
LRESULT WINAPI MsgProc(int code, WPARAM wParam, LPARAM lParam)<br />
{<br />
return(CallNextHookEx(NULL,code,wParam,lParam));<br />
}<br />
<br />
EXPORTS<br />
;dll export functions<br />
MsgProc<br />
<br />
<br />
#ifdef DETOURDLL_EXPORTS<br />
#define DETOURDLL_API __declspec(dllexport)<br />
#else<br />
#define DETOURDLL_API __declspec(dllimport)<br />
#endif<br />
<br />
LRESULT WINAPI MsgProc(int code, WPARAM wParam, LPARAM lParam);<br />
this's my all code.
When I use the "WriteProcessMemory" after the injection, but it won't execute "MessageBoxA"
|
|
|
|
|
well, your formatting sucks for a start .. I cant quite put my finger on whats wrong .. looking at examples, I cant help feel that this (your code),
BOOL WINAPI MyWriteProcessMemory(
HANDLE hProcess,
LPVOID lpBaseAddress,
LPVOID lpBuffer,
DWORD nSize,
LPDWORD lpNumberOfBytesWritten)
{
BOOL nResult=WriteProcessMemory(hProcess,lpBaseAddress,lpBaseAddress,nSize,lpNumberOfBytesWritten);
MessageBoxA(NULL,(LPCTSTR)lpBaseAddress,"Hook!",MB_OK);
return nResult;
}
should be this :-
BOOL WINAPI MyWriteProcessMemory(
HANDLE hProcess,
LPVOID lpBaseAddress,
LPVOID lpBuffer,
DWORD nSize,
LPDWORD lpNumberOfBytesWritten)
{
BOOL nResult=CopyWriteProcessMemory(hProcess,lpBaseAddress,lpBaseAddress,nSize,lpNumberOfBytesWritten);
MessageBoxA(NULL,(LPCTSTR)lpBaseAddress,"Hook!",MB_OK);
return nResult;
}
CopyWriteProcessMemory has replaced WriteProcessMemory so calling WriteProcessMemory I dont think will work. Ive seen 'Real_' used instead of 'Copy', to make it a bit more obvious .. ie instead of
CopyWriteProcessMemory you would have Real_WriteProcessMemory
Obviously that means you start with
DETOUR_TRAMPOLINE(BOOL WINAPI Real_WriteProcessMemory(HANDLE, LPVOID, LPVOID, DWORD, LPDWORD), WriteProcessMemory);
Other than that I cant spot anything dramatically wrong ..
You might want to compare your code with this http://code.google.com/p/dxhook/source/browse/trunk/dxhook.cpp?r=4[^] to see if it helps
'g'
|
|
|
|
|
thx.
But when I taked "WriteProcessMemory "to" Real_WriteProcessMemory", After injection into or unable to carry out "MessageBoxA."
|
|
|
|
|
|
rockago wrote: MessageBoxA(NULL,(LPCTSTR)lpBaseAddress,"Hook!",MB_OK);
lpBaseAddress is a pointer to void, I have no idea what it is pointing to but unless it's a string of ASCII characters you cannot cast it to LPCTSTR and expect MessageBoxA() to work.
It's time for a new signature.
|
|
|
|
|