|
what do you mean format so it is readable? i don't understand-
also i posted the actual project file for download-
at any rate, not sure what you mean.
can you give me an example of what isn't readable in the code i posted?
thanks for replying-
best,
Mike
|
|
|
|
|
There is no indentation.
Steve
|
|
|
|
|
ok. i have never posted here before. i simply copied the text from the actual IDE and then pasted here and then pressed the code formatting button below. what could i have done differently?
also, what does that matter? it is formatted and indented very nicely with color coding and etc. in the project file which is downloadable from the link included.
i really could use some help here. hopefully arguing over indentation isn't the norm here? i apologize for posting inappropriately but i have no idea how to get it like you want it. could you at least look at the code itself or perhaps load the project file and see what i am talking about? i would appreciate it-
best,
Mike
|
|
|
|
|
Mike Yurgalavage wrote: also, what does that matter? it is formatted and indented very nicely with color coding and etc. in the project file which is downloadable from the link included.
I'll answer a question if it's easy for me to do so; normally I would not go to the trouble of downloading a project file.
Steve
|
|
|
|
|
Try something like this:
EXE:
#include "stdafx.h"
using namespace std;
#ifdef __cplusplus
extern "C"
{
#endif
void __stdcall SetHook();
#ifdef __cplusplus
}
#endif
int main(int argc, char* argv[])
{
SetHook();
return 0;
}
DLL:
#include "stdafx.h"
#include <tchar.h>
HMODULE g_hMod = NULL;
#pragma comment(linker, "/SECTION:.shared,RWS")
#pragma data_seg(".shared")
HHOOK g_hHook = NULL;
#pragma data_seg()
LRESULT CALLBACK GetMsgProc(int code, WPARAM wParam, LPARAM lParam)
{
LRESULT res = CallNextHookEx(NULL, code, wParam, lParam);
static bool bDone = false;
if (bDone && res==HC_ACTION)
{
bDone = true;
UnhookWindowsHookEx(g_hHook);
::MessageBox(NULL, _T("Hello"), _T("Hello"), MB_OK);
}
return res;
}
#ifdef __cplusplus
extern "C"
{
#endif
void __stdcall SetHook()
{
HWND hwnd = FindWindow(_T("Notepad"), NULL);
if (hwnd == NULL)
{
return;
}
DWORD ThreadId = GetWindowThreadProcessId(hwnd, NULL);
HHOOK g_hHook = SetWindowsHookEx(
WH_GETMESSAGE,
reinterpret_cast<HOOKPROC>(&GetMsgProc),
g_hMod,
ThreadId
);
if (g_hHook == NULL)
{
return;
}
PostMessage(hwnd, WM_NULL, 0, 0);
}
#ifdef __cplusplus
}
#endif
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
g_hMod = reinterpret_cast<HMODULE>(hModule);
DisableThreadLibraryCalls(g_hMod);
break;
}
return TRUE;
}
Steve
modified on Tuesday, March 11, 2008 12:14 AM
|
|
|
|
|
thanks for taking the time to respond to my .dll injection questions. i have all of this working in my purebasic programs (they only compile to 32bit), but unfortunately to make the move to 64 bit i have to move on to c++. it's like starting over. i am just trying to get this to work in 32 bit environment using c++ code first, which i am failing at already!
sadly, i have to make alot changes and of course begin the learning process all over again. i am a novice at c++ and these types of topics (dll injection, etc.) are a little more advanced than the hello world apps.
at any rate, the .dll i have in the project file is the file that needs to be injected. it is more of a place holder and not a hook. unfortunately i need to be able to inject that particular file into the space of notepad.exe .
i wish i could tell why my code does not do this. i followed the same steps that i did with purebasic (the same API calls). it just won't inject-
any further help is appreciated and if none, then a sincere thanks for all you did!
best,
Mike
|
|
|
|
|
ok i figured out the problem with my code.
you cannot inject into a process that runs from the system32 directory of windows using this code.
if i move the notepad.exe to the c: drive and run it from there, then it will inject fine with no problems-
crazy how it is the simple things.
thanks again for reading and posting to all those who helped-
best,
Mike
|
|
|
|
|
create a docking toolbar which is not in any window,frame or dialog box and each button of toolbar opens a menu list.
|
|
|
|
|
If it's not in any window, frame or dialog, whoere and how can it dock ?
ok, but what is the question ? what are you wanting us to do for you?
|
|
|
|
|
hi everyone,
good evening to all.i am having one problem with lables.iwant to change the font size of the lable how can i do it.i want to do it for indidual lables.please help me out.
THANKU,
savitri
|
|
|
|
|
See the Extras section of this article. It shows how to change the font of a static control.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi all,
Actually i am making a dialog box application in that dialog box i have made a static text box, now what i want is i'll provide value for this static box at run time. Length of text may vary. so how could i can make a variable text box.
Can anybody help me in this...
Thanks in advance
|
|
|
|
|
movewindow api could help, you have to check the size of font and do the reszing of control your self!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
Make it large enough so that it can contain the largest text. That's the easiest solution and you won't see the difference.
|
|
|
|
|
In MFC, you can make a so called control-variable. It is of the type of the control class (CStatic in your case) and you can call all functions of CStatic on it.
For example MoveWindows to fit to the text size.
But this, in turn, might need to affect the layout of the other controls in the dialog.
Here you might need to use a framework like resizableLib[^].
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
I think if you used of editbox was better.
|
|
|
|
|
Hamid. wrote: I think if you used of editbox was better.
i din't understand what you intended to say?
"If it were machines, the pair_programming seem to work, but for humans it is pair_crackdown that seems to work! " - Nisamudheen
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I said editbox is better than Static control for him,but I dont know why I got 1?
|
|
|
|
|
i adjusted that voting)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
Thanks.
|
|
|
|
|
While using ShellExecute(0, _T("open"), _T(strUrl.c_str()), 0, 0,SW_HIDE);
explorer is displayed with balnk page even with SW_HIDE
any idea friends
|
|
|
|
|
And the Result is? Greater than 32?
If not, did you check it with the Documentation of ShellExecute?
nShowCmd: If lpFile specifies a document file, the flag is simply passed to the associated application. It is up to the application to decide how to handle it.
So, it seems your URL-Handling application decides to open a window on error.
Let's think the unthinkable, let's do the undoable, let's prepare to grapple with the ineffable itself, and see if we may not eff it after all. Douglas Adams, "Dirk Gently's Holistic Detective Agency"
|
|
|
|
|
While it has nothing to do with your problem, the _T() macro is intended for use with string literals.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hi!
i wrote an application in visual C++ 7, where i load the msado15.dll statically in header file with #import ... from this path:
C:\Program Files\Common Files\System\ado\msado15.dll
but when i want to run my application in computer that windows installed on D drive and msado15.dll path is:
D:\Program Files\Common Files\System\ado\msado15.dll
my application can not connect to database, how can i load the dll correctly indipendent of windows installed drive?
modified on Monday, March 10, 2008 9:37 AM
|
|
|
|
|
Oh with #import directive ... Forget my previous reply below.
Try SHGetSpecialFolderLocation with the argument CSIDL_PROGRAM_FILES_COMMON to get where the "N:\Program Files\common files " is.
Maxwell Chen
modified on Monday, March 10, 2008 10:49 AM
|
|
|
|